‎2006 Dec 05 11:02 AM
Im using a table control on my screen. I want to know the selected row and retrieve values in that row from code.
How can I go about It.
‎2006 Dec 14 4:38 PM
Hi,
1. Create program in SE38 type module pool and Activated
2. Go to SE51 give the program name and screen number then Layout Editor in drags table control with wizard.
3. Start the Wizard give the table control name (TBCL)>click the continue>Give the Dictionary table name like(MARA)>Continue>Select the filed(MATNR) or Fields>continue>continue-->check the Scroll check box >continue>continue-->click the completed --> Save --> Activated.
4. Automacaly code is generated.
5. One more Push Button (ADD) adds to layout for selected row and retrieves values into one internal table.
Flow logic:
PROCESS AFTER INPUT.
MODULE USER_COMMAND_0700.
Code:
Data: BEGIN OF TB_MARA OCCURS 0,
MNO LIKE MARA-MATNR,
END OF TB_MARA.
MODULE USER_COMMAND_0100 INPUT.
WHEN 'ADD'.
READ TABLE G_TBCL_ITAB INTO G_TBCL_WA WITH KEY FLAG = 'X'.
MOVE G_TBCL_WA-MATNR TO TB_MARA-MNO.
APPEND TB_MARA.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
‎2006 Dec 05 11:08 AM
within the table control U can define a checkbox which an be defined as a flag in ur internal table...Go to properties of table control and get the checkbox assigned with one row selected...
Now, when U check one row and click on button, the internal table flag will be X thru which u can write appropriate code..
‎2006 Dec 05 12:33 PM
Hi Ramesh.
I am new to ABAP can you give me a sample code code on how to read this column named MARK and check if it is assigned 'X'.
Thank you in advance.
‎2006 Dec 05 1:06 PM
hi
say if you have the code in an internal table ITAB, you can read the respective selected rows with the following code:
loop at itab where mark = 'X'.
--
--
-
endloop.
<b>or</b>
delete itab where mark <> 'X'
you have to write this code in PAI.
thx
pavan
‎2006 Dec 05 8:21 PM
Hi,
If itab is your internal table used for table control
data : selected_line type sy-stepl,
delete_index type i.
case sy-ucomm.
when 'DELE'.
get cursor line selected_line.
delete_index = TABLECONTROL-top_line + selected_line - 1.
delete itab index delete_index.
clear selected_line.
ENDCASE.
Hope this helps.
If you need anything let me know.
Thanks
Venki
‎2006 Dec 14 4:36 PM
Hi,
1. Create program in SE38 type module pool and Activated
2. Go to SE51 give the program name and screen number then Layout Editor in drags table control with wizard.
3. Start the Wizard give the table control name (TBCL)>click the continue>Give the Dictionary table name like(MARA)>Continue>Select the filed(MATNR) or Fields>continue>continue-->check the Scroll check box >continue>continue-->click the completed --> Save --> Activated.
4. Automacaly code is generated.
5. One more Push Button (ADD) adds to layout for selected row and retrieves values into one internal table.
Flow logic:
PROCESS AFTER INPUT.
MODULE USER_COMMAND_0700.
Code:
Data: BEGIN OF TB_MARA OCCURS 0,
MNO LIKE MARA-MATNR,
END OF TB_MARA.
MODULE USER_COMMAND_0100 INPUT.
WHEN 'ADD'.
READ TABLE G_TBCL_ITAB INTO G_TBCL_WA WITH KEY FLAG = 'X'.
MOVE G_TBCL_WA-MATNR TO TB_MARA-MNO.
APPEND TB_MARA.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
‎2006 Dec 14 4:37 PM
Hi,
1. Create program in SE38 type module pool and Activated
2. Go to SE51 give the program name and screen number then Layout Editor in drags table control with wizard.
3. Start the Wizard give the table control name (TBCL)>click the continue>Give the Dictionary table name like(MARA)>Continue>Select the filed(MATNR) or Fields>continue>continue-->check the Scroll check box >continue>continue-->click the completed --> Save --> Activated.
4. Automacaly code is generated.
5. One more Push Button (ADD) adds to layout for selected row and retrieves values into one internal table.
Flow logic:
PROCESS AFTER INPUT.
MODULE USER_COMMAND_0700.
Code:
Data: BEGIN OF TB_MARA OCCURS 0,
MNO LIKE MARA-MATNR,
END OF TB_MARA.
MODULE USER_COMMAND_0100 INPUT.
WHEN 'ADD'.
READ TABLE G_TBCL_ITAB INTO G_TBCL_WA WITH KEY FLAG = 'X'.
MOVE G_TBCL_WA-MATNR TO TB_MARA-MNO.
APPEND TB_MARA.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
‎2006 Dec 14 4:38 PM
Hi,
1. Create program in SE38 type module pool and Activated
2. Go to SE51 give the program name and screen number then Layout Editor in drags table control with wizard.
3. Start the Wizard give the table control name (TBCL)>click the continue>Give the Dictionary table name like(MARA)>Continue>Select the filed(MATNR) or Fields>continue>continue-->check the Scroll check box >continue>continue-->click the completed --> Save --> Activated.
4. Automacaly code is generated.
5. One more Push Button (ADD) adds to layout for selected row and retrieves values into one internal table.
Flow logic:
PROCESS AFTER INPUT.
MODULE USER_COMMAND_0700.
Code:
Data: BEGIN OF TB_MARA OCCURS 0,
MNO LIKE MARA-MATNR,
END OF TB_MARA.
MODULE USER_COMMAND_0100 INPUT.
WHEN 'ADD'.
READ TABLE G_TBCL_ITAB INTO G_TBCL_WA WITH KEY FLAG = 'X'.
MOVE G_TBCL_WA-MATNR TO TB_MARA-MNO.
APPEND TB_MARA.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT