‎2008 Aug 13 5:32 AM
Hi Gurus,
I have 4 tables VBRK,VBAK,VBRP & KNA1 and i need to display out put from them when i am taking the internal tables , with which one i need to loop the internal tables and read the data. i.e which is the main internal table & hw can i select that ?
waiting for ur reply
Regards
Srinath
‎2008 Aug 13 5:33 AM
HI ,
Loop on the internal table with VBAK
Edited by: A kumar on Aug 13, 2008 6:40 AM
‎2008 Aug 13 5:37 AM
hi,
VBAK contains Sales Order Header Data.
Loop that Table.
VBRK and VBRP provides Billing Header and Item Data which is based on SAles Document No.
KNA1 have Customer Information.
Regadrs
Sumit Agarwal
‎2008 Aug 13 5:37 AM
Hi,
Always loop on item table.
Here u have to loop on Billing Document: Item Data VBRP.
‎2008 Aug 13 5:39 AM
LOOP the table VBAK.
LOOP VBRP WHERE VGBEL = VBAK-VBELN.
READ TABLE VBRK with key VBELN.
READ KNA1.
append final table.
ENDLOOP.
ENDLOOP.
‎2008 Aug 13 5:45 AM
Hi ...
Some are saying one table & others saying other tables . How exactly i will come to know which is the main table and hw to select and loop on that table?
Regards
Srinath
‎2008 Aug 13 5:46 AM
hi,
wt ever our friends said is correct if u want only header data ...
& corresponding item data , partner data and customet info...
it will give u only one record...
it multiple line items contains per single sales order it wont give correct anss..
u may miss some records..
if u sales order have more than one line items & u want to display all items..
loop the VBRK internal table pass the rest info....
Regards..
Raju Mummidi.
‎2008 Aug 13 5:50 AM
Do like below code.
Loop at it_vbrk.
Loop at it_vbrp where vbeln eq it_vbrk-vbeln.
Read table it_kna1.
Read table it_vbak.
Endloop.
Endloop.
rgds
rajesh
‎2008 Aug 13 6:14 AM
Hi you can do like this :
There are two ways like if the billing data mandatory then do like this :
1.
Loop at vbrk. " because for vbrk you need item details
Loop at vbrp where vbeln equals vbrk-vbeln. item details
Read table vbak.
if sy-subrc eq 0
Read table kna1 for kunnr .
endif.
Endloop.
Endloop.
2.
Loop at vbak.
Read table kna1 for kunnr .
read table vbrk for vbeln
if sy-subrc = 0
Loop at vbrp where vbeln equals vbrk-vbeln. item details
Endloop.
endif.
Endloop.
‎2008 Aug 13 6:23 AM
Hi,
VBAK(Sales Document: Header Data) is the Main table.
LOOP the table VBAK.
LOOP The table VBRK .
Read the table VBRP.
Read the Table KNA!.
append final internal table.
ENDLOOP.
Regards,
Srinivasa Janardhan.