Skip to Content
Author's profile photo Sameer Ahmed

Creating sales orders with variant configured items using ‘BAPI_SALESORDER_CREATEFROMDAT2 ‘

Creating sales orders via ‘BAPI_SALESORDER_CREATEFROMDAT2’ using variant configured materials

SAP Product Id: LO-VC

SAP Provides a BAPI viz ‘BAPI_SALESORDER_CREATEFROMDAT2’ in order to create Sales Orders.

The usage of this BAPI is quite simple when used to create sales orders that do not used configured materials. But when it comes to creating sales orders that use variant material configurations, the logic of filling the pre-requisite structures of this BAPI is a little complicated and therefore this blog.

First things first, there is an SAP note which explains how the prerequisite structures should be filled. That note is 0000549563.

The four mandatory structures to be filled are;





The first & the second are pretty much self explanatory; it’s the third and the fourth that require some explanation.


Note 549563 says;

PART_OF_NO is the item number from the BOM

But please keep in mind that you will get the right PART_OF_NO if you use the sales BOM & not the production BOM

000001 00000001 00000002 0010 PROD112
000002 00000003 00000004 0010 PROD122

Here is how you find the item number for a material from a Bill of Material (BOM) ;



This is the tricky part since there are a lot of dynamics involved here, for instance,

    a)  There could be default characteristics for a particular class, and that might or might not appear in your order

    b)  The value range supplied could be over and above than that maintained in characteristics maintenance (Maintained by transaction CT04)

So how do you take care of that? We will get to those questions in a moment but first, here is the logic for populating this parameter.

The tables to be used are INOB, KSSK, KSML and CAWN

     a)  First pass your material in the table INOB ( Link between Internal Number and Object ) where INOB-OBJEK = your material number and fetch the           object number CUOBJ (Also enter your class type, KLART & name of the database table for object OBTAB, for variants this class will be 300)

     b)  Then pass the object number ( CUOBJ ) in the KSSK table where KSSK-OBJEK = INOB-CUOBJ to fetch the Internal class number ( CLINT )

     c)  Pass the Internal class number (CLINT) into the KSML table such that KSSK-CLINT = KSML-CLINT to finally fetch the Internal characteristic                     (IMERK). Put the results of the steps a), b), & c) in an internal table, say table A.

          Now since a picture speaks a thousand words for those who can see, here is what we have done so far in a nutshell


     d)  Now select the characteristics & its values from the master table CAWN by passing the material numbers that you are using to create the order.                     Put the results of step d) in another internal table B.

          The idea here is that since we have arrived at table A by querying with the material & class, and the result of the material B by passing just the                           materials, the results of table B should be in table A. so we loop at table B and read table A. Here is the code below;


          After this you need to separate the characteristics from the quantity, and you do that like the way shown below (of course you can code in                     whatever way you want to)







  Now back to the questions that we asked at the beginning

     a) There could be default characteristics for a particular class, and that might or might not appear in your order

         This could be checked by inquiring the value ATSTD of the table CAWN

         Here is a screenshot below;

         ss1.JPG    b) The value range supplied could be over and above than that maintained in characteristics maintenance (Maintained by transaction CT04)


     Use the code n box3, reproduced below


Finally call your BAPI


Don’t worry about the object dependencies; the BAPI takes care of it.

That’s all folks !


Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Akash Patel
      Akash Patel

      Thanks Sameer.. Very helpful document.. šŸ™‚

      Author's profile photo Arun Chembra
      Arun Chembra

      Hi All,

      I am usingĀ BAPISDORDER_GETDETAILEDLIST and passing the values to theĀ BAPI_SALESORDER_CREATEFROMDAT2. However the sales order is getting created but VC characteristics are not updating.

      Checked all the possible ways includingĀ Ā Ā Ā  LS_ORDER_ITEM_IN_PO_ITM_NO = LS_ORDER_CFS_REF-POSEX. but still facing the same.

      Any help pleaseā€¦. Checked almost all the posts but still no luck.

      Thanks & Regards,


      Author's profile photo BASIS CASTGROUP

      Hello Arun Chembra
      Did you manage to solve this problem?
      I'm having the same difficulty using BAPISDORDER_GETDETAILEDLIST and passing the values to BAPI_SALESORDER_CREATEFROMDAT2.

      I would appreciate it if you can help me.