08-17-2009 6:37 AM
experts, help needed
itab has following fields,
vbeln erdat erzet vkorg vtweg
kunnr posnr matnr bmeng.
i have written like this
if itab is not initial.
SELECT avbeln aerdat aerzet avkorg a~vtweg
akunnr bposnr b~matnr
FROM vbak AS a INNER JOIN vbap AS b
ON avbeln = bvbeln
INTO TABLE itab1
FOR ALL ENTRIES IN itab
WHERE a~vbeln = itab-vbeln.
endif.
i need to fetch confirm quantity from vbep ie bmeng filed for the items in vbap into table itab1.
so do i need to add this as well in the above join or seperately i need to select it after the above select query.
pls suggest the modifications in the above select query accordingly.
08-17-2009 6:48 AM
Hi,
You can include it within the same join statement itself like
if itab is not initial.
SELECT a~vbeln a~erdat a~erzet a~vkorg a~vtweg
a~kunnr b~posnr b~matnr c~bmeng
FROM vbak AS a INNER JOIN vbap AS b
ON a~vbeln = b~vbeln
INNER JOIN vbep as c
ON a~vbeln = c~vbeln
INTO CORRESPONDING FIELDS OF TABLE itab1
FOR ALL ENTRIES IN itab
WHERE a~vbeln = itab-vbeln.
endif.
Regards,
Vik
08-17-2009 6:53 AM
Hi,
By keeping the below statement as it is, and would like to add sepately for VBEP, then again after fetching the data from VBEP, again looping on ITAB1, you need to modify the Quantity field. It becomes poor in performance.
So you can do as below.
1. Either add even the field in the below SELECT statement only for VBEP too.
2. If the number of entries are more in VBEP, then it is suggested to select only from VBAK into table ITAB, then using for all entries go for VBAP and then VBEP and looping on ITAB again, on the internal table using the READ commands, build the final internal table.
Regards,
Santhosh.
08-17-2009 7:20 AM
if itab is not initial.
SELECT avbeln aerdat aerzet avkorg a~vtweg
akunnr bposnr bmatnr cbmeng
FROM ( ( vbak AS a INNER JOIN vbap AS b ON avbeln = bvbeln )
INNER JOIN vbep AS c ON bvbeln = cvbeln )
INTO CORRESPONDING FIELDS OF TABLE itab1
for all entries in itab
WHERE a~vbeln = itab-vbeln.
endif.
Thanks,
Gaurav