‎2008 Apr 22 7:37 AM
Hi All
I am using table control wizard on the screen. So the code in PBO & PAI is automatically generated.
Problem is, when i enter 1 or more lines in the table control wizard & press enter, the entered data get vanished.
is anyone have any solution over this? pls let me know, why this happens & what to do for the same.
thanks in advance
useful answers wil get rewarded surely.
JK
‎2008 Apr 22 7:45 AM
In the PAI you have to ensure the data from each row of the table control is updated into an internal table in your program, and in the PBO you need to read this internal table back into the row of the table control.
Jonathan
‎2008 Apr 22 7:45 AM
In the PAI you have to ensure the data from each row of the table control is updated into an internal table in your program, and in the PBO you need to read this internal table back into the row of the table control.
Jonathan
‎2008 Apr 22 7:52 AM
Hi Jonathan
Thanks for ur reply. When we take table control wizard on the screen, the code is generated for it or not? do we require to do some modifications or what?
bcz both the modules PBO & PAI are having
loop at tc_internal_table.
endloop.
statment.
do we need to add something.
I am using only one internal table to capture & show the data in table control wizard.
thanks
JK
‎2008 Apr 22 9:09 AM
You should get something like this from the Wizard for the editable table control:
PROCESS BEFORE OUTPUT.
*&SPWIZARD: PBO FLOW LOGIC FOR TABLECONTROL 'TC_0400'
MODULE TC_0400_CHANGE_TC_ATTR.
*&SPWIZARD: MODULE TC_0400_CHANGE_COL_ATTR.
LOOP AT GT_DATA
WITH CONTROL TC_0400
CURSOR TC_0400-CURRENT_LINE.
MODULE TC_0400_GET_LINES.
*&SPWIZARD: MODULE TC_0400_CHANGE_FIELD_ATTR
ENDLOOP.
* MODULE STATUS_0400.
*
PROCESS AFTER INPUT.
*&SPWIZARD: PAI FLOW LOGIC FOR TABLECONTROL 'TC_0400'
LOOP AT GT_DATA.
CHAIN.
FIELD GT_DATA-FIELD1.
FIELD GT_DATA-FIELD2.
MODULE TC_0400_MODIFY ON CHAIN-REQUEST. "update is here
endchain.
ENDLOOP.
MODULE TC_0400_USER_COMMAND.
*
and in the PAI module in the loop it should modify the internal table, e.g.
MODULE TC_0400_MODIFY INPUT.
MODIFY GT_DATA
INDEX TC_0400-CURRENT_LINE.
ENDMODULE.
Jonathan
‎2008 Apr 22 9:28 AM
In PAI write like this,
loop at tc_internal_table.
module modify.
endloop.
Module modify.
Modify tc_internal_table from <wa> index current_line.
endmodule.
<wa>- is the screen structure used for table control.
<tbctrl>- Is name of table control
Edited by: Rengith Skariah on Apr 22, 2008 10:29 AM
‎2008 Apr 22 10:16 AM
Hi Renginath & Jonathan
What u have suggested is really pointing towards the solution. The code is already given by table control wizard creation. but it's not working.
another thing i tried to write code like
MODULE modify input.
MOVE tc_400 TO work_area_400.
MODIFY internal_table_400
INDEX tc_400-current_line
FROM work_area_400.
END MODULE.
But it is showing me an error as missing program/report name.
version i am using is ECC 6.
do u have any idea?
And in PBO module
I am planning to use statment like
MOVE work_area_400 TO tc_400.
pls suggest
regards
JK
‎2008 Apr 22 11:31 AM
It's hard to tell what's happening without seeing the whole program... typically you'll have a module pool with an overall structure of includes as described in:
http://help.sap.com/saphelp_nw04/helpdata/en/9f/db9ce935c111d1829f0000e829fbfe/content.htm
so the "program" statement would normally be found in your "top" include along with global data definitions etc... check that is what your code structure looks like in SE80.
As for the sample code you provided, which variable name is your table control and which is your internal table? If "tc_400" is the table control then you will not be updating the internal table from it as it just contains data that controls the layout and positioning of the table control, not any data within the TC itself. In the example I provided above, "gt_data" was an internal table with a header line, and the table control columns names on the dynpro were gt_data-field1 and gt_data-field1 which is why the modify works without a separate work area.
Jonathan