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 Problem

Former Member
0 Likes
474

Hi all,

I have created a table control using wizard. The table control displays entries from z table.

But the problem is that the table control is scrollable so when the user selects row from first page and than scroll down to next page the rows selected before are wiped off from the itab. How can i retrieve those rows which are selected on previous page as i have to save the details to another z table. Please guide.

Thanks in advance.

Points to satisfactory answers,

Regards,

Bharat Mistry.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
438

Hi Bharat,

Please post code for table control PBO area. I will be able to pointout mistake if u any.

Vijay.

    • This is my maiden answer so co-operate in giving Rewards atleast 2 points.

3 REPLIES 3
Read only

Former Member
0 Likes
439

Hi Bharat,

Please post code for table control PBO area. I will be able to pointout mistake if u any.

Vijay.

    • This is my maiden answer so co-operate in giving Rewards atleast 2 points.

Read only

0 Likes
438

Hi Vijay,

I have solved the problem myself, still you can suggest any easy way out.

This is the flow logic for PBO,

PROCESS BEFORE OUTPUT.

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

module TC1_change_tc_attr.

*&spwizard: module TC1_change_col_attr.

loop at IT_ZDMAS

with control TC1

cursor TC1-current_line.

module TC1_get_lines.

*&spwizard: module TC1_change_field_attr

endloop.

MODULE STATUS_0100.

module TC1_change_tc_attr output.

if IT_ZDMAS-ZDPID EQ ' '.

select * into corresponding fields of table it_zdmas

from zdmas order by zdpid.

endif.

describe table IT_ZDMAS lines TC1-lines.

endmodule. "TC1_change_tc_attr OUTPUT

*&spwizard: output module for tc 'TC1'. do not change this line!

*&spwizard: get lines of tablecontrol

module TC1_get_lines output.

g_TC1_lines = sy-loopc.

endmodule. "TC1_get_lines OUTPUT

PROCESS AFTER INPUT.

*&spwizard: pai flow logic for tablecontrol 'TC1'

loop at IT_ZDMAS.

chain.

field IT_ZDMAS-ZDPNM.

field IT_ZDMAS-ZDHOD.

endchain.

field IT_ZDMAS-ZDSEL

module TC1_mark on request.

endloop.

module TC1_user_command.

*&spwizard: module TC1_change_tc_attr.

*&spwizard: module TC1_change_col_attr.

MODULE USER_COMMAND_0100.

module TC1_mark input.

data: g_TC1_wa2 like line of IT_ZDMAS.

if TC1-line_sel_mode = 1.

loop at IT_ZDMAS into g_TC1_wa2

where ZDSEL = 'X'.

g_TC1_wa2-ZDSEL = ''.

modify IT_ZDMAS

from g_TC1_wa2

transporting ZDSEL.

endloop.

endif.

modify IT_ZDMAS

index TC1-current_line

transporting ZDSEL.

endmodule. "TC1_mark INPUT

*&spwizard: input module for tc 'TC1'. do not change this line!

*&spwizard: process user command

module TC1_user_command input.

OK_CODE = sy-ucomm.

if OK_CODE eq 'SAVE'.

LOOP AT IT_ZDMAS INTO WA_ZDMAS WHERE ZDSEL eq 'X'.

ZPOMAS-ZDPID = WA_ZDMAS-ZDPID.

ZPOMAS-ZPONO = '121225'.

ZPOMAS-ZPODT = '20070319'.

INSERT ZPOMAS.

COMMIT WORK.

WA_ZDMAS-ZDSEL = ' '.

MODIFY IT_ZDMAS

FROM WA_ZDMAS

TRANSPORTING ZDSEL.

ENDLOOP.

endif.

perform user_ok_tc using 'TC1'

'IT_ZDMAS'

'ZDSEL'

changing OK_CODE.

sy-ucomm = OK_CODE.

endmodule. "TC1_user_command INPUT

PAI code is also pasted for your reference.

Regards,

Bharat Mistry.

Message was edited by:

Bharat Mistry

Read only

Former Member
0 Likes
438

Hi Bharat,

Your code is perfact.

It can also be written in following way.

PROCESS BEFORE OUTPUT.

MODULE status_0100.

LOOP WITH CONTROL flights.

MODULE fill_table_control.

ENDLOOP.

PROCESS AFTER INPUT.

LOOP WITH CONTROL flights.

MODULE read_table_control.

ENDLOOP.

MODULE user_command_0100.

MODULE fill_table_control OUTPUT.

READ TABLE itab INTO demo_conn INDEX flights-current_line.

ENDMODULE.

MODULE read_table_control INPUT.

lines = sy-loopc.

MODIFY itab FROM demo_conn INDEX flights-current_line.

ENDMODULE.

Hope we both have learned some thing new in area of TC.

Cheers.

DARSHAN PATEL

    • Reward points if u are HAPPY with the answer.