32
Input Help (List of Values) 1 of 32 Creating Input Help Prerequisites 1) Transport Request [see StepByStepCreateTransportRequestUsingSE80.pdf] 2) Package [use the package created in the first class] or create new [see StepByStep_ABAP_Create_Package.doc] 3) Copy Z027393_005A as Z027393_007A [See StepByStep_Copy_Function_Group_Program.pdf] Instead of creating from scratch we are using the program created in one of the previous class ending with ‘005A’ -- duplicating it and making changes. First copy the program and continue from here. Note: There are 5 methods to create list of values 1) Fixed Value (DOMAIN LEVEL) - Hard coded list in Data Dictionary – Using domain (of the Data Element) of the field. 2) Check Tables (FIELD LEVEL) – Specifying the Check table on the Field level. 3) Assigning the "Search Help" repository object (DATA ELEMENT LEVEL) – Create a "Search Help" Object [as an independent step] and then assign it to data element of the field. 4) Assigning the "Search Help" repository object (SCREEN ELEMENT LEVEL) – Create a "Search Help" Object [as an independent step] and then assign it to dynpro screen element in screen painter. 5) Self defined Dropdown List Boxes (SCREEN ELEMENT LEVEL) – Most flexible but requires simple SQL to populate the list – USES the PROCESS ON VALUE-REQUEST (POV) flow logic. In the following instructions, we are creating Input Help using the 4 th and 5 th methods. Step by Step Instructions (complete prerequisites shown above before you proceed) Launch SE80. Ensure that you are on the ‘Repository Browser’. Select Package from the drop down and enter your Package name [ZxxxxxxA] where xxxxxx is your SAP Login ID or Oracle ID, then click on the [Display] button. Your Function Group should be displayed below the package [if it was previously copied correctly to this package.] Open the Function Group Zxxxxxx_007A that was previously copied from Zxxxxxx_005A (if not already opened.)

Step by step abap_input help or lov

  • Upload
    mkpatil

  • View
    2.724

  • Download
    1

Embed Size (px)

DESCRIPTION

 

Citation preview

Page 1: Step by step abap_input help or lov

Input Help (List of Values)

1 of 32

Creating Input Help Prerequisites

1) Transport Request [see StepByStepCreateTransportRequestUsingSE80.pdf] 2) Package [use the package created in the first class] or create new [see

StepByStep_ABAP_Create_Package.doc] 3) Copy Z027393_005A as Z027393_007A [See

StepByStep_Copy_Function_Group_Program.pdf] Instead of creating from scratch we are using the program created in one of the previous class ending with ‘005A’ -- duplicating it and making changes. First copy the program and continue from here. Note: There are 5 methods to create list of values 1) Fixed Value (DOMAIN LEVEL) - Hard coded list in Data Dictionary – Using domain (of the Data Element) of the field. 2) Check Tables (FIELD LEVEL) – Specifying the Check table on the Field level. 3) Assigning the "Search Help" repository object (DATA ELEMENT LEVEL) – Create a "Search Help" Object [as an independent step] and then assign it to data element of the field. 4) Assigning the "Search Help" repository object (SCREEN ELEMENT LEVEL) – Create a "Search Help" Object [as an independent step] and then assign it to dynpro screen element in screen painter. 5) Self defined Dropdown List Boxes (SCREEN ELEMENT LEVEL) – Most flexible but requires simple SQL to populate the list – USES the PROCESS ON VALUE-REQUEST (POV) flow logic. In the following instructions, we are creating Input Help using the 4th and 5th methods. Step by Step Instructions (complete prerequisites shown above before you proceed) Launch SE80. Ensure that you are on the ‘Repository Browser’. Select Package from the drop down and enter your Package name [ZxxxxxxA] where xxxxxx is your SAP Login ID or Oracle ID, then click on the [Display] button. Your Function Group should be displayed below the package [if it was previously copied correctly to this package.] Open the Function Group Zxxxxxx_007A that was previously copied from Zxxxxxx_005A (if not already opened.)

Page 2: Step by step abap_input help or lov

Input Help (List of Values)

2 of 32

To display the property page, double click on the program name (node - Zxxxxxx_007A). The properties may be updated by clicking on the [Change <> Display] icon (Ctrl+F1). If any values are updated (example: the short text), ensure they are saved by clicking on the [Save] button.

