Skip to Content
author's profile photo Former Member
Former Member

SD_SALESDOCUMENT_CREATE:WBS element not populating at item level

Hi Gurus,

<br>I am trying to create a new sales order using the function module SD_SALESDOCUMENT_CREATE but when i pass a <br>value for the WBS element at item level it is not getting populated in the back end system.

<br>

<br>  data :LT_RETURN                     TYPE TABLE OF  BAPIRET2,
 <br>         LT_SALES_ITEMS_IN             TYPE STANDARD TABLE OF  BAPISDITM,
 <br>         LT_SALES_ITEMS_INX            TYPE TABLE OF  BAPISDITMX ,
 <br>        LT_SALES_PARTNERS             TYPE TABLE OF  BAPIPARNR ,
 <br>        LT_SALES_SCHEDULES_IN         TYPE TABLE OF  BAPISCHDL ,
 <br>        LT_SALES_SCHEDULES_INX        TYPE TABLE OF  BAPISCHDLX ,
 <br>        LT_SALES_CONDITIONS_IN        TYPE TABLE OF  BAPICOND ,
 <br>        LT_SALES_CONDITIONS_INX       TYPE TABLE OF  BAPICONDX,
 <br>        LT_SALES_CFGS_REF             TYPE TABLE OF  BAPICUCFG ,
 <br>        LT_SALES_CFGS_INST            TYPE TABLE OF  BAPICUINS ,
 <br>        LT_SALES_CFGS_PART_OF         TYPE TABLE OF  BAPICUPRT,
 <br>        LT_SALES_CFGS_VALUE           TYPE TABLE OF  BAPICUVAL ,
 <br>        LT_SALES_CFGS_BLOB            TYPE TABLE OF  BAPICUBLB ,
 <br>        LT_SALES_CFGS_VK              TYPE TABLE OF  BAPICUVK ,
 <br>        LT_SALES_CFGS_REFINST         TYPE TABLE OF  BAPICUREF ,
 <br>        LT_SALES_CCARD                TYPE TABLE OF  BAPICCARD ,
 <br>        LT_SALES_TEXT                 TYPE TABLE OF  BAPISDTEXT ,
 <br>        LT_SALES_KEYS                 TYPE TABLE OF  BAPISDKEY ,
 <br>        LT_SALES_CONTRACT_IN          TYPE TABLE OF  BAPICTR ,
 <br>        LT_SALES_CONTRACT_INX         TYPE TABLE OF  BAPICTRX,
 <br>        LT_EXTENSIONIN                TYPE TABLE OF  BAPIPAREX ,
 <br>        LT_PARTNERADDRESSES           TYPE TABLE OF  BAPIADDR1 ,
 <br>        LT_SALES_SCHED_CONF_IN        TYPE TABLE OF  BAPISCHDL2 ,
 <br>        LT_ITEMS_EX                   TYPE TABLE OF  BAPISDIT ,
 <br>        LT_SCHEDULE_EX                TYPE TABLE OF  BAPISDHEDU ,
 <br>        LT_BUSINESS_EX                TYPE TABLE OF  BAPISDBUSI ,
 <br>        LT_INCOMPLETE_LOG             TYPE TABLE OF  BAPIINCOMP ,
 <br>        LT_EXTENSIONEX                TYPE TABLE OF  BAPIPAREX ,
 <br>        LT_CONDITIONS_EX              TYPE TABLE OF  BAPICOND ,
 <br>        LT_PARTNERS_EX                TYPE TABLE OF  BAPISDPART ,
 <br>        LT_TEXTHEADERS_EX             TYPE TABLE OF  BAPISDTEHD ,
 <br>       LT_TEXTLINES_EX               TYPE TABLE OF  BAPITEXTLI ,
 <br>       LT_BATCH_CHARC                TYPE TABLE OF  BAPIBTSEL ,
 <br>        LT_CAMPAIGN_ASGN              TYPE TABLE OF  BAPISDCA ,
 <br>        LT_CONDITIONS_KONV_EX         TYPE TABLE OF  KONV .
 <br>
 <br>  DATA: LV_SALESDOCUMENT_EX           TYPE           BAPIVBELN-VBELN,
 <br>        LT_SALES_HEADER_OUT           TYPE           BAPISDHD,
 <br>        LT_SALES_HEADER_STATUS        TYPE           BAPISDHDST.
 <br>
 <br>  DATA: LV_VALUE_SALESDOCUMENT        TYPE           BAPIVBELN-VBELN,
 <br>        LT_SALES_HEADER_IN            TYPE           BAPISDHD1,
 <br>        LT_SALES_HEADER_INX           TYPE TABLE OF  BAPISDHD1X,
 <br>        LT_SENDER                     TYPE TABLE OF  BDI_LOGSYS,
 <br>        LV_BINARY_RELATIONSHIPTYPE    TYPE           BRELTYP-RELTYPE,
 <br>        LV_INT_NUMBER_ASSIGNMENT      TYPE           BAPIFLAG-BAPIFLAG VALUE 'R',
 <br>        LV_BEHAVE_WHEN_ERROR          TYPE           BAPIFLAG-BAPIFLAG VALUE ' ',
 <br>        LT_LOGIC_SWITCH               TYPE TABLE OF  BAPISDLS,
 <br>        LV_BUSINESS_OBJECT            TYPE           BAPIUSW01-OBJTYPE VALUE ' ',
 <br>        LT_TESTRUN                    TYPE TABLE OF  BAPIFLAG-BAPIFLAG ,
 <br>        LV_CONVERT_PARVW_AUART        TYPE           BAPIFLAG-BAPIFLAG VALUE ' ',
 <br>        LV_STATUS_BUFFER_REFRESH      TYPE           BAPIFLAG-BAPIFLAG VALUE 'X',
 <br>        LV_CALL_ACTIVE                TYPE           CHAR4.
 <br>
 <br>  DATA: WA_SALES_PARTNERS             LIKE LINE OF   LT_SALES_PARTNERS,
 <br>        WA_SALES_SCHEDULES_IN         LIKE LINE OF   LT_SALES_SCHEDULES_IN,
 <br>        WA_SALES_CONDITIONS_IN        LIKE LINE OF   LT_SALES_CONDITIONS_IN,
 <br>        WA_EXTENSIONIN                LIKE LINE OF   LT_EXTENSIONIN,
 <br>        WA_SALES_ITEMS_IN             LIKE LINE OF   LT_SALES_ITEMS_IN,
 <br>        WA_SALES_TEXT                 LIKE LINE OF   LT_SALES_TEXT.
 <br>
 <br>  LT_SALES_HEADER_IN-DOC_TYPE       = 'ZSAL'.
 <br>  LT_SALES_HEADER_IN-SALES_ORG      = '1000'.
 <br>  LT_SALES_HEADER_IN-DISTR_CHAN     = '02'.
 <br>  LT_SALES_HEADER_IN-DIVISION       = '01'.
 <br>  LT_SALES_HEADER_IN-PMNTTRMS       = 'Z020'.
 <br>  LT_SALES_HEADER_IN-DUN_COUNT      = '0'.
 <br>  LT_SALES_HEADER_IN-ADD_VAL_DY     = '00'.
 <br>  LT_SALES_HEADER_IN-EXCHG_RATE     = '0'.
 <br>   LT_SALES_HEADER_IN-BILL_DATE      = SY-DATUM.
 <br>
 <br>data lv_kunnr type kunnr value '106475'.
 <br>
 <br>CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
 <br>  EXPORTING
 <br>    INPUT         = lv_kunnr
 <br> IMPORTING
 <br>   OUTPUT        = lv_kunnr.
 <br>
 <br>  WA_SALES_PARTNERS-PARTN_ROLE      = 'AG'.
 <br>  WA_SALES_PARTNERS-PARTN_NUMB      = lv_kunnr.
 <br>  APPEND WA_SALES_PARTNERS TO LT_SALES_PARTNERS.
 <br>
 <br>  WA_SALES_PARTNERS-PARTN_ROLE      = 'WE'.
 <br>  WA_SALES_PARTNERS-PARTN_NUMB      = lv_kunnr.
 <br>  APPEND WA_SALES_PARTNERS TO LT_SALES_PARTNERS.
 <br>
 <br>  WA_SALES_TEXT-ITM_NUMBER = '000010'.
 <br>  WA_SALES_TEXT-TEXT_ID = 'ZS01'.
 <br>  WA_SALES_TEXT-LANGU =  SY-LANGU.
 <br>  APPEND WA_SALES_TEXT TO LT_SALES_TEXT.
 <br>
 <br>  WA_SALES_TEXT-ITM_NUMBER = '000010'.
 <br>  WA_SALES_TEXT-TEXT_ID = '3010'.
 <br>  WA_SALES_TEXT-LANGU =  SY-LANGU.
 <br>  APPEND WA_SALES_TEXT TO LT_SALES_TEXT.
 <br>
 <br>  WA_SALES_SCHEDULES_IN-ITM_NUMBER  = '000010'.
 <br>  WA_SALES_SCHEDULES_IN-REQ_QTY     = '22'.
 <br>  APPEND WA_SALES_SCHEDULES_IN TO LT_SALES_SCHEDULES_IN.
 <br>
 <br>  WA_SALES_CONDITIONS_IN-ITM_NUMBER = '000010'.
 <br>  WA_SALES_CONDITIONS_IN-COND_TYPE  = 'ZMAN'.
 <br>  WA_SALES_CONDITIONS_IN-CURRENCY   = 'NOK' .
 <br>  APPEND WA_SALES_CONDITIONS_IN TO LT_SALES_CONDITIONS_IN.
 <br>
 <br>  WA_EXTENSIONIN-STRUCTURE          = 'BAPE_VBAK'.
 <br> *  WA_EXTENSIONIN-VALUEPART1         = '090000000200'.
 <br>  APPEND WA_EXTENSIONIN TO LT_EXTENSIONIN.
 <br>
 <br>data lv_MATNR type MATNR value '000000000000000031'.
 <br>
 <br>CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
 <br>  EXPORTING
 <br>    INPUT         = lv_MATNR
 <br> IMPORTING
 <br>   OUTPUT        = lv_MATNR.
 <br>
 <br>  WA_SALES_ITEMS_IN-ITM_NUMBER      = '10'.
 <br>  WA_SALES_ITEMS_IN-MATERIAL        = lv_MATNR.
 <br>  WA_SALES_ITEMS_IN-TARGET_QTY      = '1'.
 <br>  WA_SALES_ITEMS_IN-TARGET_QU       = 'ST'.
 <br>  WA_SALES_ITEMS_IN-SHORT_TEXT      = 'TESST AJ'.
 <br>  WA_SALES_ITEMS_IN-SALES_UNIT      = 'ST'.
 <br>  WA_SALES_ITEMS_IN-CURRENCY        = 'NOK'.
 <br>  WA_SALES_ITEMS_IN-WBS_ELEM        = '011215'.
 <br>  APPEND WA_SALES_ITEMS_IN TO LT_SALES_ITEMS_IN.
 <br>
 <br>  DATA : WA_ORDER_ITEMS_INX TYPE BAPISDITMX.
 <br>  DATA : LT_ORDER_ITEMS_INXN TYPE STANDARD TABLE OF BAPISDITMX.
 <br>  DATA : WA_ORDER_HEADER_INX TYPE BAPISDHD1X.
 <br>  DATA : LT_ORDER_HEADER_INXN TYPE STANDARD TABLE OF BAPISDHD1X.
 <br>
 <br>  WA_ORDER_ITEMS_INX-UPDATEFLAG = ' '.
 <br>  WA_ORDER_ITEMS_INX-ITM_NUMBER = '000010'.
 <br>  WA_ORDER_ITEMS_INX-MATERIAL        = 'X'.
 <br>  WA_ORDER_ITEMS_INX-TARGET_QTY      = 'X'.
 <br>  WA_ORDER_ITEMS_INX-TARGET_QU       = 'X'.
 <br>  WA_ORDER_ITEMS_INX-SHORT_TEXT      = 'X'.
 <br>  WA_ORDER_ITEMS_INX-SALES_UNIT      = 'X'.
 <br>    WA_ORDER_ITEMS_INX-WBS_ELEM   = 'X'.
 <br>
 <br>  APPEND WA_ORDER_ITEMS_INX TO LT_ORDER_ITEMS_INXN.
 <br>
 <br>  CALL FUNCTION 'SD_SALESDOCUMENT_CREATE'
  <br>   EXPORTING
 <br>     SALESDOCUMENT                 = LV_VALUE_SALESDOCUMENT
 <br>      SALES_HEADER_IN               = LT_SALES_HEADER_IN
 <br>*     SALES_HEADER_INX              =
 <br>*     SENDER                        =
 <br>*     BINARY_RELATIONSHIPTYPE       = ' '
 <br>     INT_NUMBER_ASSIGNMENT         = LV_INT_NUMBER_ASSIGNMENT
 <br>*     BEHAVE_WHEN_ERROR             = ' '
 <br>*     LOGIC_SWITCH                  = ' '
 <br>     BUSINESS_OBJECT               = ' '
 <br>*     TESTRUN                       =
 <br>*     CONVERT_PARVW_AUART           = ' '
 <br>     STATUS_BUFFER_REFRESH         = 'X'
 <br>*     CALL_ACTIVE                   = ' '
 <br>   IMPORTING
 <br>     SALESDOCUMENT_EX              = LV_SALESDOCUMENT_EX
 <br>     SALES_HEADER_OUT              = LT_SALES_HEADER_OUT
 <br>     SALES_HEADER_STATUS           = LT_SALES_HEADER_STATUS
 <br>   TABLES
 <br>     RETURN                        = LT_RETURN
 <br>     SALES_ITEMS_IN                = LT_SALES_ITEMS_IN
 <br>*     SALES_ITEMS_INX               =
 <br>     SALES_PARTNERS                = LT_SALES_PARTNERS
 <br>     SALES_SCHEDULES_IN            = LT_SALES_SCHEDULES_IN
 <br>*     SALES_SCHEDULES_INX           =
 <br>     SALES_CONDITIONS_IN           = LT_SALES_CONDITIONS_IN
 <br>*     SALES_CONDITIONS_INX          =
 <br>*     SALES_CFGS_REF                =
 <br>*     SALES_CFGS_INST               =
 <br>*     SALES_CFGS_PART_OF            =
 <br>*     SALES_CFGS_VALUE              =
 <br>*     SALES_CFGS_BLOB               =
 <br>*     SALES_CFGS_VK                 =
 <br>*     SALES_CFGS_REFINST            =
 <br>*     SALES_CCARD                   =
 <br>     SALES_TEXT                    = LT_SALES_TEXT
 <br>*     SALES_KEYS                    =
 <br>*     SALES_CONTRACT_IN             =
 <br>*     SALES_CONTRACT_INX            =
 <br>     EXTENSIONIN                   = LT_EXTENSIONIN
 <br>*     PARTNERADDRESSES              =
 <br>*     SALES_SCHED_CONF_IN           =
 <br>     ITEMS_EX                      = LT_ITEMS_EX
 <br>     SCHEDULE_EX                   = LT_SCHEDULE_EX
 <br>*     BUSINESS_EX                   =
 <br>*     INCOMPLETE_LOG                =
 <br>     EXTENSIONEX                   = LT_EXTENSIONEX
 <br>*     CONDITIONS_EX                 =
 <br>*     PARTNERS_EX                   =
 <br>*     TEXTHEADERS_EX                =
 <br>*     TEXTLINES_EX                  =
 <br>*     BATCH_CHARC                   =
 <br>*     CAMPAIGN_ASGN                 =
 <br>*     CONDITIONS_KONV_EX            =
 <br>.
 <br>
 <br> commit work.

