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: 

Insert a condition type in sales order

Former Member
0 Kudos

Dear Gurus,

My requirement is very silly.I have created a sales order via 'BAPI_SALESORDER_CREATEFROMDAT2', now i have to insert some condition type into it. With respect to some validations in it,after commit work of BAPI_SALESORDER_CREATEFROMDAT2 i have called BAPI_SALESORDER_CHANGE and passed ITM_NUMBER, COND_TYPE, COND_VALUE,CURRENCY,CONDORIGIN, UPDATEFLAG in it.But still no condition types are getting inserted into the sales order.

Have searched extensively SCN and used all the given solutions, but could not get desired output.

Can anyone let me know what all i should pass other that this in CONDITIONS_IN and IT_CONDITIONS_INX in BAPI_SALESORDER_CHANGE for condition type insertion.

Should i have to use some other BAPI for this?

Waiting for your replies.

With Regards,

Jagan

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Are you sure that there is no other change BAPI to use?  That one doesn't even return success or failure.

Neal

6 REPLIES 6

Former Member
0 Kudos

Are you sure that there is no other change BAPI to use?  That one doesn't even return success or failure.

Neal

0 Kudos
Hi Neal, Thanks for your response...this change bapi do captures all standard errors...but the thing is.... After creating a sales order via bapi...i want to insert some condition type in it...is there any bapi or way to do it....  Can u just guide me with this regards...  Thanks Jagan

0 Kudos

Hi,

Read the function documentation carefully and see if you are not missing the necessary details, such as:

  • Select the fields entering an 'X' in the respective check fields  (in IT_CONDITIONS_INX, type BAPISDITMX)
  • Specify the appropriate update type in field UPDATEFLAG (in this case, it should be 'I', i suppose)
  • Specify the key fields, also in the check fields (the order number and the item i think, that would be in ORDER_ITEM and ORDER_ITEM_INX)
  • Always specify the update flag in ORDER_HEADER_INX

Regards,

Bruno

0 Kudos

Dear Bruno,

I have tried all the possible things what you have said.But data is not getting inserted into the sales order.Am i missing some thing??

ie,

header: COND_HANDL flag = 'X' and UPDATEFLAG = 'U'.

       WA_COND-ITM_NUMBER = KPOSN.

       WA_COND-COND_ST_NO = WA_KONV-STUNR.

       WA_COND-COND_COUNT = ZAEHK.

       WA_COND-COND_TYPE = 'ZMRE'.

       WA_COND-COND_VALUE = AMOUNT.

       WA_COND-CURRENCY = 'INR'.

       WA_COND_INX-ITM_NUMBER = KPOSN.

       WA_COND_INX-COND_ST_NO = '160'.

       WA_COND_INX-COND_COUNT = ZAEHK.

       WA_COND_INX-COND_TYPE = 'ZMRE'.

       WA_COND_INX-UPDATEFLAG = 'I'.

       WA_COND_INX-COND_VALUE = 'X'.

       WA_COND_INX-CURRENCY = 'X'.

With Regards,

Jagan

0 Kudos

Jagannathan,

I think you also have to fill ORDER_ITEM_IN and ORDER_ITEM_INX in order to give the item key and check it . Try doing that. And of course the SALESDOCUMENT field.

Also make sure you do the commit, using BAPI_TRANSACTION_COMMIT.

And try to give the value R in field BEHAVE_WHEN_ERROR.

Bruno

0 Kudos

Hello Dear

I have completed  creation on Sales order using BAPI now I need  to pass its condition type (item level ) so kindly guide me what are the key field for condition fields  type.

________________________

I wrote following code

________________________

data : order_condition_type_item like BAPICONDX  occurs 0 with

header line.

order_condition_type_item-ITM_NUMBER = order_items_in-itm_number.

       order_condition_type_item-COND_ST_NO = '130'.

       order_condition_type_item-COND_type = 'ZDI0'."tab-COND_type'.

        order_condition_type_item-UPDATEFLAG 'I'.

       order_condition_type_item-COND_VALUE tab-COND_VALUE.

       append order_condition_type_item.

_________________________________________________

what else I need to pass in Internal table