0
votes

I have an table control (ctrl) and an internal table (snctab). I want to add items snctab from the table control. I can add but not modify a record from snctab. Here are my PBO and PAI modules:

PROCESS BEFORE OUTPUT.
    MODULE status_0100.

    LOOP AT snctab WITH CONTROL ctrl CURSOR ctrl-current_line.
    ENDLOOP.

PROCESS AFTER INPUT.

    LOOP AT snctab.
        MODULE update.
    ENDLOOP.

    MODULE user_command_0100.

    MODULE update INPUT.    "my update module
        READ TABLE snctab INDEX ctrl-current_line.
        IF sy-subrc <> 0.
            APPEND snctab.
        ELSE.
            MODIFY snctab INDEX ctrl-current_line.
        ENDIF.
    ENDMODULE.                 " UPDATE  INPUT
2
Just to clarify, when an item is in both scntab and ctrl, the contents of ctrl is not being updated in your code? But if the record doesn't exist in ctrl, it will successfully be added to ctrl? - gkubed
Actual problem is when an item is in both scntab and ctrl, i am changing some fields of this record on the screen but there is no change neither of snctab and ctrl on background. - Nuran Yüksekce

2 Answers

1
votes

I updated the update module like this and problem solved.

 MODULE update INPUT.    "my update module
    MODIFY snctab INDEX ctrl-current_line.
    IF sy-subrc <> 0.
       APPEND snctab.
    ENDIF.
 ENDMODULE. 
0
votes

Your LOOP statement in the PAI module does not take the table control into account - you are using an obsolete variant that was used to process step loops there. Check the demo program DEMO_DYNPRO_TABCONT_LOOP in your system to see a working example.