Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Create Sales Order through VB

Former Member
0 Likes
2,099

Hi Experts

I am new to BAPI, my requirement is to create sales order in SAP through VB.

Please provide me the BAPI coding part which are needed and also suggest me the steps to be followed in SAP and VB.

Thanks in advance.

Regards

Rajaram

6 REPLIES 6
Read only

Former Member
0 Likes
1,250

Try using the IDoc Concept for creating the Sales Order through VB.

http://www.allsaplinks.com/idoc_sample.html

For creating sales documents (sales order) through IDOCS you will have to use the T code WE19. In that click basic type and enter order05(IDOC type) and select via message type then enter ORDERS(message type), click execute.

You will get to see many fields.here you have to enter the datas that you enter in the VA01 screen in order to create sales order. The datas such as material name, date, qty, P.O no etc. After entering all the datas, you click standard inbound the IDOC would be created by the system.You can see the created order by going in to VA03 screen.

Next time when you create the IDOC, in same tcode WE19 screen, click existing IDOC and enter the IDOC which you created in the above step and just change the P.O no.Sytem will create new sales order through new IDOC

Before doing all you need to maintain the partner profile in T code WE20. For this Discuss with EDI consultant.

Regards.

Read only

0 Likes
1,250

Hi Prakash

My requirement is to develope by BAPI only,

can you pls suggest me on this.

Regards

Rajaram

Read only

0 Likes
1,250

Hi Vinodh

thanks for your links, but still am not getting the exact coding part with clear guidelines.

Can you pls give me the coding part in VB and clear guidelines.

Regards

Rajaram

Read only

0 Likes
1,250

Hi Vinodh

I tried this coding as part of your link, but it contains Run-time error as Object Required.

Anything needs to be added in my VB Project, i have already added the BAPI ActiveX contol in my project.

Pls sugges me.

Dim boOrder As Object 'Business object SalesOrder

Dim oPartners As Object 'Parameter OrderPartners of BAPI method

Dim oHeader As Object 'Parameter OrderHeaderIn of BAPI method

Dim oItemsIn As Object 'Parameter OrderItemsIn of BAPI method

Dim oReturn As Object 'Parameter Return of BAPI method

Private Sub Form_Load()

'Connect to business object SalesOrder

'(this creates an anonymous object with an empty key field):

Set boOrder = oBAPICtrl.GetSAPObject("SalesOrder")

'Get structure/table objects:

Set oPartners = oBAPICtrl.DimAs(boOrder, "CreateFromData", "OrderPartners")

Set oHeader = oBAPICtrl.DimAs(boOrder, "CreateFromData", "OrderHeaderIn")

Set oItemsIn = oBAPICtrl.DimAs(boOrder, "CreateFromData", "OrderItemsIn")

'Fill header:

oHeader.Value("DOC_TYPE") = "TA" 'Standard order

oHeader.Value("SALES_ORG") = "0001" 'Sales organization

oHeader.Value("DISTR_CHAN") = "01" 'Sales channel

oHeader.Value("DIVISION") = "01" 'Division

oHeader.Value("PO_NUMBER") = "" 'Customer purchase orderNumber

oHeader.Value("PRICE_DATE") = Now 'Date

'Fill partners:

oPartners.Rows.Add

oPartners.Value(1, "PARTN_ROLE") = "AG" 'PartnerRoll: Person posting the order

oPartners.Value(1, "PARTN_NUMB") = "0000010096" 'Customer number

'Fill items:

oItemsIn.Rows.Add

oItemsIn.Value(1, "REQ_QTY") = "0000000010000" 'Quantity

oItemsIn.Value(1, "MATERIAL") = "BERLINER" 'Product ID

oItemsIn.Value(1, "COND_VALUE") = "1432" 'Rate

'Call the method:

boOrder.CreateFromData OrderHeaderIn:=oHeader, _

OrderPartners:=oPartners, _

OrderItemsIn:=oItemsIn, _

Return:=oReturn

'Free the business objects:

Set boOrder = Nothing

End Sub

Regards

Rajaram