Now, click on the [Main program] button.

Page 3: Step by step abap_input help or lov

Input Help (List of Values)

3 of 32

After the main program is opened, toggle the [Change <> Display] icon (Ctrl+F1) to update the program code. Note the name of the Main Program [SAPLZ027393_007A] it will be used to create a transaction code (T-code) later.

Add description on the top as shown. *&---------------------------------------------------------------------* *& Module Pool Z027393_007A *& DEMO -> Input Help (List of Values.) *&---------------------------------------------------------------------*

Save the program. Activate the Function Group by clicking on the [Activate] button on the top tool bar.

Page 4: Step by step abap_input help or lov

Input Help (List of Values)

4 of 32

If a list of objects to be activated is provided, select all the objects (related to this program), by clicking on each of them and then click on the [Continue] button or [hit Enter] to activate them all. Before we make any changes to create the Input Help, we will confirm that the program runs fine using the T-Code. If you have not created a Transaction Code while copying the program, create it now. To create a Transaction Code (T-Code), we need the name of the Function Group Main program [SAPLZ027393_007A] and use following menu in SE80 (or by directly using T-Code SE93 – not shown here.)

Enter the Transaction Code name and a short description. Leave remaining fields as default as shown below on this screen. Click [Continue] or hit [Enter].

Page 5: Step by step abap_input help or lov

Input Help (List of Values)

5 of 32

Enter program name as [SAPLZ027393_007A] and the (starting) Screen number as [0100]. Save. Accept the Package and the Transport Request in the subsequent screens.

Page 6: Step by step abap_input help or lov

Input Help (List of Values)

6 of 32

Run the program by entering the T-code/Transaction Code [Z027393_007A] or [/nZ027393_007A], to confirm that the program runs fine. Note: /n is required if you are not currently in the SAP Easy Access screen, but in another transaction.

We will use (5) Self defined Dropdown List Boxes (SCREEN ELEMENT LEVEL) – Most flexible but requires simple SQL to populate the list for these fields.

Page 7: Step by step abap_input help or lov

Input Help (List of Values)

7 of 32

PART 1). Let us start with the Screen 0100 changes, as mentioned using (5) Self defined Dropdown List Boxes (SCREEN ELEMENT LEVEL.) Double click on the screen 0100 under the screen sub-node that is listed under the function group we are currently working on.

We will use (4) Assigning the "Search Help" repository object (SCREEN ELEMENT LEVEL) – Create a "Search Help" Object [as an independent step] and then assign it to DYNPRO screen element in screen painter for this (CITYFROM) and the CITYTO Field in the next TAB.

Page 8: Step by step abap_input help or lov

Input Help (List of Values)

8 of 32

Add the PROCESS ON VALUE-REQUEST (POV) Flow Logic as shown. PROCESS ON VALUE-REQUEST. FIELD ZBC400_S_HDR_CURR-CARRID MODULE create_dropdown_box1. FIELD ZBC400_S_HDR_CURR-CONNID MODULE create_dropdown_box2.

Save the screen. Note that modules create_dropdown_box1 and create_dropdown_box2 do not exist yet, we will now create them using forward navigation. Double click on the module create_dropdown_box1. The following pop-up is displayed.

Page 9: Step by step abap_input help or lov

Input Help (List of Values)

9 of 32

Click on the ‘Yes’ button. Since this is a small application, include this new module in include file LZ027393_007AI01 (note the ‘I’ [Input] in the name.) VALUE-REQUEST (POV) modules are considered an INPUT type rather than OUTPUT types, because they are activated whenever user generates an event on the screen (click something or hit a function key).

(Optional) If you are creating a new INCLUDE the following message may be displayed. Click on [Continue] button or hit Enter.

Page 10: Step by step abap_input help or lov

Input Help (List of Values)

10 of 32

The module is created in the INCLUDE file, add the following code (just need to add the second line – the empty module shell is already created by the system.) MODULE CREATE_DROPDOWN_BOX1 INPUT. dynpro_utilities1=>value_help1( ). ENDMODULE. " CREATE_DROPDOWN_BOX1 INPUT

