Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results forĀ 
Search instead forĀ 
Did you mean:Ā 
Read only

modify statement is not working with internal table

Balu483
Participant
0 Likes
3,904

in table control i want to modify table control internal table after user PRESS ENTER  .

but internal table is not getting modified it is giving sy-subrc = 4.

please help me how to modify internal table and display the data in table control in module pool program

my logic:

FLOW LOGIC:

PROCESS BEFORE OUTPUT.

MODULE status_0483."""for pf status

  LOOP AT gt_fdint INTO gs_fdint WITH CONTROL tab_con CURSOR

                                        tab_con-current_line.

  ENDLOOP.

PROCESS AFTER INPUT.

  LOOP AT gt_fdint .

    CHAIN.

      FIELD gs_fdint-zselno.

      FIELD gs_fdint-zcustm.

      FIELD gs_fdint-zfddes.

      FIELD gs_fdint-zstart.

      FIELD gs_fdint-zenddt.

      FIELD gs_fdint-zaccrl.

      FIELD gs_fdint-zintrs.

      FIELD gs_fdint-zintdes.

      FIELD gs_fdint-zpstdt.

      FIELD gs_fdint-channel.

      MODULE tc_acunt_modify ON CHAIN-REQUEST.

    ENDCHAIN.

  ENDLOOP.

  MODULE user_command_0483."""USER COMMAND SUBROUTINE

  MODULE exit_command_483."""EXIT COMMAND SUBROUTINE

MODULE tc_acunt_modify INPUT.

  MODIFY gt_fdint

         FROM gs_fdint

         INDEX tab_con-current_line.

ENDMODULE.

hear internal table is initially contains no record, if  i give sone input in table control and press enter then

MODULE tc_acunt_modify ON CHAIN-REQUEST. is triggering and but it is not modifying the internal table 

after MODIFY statement it is giving SY-SUBRC = 4.

1 ACCEPTED SOLUTION
Read only

VenkatRamesh_V
Active Contributor
0 Likes
1,593

Hi Chandu,

Modify statement never insert  a new record in internal table.

  MODIFY gt_fdint

         FROM gs_fdint

         INDEX tab_con-current_line.

IF sy-subrc <> 0.

INSERT gs_fdint INTO gt_fdint    INDEX tab_con-current_line.

ENDIF.

Hope it helpful,

Regards,

Venkat.

4 REPLIES 4
Read only

Former Member
0 Likes
1,593

Hi,

first insert a initial line in the internal table and then modify the same as below.

PROCESS AFTER INPUT.

  LOOP AT gt_fdint .

    CHAIN.

      FIELD gs_fdint-zselno.

      FIELD gs_fdint-zcustm.

      FIELD gs_fdint-zfddes.

      FIELD gs_fdint-zstart.

      FIELD gs_fdint-zenddt.

      FIELD gs_fdint-zaccrl.

      FIELD gs_fdint-zintrs.

      FIELD gs_fdint-zintdes.

      FIELD gs_fdint-zpstdt.

      FIELD gs_fdint-channel.

      Module tc_insert_line ON CHAIN-REQUEST.

      MODULE tc_acunt_modify ON CHAIN-REQUEST.

    ENDCHAIN.

  ENDLOOP.

  MODULE user_command_0483."""USER COMMAND SUBROUTINE

  MODULE exit_command_483."""EXIT COMMAND SUBROUTINE

MODULE tc_insert_line INPUT.

  READ TABLE  gt_fdint INDEX tab_con-current_line TRANSPORTING NO FIELDS.

  IF sy-subrc <> 0.

    INSERT INITIAL LINE INTO  gt_fdint INDEX tab_con-current_line.

  ENDIF.

ENDMODULE.                 " tc_insert_line  INPUT

MODULE tc_acunt_modify INPUT.

  MODIFY gt_fdint

         FROM gs_fdint

         INDEX tab_con-current_line.

ENDMODULE.

Hope this helps.

Read only

VenkatRamesh_V
Active Contributor
0 Likes
1,594

Hi Chandu,

Modify statement never insert  a new record in internal table.

  MODIFY gt_fdint

         FROM gs_fdint

         INDEX tab_con-current_line.

IF sy-subrc <> 0.

INSERT gs_fdint INTO gt_fdint    INDEX tab_con-current_line.

ENDIF.

Hope it helpful,

Regards,

Venkat.

Read only

0 Likes
1,593

Hi Venkat Ramesh,

thank you so much for your reply . really it is so helpful.

Read only

Former Member
0 Likes
1,593

Create your table control using the table control wizard rather than doing it be hand.

Rich