Search code examples
abapdynpro

Internal table isn't modified from table control


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

Solution

  • 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.