0

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
Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
Nuran Yüksekce
  • 155
  • 1
  • 9
  • 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 Jul 06 '17 at 14:31
  • 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 Jul 07 '17 at 06:01

2 Answers2

1

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. 
Nuran Yüksekce
  • 155
  • 1
  • 9
0

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.

vwegert
  • 18,371
  • 3
  • 37
  • 55