The code basically calls a static method value_help1 in the class dynpro_utilities1. (Note: we haven’t defined the CLASS and its STATIC METHOD yet – we will do that in a minute.) Save the INCLUDE file. Click on the Back button to go the Flow Logic of the screen 100 (or double click on the screen 0100 on the left side and then click on the Flow Logic tab.)

Page 11: Step by step abap_input help or lov

Input Help (List of Values)

11 of 32

Double click on the module create_dropdown_box2. The following pop-up is displayed to create the module using forward navigation.

Click on ‘Yes’, the select the same include file LZ027393_007AI01 again.

Page 12: Step by step abap_input help or lov

Input Help (List of Values)

12 of 32

The module is created in the INCLUDE file, add the following code MODULE CREATE_DROPDOWN_BOX2 INPUT. dynpro_utilities1=>value_help2( ). ENDMODULE. " CREATE_DROPDOWN_BOX2 INPUT

Page 13: Step by step abap_input help or lov

Input Help (List of Values)

13 of 32

We now need to add the CLASS with the static METHODS value_help1 and value_help2. Double click on the LZ027393_007ATOP include. Add the following code (both the DEFINITION and the IMPLEMENTATION of the class) CLASS DYNPRO_UTILITIES1 DEFINITION. PUBLIC SECTION. CLASS-METHODS value_help1. CLASS-METHODS value_help2. ENDCLASS. "DYNPRO_UTILITIES1 CLASS DYNPRO_UTILITIES1 IMPLEMENTATION. METHOD value_help1. TYPES: BEGIN of carrid_line, carrid TYPE ZBC400_S_DYNCONN-carrid,

Page 14: Step by step abap_input help or lov

Input Help (List of Values)

14 of 32

END OF carrid_line. DATA carrid_list TYPE STANDARD TABLE OF carrid_line. SELECT distinct carrid from ZBC400_S_DYNCONN into corresponding fields of table carrid_list order by carrid. CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST' EXPORTING retfield = 'CARRID' value_org = 'S' TABLES value_tab = carrid_list EXCEPTIONS parameter_error = 1 no_values_found = 2 OTHERS = 3. IF sy-subrc <> 0. ENDIF. ENDMETHOD. METHOD value_help2. * TYPES: BEGIN of connid_line, * connid TYPE ZBC400_S_DYNCONN-connid, * END OF connid_line. * * DATA connid_list TYPE STANDARD TABLE OF connid_line. * SELECT distinct connid from ZBC400_S_DYNCONN into * corresponding fields of table * connid_list order by connid. TYPES: BEGIN of connid_line, connid TYPE ZBC400_S_DYNCONN-connid, CITYFROM TYPE ZBC400_S_DYNCONN-CITYFROM, END OF connid_line. DATA connid_list TYPE STANDARD TABLE OF connid_line. *SELECT distinct connid CITYFROM from ZBC400_S_DYNCONN into * corresponding fields of table connid_list order by connid. SELECT distinct connid from ZBC400_S_DYNCONN into corresponding fields of table connid_list order by connid. CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST' EXPORTING retfield = 'CONNID' value_org = 'S' TABLES value_tab = connid_list EXCEPTIONS parameter_error = 1 no_values_found = 2 OTHERS = 3. IF sy-subrc <> 0.

Page 15: Step by step abap_input help or lov

Input Help (List of Values)

15 of 32

ENDIF. ENDMETHOD. ENDCLASS. "DYNPRO_UTILITIES1

The function 'F4IF_INT_TABLE_VALUE_REQUEST' is already defined by SAP, so does not have to be redefined. On the layout of the Screen 100 to access the field properties of ZBC400_S_HDR_CURR-CARRID field and select ‘list’ from the Dropdown property.

Page 16: Step by step abap_input help or lov

Input Help (List of Values)

16 of 32

Or make this change directly on the Text/I/O template Tab (of the Element list Tab) of the screen properties.

Page 17: Step by step abap_input help or lov

Input Help (List of Values)

17 of 32

Repeat the same for the ZBC400_S_HDR_CURR-CONNID field as shown below

Page 18: Step by step abap_input help or lov

Input Help (List of Values)

18 of 32

Or

Page 19: Step by step abap_input help or lov

Input Help (List of Values)

19 of 32

