11-08-2016 12:24 PM
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.
11-08-2016 12:43 PM
The "CASE OK_CODE" block should be in the module BOM_TBL_USER_COMMAND or USER_COMMAND_3031.
11-08-2016 2:36 PM
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
11-08-2016 3:05 PM
You need to pass number of records to table line field
DESCRIBE TABLE IT_BOM LINES TABLE_CONTROL_NAME-LINES
Regards
Guru Prasad.
11-10-2016 5:51 AM
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.