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 + press enter

Former Member
0 Likes
3,189

Hello Friends,

When I fill the table control and press enter button the values entered are going to dis-appred any idea whats going on?

the table control is shown in a screen as pop-up

Regards,

1 ACCEPTED SOLUTION
Read only

former_member673464
Active Contributor
0 Likes
2,028

hi..

Table control may be not updating the internal table from which data is displaying. They might have written code for trigerring PAI event for "ENTER "

key .When PAI and PBO trigers ,it again displays the same internal table content for "ENTER " key.For table control update check the demo program

<b>demo_dynpro_tabcont_loop_at</b>

regards,

veeresh

16 REPLIES 16
Read only

Former Member
0 Likes
2,028

Are you referring the table control and the internal table are same.

and can you show your PBO module code.

If you are using the same reference then there is some problem with PBO logic.

which is present in the

loop at itab with control tc.

module transfer_tab_to_tc. "<----here might be the problem

endloop.

Just show your code once.

Best Regards

Vijay

Read only

0 Likes
2,028

Hello ,

Here is the code:

process before output.

*&spwizard: pbo flow logic for tablecontrol 'Z_TAB_CTRL'

module z_tab_ctrl_init.

module change_screen.

*&spwizard: module Z_TAB_CTRL_change_tc_attr.

*&spwizard: module Z_TAB_CTRL_change_col_attr.

loop at g_z_tab_ctrl_itab

into g_z_tab_ctrl_wa

with control z_tab_ctrl

cursor z_tab_ctrl-current_line.

*&spwizard: module Z_TAB_CTRL_change_field_attr

module z_tab_ctrl_move.

module z_tab_ctrl_get_lines.

endloop.

module status_0100.

module Z_TAB_CTRL_init output.

  • DESC_INPUT = DESC.

  • TC_IN_INPUT = 'testwest'.

if g_Z_TAB_CTRL_copied is initial.

*&spwizard: copy ddic-table 'ZENCO_TAB_CTRL'

*&spwizard: into internal table 'g_Z_TAB_CTRL_itab'

select * from ZENCO_TAB_CTRL

into corresponding fields

of table g_Z_TAB_CTRL_itab.

g_Z_TAB_CTRL_wa-VIDEOCODEC = ''. " INS SYED

"append g_Z_TAB_CTRL_wa to g_Z_TAB_CTRL_itab. " INS SYED

g_Z_TAB_CTRL_copied = 'X'.

refresh control 'Z_TAB_CTRL' from screen '0100'.

endif.

endmodule.

MODULE change_screen OUTPUT.

Loop AT SCREEN.

if screen-name = 'ASPECT_RATIO_INPUT'.

  • screen-output = '1'.

  • screen-input = '0'.

  • screen-value_in = '1'.

  • screen-ACTIVE = '1'.

endif.

MODIFY SCREEN.

ENDLOOP.

module Z_TAB_CTRL_move output.

clear: g_Z_TAB_CTRL_wa.

move-corresponding g_Z_TAB_CTRL_wa to ZENCO_TAB_CTRL.

endmodule.

module Z_TAB_CTRL_get_lines output.

g_Z_TAB_CTRL_lines = sy-loopc.

endmodule.

Regards,

Read only

former_member196299
Active Contributor
0 Likes
2,028

hi ,

You need to write the code in the PBO of the screen containing the table control to retain the values after you press enter ..

Actually whats happening in your program is , once u r entering PAI is getting triggered and again the PBO , when its triggering the PBO , your field values are getting refreshed , so u need to avoid that and code to retain the values . That is simply loop at the itab and pass the values back to the fields in the PBO itself .

Hope I am clear else revert back .

Regards,

Ranjita

Read only

Former Member
0 Likes
2,028

After entering values in table control you may not be storing those values in an internal table, in internal table no values exist.. and when it come to PBO, it again find itab as blank and show u blank table control..

plz check it..

Regards

Prax

Read only

former_member673464
Active Contributor
0 Likes
2,029

hi..

Table control may be not updating the internal table from which data is displaying. They might have written code for trigerring PAI event for "ENTER "

key .When PAI and PBO trigers ,it again displays the same internal table content for "ENTER " key.For table control update check the demo program

<b>demo_dynpro_tabcont_loop_at</b>

regards,

veeresh

Read only

Former Member
0 Likes
2,028

hi

in pai u might have written codings to transfer data from table control(what u have entered thro keyboard) to internal table. so every record will be transferred to int table..

so in PBO again u have to move tto screen..

i think u have put all screen fields in a custom table..

loop at tc.

move-corresponding int table to screen.(custom table name)

endloop.

reward if useful

Read only

0 Likes
2,028

