‎2006 Aug 28 4:12 PM
Hello Experts,
I want to display sales data using the tables vbak & vbap in a table control (dialog programming).
Can any one give me correct code for this.
Waiting for your reply...
Raj
‎2006 Aug 28 4:18 PM
Hi
Check with the following code.
PROGRAM ZHTABLE_CONTROL .
Tables VBAK.
Data Itab like VBAK occurs 0 with header line.
Controls tabctrl type tableview using screen 1000.
Data fill type i.
&----
*& Module Assign_data OUTPUT
&----
text
----
MODULE Assign_data OUTPUT.
move itab to vbak.
ENDMODULE. " Assign_data OUTPUT
&----
*& Module USER_COMMAND_1000 INPUT
&----
text
----
MODULE USER_COMMAND_1000 INPUT.
case sy-ucomm.
when 'EXIT'.
set screen 0.
endcase.
ENDMODULE. " USER_COMMAND_1000 INPUT
&----
*& Module STATUS_1000 OUTPUT
&----
text
----
MODULE STATUS_1000 OUTPUT.
SET PF-STATUS 'xxxxxxxx'.
SET TITLEBAR 'xxx'.
Select * from vbak into table itab.
describe table itab lines fill.
tabctrl-lines = fill.
ENDMODULE. " STATUS_1000 OUTPUT
______________________________________________________
cODE IN PROCESS BEFORE OUTPUT AND PROCESS AFTER INPUT.
______________________________________________________
PROCESS BEFORE OUTPUT.
MODULE STATUS_1000.
loop at itab with control tabctrl cursor tabctrl-top_line.
Module Assign_data.
endloop.
PROCESS AFTER INPUT.
MODULE USER_COMMAND_1000.
loop at itab.
endloop.
‎2006 Aug 28 4:20 PM
Hi,
Create the Table Control with all the Fields required.
in Flow Logic,
Loop at itab into wa_itab conmtrols tabc.
endloop.
in your main code,
Select <Req Fields> from VBAK into table itab where any cond.
Do similar for VBAP.
hope this might help you.
Cheers,
Prashanth
‎2006 Aug 28 4:20 PM
Hi,
Follow this steps
1 Define table control tc
2 In table control define fields to be populated
3 select * from vbak into table it_vbak
if not it_vbak[] is initial.
select * from vbap for all entries in it_vbak
where vbeln = it_vbak-vbeln.
loop at it_vbak.
loop at it_vbap.
endloop.
<b> populate required fields into target table itab</b>
endloop.
endif.
now itab will used to display data in table control.
Regards
Amole