Download Android App of sapabap-vamsi

sapabap-vamsi : Download Android App for Mobiles

Sunday, April 22, 2012

Demo on using Table Control

*&---------------------------------------------------------------------*
*& Report  Z_DB_TABLECONTROL                                           *
*&                                                                     *
*&---------------------------------------------------------------------*
*&                                                                     *
*&                                                                     *
*&---------------------------------------------------------------------*
REPORT  Z_DB_TABLECONTROL.
TABLES: MARA.
CONTROLS MATERIAL TYPE TABLEVIEW USING SCREEN 130.
TYPES: BEGIN OF ST_MARA,
       MATNR TYPE MARA-MATNR,
       ERSDA TYPE MARA-ERSDA,
       ERNAM TYPE MARA-ERNAM,
       LAEDA TYPE MARA-LAEDA,
       END OF ST_MARA.
DATA: IT_ST TYPE TABLE OF ST_MARA,
      WA_ST TYPE ST_MARA,
      IT_MARA TYPE MARA,
      WA_MARA TYPE MARA,
      OK_CODE LIKE SY-UCOMM.
CALL SCREEN 130.
*&---------------------------------------------------------------------*
*&      Module  V1  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE V1 INPUT.
CASE OK_CODE.
WHEN 'SAVE'.
WA_ST-MATNR = MARA-MATNR.
WA_ST-ERSDA = MARA-ERSDA.
WA_ST-ERNAM = MARA-ERNAM.
WA_ST-LAEDA = MARA-LAEDA.
MOVE-CORRESPONDING WA_ST TO WA_MARA.
INSERT INTO MARA VALUES WA_MARA.
WHEN 'DELETE'.
WA_ST-MATNR = MARA-MATNR.
WA_ST-ERSDA = MARA-ERSDA.
WA_ST-ERNAM = MARA-ERNAM.
WA_ST-LAEDA = MARA-LAEDA.
MOVE-CORRESPONDING  WA_ST TO WA_MARA.
DELETE MARA FROM WA_MARA.
WHEN 'MODIFY'.
WA_ST-MATNR = MARA-MATNR.
WA_ST-ERSDA = MARA-ERSDA.
WA_ST-ERNAM = MARA-ERNAM.
WA_ST-LAEDA = MARA-LAEDA.
MOVE-CORRESPONDING  WA_ST TO WA_MARA.
MODIFY MARA FROM WA_MARA.
ENDCASE.
ENDMODULE.                 " V1  INPUT
*&---------------------------------------------------------------------*
*&      Module  EXIT  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE EXIT INPUT.
IF OK_CODE = 'EXIT'.
LEAVE PROGRAM.
ENDIF.
ENDMODULE.                 " EXIT  INPUT
Create a screen by number 130 and provide the following attributes: 
 
LAYOUT:
 
ELEMENT LIST:
 
FLOW LOGIC.
 
EXECUTE: 

No comments:

Post a Comment