0% found this document useful (0 votes)
89 views4 pages

Demo On Using Table Control

This document demonstrates using a table control in ABAP to display and modify data from the MARA table. It defines a structure to map MARA fields, populates an internal table from MARA, displays the data in a screen, and includes logic modules to handle save, delete, and modify operations by inserting, deleting, or updating records in MARA.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
89 views4 pages

Demo On Using Table Control

This document demonstrates using a table control in ABAP to display and modify data from the MARA table. It defines a structure to map MARA fields, populates an internal table from MARA, displays the data in a screen, and includes logic modules to handle save, delete, and modify operations by inserting, deleting, or updating records in MARA.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 4

Demo on using Table Control

By Raghav Vakada, MouriTech Solutions

*&---------------------------------------------------------------------*
*& 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:

You might also like