‎2010 Jan 13 12:58 PM
Hi guys,
I am really frustrated of getting the row, selected in table control. I can see hudreds of post in the same topic in SDN. But I can't figure out where I went wrong.
I have table control, in that I set the attribute w/Sel Column as MARK and I created the same field in my internal table.
And on the execution, I selected a row and that row is not getting the value as X for the field mark in my internal table. Please have a look at my code and guide me where I was going wrong.
Please note that GET CURSOR LINE doesn't suit for my requirement.
PROCESS BEFORE OUTPUT.
MODULE status_2000.
LOOP AT gt_main INTO gwa_main WITH CONTROL tc_main.
MODULE fill_table_control.
ENDLOOP.
*
PROCESS AFTER INPUT.
LOOP AT gt_main.
MODULE read_table_conrol.
ENDLOOP.
MODULE user_command_2000.
CONTROLS: tc_main TYPE TABLEVIEW USING SCREEN 2000.
TYPES: BEGIN OF ty_main,
rmsno TYPE zmm_spa_item-rmsno,
reqno TYPE zmm_spa_item-reqno,
mfnam TYPE zmm_spa_item-mfnam,
mfpcd TYPE zmm_spa_item-mfpcd,
magnt TYPE zmm_spa_item-magnt,
crdat TYPE zmm_spa_item-crdat,
fstat TYPE zmm_spa_item-fstat,
sirst TYPE zmm_spa_item-sirst,
purst TYPE zmm_spa_item-purst,
tecst TYPE zmm_spa_item-tecst,
qcvst TYPE zmm_spa_item-qcvst,
plnst TYPE zmm_spa_item-plnst,
prdst TYPE zmm_spa_item-prdst,
aslgr TYPE zmm_spa_item-aslgr,
lifnr TYPE zmm_spa_item-lifnr,
mark TYPE c,
END OF ty_main.
MODULE fill_table_control OUTPUT.
READ TABLE gt_main INTO gwa_main INDEX tc_main-current_line.
IF sy-subrc EQ 0.
MOVE-CORRESPONDING gwa_main TO zmm_spa_item.
ENDIF.
ENDMODULE. " FILL_TABLE_CONTROL OUTPUT
MODULE read_table_conrol INPUT.
* GET CURSOR LINE gv_curline.
READ TABLE gt_main INTO gwa_main WIH KEY mark = 'X'.
IF sy-subrc EQ 0.
MOVE-CORRESPONDING gwa_main TO zmm_spa_item.
ELSE.
MESSAGE e001 WITH 'Please select a request number'.
ENDIF.
CALL SCREEN 2200.
ENDMODULE. " READ_TABLE_CONROL INPUT
‎2010 Jan 13 1:13 PM
Before read control you need to modify the table control value with 'X'.
‎2010 Jan 13 1:14 PM
Hi,
i think its missing a modify inside a chain for each line.
Try following:
PROCESS AFTER INPUT.
LOOP AT gt_main.
CHAIN.
gwa_main-mark.
MODULE update_fields ON CHAIN-REQUEST.
ENDCHAIN.
ENDLOOP.
MODULE read_table_conrol.
MODULE user_command_2000.
MODULE update_fields INPUT.
MODIFY gtmain
FROM gwa_main
INDEX tc_main-current_line.
ENDMODULE.
MODULE read_table_conrol INPUT.
LOOP AT gt_main INTO gwa_main
WHERE mark = 'X'.
...
ENDLOOP.
ENDMODULE.
Regards,
Frisoni
‎2010 Jan 13 2:03 PM
Hi Frisoni & Keshav,
I found out the problem. Instead of MARK, I made the field name as gwa_main-mark in the table control attributes and it is capturing now. And changed the code as below.
MODULE read_table_conrol INPUT.
MODIFY gt_main FROM gwa_main INDEX tc_main-current_line.
ENDMODULE.
Thanks for your quick replies.
Yasin.
‎2010 Jan 13 1:22 PM
In PAI
LOOP AT itab_table .
MODULE modify_int_table.
ENDLOOP.
In the MODULE call modify_int_table we can use
MODIFY int_table FROM workarea INDEX tab_con-CURRENT_LINE
i think this will solve your issue.