<br>

<br>I am aware that there are other BAPI's available to create a new sales order(BAPI_SALESORDER_CREATEFROMDAT2 <br>etc.) but the problem with using them is they internally call the same function module 'SD_SALESDOCUMENT_CREATE'. i <br>have already tried to create the sales order using 'BAPI_SALESORDER_CREATEFROMDAT' but the effect is the same.

<br>When I pass WBS element value in VA01 and create a sales order I can see that WBS element value is coming correctly. <br>But when i create the sales order using ABAP code WBS element is coming as blank. When I execute this standard FM it <br>creates the sales order correctly with a blank against WBS element. I checked in the VBAP table the value is not even <br>populated there . Kindly share your valuable inputs for the same.

<br>

<br>- Akshay

Edited by: yahooakshay on Dec 12, 2011 9:49 AM

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

5 Answers

  • Posted on Dec 12, 2011 at 08:52 AM

    Hi;

    Did you use convers.routine for WBS Element?

    You should use CONVERSION_EXIT_ABPSN_INPUT / CONVERSION_EXIT_ABPSN_OUTPUT FMs in your code for background.

    Best regards.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 12, 2011 at 08:58 AM

    WBS element are stored as number but displayed as some string. Please try using both number as well as string one.

    It will work for me.

    thanks

    Nabheet

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 12, 2011 at 09:16 AM

    Above FMs convert to from PRPS-PSPNR field to PRPS-POSID field or from PRPS-POSID field to PRPS-PSPNR field.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 12, 2011 at 11:40 AM

    I have already tried the conversion routines, But there is no need for converting them to internal number format. The FM takes care of that. The WBS element needs to be entered in the external number format itself.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 12, 2011 at 01:47 PM

    Set field UPDKZ = 'I' ([Note 719294 - WBS element (WBS_ELEM) is not transferred|https://service.sap.com/sap/support/notes/719294])

    WA_ORDER_ITEMS_INX-UPDATEFLAG = 'I'. 

    Regards,

    Raymond

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.