Sales Data Flow Based on User Input Using FPM Framework

38
Sales data flow based on User Input using FPM Framework This document shows the sales data flow from Header to Invoice details based on User Input using FPM Framework. Step 1: Create Webdynpro Component Step 2: Create context in component controller Create a node VBAK with cardinality 1..n Click on add attributes from structure.

Transcript of Sales Data Flow Based on User Input Using FPM Framework

Page 1: Sales Data Flow Based on User Input Using FPM Framework

Sales data flow based on User Input using FPM Framework

This document shows the sales data flow from Header to Invoice details based on User Input using FPM Framework.

Step 1: Create Webdynpro Component

Step 2: Create context in component controller

Create a node VBAK with cardinality

1..n

Click on add attributes from structure.

Page 2: Sales Data Flow Based on User Input Using FPM Framework

Create node VBAP with Cardinality 1..n

Click on add attributes from structure and select the fields in the below screen shot

Create node KONV with Cardinality 0..n

Page 3: Sales Data Flow Based on User Input Using FPM Framework

Click on add attributes from structure and select the fields in the below screen shot

Create node VBFA with Cardinality 0..n

Click on add attributes from structure and select the fields in the below screen shot

Page 4: Sales Data Flow Based on User Input Using FPM Framework

Create node INVOICE with Cardinality 0..n and Click on OK .

Right click on INVOICE NODE and select add attributes from structure. Give structure name LIPS and select the fields in the below screen shot

Page 5: Sales Data Flow Based on User Input Using FPM Framework

Right click on INVOICE NODE and select add attributes from structure. Give structure name LIPS and select the fields in the below screen shot

Page 6: Sales Data Flow Based on User Input Using FPM Framework

Step 3: Create views and windows

Create 4 Views to the corresponding Windows as below:

View Window

LINE_ITEM LINE_ITEM_WIN

CONDITIONS CONDITIONS_WIN

DELIVERIES DELIVERIES_WIN

INVOICE INVOICE_WIN

Page 7: Sales Data Flow Based on User Input Using FPM Framework

Step 4: Map the context of controller to the View Header and design the layout as follows

Page 8: Sales Data Flow Based on User Input Using FPM Framework

Step 5: Embed the Select_options Standard component in the Used components

Page 9: Sales Data Flow Based on User Input Using FPM Framework

Go to Component Controller and give global attribute M_HANDLER with ref to IF_WD_SELECT_OPTIONS

Copy the below code in the WDDOINIT( ) method of component controller

method WDDOINIT . DATA lo_cmp_usage TYPE REF TO if_wd_component_usage.

Page 10: Sales Data Flow Based on User Input Using FPM Framework

lo_cmp_usage = wd_this->wd_cpuse_select_options( ). IF lo_cmp_usage->has_active_component( ) IS INITIAL. lo_cmp_usage->create_component( ). ENDIF.

DATA lo_interfacecontroller TYPE REF TO iwci_wdr_select_options .lo_interfacecontroller = wd_this->wd_cpifc_select_options( ).

wd_this->m_handler = lo_interfacecontroller->init_selection_screen( ).data: lt_range TYPE REF TO data, lt_range1 TYPE REF TO data.CALL METHOD wd_this->m_handler->create_range_table EXPORTING i_typename = 'VKORG'* i_length =* i_decimals = receiving rt_range_table = lt_range .CALL METHOD wd_this->m_handler->create_range_table EXPORTING i_typename = 'VTWEG' receiving rt_range_table = lt_range1 .

CALL METHOD wd_this->m_handler->add_selection_field EXPORTING i_id = 'VKORG'* i_within_block = MC_ID_MAIN_BLOCK* i_description =* i_is_auto_description = ABAP_TRUE it_result = lt_range .CALL METHOD wd_this->m_handler->add_selection_field EXPORTING i_id = 'VTWEG'* i_within_block = MC_ID_MAIN_BLOCK* i_description =* i_is_auto_description = ABAP_TRUE it_result = lt_range1.

endmethod.

Go to window and embed the Standard WIND_SELECTION_SCREEN into VIEW CONTAINER of HEADER view

Page 11: Sales Data Flow Based on User Input Using FPM Framework

Step 6: Map the context of controller to the View LINE_ITEM and design the layout as follows

Page 12: Sales Data Flow Based on User Input Using FPM Framework

Step 7: Map the context of controller to the View CONDITION and design the layout as follows

Page 13: Sales Data Flow Based on User Input Using FPM Framework

Step 8: Map the context of controller to the View DELIVERIES and design the layout as follows

Page 14: Sales Data Flow Based on User Input Using FPM Framework

Step 9: Map the context of controller to the View INVOICE and design the layout as follows

Page 15: Sales Data Flow Based on User Input Using FPM Framework

Step 10: Embed the Standard Interface IF_FPM_BUILDING_BLOCK in our component implemented interfaces

Click on Reimplement button.

Page 16: Sales Data Flow Based on User Input Using FPM Framework

Go and check in the component controller methods tab all the interface methods will be available .

Step 11: Save all and activate the Component

Page 17: Sales Data Flow Based on User Input Using FPM Framework

