You are on page 1of 2

Attaching standard Characteristics search help(MM03) in the selection screen

Posted by nitin kacker Apr 2, 2013 There is an interesting development where the standard search help for characteristics (MM01/MM03) value needs to be attached on the selection screen;as shown below:

This should be based on the class type and class,already entered on the selection screen.The user should be able to add values for the various characteristics and that should be used in the selection. Please find below the relevant code below: step 1: Create a new screen to display this search help.For e.g. screen 100 in the main report program: step 2: Now add the following statement in the selection screen include: SELECTION-SCREEN: BEGIN OF TABBED BLOCK mytab FOR 13 LINES, TAB (20) button1 USER-COMMAND d1 , END OF BLOCK mytab. SELECTION-SCREEN END OF BLOCK b3. step 3: Now create the PAI module for screen 100 and add following code: *&---------------------------------------------------------------------* *& Module USER_COMMAND_0100 INPUT *&---------------------------------------------------------------------*

* Triggers the Focde for the characteristics screen in the slection screen *----------------------------------------------------------------------* MODULE user_command_0100 INPUT. CALL FUNCTION 'CTMS_DDB_EXECUTE_FUNCTION' EXPORTING okcode = sy-ucomm EXCEPTIONS OTHERS = 1. "#EC * IF sy-subrc <> 0. MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. ENDIF. ENDMODULE. " USER_COMMAND_0100 INPUT step 4: To read the values entered by the user on the selection screen, for the characterisitics,the field symbols can be used to access the global memory; like, FORM f_read_globals CHANGING p_char_values TYPE ty_tt_char_values p_bild LIKE gt_bild p_flag TYPE c. DATA : lv_val1(16) TYPE c, lv_val2(16) TYPE c, ls_char_values TYPE ty_char_values. FIELD-SYMBOLS: <lfs_bild> TYPE ANY TABLE, <lfs_mi> TYPE ANY TABLE, <lfs_bild_s> TYPE ty_bild. FIELD-SYMBOLS: <lfs_mi1> TYPE ANY, <lfs_mi2> TYPE ANY, <lfs_mi3> TYPE ANY. lv_val1 = '(SAPLCTMS)bild[]'. lv_val2 = '(SAPLCTMS)mi[]'. ASSIGN (lv_val1) TO <lfs_bild>. ASSIGN (lv_val2) TO <lfs_mi>. p_bild = <lfs_bild>. LOOP AT p_bild ASSIGNING <lfs_bild_s> WHERE atwrt IS NOT INITIAL . p_flag = gc_x. ls_char_values-value_char = <lfs_bild_s>-atwrt. LOOP AT <lfs_mi> ASSIGNING <lfs_mi1> . ASSIGN COMPONENT 3 OF STRUCTURE <lfs_mi1> TO <lfs_mi2>. IF sy-subrc = 0. IF <lfs_mi2> = <lfs_bild_s>-mindx. ASSIGN COMPONENT 2 OF STRUCTURE <lfs_mi1> TO <lfs_mi3>. ls_char_values-charact_descr = <lfs_mi3>. APPEND ls_char_values TO p_char_values. UNASSIGN: <lfs_mi2>, <lfs_mi3>. ENDIF. ENDIF. ENDLOOP. ENDLOOP. ENDFORM. " F_READ_GLOBALS Hope this post may be useful in future !