Skip to Content
author's profile photo Former Member
Former Member

Table control: While creating new entries

Dear all,

I have created a table control with input control in the screen..

In which my requirement is like.. what ever the entries user is typing in the table control, I have to store it in a Z-table.

I dont have any issue in storing the internal table into the Z-table.

My problem is:

When i am typing any thing in the table control row and press ENTER, the values got erased. For this problem, where I need to Append the values into an Internal table..

Can anyone show the sample piece of code How to pass values from table control to an Internal table?

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

5 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Aug 08, 2009 at 02:41 PM

    when you press enter, PBO of that screen in triggered after the PAI. i guess you are using clear or refresh on the table in these events.

    remove it.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Aug 08, 2009 at 02:53 PM

    Hello Prem,

    You can start with following link:

    http://help.sap.com/saphelp_nw04/helpdata/en/9f/dbac1d35c111d1829f0000e829fbfe/content.htm

    Thanks,

    Augustin.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 11, 2009 at 09:21 AM

    The Table control gets the value in PBO

    Gives the values in PAI.

    PROCESS BEFORE OUTPUT.
    MODULE STATUS_0001.
    
    LOOP AT ITAB WITH CONTROL TC.
      MODULE MOV.
    ENDLOOP.
    
    PROCESS AFTER INPUT.
    
    LOOP AT ITAB.
      module save_data.
    ENDLOOP.
    
    MODULE USER_COMMAND_0001.
    
    

    In the above code

    In PAI you get the values from Table control you save it in Internal table in the module 'save_data'

    In PBO table control will be initialised (ie no data in it) .

    So in the module MOV.

    You have move the data from the internal table to the table control ( move IT to screen-fieldname).

    then you able to see the data when you press the enter.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 11, 2009 at 09:29 AM

    Hi,

    Once you press ENTER, the PAI is triggered, internal table is populated and data is inserted into the database table.

    Now the PBO is again triggered where I guess, you havent repopulated your screen fields with data from the internal table.

    In the PBO

    PROCESS BEFORE OUTPUT.
      MODULE STATUS_0112.
      LOOP AT gt_itab1 WITH CONTROL tabcontrol.
        MODULE move_data.
      ENDLOOP.
    
    PROCESS AFTER INPUT.
      LOOP AT gt_itab1.
        MODULE insert_data.
      ENDLOOP.
    

    In MODULE move_data.,

    if sy-ucomm eq 'ENTER'.
        read table gt_itab1 into wa_itab1 index tabcontrol-current_line.
        screen_field1 = wa_itab1-field1.
        screen-field2 = wa_itab1-field2.
    endif.
    

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Aug 11, 2009 at 09:36 AM

    Hi,

    Normally if the Screen Field name and a variable in the program are same the automatic data transfer takes place, but in the case of Table controls you need to explictly handle this.

    In PAI.

    Loop at itab.

    module modify_data.

    endloop.

    in program

    module modify_tab.

    describe table itab llines tc-lines.

    if tc-lines <= tc-current_lline.

    modify itab index tc-current_line.

    else

    append itab

    endmodule.

    if you above code is not implemented the data from screen is not transported to the itab in program

    Cheers

    Ramchander RaoK

    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.