Application Development 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: 

Sales Order Creating using Fucntion Module

Former Member
0 Kudos

HI,

I am working on RFC's. I need to create a sales order from one system to other.

I created a BDC using SHDB transaction and created a function module for it. i able to create a sales order but i should be able to retrieve the sales order number too so that i can make use of it in RFC Program.

Can anyone tell me how to find out the sales order number using a function module??

regards

Ramakanth

6 REPLIES 6

Former Member
0 Kudos

hi

In bdc you can get the messages from this

l_tab_messtab TYPE TABLE OF bdcmsgcoll,

PERFORM bdc_transaction TABLES lt_messtab USING 'VA01' g_ctu g_mode g_update

CALL FUNCTION 'CONVERT_BDCMSGCOLL_TO_BAPIRET2'

TABLES

imt_bdcmsgcoll = l_tab_messtab

ext_return = et_message_return.

BAPI_SALESORDER_GETLIST for get the SO based on the Customer

Former Member
0 Kudos

Hi,

You can populate your return messages from BDC using this FM 'MESSAGE_TEXT_BUILD'.

Here, the parameter MSGV2 will return the sales order number that is created

Former Member
0 Kudos

Hi ,

Use This BAPI To Create Sales Order.Goto se37 and enter this BAPI & check it will work.BAPI is RFC Enabled Function Module.

CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'

EXPORTING

  • SALESDOCUMENTIN =

ORDER_HEADER_IN = bapi_head

ORDER_HEADER_INX = bapi_headx

IMPORTING

SALESDOCUMENT = SALESDOCUMENT

TABLES

RETURN = it_ret1

ORDER_ITEMS_IN = it_item

ORDER_ITEMS_INX = it_itemx

ORDER_PARTNERS = it_parnr

ORDER_SCHEDULES_IN = it_sched

ORDER_SCHEDULES_INX = it_schedx

EXTENSIONIN = it_extensionin

.

Regards,

Manesh.R

former_member555112
Active Contributor
0 Kudos

Hi,

As suggested; do not use a BDC, use the BAPI instead.

Regards,

Ankur Parab

P561888
Active Contributor
0 Kudos

Hi ,

It is better to use th BAPI BAPI_SALESORDER_CREATEFROMDAT2 instead of going for FM.

Read the documentation before using this.

Regards,

Bharani

Former Member
0 Kudos

Hi,

You can use BAPI_SALESORDER_SIMULATE , BAPI_SALESORDER_CREATEFROMDAT1 or BAPI_SALESORDER_CREATEFROMDAT2.

It will work fine.

Regards