on 2015 Jun 08 3:54 PM
Hi,
I need to use a BAPI method for fetching the given PO number information in my VB program. I need following information regarding a PO.
a) PO Date
b) PO Release Status
c) Vendor
d) PO Type
e) PO organization
f) PO Item details (including site).
Any help is appreciated.
Regards,
Farrukh Shaheer
Request clarification before answering.
Hi Farrukh,
have you tried to search for similar Posts in SCN? For example in thread http://scn.sap.com/thread/3481472 the Problem seems to be solved ...
Regards
Oliver
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Try BAPI_PO_GETDETAIL.
Thanks,
Vikram.M
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Farrukh,
the BAPI to read PO Details is BAPI_PO_GETDETAIL1. You can find PO Date, Release Status, Vendor, PO Type and PO Organization on the returned PO Header and the complete item Details are returned as well. Please note that the indicators you can pass to the BAPI are influencing if the corresponding data is returned or not.
Regards
Oliver
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Oliver,
Thanks for the information, I need to understand if the following code i wrote is correct to fetch the PO details for a given PO number?
Dim BAPICTRL As Object
Dim BOORDER As Object
Dim OHEADER As Object
Dim ORETURN As Object
Dim OCONN As Object
Private Sub Form_Load()
Set BAPICTRL = CreateObject("SAP.BAPI.1")
Set OCONN = BAPICTRL.Connection
OCONN.LOGON
Set BOORDER = BAPICTRL.GetSAPObject("PurchaseOrder")
Set OHEADER = BAPICTRL.DimAs(BOORDER, "GetDetail1", "PoHeader")
Set ORETURN = BAPICTRL.DimAs(BOORDER, "GetDetail1", "RETURN")
End Sub
Private Sub Command1_Click()
Dim X As String
OHEADER.Value("PURCH_NO") = Text2 ' Text2=Find this PO Detail
BOORDER.GetDetail1 PoHeader:=OHEADER, Return:=ORETURN
X = ORETURN.Value("message")
If X = "" Then
TxtHdrs(0) = OHEADER.Value("DOC_TYPE")
TxtHdrs(1) = OHEADER.Value("PURCH_ORG")
TxtHdrs(2) = OHEADER.Value("PUR_GROUP")
TxtHdrs(3) = OHEADER.Value("VENDOR")
TxtHdrs(4) = OHEADER.Value("DOC_DATE")
TxtHdrs(5) = OHEADER.Value("CO_CODE")
Else
MsgBox (ORETURN.Columns("MESSAGE").Value(1))
End If
End Sub
No, it doesn't fill. gives error.
I need to know how to invoke GetDetail1 method for fetching a specified PO number details (in any language not just VB)
I used following method with just two parameters. Where the first parameter assuming to be both import/export type and containing the PO Number in its field for which details are requested.
BOORDER.GetDetail1 PoHeader:=OHEADER, Return:=ORETURN
Thanks
Hi Farrukh,
I am not an VB expert but I believe you are passing passing the PO number via this statement.
Set BOORDER = BAPICTRL.GetSAPObject("PurchaseOrder") and then
OHEADER.Value("PURCH_NO") = Text2 ' Text2=Find this PO Detail .
Text 2 is the PO number and is being used an input.
Right?
Please note all the field values are named in UPPERCASE send them in UPPERCASE.
Also OHEDER is referencing Structure "PoHeader". It is "POHEADER" again in upper case in and it is an exporting structure which you will get back after the call so you cannot use it to pass the PO number
Send the PO number in the Importing field "PURCHASEORDER". You get the Details back in structure POHEADER. If you need other info first check with somebody in SAP side via transaction SE37 for the correct field names
R
Hi,
Thanks everyone for your inputs.
I am using following statement to call the function,
The variable strFindPO contains the PO number whose details are requested
The statement BOORDER.GetDetail1 is used to invoke the function and the parameters are passed to it,
strFindPO = "5200000001"
BOORDER.GetDetail1 PURCHASEORDER:=strFindPO, POHEADER:=OHEADER, RETURN:=ORETURN
The system is returning the message that named argument not found. Please let me know if i am correctly invoking the function. Any example of this function in any programming language will be appreciated.
Thanks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.