I have to restrict the PBO to execute again, when use press the enter button ....

why the PBO is executed when the user press the enter button ?

Can anyone pls see my code above, and let me know what I am doing wrong?

Regards,

Read only

0 Likes
2,028

Hello,

Any idea, what i am doing wrong, ?

Regards,

Read only

0 Likes
2,028

HI Sash ,

The basic of screen programming is , when u see the screen for the first time the PBO part of the screen is procesed and once you trigger any event on the screen , the PAI gets triggered and then the PBO is called again n u can see the screen back . this is the basic flow of the screens when we see them .

Now coming to your querry , I did not understand why have you pur a REFRESH in the 1st module unit of PBO . You shuld comment it n try again .

Notice this area :

module Z_TAB_CTRL_init output.

  • DESC_INPUT = DESC.

  • TC_IN_INPUT = 'testwest'.

if g_Z_TAB_CTRL_copied is initial.

*&spwizard: copy ddic-table 'ZENCO_TAB_CTRL'

*&spwizard: into internal table 'g_Z_TAB_CTRL_itab'

select * from ZENCO_TAB_CTRL

into corresponding fields

of table g_Z_TAB_CTRL_itab.

g_Z_TAB_CTRL_wa-VIDEOCODEC = ''. " INS SYED

"append g_Z_TAB_CTRL_wa to g_Z_TAB_CTRL_itab. " INS SYED

g_Z_TAB_CTRL_copied = 'X'.

refresh control 'Z_TAB_CTRL' from screen '0100'. <b>" comment this line and check [\b] .

endif.

endmodule.

Else I'll be Posting a sample code for table controls with wizard and you can very well compare the logics.

Ranjita

Read only

0 Likes
2,028

The refersh button is not executed the second time the PBO is called, because the statement if g_Z_TAB_CTRL_copied is initial. is not true...

Regards,

Read only

0 Likes
2,028

hey ..

check the logic from here :

process before output.

*&SPWIZARD: PBO FLOW LOGIC FOR TABLECONTROL 'TC_01'

module tc_01_init.

*&SPWIZARD: MODULE TC_01_CHANGE_TC_ATTR.

*&SPWIZARD: MODULE TC_01_CHANGE_COL_ATTR.

loop at g_tc_01_itab

into g_tc_01_wa

with control tc_01

cursor tc_01-current_line.

*&SPWIZARD: MODULE TC_01_CHANGE_FIELD_ATTR

module tc_01_move.

module tc_01_get_lines.

endloop.

module status_0001.

*

process after input.

*&SPWIZARD: PAI FLOW LOGIC FOR TABLECONTROL 'TC_01'

loop at g_tc_01_itab.

chain.

field sflight-carrid.

field sflight-connid.

field sflight-fldate.

module tc_01_modify on chain-request.

endchain.

endloop.

module tc_01_user_command.

*&SPWIZARD: MODULE TC_01_CHANGE_TC_ATTR.

*&SPWIZARD: MODULE TC_01_CHANGE_COL_ATTR.

  • MODULE USER_COMMAND_0001.

Regards,

Ranjita

Read only

0 Likes
2,028

hi , I have tried following:

module Z_TAB_CTRL_move output.

clear: g_Z_TAB_CTRL_wa.

move-corresponding g_Z_TAB_CTRL_wa to ZENCO_TAB_CTRL.

endmodule.

I have comment the statement-.

clear: g_Z_TAB_CTRL_wa. and seems to me worked fine ?

Any idea, what could be wrong, if i do not clear this wa ?

( but to this problem it works fine now )...

Regards,

Read only

0 Likes
2,028

hi Sash ,

Please comment " module z_tab_ctrl_init. " and check .

I think it should work .

Regard,

Ranjita

Read only

Former Member
0 Likes
2,028

Hi

If u saving table control data to any internal table than try one thing..

There would b one module in PAI

MODULE tab1_modify INPUT.

there will b some code like

MODIFY itab_det

FROM itab_det

INDEX tab1-current_line.

after this put this code...

APPEND itab_det.

Hope it will helpful to u

Read only

0 Likes
2,028

The thing is, the pop-up carring the table control has to be called multiple time, I have comment the following statement:

clear: g_Z_TAB_CTRL_wa.

and now after pressing the enter button the things work fine, but when the screen called second time, the values are still there...........

How I can fix the both issues that, when user press the enter button then the values should be shown, but when screen comes second time, it should be clean ?

Regards,

Read only

0 Likes
2,028

hello Ranjita ,

Any idea, how I can handel both stuff ?

While press enter, values showed be shown, but when the screen called second time in the loop, the values should not be there..... is it possible to have such stuff ?

Regards,

Message was edited by:

Shah H