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

Table control with wizard- Values entered got vanished

Former Member
0 Likes
1,299

Hi All,

I have a table control in my screen and the table control will update the Database table . When i enter the  value in the table control and i press enter the values i entered is not in the screen . Its simply reset. I am using the table control with wizard. i know that i need to write some code in the automated code. can you please share some code sample.

Thanks,

Pradeep.

Hi All,

I have a table control in my screen and the table control will update the Database table . When i enter the  value in the table control and i press enter the values i entered is not in the screen . Its simply reset. I am using the table control with wizard. i know that i need to write some code in the automated code. can you please share some code sample.

Thanks,

Pradeep.

9 REPLIES 9
Read only

former_member191728
Active Participant
0 Likes
1,263

Hi Pradeep

when you click enter button

in PBO BUTTON

write you code in module_user_command_<scrno>

by default this will be commented

uncomment and write your code

be sure that you are not refreshing the internal table before you update the table.

module user_command_<scrno>

if sy-ucomm = 'ENTER'

UPDATE sflight(db table)  FROM TABLE sflight_tab(internal table) .

ENDIF.

endmodule

refer to below document

http://saptechnical.com/Tutorials/ABAP/TableControl/Wizard.htm

Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,263

Look in the PAI of the screen, there must be a module between the LOOP/ENDLOOP on the table control, usually the last one, in this module insure you read and modify the internal table in the program. Look at this sample in sap documentation : Table Control with Modifications

Regards,

Raymond

Read only

0 Likes
1,263

Raymond,

Thanks for the input . I tried and i am getting an error in the flights-lines = lines statement.

Read only

0 Likes
1,263

In the PAI you should have something like

* Flow logic

PROCESS AFTER INPUT.
   LOOP AT itab.
     MODULE read_itab.
     field dynpro-fieldname.
     MODULE modify_itab.
   ENDLOOP.
* include of PAI
MODULE read_itab INPUT.
   READ TABLE itab INDEX control-current_line.
ENDMODULE.                 " task_210_read  INPUTs

MODULE modify_itab INPUT.
   itab-fieldname = dynpro-fieldname.
   MODIFY itab INDEX control-current_line.
ENDMODULE.  

Don't confuse control name and itab/work area name

Regards,

Raymond

Read only

0 Likes
1,263

I debugged the code and when i enter the value in the table control screen and i press enter the cursor came in line no 3. there my itab is initial so the line no 09  and 013 fails.

Read only

0 Likes
1,263

HI All,

I have to use the current line . describe table lines statement to fix this issue. but i don't know exactly where to write the code.

Read only

arindam_m
Active Contributor
0 Likes
1,263

Hi,

As suggested please check your PAI event as all the updates happen there you must be refreshing or clearing tables or variable.

Cheers,

Arindam

Read only

Former Member
0 Likes
1,263

Hi Arindam,

I have not used any refresh statement .

Read only

amrendra_tiwari
Explorer
0 Likes
1,263
Hi,
I also had the same problem but manged in this way:

Assign Function Code 'CHECK' for standard toolbar(Tick Mark)

In PBO...

  LOOP WITH CONTROL TBLCTRL  .

    MODULE DISPLAY_DATA.

  ENDLOOP.

In PAI...

LOOP WITH CONTROL TBLCTRL  .
    CHAIN.
      FIELD    WA_DATA-FIELD1.<=Table Control Table Fields
      FIELD    WA_DATA-FIELD2.
      FIELD    WA_DATA-FIELD3.
      MODULE VALIDATE_DATA ON CHAIN-INPUT.
      MODULE MODIFY_TBL_INPUT.
    ENDCHAIN.

  ENDLOOP.

*****************MODULE DISPLAY_DATA.****************

   READ TABLE IT_DATA INTO WA_DATA INDEX TBLCTRL-CURRENT_LINE.
    MOVE-CORRESPONDING WA_DATA TO TBLCTRL.

*****************MODULE VALIDATE_DATA.****************

   IF  SY-UCOMM = 'CHECK'

      IF IT_DATA-FIELD1 EQ SPACE.

        SET CURSOR FIELD 'WA_DATA-FIELD1' LINE TB_LN.

        MESSAGE E0xx(xx).

     ELSEIF...................

*This will make cursor to move on the field on ENTER key.

      ENDIF.

ENDIF.

*****************MODIFY_TBL_INPUT****************

   MODIFY IT_DATA FROM WA_DATA INDEX TBLCTRL-CURRENT_LINE.

Hope It will help you.

Regards,

Amrendra