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

information about BAPI_SALESORDER_CREATEFROMDAT2

Former Member
0 Likes
3,270

hi everybody,

we are creating sales order through the bapi BAPI_SALESORDER_CREATEFROMDAT2. we are also passing variant configuration data to the material through this bapi. we are able to create sale order, but the variant configuration data is not getting updated in the transaction.

i am passing the following tables and fileds to the bapi.

ORDER_HEADER_IN

ORDER_HEADER_INX

ORDER_ITEMS_IN

ORDER_ITEMS_INX

ORDER_PARTNERS

ORDER_CFGS_REFINST

POSEX

CONFIG_ID

INST_ID

ORDER_CFGS_REF

POSEX

CONFIG_ID

INST_ID

ORDER_CFGS_INST

CONFIG_ID

INST_ID

OBJ_TYPE

CLASS_TYPE

OBJ_KEY

ORDER_CFGS_VALUE

CONFIG_ID

CHARC

VALUE

do i need to pass some other mandatory tables or fileds. or if this data enough, where could i go wrong. pls help regarding this. pls tell me what are the mandatory filds and tables we need to pss thru this bapi for sales order creation with variant configuration.

thanks,

santosh.

7 REPLIES 7
Read only

Former Member
0 Likes
1,239

after calling BAPI for sales order write the following code :

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

then it will update the data in transaction.

<b><REMOVED BY MODERATOR></b>

Message was edited by:

Alvaro Tejada Galindo

Read only

Former Member
0 Likes
1,239

hi,

You can use the same bapi BAPI_SALESORDER_CREATEFROMDAT2, check the following like for your further understanding on how to pass quotation data.

Create Sales Order WR to Quotation

or use as follows &----


*& Report ZSAN_BAPI_TEST2 *

*& *

&----


*& *

*& *

&----


REPORT ZSAN_BAPI_TEST2 .

PARAMETERS: C_NUMBER LIKE BAPI1007-CUSTOMER ,

" Customer Number

S_ORG LIKE BAPIORDERS-SALES_ORG.

" Sales Organization

DATA: SALES_ORDERS LIKE BAPIORDERS OCCURS 0 WITH HEADER LINE,

" Order Items for Material

RETURN LIKE BAPIRETURN OCCURS 0 WITH HEADER LINE.

" Return Parameter

*Get Sales order numbers

CALL FUNCTION 'BAPI_SALESORDER_GETLIST'

EXPORTING

CUSTOMER_NUMBER = C_NUMBER

SALES_ORGANIZATION = S_ORG

IMPORTING

RETURN = RETURN

TABLES

SALES_ORDERS = SALES_ORDERS.

*Get Title

FORMAT COLOR 6 INVERSE ON.

WRITE: /,1(13)'Sales order',

15(25)'Item number',

28(36)'Material',

38 'Short text'.

FORMAT COLOR OFF INVERSE OFF.

*Display Sales orders

LOOP AT SALES_ORDERS.

WRITE: /,4(13) SALES_ORDERS-SD_DOC,

17(25) SALES_ORDERS-ITM_NUMBER,

29(36) SALES_ORDERS-MATERIAL,

40 SALES_ORDERS-SHORT_TEXT.

ENDLOOP.

thanks,

<b><REMOVED BY MODERATOR></b>

Message was edited by:

Alvaro Tejada Galindo

Read only

Former Member
0 Likes
1,239

Hi Santosh,

I had the same problem.. however, I found that I forgot to fill a certain field in the ORDER_ITEMS_IN - Table.

You have to fill the

ORDER_ITEMS_IN-PO_ITM_NO = ORDER_CFGS_REF-POSEX.

ORDER_ITEMS_INX-PO_ITM_NO = 'X'.

