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: 

Add a header condition with BAPI_CUSTOMERCONTRACT_CHANGE

Former Member
0 Kudos
545

Hi,

I've been trying to use BAPI_CUSTOMERCONTRACT_CHANGE to update an existing contract and the update is to add a new pricing condition - the condition type does not exist already in the header conditions of the contract.

I've seen alot of posts in SCN about BAPI_CUSTOMERCONTRACT_CHANGE and conditions but these all seem to be about updating existing conditions. My BAPI is populated as follows:

Importing parameters:

  • Sales Document = contract number
  • Contract_header_in - this is not populated
  • Contract_Header_Inx
    • UPDATEFLAG = U


Tables parameters:

  • Conditions_In
    • ITM_NUMBER                     = 000000   (left blank as this is the header)
    • COND_TYPE                      = ZNEW
    • COND_VALUE                    = 77-
  • Conditions_Inx
    • ITM_NUMBER                     000000   (left blank as this is the header)

    • COND_TYPE                      ZNEW

    • UPDATEFLAG                     I

    • COND_VALUE                     X

    • CURRENCY                         X

      When run and a commit is made at the end I get success return messages but the new condition is never added? Can anyone shed some light on this?

      I have also tried using the LOGIC_SWITCH parameter COND_HANDL but this seems to be - from what I've read - more for handling updates to conditions.

      Thanks in advance!

1 ACCEPTED SOLUTION

Former Member
0 Kudos
234

Looks like I solved my issue.

It was a case of BAPI_TRANSACTION_COMMIT or a COMMIT WORK not being used.

Actually I testing this via SE37 (Fucntion Builder) and was triggering the commits via the debugger at the end of the BAPI call but it seems they weren't having an effect.

Place the code into a program or add a next function module call to BAPI_TRANSACTION_COMMIT and all works.

3 REPLIES 3

Former Member
0 Kudos
234

Hi Peter, make sure you have followed the BAPI documentation for the structure CONDITIONS_IN. Have you filled CURRENCY or CURRENCY_ISO ?


  • The condition calculation type is not expressed in percentage
    In this case the COND_VALUE field is a currency quantity field. You must enter the CURRENCY or CURRENCY_ISO field so that the correct conversion takes place. Again, you must enter the amount kommagerecht.

If neither the CURRENCY or the CURRENCY_ISO fields are completed, the entry is issued as a percentage value. This could lead to an incomplete entry if the condition type is not in percentages.

0 Kudos
234

Sorry , my typo. I forgot to add that CURRENCY was filled in my Conditions_In table.

So:

  • Conditions_In
    • ITM_NUMBER                     = 000000   (left blank as this is the header)
    • COND_TYPE                      = ZNEW
    • COND_VALUE                    = 77-
    • CURRENCY                        = GBP

Thanks for spotting that.

Former Member
0 Kudos
235

Looks like I solved my issue.

It was a case of BAPI_TRANSACTION_COMMIT or a COMMIT WORK not being used.

Actually I testing this via SE37 (Fucntion Builder) and was triggering the commits via the debugger at the end of the BAPI call but it seems they weren't having an effect.

Place the code into a program or add a next function module call to BAPI_TRANSACTION_COMMIT and all works.