Step 10: Create Application and save it in Package.

Give the Component name: FPM_GAF_COMPONENT

Interface View : FPM_WINDOW

Default : DEFAULT

Page 18: Sales Data Flow Based on User Input Using FPM Framework

Note: Whatever application you had created that will not be available in Webdynpro Component it will be available in Package.

Step 11: Open the Package and expand the WebDynpro applications folder

Select the Webdynpro application and right click on it select create/change configuration

Page 19: Sales Data Flow Based on User Input Using FPM Framework

Step 12: Application and Component Configuration Settings to display the application using FPM

Give configuration ID as ZSALES_APPLCONFIG

Click on Create.

New Window will open.

Here give the name for Component Configuration (any name):ZSALES_COMP_CONFIG

Click on Save and click on Go to Component Configuration automatically it navigates to another window.

Click on create and new window will open and save the component configuration in the package.

Page 20: Sales Data Flow Based on User Input Using FPM Framework

New Window for configuration for particular component will open with Default RoadMap with buttons.

Select the Main Step From Hierarchy and Properties will available in right side.

Give Mainstep ID :Header Details and Mainstep Name: Header Details

Page 21: Sales Data Flow Based on User Input Using FPM Framework

In Right Side, click on Add Main Step button automatically one more road map will be added change the Main Step id and Main Step name: Line Items

Add few more steps same as above for Conditions View, Deliveries View and Invoice View and screenshot as follows:

Page 22: Sales Data Flow Based on User Input Using FPM Framework
Page 23: Sales Data Flow Based on User Input Using FPM Framework

Save the Configuration and Select the Header Details Step and Click on Add Toolbar Element.

New Popup will be open. Application Specific buttons will be there.

Select the Other Function Button and click on Ok.

Repeat above process one more time for one more Function.

Select the buttons in the application title and Change the button properties

For 1st Button:

Give Label HEADER DETAILS and FPM Event ID HEADER

For 2nd Button:

Give Label ITEM DETAILS and FPM Event ID LINE_ITEM

Page 24: Sales Data Flow Based on User Input Using FPM Framework

Select the Line Items Step and Click on Add Toolbar Element.

New Popup will be open. Application Specific buttons will be there.

Select the Other Function Button and click on Ok.

Select the button in the application title and Change the button properties

Give Label Condition and FPM Event ID CONDITION

Select the CONDITIONS Step and Click on Add Toolbar Element.

New Popup will be open. Application Specific buttons will be there.

Select the Other Function Button and click on Ok.

Select the button in the application title and Change the button properties

Give Label Delivery and FPM Event ID DELIVERY

Page 25: Sales Data Flow Based on User Input Using FPM Framework

Select the DELIVERIES Step and Click on Add Toolbar Element.

New Popup will be open. Application Specific buttons will be there.

Select the Other Function Button and click on Ok.

Select the button in the application title and Change the button properties

Give Label INVOICE and FPM Event ID INVOICE

Save the Configuration Data.

Expand the Header Details Step from hierarchy. Select UIBB and change the properties.

Page 26: Sales Data Flow Based on User Input Using FPM Framework

Give Component Name :< Your Component Name> (here YH1168_SALES_DETAILS)

Window Name : <Window name> (here YH1168_SALES_DETAILS)

Repeat the same for all the Main Steps as follows.

Page 27: Sales Data Flow Based on User Input Using FPM Framework
Page 28: Sales Data Flow Based on User Input Using FPM Framework

Step 13: Process the Events of FPM in Component Controller

Go to Component controller and Double Click on Process_Event Method

Copy the below code in Process_Event Method.

Save and activate it.

method PROCESS_EVENT . DATA lo_nd_vbak TYPE REF TO if_wd_context_node. DATA lo_el_vbak TYPE REF TO if_wd_context_element. DATA ls_vbak TYPE wd_this->element_vbak. lo_nd_vbak = wd_context->get_child_node( name = wd_this->wdctx_vbak ).

Page 29: Sales Data Flow Based on User Input Using FPM Framework

