Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

module pool

0 Likes
1,018
PROGRAM  ZSIMPLE_TAB3.


TABLES: ZEKKO1,ZEKPO.
TYPES: BEGIN OF STRU,
        ZEBELN TYPE ZEKPO-ZEBELN,
        ZTXZ01 TYPE ZEKPO-ZTXZ01,
        ZMATNR TYPE ZEKPO-ZMATNR,
        ZEBELP TYPE ZEKPO-ZEBELP,
        ZWERKS TYPE ZEKPO-ZWERKS,
        ZLGORT TYPE ZEKPO-ZLGORT,
        ZMEINS TYPE ZEKPO-ZMEINS,
        ZGR_STATUS TYPE ZEKPO-ZGR_STATUS,
        ZNETWR TYPE ZEKPO-ZNETWR,
        ZMENGE TYPE ZEKPO-ZMENGE,
      END OF STRU.


DATA: WA TYPE STRU,   " WORK AREA AND INTERNAL TABLE FOR TABLE CONTROL"
      ITAB TYPE TABLE OF STRU.


DATA: ITAB1 TYPE TABLE OF ZEKPO, "WORK AREA FOR PASSING FROM TABC TO ZEKPO TABLE"
      WA1 TYPE ZEKPO.


*&SPWIZARD: DECLARATION OF TABLECONTROL 'TBC_TAB' ITSELF
CONTROLS: TBC_TAB TYPE TABLEVIEW USING SCREEN 2345.


*&SPWIZARD: OUTPUT MODULE FOR TC 'TBC_TAB'. DO NOT CHANGE THIS LINE!
*&SPWIZARD: UPDATE LINES FOR EQUIVALENT SCROLLBAR
MODULE TBC_TAB_CHANGE_TC_ATTR OUTPUT.
  DESCRIBE TABLE ITAB LINES TBC_TAB-lines.
ENDMODULE.


*&SPWIZARD: INPUT MODULE FOR TC 'TBC_TAB'. DO NOT CHANGE THIS LINE!
*&SPWIZARD: MODIFY TABLE
MODULE TBC_TAB_MODIFY INPUT.
  MODIFY ITAB
    FROM WA
    INDEX TBC_TAB-CURRENT_LINE.
ENDMODULE.
*&---------------------------------------------------------------------*
*&      Module  USER_COMMAND_2345  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE USER_COMMAND_2345 INPUT.
CASE SY-UCOMM.


    WHEN 'CREATE'.
      INSERT ZEKKO1. " HEADER DATA IS WORKING"




      LOOP AT ITAB INTO WA. " PASSING DATA FROM WA TO WA1V"


        WA1-ZEBELN = WA-ZEBELN.
        WA1-ZTXZ01 = WA-ZTXZ01.
        WA1-ZMATNR = WA-ZMATNR.
        WA1-ZEBELP = WA-ZEBELP.
        WA1-ZWERKS = WA-ZWERKS.
        WA1-ZLGORT = WA-ZLGORT.
        WA1-ZMEINS = WA-ZMEINS.
        WA1-ZGR_STATUS = WA-ZGR_STATUS.
        WA1-ZNETWR = WA-ZNETWR.
        WA1-ZMENGE = WA-ZMENGE.
        APPEND WA1 TO ITAB1. "PASSING DATA FROM WA1 TO ITAB1"
      ENDLOOP.
      MODIFY ZEKPO FROM  TABLE ITAB1. " PASSING DATA FROM TABC ITAB1 TO ZEKPO"




    WHEN 'BACK'.
      LEAVE TO SCREEN 0 .


    WHEN 'CHANGE'.


    WHEN 'DELETE'.




ENDCASE.






ENDMODULE.                 " USER_COMMAND_2345  INPUT




flow logic


PROCESS BEFORE OUTPUT.
*&SPWIZARD: PBO FLOW LOGIC FOR TABLECONTROL 'TBC_TAB'
  MODULE TBC_TAB_CHANGE_TC_ATTR.
*&SPWIZARD: MODULE TBC_TAB_CHANGE_COL_ATTR.
  LOOP AT   ITAB
       INTO WA
       WITH CONTROL TBC_TAB
       CURSOR TBC_TAB-CURRENT_LINE.
*&SPWIZARD:   MODULE TBC_TAB_CHANGE_FIELD_ATTR
  ENDLOOP.


* MODULE STATUS_2345.
*
PROCESS AFTER INPUT.
*&SPWIZARD: PAI FLOW LOGIC FOR TABLECONTROL 'TBC_TAB'
  LOOP AT ITAB.
    CHAIN.
      FIELD WA-ZEBELN.
      FIELD WA-ZTXZ01.
      FIELD WA-ZMATNR.
      FIELD WA-ZEBELP.
      FIELD WA-ZWERKS.
      FIELD WA-ZLGORT.
      FIELD WA-ZMEINS.
      FIELD WA-ZGR_STATUS.
      FIELD WA-ZNETWR.
      FIELD WA-ZMENGE.
      MODULE TBC_TAB_MODIFY ON CHAIN-REQUEST.
    endchain.
  ENDLOOP.
*&SPWIZARD: MODULE TBC_TAB_CHANGE_TC_ATTR.
*&SPWIZARD: MODULE TBC_TAB_CHANGE_COL_ATTR.


 MODULE USER_COMMAND_2345.

hello! i have two ztables one with header data and another with item data i have made item table with table control wizard and header from data dictionary when i click create the porder data should get saved in two tables please leave me a solution and consider below images and codes let me know where to change if wrong please provide solution

1 ACCEPTED SOLUTION
Read only

Sandra_Rossi
Active Contributor
0 Likes
858

Test SY-SUBRC after INSERT and MODIFY, if okay then use COMMIT WORK, otherwise ROLLBACK WORK and error message. Read the documentation for more information.

3 REPLIES 3
Read only

Sandra_Rossi
Active Contributor
0 Likes
859

Test SY-SUBRC after INSERT and MODIFY, if okay then use COMMIT WORK, otherwise ROLLBACK WORK and error message. Read the documentation for more information.

Read only

retired_member
Product and Topic Expert
Product and Topic Expert
0 Likes
858

Look into the documentation for Working examples.

Read only

matt
Active Contributor
858

Are you seriously asking how to store data in the database? Have you not done the basic training, or read some kind of book - or looked online for examples?