Skip to Content

How to insert row in table control and save the data in tables

Hi,

I have one table control i am displaying data into table control ,

my problem is : i want to display data into read mode in table control.

but when i click on insert button on the same screen i want one blank line should inserted into table control , then i want to insert some data into table control on that row , when i click the save button . the new data inserted into the table control is insert that data into ztable ,

please give me solution

main problen is how can know inserted line in table control and pass that data into ztable.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Mar 02, 2007 at 02:01 PM

    Check out these Demo Programs

    RSDEMO_TABLE_CONTROL

    DEMO_DYNPRO_TABLE_CONTROL_1

    DEMO_DYNPRO_TABLE_CONTROL_2

    RSDEMO_TABLE_CONTROL

    RSDEMO02

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Mar 02, 2007 at 02:07 PM

    Hi,

    Please check this sample code.

    SAVE_OK = OK_CODE.
    CLEAR OK_CODE.
    CASE SAVE_OK.
    
    WHEN 'INSERT'.
      READ TABLE TC-COLS INTO COL WITH KEY SCREEN-INPUT = '1'.
      IF SY-SUBRC = 0.
        LOOP AT I_BINLOC INTO ZMBINLOC WHERE ZMARK = 'X'.
          CLEAR ZMBINLOC.
          INSERT ZMBINLOC INTO I_BINLOC INDEX SY-TABIX.
        ENDLOOP.
        DESCRIBE TABLE I_BINLOC LINES TC-LINES.
      ENDIF.
    
    WHEN 'SAVE'.
      SORT I_BINLOC ASCENDING BY WERKS LGORT ZBINLOC.
      DELETE ADJACENT DUPLICATES FROM I_BINLOC.
      IF NOT I_DELETE[] IS INITIAL.
        DELETE ZMBINLOC FROM TABLE I_DELETE.
      ENDIF.
      MODIFY ZMBINLOC FROM TABLE I_BINLOC.
      IF SY-SUBRC = 0.
        MESSAGE S899(BD) WITH TEXT-002.
      ENDIF.
    
    ...
    
    ENDCASE.
    

    Regards,

    Ferry Lianto

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 02, 2007 at 04:47 PM

    Hi,

    When you create a table control then loop of that control should be done in the PBO and PAI of flow logic.

    **TO update the internal table entered in the table control.

    PAI:

    loop at itab.

    module field_name.

    endloop.

    Module field_name.

    if wa_itab-selec = X.

    append itab from wa_itab .

    end module.

    **To display the appended list on the screen.

    PBO:

    LOOP AT itab INTO wa_itab

    WITH CONTROL tc_itab

    CURSOR tc_itab-current_line.

    • IF you need any validation.

    create a module for validation.

    ENDLOOP.

    Br,

    Laxmi

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 02, 2007 at 04:53 PM

    Hi,

    Follow the below logic,

    PROCESS BEFORE OUTPUT.

    MODULE STATUS_0001.

    MODULE POPULATE_TABLE_CONTROL. --> Get the data from table store in

    ITAB

    LOOP AT GT_CTRL_LP_D516 INTO GS_WA_CTRL_LP_D516

    WITH CONTROL CTRL_LP_D516

    CURSOR CTRL_LP_D516-CURRENT_LINE.

    • The following module moves data to control

    MODULE MOVE_TO_CONTROL.--> Move data from ITAB to table control

    ENDLOOP.

    PROCESS AFTER INPUT.

    LOOP AT GT_CTRL_LP_D516.

    ENDLOOP.

    MODULE EXIT AT EXIT-COMMAND.

    MODULE USER_COMMAND_0001. --> Here you have to take out the values from table control and update database table

    Reward points if helpful.

    Thanks and regards,

    Mallareddy Rayapureddy,

    Munich, Germany.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.