(otherwise the bapi doesn't start the process of adding the variants to the item)

hope I was able to help..

Read only

0 Likes
1,239

Hi, I also found that I needed to fill in QUOTATION_ITEMS_IN-PO_ITM_NO for BAPI_QUOTATION_CREATEFROMDATA2 to add the configuration. Do you know the reason why this is?

We are creating a Quotation with reference to another Quotation and I found that if the source Quotation does not have a PO_ITM_NO and I leave the field empty the configuration is not added. If the source Quotation does have a PO_ITM_NO, which can be anything e.g. 'ABCDEF', the configuration is added. If the source Quotation does not have a PO_ITM_NO and I fill the field with the POSEX it works ok.

When using VA21 to create a Quotation with reference the PO_ITM_NO does not have to be filled in and the configuration is fine.

In short...is there anyway to use BAPI_QUOTATION_CREATEFROMDATA2 with configuration without filling the PO_ITM_NO field?

Read only

0 Likes
1,239

Has anyone found a solution to this query?

I have a related question around ITM_NUMBER

I am currently able to get the BAPI to work for multiple line items only if I populate ITM_NUMBER,

which is not required when creating quotations manually via VA21.

My issue is that some of my products have Sales BOMs which explode on creation so I cannot predict the

next available ITM_NUMBER in advance when saving a quotation.

I would prefer to leave it blank & let SAP determing the item number on creation.is this possible?

PS: I also cannot get the configuration to update do I need to populate ITM_NUMBER as well as PO_ITM_NO

I was using ITM_NUMBER = POSEX

Thanks for any advice,

Robert

Read only

Former Member
0 Likes
1,239

Hello All,

Actually it depends on your system setting.

However you can create a sales order with variant configuration if you fill the value by following the below step.

1. ORDER_HEADER_IN

ORDER_HEADER_INX

2. INT_NUMBER_ASSIGNMENT = 'X' <-- depends on your setting

CONVERT = 'X' <-- depends on your setting

3. ORDER_ITEMS_IN

ORDER_ITEMS_INX

you have to make sure the below

ORDER_ITEMS_IN-ITEM_CATEG = 'your_value'

ORDER_ITEMS_INX-ITEM_CATEG = 'X'

ORDER_ITEMS_IN-CONFIG_ID = 'your value(i.e. 000001)'

ORDER_ITEMS_INX-CONFIG_ID = 'X'

ORDER_ITEMS_IN-INST_ID = 'your value(i.e. 00000001)'

ORDER_ITEMS_INX-INST_ID = 'X'

4. ORDER_PARTNERS

5. ORDER_CFGS_REF

ORDER_CFGS_REF-POSEX = '000020' <-- Item no. for first variant

ORDER_CFGS_REF-CONFIG_ID = '000001'

ORDER_CFGS_REF-ROOT_ID = '00000001'

ORDER_CFGS_REF-POSEX = '000030' <-- Item no. for second variant

ORDER_CFGS_REF-CONFIG_ID = '000001'

ORDER_CFGS_REF-ROOT_ID = '00000001'

6. ORDER_CFGS_INST

ORDER_CFGS_INST-CONFIG_ID = '000001'

ORDER_CFGS_INST-INST_ID = '00000001' <-- instance id for first variant

ORDER_CFGS_INST-OBJ_TYPE = 'Mat'

ORDER_CFGS_INST-CLASS_TYPE = 'your class type'

ORDER_CFGS_INST-OBJ_KEY = 'you can find this value on field 'KSSK-OBJEK'

ORDER_CFGS_INST-CONFIG_ID = '000001'

ORDER_CFGS_INST-INST_ID = '00000002' <-- instance id for second variant

ORDER_CFGS_INST-OBJ_TYPE = 'Mat' <-- same with first instance

ORDER_CFGS_INST-CLASS_TYPE = 'your class type' <-- same with first instance

ORDER_CFGS_INST-OBJ_KEY = 'you can find this value on field 'KSSK-OBJEK' <-- same with first instance

7. ORDER_CFGS_VALUE

ORDER_CFGS_VALUE-CONFIG_ID = '000001'

ORDER_CFGS_VALUE-INST_ID = '00000001' <-- instance id for first variant

ORDER_CFGS_VALUE-CHARC = 'your characteristic, you can find this value on field 'CAWN-ATINN'

ORDER_CFGS_VALUE-VALUE = 'your value, you can find this value on field 'CAWN-ATWRT'

ORDER_CFGS_VALUE-CONFIG_ID = '000001'

ORDER_CFGS_VALUE-INST_ID = '00000002' <-- instance id for second variant

ORDER_CFGS_VALUE-CHARC = 'your characteristic, you can find this value on field 'CAWN-ATINN'

ORDER_CFGS_VALUE-VALUE = 'your value, you can find this value on field 'CAWN-ATWRT'

8. ORDER_CFGS_REFINST

ORDER_CFGS_REFINST-POSEX = '000020'

ORDER_CFGS_REFINST-CONFIG_ID = '000001'

ORDER_CFGS_REFINST-NST_ID = '00000001' <-- instance id for first variant

ORDER_CFGS_REFINST-POSEX = '000030'

ORDER_CFGS_REFINST-CONFIG_ID = '000001'

ORDER_CFGS_REFINST-NST_ID = '00000002' <-- instance id for second variant

Don't forget to use 'BAPI_TRANSACTION_COMMIT' at the end of your source.

Good luck!

Read only

Former Member
0 Likes
1,239

As a follow up - to the solution I have used.

Item Number Asssignment - By setting INT_NUMBER_ASSIGNMENT = X then SAP takes care of the

number assignemtn which is what I wanted so an easy for that one.

For Configuration - in our scenarion we populated the following for our simplified scenario.

Note:

you must populate PO_ITM_NO in the items section to refer to POSEX or else it does not work,

in our case although we do not have a PO_ITEM_NO we simply made it = ITM_NUMBER

QUANTITY_UNIT must also be populated, these are the 2 items that caught us out.

QUOTATION_CFGS_REF

POSEX - same as item no

CONFIG_ID - same as item no

ROOT_ID - same as item no

QUOTATION_CFGS_INST

CONFIG_ID - same as item no

INST_ID - same as item no

OBJ_TYPE - MARA

CLASS_TYPE - 300

OBJ_KEY Material Number

QUANTITY xx

QUANTITY_UNIT EA

QUOTATION_CFGS_VALUE

CONFIG_ID - same as item no

INST_ID - same as item no

CHARC xxxxxx

VALUE xxxxxx

Cheers,

Robert