Step by step abap_input help or lov

2,686
-1

Published on

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
2,686
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
169
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Step by step abap_input help or lov

  1. 1. Input Help (List of Values)Creating Input HelpPrerequisites 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 classending with ‘005A’ -- duplicating it and making changes. First copy the program and continuefrom here.Note: There are 5 methods to create list of values1) Fixed Value (DOMAIN LEVEL) - Hard coded list in Data Dictionary – Using domain (of theData 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 inscreen painter.5) Self defined Dropdown List Boxes (SCREEN ELEMENT LEVEL) – Most flexible butrequires 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 abovebefore 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 isyour SAP Login ID or Oracle ID, then click on the [Display] button. Your Function Groupshould 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 (ifnot already opened.) 1 of 32
  2. 2. Input Help (List of Values)To display the property page, double click on the program name (node - Zxxxxxx_007A). Theproperties may be updated by clicking on the [Change <> Display] icon (Ctrl+F1). If any valuesare updated (example: the short text), ensure they are saved by clicking on the [Save] button.Now, click on the [Main program] button. 2 of 32
  3. 3. Input Help (List of Values)After the main program is opened, toggle the [Change <> Display] icon (Ctrl+F1) to update theprogram code. Note the name of the Main Program [SAPLZ027393_007A] it will be used tocreate 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. 3 of 32
  4. 4. Input Help (List of Values)If a list of objects to be activated is provided, select all the objects (related to this program), byclicking on each of them and then click on the [Continue] button or [hit Enter] to activate themall.Before we make any changes to create the Input Help, we will confirm that the program runs fineusing 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 asshown below on this screen. Click [Continue] or hit [Enter]. 4 of 32
  5. 5. Input Help (List of Values)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. 5 of 32
  6. 6. Input Help (List of Values)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 anothertransaction. 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. 6 of 32
  7. 7. Input Help (List of Values) 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.PART 1). Let us start with the Screen 0100 changes, as mentioned using (5) Self definedDropdown List Boxes (SCREEN ELEMENT LEVEL.)Double click on the screen 0100 under the screen sub-node that is listed under the function groupwe are currently working on. 7 of 32
  8. 8. Input Help (List of Values)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 willnow create them using forward navigation.Double click on the module create_dropdown_box1. The following pop-up is displayed. 8 of 32
  9. 9. Input Help (List of Values)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 orhit a function key).(Optional) If you are creating a new INCLUDE the following message may be displayed. Clickon [Continue] button or hit Enter. 9 of 32
  10. 10. Input Help (List of Values)The module is created in the INCLUDE file, add the following code (just need to add the secondline – the empty module shell is already created by the system.)MODULE CREATE_DROPDOWN_BOX1 INPUT.dynpro_utilities1=>value_help1( ).ENDMODULE. " CREATE_DROPDOWN_BOX1 INPUTThe 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 aminute.)Save the INCLUDE file.Click on the Back button to go the Flow Logic of the screen 100 (or double click on the screen0100 on the left side and then click on the Flow Logic tab.) 10 of 32
  11. 11. Input Help (List of Values)Double click on the module create_dropdown_box2. The following pop-up is displayed to createthe module using forward navigation.Click on ‘Yes’, the select the same include file LZ027393_007AI01 again. 11 of 32
  12. 12. Input Help (List of Values)The module is created in the INCLUDE file, add the following codeMODULE CREATE_DROPDOWN_BOX2 INPUT.dynpro_utilities1=>value_help2( ).ENDMODULE. " CREATE_DROPDOWN_BOX2 INPUT 12 of 32
  13. 13. Input Help (List of Values)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_UTILITIES1CLASS DYNPRO_UTILITIES1 IMPLEMENTATION.METHOD value_help1. TYPES: BEGIN of carrid_line, carrid TYPE ZBC400_S_DYNCONN-carrid, 13 of 32
  14. 14. Input Help (List of Values) 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 fieldsof 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. 14 of 32
  15. 15. Input Help (List of Values) ENDIF.ENDMETHOD.ENDCLASS. "DYNPRO_UTILITIES1The function F4IF_INT_TABLE_VALUE_REQUEST is already defined by SAP, so does nothave 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. 15 of 32
  16. 16. Input Help (List of Values)Or make this change directly on the Text/I/O template Tab (of the Element list Tab) of the screenproperties. 16 of 32
  17. 17. Input Help (List of Values)Repeat the same for the ZBC400_S_HDR_CURR-CONNID field as shown below 17 of 32
  18. 18. Input Help (List of Values)Or 18 of 32
  19. 19. Input Help (List of Values)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 themost 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 STATICMETHOD of the CLASS.SELECT distinct connid from ZBC400_S_DYNCONN into corresponding fields oftable connid_list order by connid.Or 19 of 32
  20. 20. Input Help (List of Values)SELECT distinct connid from ZBC400_S_DYNCONN into corresponding fields oftable connid_list where connid < 1004 order by connid.Or add a description field to see a description in the listSELECT distinct connid CITYFROM from ZBC400_S_DYNCONN into correspondingfields of table connid_list order by connid.PART 2) Let us now work on the Screen 0200 (actually subscreens 0201 and 0202) changes, asmentioned using (4) Assigning the "Search Help" repository object (SCREEN ELEMENTLEVEL) – Create a "Search Help" Object [as an independent step] and then assign it to dynproscreen element in screen painter.We need to first create the repository object ‘Search Help’. Once created since this is arepository object any one can use it. 20 of 32
  21. 21. Input Help (List of Values)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 IDClick on the Enter button or hit Enter.Enter a description and click on the Selection Method search (dropdown) 21 of 32
  22. 22. Input Help (List of Values)You may search for database tables or for views. 22 of 32
  23. 23. Input Help (List of Values)Select ZCITY_TBLSave 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 forvarious parameters line by line.) Then select the EXP check box for both and the LPos and SPosfields as shown below. LPos is Position in the hit list of an elementary search help. SPos isPosition in dialog box of an elementary search help. 23 of 32
  24. 24. Input Help (List of Values)Search screen shown below for the above parameters in case you wish to select and not enterthese manually. LPos 24 of 32
  25. 25. Input Help (List of Values)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 buttonrespectively. If multiple objects are displayed to Activate, select all or all those which arerelevant.The next step is to associate the search help object (Z027393_SRCH or Zxxxxxx_SRCH) to therequired field ZBC400_S_HDR_CURR-CITYFROM. This field is on the screen 0201. Open thescreen as shown below and double click on the CITYFROM Field to access the properties. Enterthe search help object Z027393_SRCH or Zxxxxxx_SRCH into the Search Help field as shownbelow. 25 of 32
  26. 26. Input Help (List of Values)Alternately this can also be done directly from the screen’s Reference Tab that is under theElement List tab as shown below. Save and Activate the screen. 26 of 32
  27. 27. Input Help (List of Values)Repeat the same for the other field (ZBC400_S_HDR_CURR-CITYTO) that needs the SearchHelp of the list of values to be displayed. The field is on screen 0202 as shown below. 27 of 32
  28. 28. Input Help (List of Values)Similarly this can also be done directly from the screen’s Reference Tab that is under theElement List tab as shown below. 28 of 32
  29. 29. Input Help (List of Values)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 asshown in the next few screenshots. 29 of 32
  30. 30. Input Help (List of Values)Screen 100Screen 200 (Tab 1) 30 of 32
  31. 31. Input Help (List of Values) 31 of 32
  32. 32. Input Help (List of Values)Screen 200 (Tab 2) 32 of 32

×