on 2024 Nov 03 8:28 PM
Hello everyone, I'm new to ABAP and I'm currently trying to practice with table control, everything is going great but then I face a problem that I could not solve.
The thing I'm trying to do here is create new data into gt_ordit from the table control on the screen, but everytime I press enter or 'SAVE' on the toolbar, the data disappear. I've try to run the debug and found out that the modify line in the validate_input_200_detail is not working. There is data in the gs_ordit but it doesn't modify the data in the gt_ordit?
Please let me know if you need more code in my program. Thank you so much
Source Code:
Table Control in the TOP Include
CONTROLS TC_DETAIL_LIST TYPE TABLEVIEW USING SCREEN 200.
The flow logic in screen 200
LOOP AT gt_ordit.
module no_update.
chain.
FIELD GS_ORDIT-LINE_ITEM.
FIELD GS_ORDIT-MAT_CODE.
FIELD GS_ORDIT-SHORT_TEXT.
FIELD GS_ORDIT-QUANTITY.
FIELD GS_ORDIT-UNIT.
FIELD GS_ORDIT-NET_PRICE.
endchain.
module validate_input_200_detail.
ENDLOOP.
The module validate_input_200_detail (Line 14 is not working as intended).
MODULE validate_input_200_detail INPUT.
IF gs_ordit-mat_code IS NOT INITIAL.
SELECT SINGLE * FROM mara INTO @DATA(ls_mara) WHERE matnr = @GS_ordit-mat_code.
IF sy-subrc <> 0.
MESSAGE: 'Can not find material' TYPE 'E'.
ENDIF.
ENDIF.
IF gs_ordit-line_item IS NOT INITIAL AND
gs_ordit-short_text IS NOT INITIAL AND
gs_ordit-quantity IS NOT INITIAL AND
gs_ordit-unit IS NOT INITIAL AND
gs_ordit-net_price IS NOT INITIAL.
MODIFY gt_ordit FROM gs_ordit INDEX tc_detail_list-current_line.
ENDIF.
ENDMODULE.
Request clarification before answering.
Does the record exist in the itab, if not replace MODIFY statement with some APPEND / INSERT statement depending on the itab type.
Insure also that the SAVE function code is not defined as an Exit function code, and that the LOOP AT control logic is executed before the ok_code processing modules (but after the AT EXIT-COMMAND modules)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 18 | |
| 6 | |
| 6 | |
| 6 | |
| 4 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.