‎2009 Jul 20 10:23 AM
Hi Experts,
I am useing VBKD-INCO1 - Incoterms (part 1)
VBKD-INCO2 - Incoterms (part 2)
VBKD-ZTERM - Terms of payment key
for some of my report.In VBAP there are suppose 4 line item but in VBKD there is only one entry with line item no 000000 .
so I am not able to utilize this above mentioned fields.
can anyone guid me why there is no entry in VBKD and is there any other table from where I can take this above metioned field?
Thanks in advance
Thanks
Sanujeet
‎2009 Jul 20 10:47 AM
Hi
The record with item 0 means header data:
The data stored in VBKD are valid for all items of sales document, so the system inserts one record only with the item equal to 0.
Only if the user changes some data of VBKD for a certain item, the system'll insert a new record for VBKD with item equal to the item where the modification was done.
So if you need to extract data from VBKD u should run the select twice:
DATA: POSNR TYPE VBAP-POSNR.
DATA: VBKD_H TYPE VBKD.
DATA: VBKD_P TYPE VBKD.
SELECT * FROM VBAP WHERE VBELN = .......
IF VBKD_H IS INITIAL.
SELECT SINGLE * FROM VBKD INTO VBKD_H
WHERE VBELN = VBAP-VBELN
AND POSNR = '000000'.
ENDIF.
SELECT SINGLE * FROM VBKD INTO VBKD_P
WHERE VBELN = VBAP-VBELN
AND POSNR = VBAP-POSNR.
IF SY-SUBRC <> 0.
VBKD_P = VBKD_H.
ENDIF.
ENDSELECT.Anyway just as I said, the Sales Document: Business Data are generally the same for all items, so I think it''s rare u can find another record there except the header one.
Max
‎2009 Jul 20 10:27 AM
Hi,
Try to table VBUP with VBKD.
VBUP is check table for posnr.
Regards,
Vijay
‎2009 Jul 20 10:39 AM
HI,
Can u explane more about it.How there is only one entry with item 000000 in VBKD when there is 4 line item in VBAP table
Thanks
Sanujeet
‎2009 Jul 20 10:54 AM
Hi Sanujeet again,
select records from vbap table with your selection condition and then user inner join for table vbkd and vbup and use for all entries for this inner join.
e.g.
select * from vbap into I_vbap where vbeln in s_vbeln.
if not i_vbap[] is initial.
select avbeln aposnr
into table itab
from vbkd as a inner join vbup as b
on avbeln = bvbeln and aposnr = bposnr
for all entries in i_vbap
where vbeln = i_vbap-vbeln.
endif.
Regards,
Vijay
‎2009 Jul 20 10:47 AM
Hi
The record with item 0 means header data:
The data stored in VBKD are valid for all items of sales document, so the system inserts one record only with the item equal to 0.
Only if the user changes some data of VBKD for a certain item, the system'll insert a new record for VBKD with item equal to the item where the modification was done.
So if you need to extract data from VBKD u should run the select twice:
DATA: POSNR TYPE VBAP-POSNR.
DATA: VBKD_H TYPE VBKD.
DATA: VBKD_P TYPE VBKD.
SELECT * FROM VBAP WHERE VBELN = .......
IF VBKD_H IS INITIAL.
SELECT SINGLE * FROM VBKD INTO VBKD_H
WHERE VBELN = VBAP-VBELN
AND POSNR = '000000'.
ENDIF.
SELECT SINGLE * FROM VBKD INTO VBKD_P
WHERE VBELN = VBAP-VBELN
AND POSNR = VBAP-POSNR.
IF SY-SUBRC <> 0.
VBKD_P = VBKD_H.
ENDIF.
ENDSELECT.Anyway just as I said, the Sales Document: Business Data are generally the same for all items, so I think it''s rare u can find another record there except the header one.
Max