Tuesday, December 28, 2010
Procedure:
- PBO ->Set PF-STATUS for screen and set Function Code 'PICK' for F2 function key.
- Double click on each table control field ->Screen element properties popup->Click Display attributes tab->Check "Responds to Double-click" check box.
- PAI ->Read the line on which double click was happened.
Sample program
- Create one module program SAPMZTEST_DBL_CLICK at SE80.
- Define two internal table IT_0001 and IT_0006 and two table control controller variable for two screens 1001 and 1002 in TOP include.
- Define OK_CODE variable in TOP include.
- Activate TOP include.
- Top include code
- Create screen 1001 and table control(TC_0001) in it and place IT_0001 program table fields in the table control.
- Click on each field of table control and check RESPOND TO DOUBLE-CLICK in the properties of screen field properties.
- PBO - Create SET PF-STAUS for screen 1001 and set "PICK" function code for F2 function key.
- PAI - Read selected line of the table control( Statement GET CURSOR FIELD).
- Call Screen 1002.
- Flow logic code.
- Function code "PICK" should be set to F2 function key.
- Create screen 1002 and table control(TC_0006) in it and place IT_0006 program table fields in the table control.
- Flow logic code.
- Create transaction code and execute.
PROGRAM SAPMZTEST_DBL_CLICK. TYPES: BEGIN OF TY_0001, PERNR TYPE PA0001-PERNR, ENAME TYPE PA0001-ENAME, END OF TY_0001, BEGIN OF TY_0006, PERNR TYPE PA0006-PERNR, ANSSA TYPE PA0006-ANSSA, NAME2 TYPE PA0006-NAME2, STRAS TYPE PA0006-STRAS, ORT01 TYPE PA0006-ORT01, ORT02 TYPE PA0006-ORT02, PSTLZ TYPE PA0006-PSTLZ, LAND1 TYPE PA0006-LAND1, TELNR TYPE PA0006-TELNR, END OF TY_0006. DATA: IT_0001 TYPE STANDARD TABLE OF TY_0001, IT_0006 TYPE STANDARD TABLE OF TY_0006. DATA: WA_0001 TYPE TY_0001, WA_0006 TYPE TY_0006. CONTROLS: TC_0001 TYPE TABLEVIEW USING SCREEN '1001', TC_0006 TYPE TABLEVIEW USING SCREEN '1002'. DATA: OK_CODE TYPE SY-UCOMM.
PROCESS BEFORE OUTPUT. MODULE STATUS_1001. MODULE GET_DATA_0001. LOOP AT IT_0001 INTO WA_0001 WITH CONTROL TC_0001. ENDLOOP. PROCESS AFTER INPUT. LOOP AT IT_0001. ENDLOOP. MODULE USER_COMMAND_1001.
*&------------------------------------------------------------* *& Module STATUS_1001 OUTPUT *&------------------------------------------------------------* * text *-------------------------------------------------------------* MODULE STATUS_1001 OUTPUT. SET PF-STATUS 'ZTEST_DBL_CLICK'. ENDMODULE. " STATUS_1001 OUTPUT
*&-----------------------------------------------------------* *& Module GET_DATA_0001 OUTPUT *&-----------------------------------------------------------* * text *-----------------------------------------------------------* MODULE GET_DATA_0001 OUTPUT. IF IT_0001 IS INITIAL. SELECT * FROM PA0001 INTO CORRESPONDING FIELDS OF TABLE IT_0001 UP TO 50 ROWS. SORT IT_0001 BY PERNR. DELETE ADJACENT DUPLICATES FROM IT_0001. ENDIF. ENDMODULE. " GET_DATA_0001 OUTPUT
*&------------------------------------------------------------* *& Module USER_COMMAND_1001 INPUT *&-----------------------------------------------------------* * text *------------------------------------------------------------* MODULE USER_COMMAND_1001 INPUT. DATA: LV_FIELD(30), LV_LINE TYPE I. CASE OK_CODE . WHEN 'PICK'. GET CURSOR FIELD LV_FIELD LINE LV_LINE. READ TABLE IT_0001 INDEX LV_LINE INTO WA_0001. CALL SCREEN 1002. ENDCASE. ENDMODULE. " USER_COMMAND_1001 INPUT
PROCESS BEFORE OUTPUT. MODULE GET_DATA_0006. LOOP AT IT_0006 INTO WA_0006 WITH CONTROL TC_0006. ENDLOOP. PROCESS AFTER INPUT. LOOP AT IT_0006. ENDLOOP.
*&-------------------------------------------------------* *& Module GET_DATA_0006 OUTPUT *&------------------------------------------------------* * text *-------------------------------------------------------* MODULE GET_DATA_0006 OUTPUT. SELECT * FROM PA0006 INTO CORRESPONDING FIELDS OF TABLE IT_0006 WHERE PERNR EQ WA_0001-PERNR. ENDMODULE. " GET_DATA_0006 OUTPUT
Followers
Popular Posts
- ABAP - ALV Report example with steps
- ABAP - Sending email with pdf attachment
- ABAP - Step by step tutorial on Smart Forms - Template Node
- SAP Adobe Form - Steps to create simple ADOBE Form and calling it from ABAP Program
- SAP ABAP - CL_ABAP_CHAR_UTILITIES class usage
- ABAP - Multiple value selection from F4 help for SELECT-OPTIONS
- Execute ABAP Report using SUBMIT statement
- ABAP - Select all or Deselect all in ALV or Check box handling in ALV
- Web Dynpro ABAP ALV - ON_CLICK event
- ABAP - Dynamic WHERE clause
Why F2 or PICK ?
ReplyDeletebest post.
ReplyDeleteSAP Secrity training
SAP Secrity and sap grc online training