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

Former Member
0 Likes
568

Hi all,

I have 2 questions..

Iam developing custom transaction which has 3 screens.

1.Please send me the sample logic code for 'SELECT ALL' 'DESELECT ALL' and 'NEW ENTRIES' for the custom transaction ...for this iam using table control.

2.On the 3rd screen there is a user input of 3 fields which is again table control ...the logic should look like this..

when i hit 'SAVE' the user inputs should save to the custom table i created.

when i hit 'ENTER' the description for the material should appear in the other column of the table control.

Thanks,

Madhu

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
538

Hi,

1) SELECTALL / DESELECT ALL

When you create the table control you would have give a variable for column selection.

<b>Selection col. name GV_LINESEL</b>..I am assuming it to be GV_LINESEL.

Have a column called LINSEL in your internal table ITAB for the table control.

<b>PROCESS AFTER INPUT.</b>

LOOP AT ITAB.

MODULE CHECK.

ENDLOOP.

MODULE USER_COMMAND.

<b>* MODULES CODE.</b>

MODULE CHECK.

ITAB-LINESEL = GV_LINESEL.

MODIFY ITAB INDEX tc_crossover-current_line.

ENDMODULE.

MODULE USER_COMMAND.

CASE SY-UCOMM.

WHEN 'SELECTALL'.

ITAB = 'X'.

<b>MODIFY ITAB TRANSPORTING LINESEL WHERE LINESEL IS INITIAL.</b>

WHEN 'DESELECTALL'.

ITAB = ' '.

<b>MODIFY ITAB TRANSPORTING LINESEL WHERE NOT LINESEL IS INITIAL.</b>

ENDCASE.

ENDMODULE.

<b>PROCESS BEFORE OUTPUT.</b>

LOOP AT ITAB WITH CONTROL TC.

MODULE SET_CHECK.

ENDLOOP.

MODULE SET_CHECK.

GV_LINESEL = ITAB-LINESEL.

ENDMODULE.

Thanks,

Naren

7 REPLIES 7
Read only

Former Member
0 Likes
538

Something like:


*&---------------------------------------------------------------------*
*       Select all records
*----------------------------------------------------------------------*
form select_all.

  loop at zzerd_line_item_data_0100.
    zzerd_line_item_data_0100-mark = 'X'.
    modify zzerd_line_item_data_0100.
  endloop.

endform.                    " select_all

Rob

Read only

Former Member
0 Likes
539

Hi,

1) SELECTALL / DESELECT ALL

When you create the table control you would have give a variable for column selection.

<b>Selection col. name GV_LINESEL</b>..I am assuming it to be GV_LINESEL.

Have a column called LINSEL in your internal table ITAB for the table control.

<b>PROCESS AFTER INPUT.</b>

LOOP AT ITAB.

MODULE CHECK.

ENDLOOP.

MODULE USER_COMMAND.

<b>* MODULES CODE.</b>

MODULE CHECK.

ITAB-LINESEL = GV_LINESEL.

MODIFY ITAB INDEX tc_crossover-current_line.

ENDMODULE.

MODULE USER_COMMAND.

CASE SY-UCOMM.

WHEN 'SELECTALL'.

ITAB = 'X'.

<b>MODIFY ITAB TRANSPORTING LINESEL WHERE LINESEL IS INITIAL.</b>

WHEN 'DESELECTALL'.

ITAB = ' '.

<b>MODIFY ITAB TRANSPORTING LINESEL WHERE NOT LINESEL IS INITIAL.</b>

ENDCASE.

ENDMODULE.

<b>PROCESS BEFORE OUTPUT.</b>

LOOP AT ITAB WITH CONTROL TC.

MODULE SET_CHECK.

ENDLOOP.

MODULE SET_CHECK.

GV_LINESEL = ITAB-LINESEL.

ENDMODULE.

Thanks,

Naren

Read only

0 Likes
538

Hi Naren

Thanks for your reply...

for select/deselect all ..i still don't get logic which u have explained.

the table control has followiing fields in its deep structure.

FIXED_COLS

LINES

TOP_LINE

CURRENT_LINE

LEFT_COL

LINE_SEL_MODE

COL_SEL_MODE

LINE_SELECTOR

V_SCROLL

H_GRID

V_GRID

COLS

INVISIBLE

Here i need 2 clarifications..

ITAB-LINESEL = GV_LINESEL.

what is LINESEL?

and what is GV_LINESEL?

i mean where to declare it and how to use?

iam popluating the values in table control from the select statement

after giving the inputs in the first screen

lets say my table control name is TC and i have assigned

w/selColumn = ITAB-MARK in table control.

in this case how can i write the logic to select and deselect the rows

in table control.

if you have the time please give the code for NEW ENTRIES in the table

control aswell.

Thanks,

Madhu

Read only

0 Likes
538

Hi Naren,

Thank u very much i got the logic for selectall/deselect but

could u please send the logic for NEW ENTRIES if you have time?

Thanks,

Madhu

Read only

Former Member
0 Likes
538

Hi,

2) Hit enter material description should be displayed.

PROCESS BEFORE OUTPUT.

LOOP AT ITAB WITH CONTROL TC.

MODULE SET_DESCRIPTION.

ENDLOOP.

MODULE SET_DESCRIPTION.

SELECT SINGLE * FROM MAKT WHERE SPRAS = SY-LANGU

AND MATNR = ITAB-MATNR.

IF SY-SUBRC = 0.

THRID_COLUMN_NAME = MAKT-MAKTX.

ENDIF.

ENDMODULE.

Thanks,

Naren

Read only

Former Member
0 Likes
538

Hi,

2) when i hit 'SAVE' the user inputs should save to the custom table i created.

PROCESS AFTER INPUT.

LOOP AT ITAB.

...

ENDLOOP.

MODULE USER_COMMAND.

MODULE USER_COMMAND.

IF SY-UCOMM = 'SAVE'.

LOOP AT ITAB.

MOVE-CORRESPONDING ITAB TO ZTABLE.

MODIFY ZTABLE.

ENDLOOP.

ENDIF.

ENDMODULE.

Thanks,

Naren

Read only

Former Member
0 Likes
538

Hi,

I have changed the code accordingly..If you have ITAB-MARK as your field...

Also assuming you have column MARK in your internal table ITAB..

1) SELECTALL / DESELECT ALL

PROCESS AFTER INPUT.

LOOP AT ITAB.

MODULE CHECK.

ENDLOOP.

MODULE USER_COMMAND.

  • MODULES CODE.

MODULE CHECK.

MODIFY ITAB INDEX tc_crossover-current_line.

ENDMODULE.

MODULE USER_COMMAND.

CASE SY-UCOMM.

WHEN 'SELECTALL'.

ITAB-<b>MARK</b> = 'X'.

MODIFY ITAB TRANSPORTING<b> MARK</b> WHERE <b>MARK</b> IS INITIAL.

WHEN 'DESELECTALL'.

ITAB-<b>MARK</b> = ' '.

MODIFY ITAB TRANSPORTING<b> MAR</b>K WHERE NOT <b>MARK</b> IS INITIAL.

ENDCASE.

ENDMODULE.

Thanks,

Naren