Considering the performance, VBAK-BSTNK could be used only if the length never greater than 20.The correct field should be VBKD- BSTKD rather than VBAK-BSTNK for header data.WHERE vbeln IN AT itab ASSIGNING field-symbol() WHERE posnr NE '000000'. WHERE vbak~vbeln IN vbkd~posnr EQ '000000'. SELECT vbak~vbeln, vbkd~posnr, vbak~bstnk, vbkd~bstkd, vbkd~bstkd_e The conclusion is that the standard logic will get the incorrect result if we change the customer PO number on item data, so we change our report again, and finally all the result correct. SELECT vbak~vbeln, vbap~posnr, vbak~bstnk, vbkd~bstkd, vbkd~bstkd_eįrom the result we found that there still some problem, no header customer PO, and the item customer PO will be duplicated. Refer to standard function SD_VBKD_ARRAY_READ, we can change our report as below. VBKD-BSTKD_E is for ship-to party and VBKD-BSTKD is for sold-to party, there are different things, we should verify what they exactly are before we write the report. VBAK-BSTNK could use only for header, it could be used only for better performance and the length never greater than 20. Normally we should use VBKD-BSTKD and should consider POSNR as empty for item to get header data. SELECT * FROM VBKD INTO TABLE LB_VBKDVBįrom previous three scenarios, we should know that there are three fields related to customer PO number, VBAK-BSTNK, VBKD-BSTKD, VBKD-BSTKD_E, and the table VBKD not always store each item.
PO NUMBER HOW TO
5.3 Scenario Cįor Scenario C, we may find customer PO number within overview screen, and see to VBKD-BSTKD_E as PO Number, since VBKD-BSTKD shows as PO Details in this screen.īefore we figure out the solution, we could go to standard function to check the standard logic how to select table VBKD within SD_VBKD_ARRAY_READ. That is to say, we can read item customer PO first, if there is no corresponded one, read the header customer PO instead. In other words, customer PO from item data will be the same as header data as default, and not store separately into table VBKD, and will be duplicated only if we change it within item data. Try to change to customer PO number in “ Order Data” of the item data and then check the table VBAP and VBKD again, there are four items in VBAP, but only two entries on table VBKD. 5.2 Scenario Bįor scenario B, we would like to show customer PO number on item data, so we took VBKD-BSTKD to join table VBAP, although we could find the customer PO number in “ Order Data” of the item data, there is no corresponded data store in table VBKD-BSTKD with item 10. When the length of customer PO number greater than 20, it will be truncated. There are two field in this screen named customer PO number, VBAK-BSTNK with length 20 and VBKD-BSTKD with length 35.Ĭonsidering the performance, we should use as less table as we can, so we may choose VBAK-BSTNK if we forget to check the length of these two fields. Reason and Prerequisites 5.1 Scenario Aįor scenario A, we took VBAK-BSTNK as customer PO number, we can navigate to another screen when double click on the customer PO number field of sales order overview.
The customer PO number in item 10 of sales order 5085 is AIT-432990-TEST- TRUNCATED, but our report shows AIT-432990-TEST- INCORRECT.ĥ. SELECT vbak~vbeln, vbap~posnr, vbkd~bstkd_e
Here we write down a simply report which the customer PO will be incorrect. The customer PO number in item 10 of sales order 5008 is DG-27011997-4, but our report shows nothing. SELECT vbak~vbeln, vbap~posnr, vbak~bstnk, vbkd~bstkd Here we write down a simply report which the customer PO will missing. The customer PO Number in sales order 5085 is AIT-432990-TEST-TRUN CATED, but our report shows that AIT-432990-TEST-TRUN. Here we write down a simply report which the customer PO will be truncated. This document is under SAP ERP 6.0 EHP7 with IDES on NetWeaver 7.42, and also verified on SAP S4/HANA 1511(S4Core 100 SP03) on NetWeaver 7.49. If you don’t have problem, directly go to section 6 to check with the solution. It is a common requirement to develop a report to show the relationship between sales order and customer PO, but sometimes we will get incorrect result or inconsistent relationship, let’s figure out the root cause.