F Insert values from Report Parameters into custom Database Table in SAP ABAP | CodeTheta

Insert values from Report Parameters into custom Database Table in SAP ABAP


First create a custom table in SE11, give valid name start with Z. in my case i have given ZVP_STD_TBL. Then give the corresponding Data Element name and domain, give Field Label name etc.


Table fields are -
ID
NAME
AGE
ADDRESS

After that go to transaction code SE38 and five a valid name starting with Z.

Our focus is to insert data from report Parameter to custom table which we have created in SE11.

Code :
REPORT ZVP_INSERT_TO_DATABASE_TABLE.

PARAMETERS: P_ID TYPE ZDEID,
            P_NAME TYPE ZDENAME,
            P_AGE TYPE ZDEAGE,
            P_ADDRS TYPE ZDEADDRESS.

DATA: IT TYPE TABLE OF ZVP_STD_TBL,
      WA TYPE ZVP_STD_TBL.

MOVE P_ID TO WA-ID.
MOVE P_NAME TO WA-NAME.
MOVE P_AGE TO WA-AGE.
MOVE P_ADDRS TO WA-ADDRESS.
INSERT ZVP_STD_TBL FROM WA.

IF SY-SUBRC EQ 0.
  MESSAGE: 'SUCCESSFULLY SAVED' TYPE 'S'.
  ELSE.
  MESSAGE: 'NOT SAVED' TYPE 'E'.
ENDIF.

Output :

data insert from report parameters


Table Entries


IDE Used To Test This Code : ABAP Editors.

Try this code in your computer for better understanding. Enjoy the code. If you have any Question you can contact us or mail us.We will reply you as soon as possible.

Post a Comment