We have now created the INPUT HELP for the two fields on the screen 100. We have used the ‘Self defined Dropdown List Boxes (SCREEN ELEMENT LEVEL).’ As mentioned this is the most flexible but requires simple SQL to populate the list. Activate and run the program using the transaction id created earlier. Depending on what need to be displayed change the SQL select statement in the STATIC METHOD of the CLASS. SELECT distinct connid from ZBC400_S_DYNCONN into corresponding fields of table connid_list order by connid.

Or

Page 20: Step by step abap_input help or lov

Input Help (List of Values)

20 of 32

SELECT distinct connid from ZBC400_S_DYNCONN into corresponding fields of table connid_list where connid < '1004' order by connid.

Or add a description field to see a description in the list SELECT distinct connid CITYFROM from ZBC400_S_DYNCONN into corresponding fields of table connid_list order by connid.

PART 2) Let us now work on the Screen 0200 (actually subscreens 0201 and 0202) changes, as mentioned using (4) Assigning the "Search Help" repository object (SCREEN ELEMENT LEVEL) – Create a "Search Help" Object [as an independent step] and then assign it to dynpro screen element in screen painter. We need to first create the repository object ‘Search Help’. Once created since this is a repository object any one can use it.

Page 21: Step by step abap_input help or lov

Input Help (List of Values)

21 of 32

Enter a new/unique Search Help name as shown below. Use a unique name – example: Zxxxxxx_SRCH where xxxxxx is your SAP Login ID or Oracle ID

Click on the Enter button or hit Enter. Enter a description and click on the Selection Method search (dropdown)

Page 22: Step by step abap_input help or lov

Input Help (List of Values)

22 of 32

You may search for database tables or for views.

Page 23: Step by step abap_input help or lov

Input Help (List of Values)

23 of 32

Select ZCITY_TBL Save the search help and enter appropriate package name.

Enter the appropriate workbench request.

Enter the search help parameters (enter manually or click on the search for list of values for various parameters line by line.) Then select the EXP check box for both and the LPos and SPos fields as shown below. LPos is Position in the hit list of an elementary search help. SPos is Position in dialog box of an elementary search help.

Page 24: Step by step abap_input help or lov

Input Help (List of Values)

24 of 32

Search screen shown below for the above parameters in case you wish to select and not enter these manually.

LPos

Page 25: Step by step abap_input help or lov

Input Help (List of Values)

25 of 32

Note: See the next screen to understand the significance of the LPos and SPos parameters.

Save the search help object and activate it, by clicking on the Save button and Activate button respectively. If multiple objects are displayed to Activate, select all or all those which are relevant. The next step is to associate the search help object (Z027393_SRCH or Zxxxxxx_SRCH) to the required field ZBC400_S_HDR_CURR-CITYFROM. This field is on the screen 0201. Open the screen as shown below and double click on the CITYFROM Field to access the properties. Enter the search help object Z027393_SRCH or Zxxxxxx_SRCH into the Search Help field as shown below.

Page 26: Step by step abap_input help or lov

Input Help (List of Values)

26 of 32

Alternately this can also be done directly from the screen’s Reference Tab that is under the Element List tab as shown below. Save and Activate the screen.

Page 27: Step by step abap_input help or lov

Input Help (List of Values)

27 of 32

Repeat the same for the other field (ZBC400_S_HDR_CURR-CITYTO) that needs the Search Help of the list of values to be displayed. The field is on screen 0202 as shown below.

Page 28: Step by step abap_input help or lov

Input Help (List of Values)

28 of 32

Similarly this can also be done directly from the screen’s Reference Tab that is under the Element List tab as shown below.

Page 29: Step by step abap_input help or lov

Input Help (List of Values)

29 of 32

Save and Activate the screen. Run the program by using the Transaction Code created earlier.

The search help can be accessed for Carried ID, Connection ID and for both the CITY fields as shown in the next few screenshots.

Page 30: Step by step abap_input help or lov

Input Help (List of Values)

30 of 32

Screen 100

Screen 200 (Tab 1)

Page 31: Step by step abap_input help or lov

Input Help (List of Values)

31 of 32

Page 32: Step by step abap_input help or lov

Input Help (List of Values)

32 of 32

Screen 200 (Tab 2)