Вы находитесь на странице: 1из 42

Explains Sales Data Flow Based

on User Input using FPM


Framework

Applies to:
Webdynpro ABAP. For more information, visit the Web Dynpro ABAP homepage.

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

Tulasi Palnati

Company: Yash Technologies


th

Created on: 17 Aug, 2010

Author Bio
Tulasi Palnati is an Enterprise Portal Consultant at Yash Technologies, Hyderabad-India

SAP COMMUNITY NETWORK


2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com


1

Table of Contents
Step 1: Create Webdynpro Component .......................................................................................................... 3
Step 2: Create context in component controller .............................................................................................. 3
Step 3: Create views and windows ................................................................................................................. 9
Step 4: Map the context of controller to the View Header and design the layout as follows ........................ 11
Step 5: Embed the Select_options Standard component in the Used components ..................................... 12
Step 6: Map the context of controller to the View LINE_ITEM and design the layout as follows ................ 15
Step 7: Map the context of controller to the View CONDITION and design the layout as follows................ 16
Step 8: Map the context of controller to the View DELIVERIES and design the layout as follows............... 17
Step 9: Map the context of controller to the View INVOICE and design the layout as follows ..................... 18
Step 10: Embed the Standard Interface IF_FPM_BUILDING_BLOCK in our component implemented
interfaces ....................................................................................................................................................... 19
Step 11: Save all and activate the Component ............................................................................................. 20
Step 12: Create Application and save it in Package. .................................................................................... 21
Step 13: Open the Package and expand the Web Dynpro applications folder............................................. 22
Step 14: Application and Component Configuration Settings to display the application using FPM ............ 23
Step 15: Process the Events of FPM in Component Controller .................................................................... 32
Step 16: Test the Application ........................................................................................................................ 35
Related Content ................................................................................................................................................ 41
Disclaimer and Liability Notice .......................................................................................................................... 42

SAP COMMUNITY NETWORK


2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com


2

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.

Create node VBAP with Cardinality 1..n

SAP COMMUNITY NETWORK


2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com


3

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

SAP COMMUNITY NETWORK


2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com


4

Create node KONV with Cardinality 0..n


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

SAP COMMUNITY NETWORK


2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com


5

Create node VBFA with Cardinality 0..n


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

SAP COMMUNITY NETWORK


2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com


6

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

SAP COMMUNITY NETWORK


2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com


7

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

SAP COMMUNITY NETWORK


2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com


8

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

SAP COMMUNITY NETWORK


2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com


9

SAP COMMUNITY NETWORK


2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com


10

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

SAP COMMUNITY NETWORK


2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com


11

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

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

SAP COMMUNITY NETWORK


2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com


12

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


method WDDOINIT .
DATA lo_cmp_usage TYPE REF TO if_wd_component_usage.
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.

SAP COMMUNITY NETWORK


2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com


13

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

SAP COMMUNITY NETWORK


2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com


14

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

SAP COMMUNITY NETWORK


2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com


15

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

SAP COMMUNITY NETWORK


2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com


16

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

SAP COMMUNITY NETWORK


2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com


17

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

SAP COMMUNITY NETWORK


2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com


18

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

Click on Reimplement button.

SAP COMMUNITY NETWORK


2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com


19

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

Step 11: Save all and activate the Component

SAP COMMUNITY NETWORK


2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com


20

Step 12: Create Application and save it in Package.

Give the Component name: FPM_GAF_COMPONENT


Interface View

: FPM_WINDOW

Default

: DEFAULT

Note: When the Application gets created it will be available in Package.

SAP COMMUNITY NETWORK


2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com


21

Step 13: Open the Package and expand the Web Dynpro applications folder
Select the Webdynpro application and right click on it select create/change configuration

SAP COMMUNITY NETWORK


2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com


22

Step 14: Application and Component Configuration Settings to display the application using FPM
Give configuration ID as ZSALES_APPLCONFIG
Click on Create.

New Window will be opened.


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.

SAP COMMUNITY NETWORK


2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com


23

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

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

SAP COMMUNITY NETWORK


2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com


24

Select the Main Step From Hierarchy and Properties will available in right side.
Give Mainstep ID :Header Details and Mainstep Name: Header Details

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

SAP COMMUNITY NETWORK


2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com


25

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

SAP COMMUNITY NETWORK


2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com


26

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 for one more Function.

SAP COMMUNITY NETWORK


2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com


27

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

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

SAP COMMUNITY NETWORK


2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com


28

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

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

SAP COMMUNITY NETWORK


2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com


29

Save the Configuration Data.


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

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.

SAP COMMUNITY NETWORK


2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com


30

SAP COMMUNITY NETWORK


2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com


31

Step 15: 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 ).
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:

SAP COMMUNITY NETWORK


2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com


32

<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.
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

SAP COMMUNITY NETWORK


2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com


33

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.

SAP COMMUNITY NETWORK


2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com


34

Step 16: Test the Application


Go to Package and Expand WebDynpro Folder.
Expand the Application Configurations Folder. Select the particular application and click on Test.

SAP COMMUNITY NETWORK


2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com


35

Output:

If you dont 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 ).
Select the buttons which you dont want to display Right click on it and select Settings for current
configuration.

SAP COMMUNITY NETWORK


2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com


36

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

SAP COMMUNITY NETWORK


2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com


37

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

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

SAP COMMUNITY NETWORK


2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com


38

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

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

SAP COMMUNITY NETWORK


2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com


39

SAP COMMUNITY NETWORK


2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com


40

Related Content
WebDynpro ABAP Wiki's
WebDynpro ABAP Homepage
For more information, visit the Web Dynpro ABAP homepage

SAP COMMUNITY NETWORK


2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com


41

Disclaimer and Liability Notice


This document may discuss sample coding or other information that does not include SAP official interfaces and therefore is not
supported by SAP. Changes made based on this information are not supported and can be overwritten during an upgrade.
SAP will not be held liable for any damages caused by using or misusing the information, code or methods suggested in this document,
and anyone using these methods does so at his/her own risk.
SAP offers no guarantees and assumes no responsibility or liability of any type with respect to the content of this technical article or
code sample, including any liability resulting from incompatibility between the content within this document and the materials and
services offered by SAP. You agree that you will not hold, or seek to hold, SAP responsible or liable with respect to the content of this
document.

SAP COMMUNITY NETWORK


2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com


42

Вам также может понравиться