Application Development 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: 

Add button is not displaying values correctly in table control. ABAP

Former Member
0 Kudos

Only material number and the quantity is being displayed when i press the add button. Also, when i try to add more records into the table, it just replaces the first line and the first entry i entered is not shown. Screen shot of the output is attached.

The table control was created using the wizard. I cannot find the problem. Please Help

Here is my code:

 *INCLUDE
DATA: BEGIN OF BOM_STRUC,

    MANDT(3) TYPE c,

    MNUM TYPE Z032_ITEM_DATATYPE,

    INAME TYPE Z032_INAM_DATATYPE,

    BQUA TYPE INT4,

    PRUNIT(4) TYPE c,

    END OF BOM_STRUC.

    data: it_BOM like sorted TABLE OF BOM_STRUC with unique key MNUM,

          wa_BOM like BOM_STRUC.

*MAIN PROGRAM
MODULE USER_COMMAND_3031 INPUT.
CASE OK_CODE.

WHEN 'ADD'.

            BOM_STRUC-MNUM = MAT_NUM.

            BOM_STRUC-INAME = MAT_NAME.

            BOM_STRUC-BQUA = BQUA.

            BOM_STRUC-PRUNIT = PRUNIT.

            APPEND BOM_STRUC TO IT_BOM.
ENDCASE.

ENDMODULE.

*FLOW LOGIC
PROCESS BEFORE OUTPUT.

*&SPWIZARD: PBO FLOW LOGIC FOR TABLECONTROL 'BOM_TBL'

  MODULE BOM_TBL_CHANGE_TC_ATTR.

*&SPWIZARD: MODULE BOM_TBL_CHANGE_COL_ATTR.

  LOOP AT   IT_BOM

       INTO WA_BOM

       WITH CONTROL BOM_TBL

       CURSOR BOM_TBL-CURRENT_LINE.

    MODULE BOM_TBL_GET_LINES.

*&SPWIZARD:   MODULE BOM_TBL_CHANGE_FIELD_ATTR

  ENDLOOP.



 MODULE STATUS_3031.



PROCESS AFTER INPUT.

*&SPWIZARD: PAI FLOW LOGIC FOR TABLECONTROL 'BOM_TBL'

  LOOP AT IT_BOM.

    CHAIN.

      FIELD WA_BOM-MNUM.

      FIELD WA_BOM-INAME.

      FIELD WA_BOM-BQUA.

      FIELD WA_BOM-PRUNIT.

      MODULE BOM_TBL_MODIFY ON CHAIN-REQUEST.

    endchain.

    FIELD WA_BOM-MANDT

      MODULE BOM_TBL_MARK ON REQUEST.

  ENDLOOP.

  MODULE BOM_TBL_USER_COMMAND.

*&SPWIZARD: MODULE BOM_TBL_CHANGE_TC_ATTR.

*&SPWIZARD: MODULE BOM_TBL_CHANGE_COL_ATTR.



 MODULE USER_COMMAND_3031.



PROCESS ON VALUE-REQUEST.

   FIELD MAT_NUM MODULE BOX_3031.
4 REPLIES 4

Sandra_Rossi
Active Contributor
0 Kudos

The "CASE OK_CODE" block should be in the module BOM_TBL_USER_COMMAND or USER_COMMAND_3031.

0 Kudos

Sorry, I just forgot to add that part of the code here. i just updated it. The "CASE OK_CODE" block is in the module USER_COMMAND_3031

former_member288834
Participant
0 Kudos

You need to pass number of records to table line field

DESCRIBE TABLE IT_BOM LINES TABLE_CONTROL_NAME-LINES

Regards

Guru Prasad.

Former Member
0 Kudos

Hi Josh Dang-Il,

Try to declare structure BOM_STRUC, Internal table(IT_BOM), and Workarea(WA_BOM) in the main program of this screen, Then value of internal table and workarea will available in whole program.

Dont declare in any include programs, Declaration you can do in Main Program.

Try this it may help you.

Thanks,

Sivaraj Sadasivam.