‎2007 Aug 24 5:17 AM
Hi experts
Actually I have a internal table having data which is not from any ztables,
it is from standard tables.
Now, I want to display the internal table values into table control.
I dont know how to do, please advice me and give the sample code also.
Let us say my internal table it_final.
Thanks in advance.
Regards
Rajaram
‎2007 Aug 24 9:42 AM
hi
check program : demo_dynpro_tabcont_loop_at.
u will get brief overview of table controls.
If u still have any doubts, revert back to me.
Regards,
Prasant
*Reward if useful
‎2007 Aug 24 1:50 PM
Hi,
<b>THIS IS THE FLOW LOGIC.</b>
PROCESS BEFORE OUTPUT.
*&SPWIZARD: PBO FLOW LOGIC FOR TABLECONTROL 'TAB1'
MODULE fetch_data.
MODULE tab1_change_tc_attr.
*&SPWIZARD: MODULE TAB1_CHANGE_COL_ATTR.
LOOP AT itab
INTO itab
WITH CONTROL tab1
CURSOR tab1-current_line.
*&SPWIZARD: MODULE TAB1_CHANGE_FIELD_ATTR
ENDLOOP.
MODULE status_1000.
PROCESS AFTER INPUT.
*&SPWIZARD: PAI FLOW LOGIC FOR TABLECONTROL 'TAB1'
LOOP AT itab.
CHAIN.
FIELD itab-xblnr.
FIELD itab-bldat.
FIELD itab-rmwwr.
ENDCHAIN.
FIELD itab-mark
MODULE tab1_mark ON REQUEST.
ENDLOOP.
*&SPWIZARD: MODULE TAB1_CHANGE_TC_ATTR.
*&SPWIZARD: MODULE TAB1_CHANGE_COL_ATTR.
MODULE user_command_1000.
u have to just made one MODULE as <b>FETCH_DATA</b>.
<b>module fetch_data output.</b>
SELECT SINGLE xblnr bldat rmwwr FROM rbkp INTO
corresponding fields of itab
WHERE xblnr = '5105600513'.
MODIFY itab FROM itab INDEX tab1-current_line.
APPEND itab.
<b>endmodule. " fetch_data OUTPUT</b>
here my internal table is <b>itab</b> and table control is <b>tab1</b>
hope it will b useful to u.
‎2007 Aug 27 2:39 PM
Hello,
Since you have internal table in your program with the data then you can bring it directly on the screen(table it_final)
Please do the following
double click on the screen containing the table control-> go to screen layout-> change mode ---> you will be able to view the table control in change mode ---> on the top of the screen...u can view three buttons (small,square,coloured) of which one stands for "Get from Program"....the one used for your program now will be "Get from Dictionary"
click on "Get from Program" --->
a list will be displayed showing all variables declared in the program ---> on the window you can view the internal table fields you have already declared in the program ---> click on it and select it(if it is already being used in the table control a lock will appear beside it) ---> field appears on the screen ---> bring it to the table control by dragging and dropping it into the table control...you can change the position and other actions by drag-drop
Do the needful coding to show data(PBO) and retrieve or actions (PAI)
For coding in PBO/PAI
in SAP ..go to se38 and view the following programs
1)DEMO_DYNPRO_TABCONT_LOOP_AT
2)demo_dynpro_tabcont_loop
the following exract code if from the above pgms
PROCESS BEFORE OUTPUT.
MODULE STATUS_0100.
LOOP WITH CONTROL it_final.
MODULE FILL_TABLE_CONTROL.
"in this module write code to display the data
ENDLOOP.
PROCESS AFTER INPUT.
MODULE CANCEL AT EXIT-COMMAND.
LOOP WITH CONTROL it_final.
module read_table_control.
"write code for validations in this module
"The user actions will be captured here
ENDLOOP.
Hope the above suggestions proved useful
You can only learn more through writing your own code for the table control after going through the standard demo examples
Reward if helpful
Regards
Byju
‎2007 Aug 29 7:24 AM
Hi Raja
You can do it easily.
First of all you design your screen which table control.and your internal table and columns of table control should match.
Then in the module pool program
1.internal table it_final.
2.declare of table control.
tcontrol type tableview using screen number '1111'.
3 . in module status input.
write user-command program to get data into the inernal table,
select........from .... into table it_table.
4.then in module status output
move-corresponding it_table into table.
5. write loop endloop on process-before-output.
loop at it_table with control tcontrol.
endloop.
This statement will copy row of data into table control row.
Reward if useful.
‎2007 Aug 29 7:32 AM
Hi
just fetch the data in ur pai
then go to the pbo event
write loop with control table control.
....
......
...
endloop.
inside this just move the field from your internal table to ur table cotrol.
u can use the move corresponding if u have same fileds in ur tab control and internal table.
reward if helpful
thanks
vivekanand
‎2007 Sep 09 8:17 AM
Hi,
It is very simple.
Fetch required records through select statements into internal table at PBO. Use,
DESCRIBE TABLE <INTERNAL TABLE> LINES <YOUR TABLE CONTROL>-LINES.
REFRESH CONTROL <NAME> FROM SCREEN <SCREEN NO.>.
It is very important that while adding fields to your table control assign your internal table column name as name of the table column.
If your table columns are editable, if you modify or add records to your table control, write appropriate code to modify or add records to your internal table independently and refresh the control using,
REFRESH CONTROL <NAME> FROM SCREEN <SCREEN NO.>.
Reward if answer is useful.
Regards,
Hema