Skip to Content
0

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

Nov 08, 2016 at 12:24 PM

66

avatar image

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.
output.png (36.5 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Sandra Rossi Nov 08, 2016 at 12:43 PM
0

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

Show 1 Share
10 |10000 characters needed characters left characters exceeded

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

0
Guru Prasad Nov 08, 2016 at 03:05 PM
0

You need to pass number of records to table line field

DESCRIBE TABLE IT_BOM LINES TABLE_CONTROL_NAME-LINES

Regards

Guru Prasad.

Share
10 |10000 characters needed characters left characters exceeded
Sivaraj Sadasivam Nov 10, 2016 at 05:51 AM
0

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.

Share
10 |10000 characters needed characters left characters exceeded