lo_el_vbak = lo_nd_vbak->get_element( ). lo_el_vbak->get_static_attributes( IMPORTING static_attributes = ls_vbak ). DATA lo_nd_vbap3 TYPE REF TO if_wd_context_node. DATA lo_el_vbap3 TYPE REF TO if_wd_context_element. DATA ls_vbap3 TYPE wd_this->element_vbap. lo_nd_vbap3 = wd_context->get_child_node( name = wd_this->wdctx_vbap ). lo_el_vbap3 = lo_nd_vbap3->get_element( ). lo_el_vbap3->get_static_attributes( IMPORTING static_attributes = ls_vbap3 ). CASE io_event->mv_event_id. WHEN 'HEADER'. DATA : lo_nd_vbak1 TYPE REF TO if_wd_context_node, lt_vbak TYPE wd_this->elements_vbak, lt_range TYPE REF TO data, lt_range1 TYPE REF TO data, lo_fpm TYPE REF TO if_fpm. FIELD-SYMBOLS: <fs> TYPE ANY TABLE , <fs2> TYPE ANY TABLE. lo_nd_vbak1 = wd_context->get_child_node( 'VBAK' ). CALL METHOD wd_this->m_handler->get_range_table_of_sel_field EXPORTING i_id = 'VKORG' receiving rt_range_table = lt_range .ASSIGN lt_range->* to <fs>.CALL METHOD wd_this->m_handler->get_range_table_of_sel_field EXPORTING i_id = 'VTWEG' receiving rt_range_table = lt_range1 . ASSIGN lt_range1->* to <fs2>. SELECT * FROM vbak into CORRESPONDING FIELDS OF TABLE lt_vbak WHERE vkorg in <fs> OR vtweg in <fs2>.lo_nd_vbak1->bind_table( lt_vbak ).WHEN 'LINE_ITEM'.lo_fpm = cl_fpm_factory=>get_instance( ).lo_fpm->raise_event_by_id( cl_fpm_event=>GC_EVENT_NEXT_STEP ).DATA: lo_nd_vbap TYPE REF TO if_wd_context_node, lt_vbap TYPE wd_this->elements_vbap. lo_nd_vbap = wd_context->get_child_node( 'VBAP' ).SELECT * FROM vbap INTO CORRESPONDING FIELDS OF TABLE lt_vbap WHERE VBELN EQ ls_vbak-vbeln. lo_nd_vbap->bind_table( lt_vbap ). WHEN 'CONDITION'. DATA : lo_nd_konv TYPE REF TO if_wd_context_node, lt_konv TYPE wd_this->elements_konv.

Page 30: Sales Data Flow Based on User Input Using FPM Framework

lo_nd_konv = wd_context->get_child_node( 'KONV' ).SELECT * FROM konv into CORRESPONDING FIELDS OF TABLE lt_konv WHERE knumv EQ ls_vbak-knumv AND kposn EQ ls_vbap3-posnr.lo_nd_konv->bind_table( lt_konv ). lo_fpm = cl_fpm_factory=>get_instance( ).lo_fpm->raise_event_by_id( cl_fpm_event=>GC_EVENT_NEXT_STEP ).

WHEN 'DELIVERY'. DATA: lo_nd_vbfa TYPE REF TO if_wd_context_node, lt_vbfa TYPE wd_this->elements_vbfa. lo_nd_vbfa = wd_context->get_child_node( 'VBFA' ). SELECT vbelv posnv vbeln posnn rfmng meins FROM vbfa INTO CORRESPONDING FIELDS OF TABLE lt_vbfa WHERE vbelv EQ ls_vbap3-vbeln AND posnv EQ ls_vbap3-posnr AND vbtyp_n EQ 'J'. lo_nd_vbfa->bind_table( lt_vbfa ).lo_fpm = cl_fpm_factory=>get_instance( ).lo_fpm->raise_event_by_id( cl_fpm_event=>GC_EVENT_NEXT_STEP ).

WHEN 'INVOICE'. DATA: lo_nd_invoice TYPE REF TO if_wd_context_node, lt_invoice TYPE wd_this->elements_invoice. lo_nd_invoice = wd_context->get_child_node( 'INVOICE' ). SELECT vrp~vbeln vrp~posnr lps~vbeln lps~posnr FROM lips AS lps INNER JOIN vbrp AS vrp ON vrp~vgbel EQ lps~vbeln AND vrp~vgpos EQ lps~posnr INTO table lt_invoice WHERE lps~vgbel EQ ls_vbap3-vbeln AND lps~vgpos EQ ls_vbap3-posnr. lo_nd_invoice->bind_table( lt_invoice ). lo_fpm = cl_fpm_factory=>get_instance( ).lo_fpm->raise_event_by_id( cl_fpm_event=>GC_EVENT_NEXT_STEP ).ENDCASE.endmethod.

Step 13: Test the Application

Go to Package and Expand WebDynpro Folder.

Expand the Application Configurations Folder. Select the particular application and click on Test.

Page 31: Sales Data Flow Based on User Input Using FPM Framework

Output:

If you don’t want default buttons should display make it as invisible by opening the application in configuration mode (by adding the application path with this parameter &sap-config-mode=X ).

Page 32: Sales Data Flow Based on User Input Using FPM Framework

Select the buttons which you don’t want to display Right click on it and select Settings for current configuration.

Page 33: Sales Data Flow Based on User Input Using FPM Framework

Give some Selection Screen Input Sales Organization 1000 and Distribution Channel 10 to 12

.

Select any header Details in the Table and Click on Line Items automatically it navigates to Second Screen with line Items of particular header

Page 34: Sales Data Flow Based on User Input Using FPM Framework

Select the particular Item and Click on Condition automatically it navigates to Next screen with Conditions of particular line item.

Page 35: Sales Data Flow Based on User Input Using FPM Framework

Select the particular Item and Click on Deliveries automatically it navigates to Next screen with Deliveries of particular line item.

Page 36: Sales Data Flow Based on User Input Using FPM Framework

Select the particular delivery Item and Click on Invoice automatically it navigates to Next screen with Invoice Details particular line item.

Page 37: Sales Data Flow Based on User Input Using FPM Framework
Page 38: Sales Data Flow Based on User Input Using FPM Framework