Skip to Content
0
Former Member
Jul 18, 2007 at 09:58 PM

Error with SD_SALESDOCUMENT_CREATE

1503 Views

Hi All,

I was trying to execute the fuction SD_SALESDOCUMENT_CREATE in my report and got short dump saying "

The call to the function module "SD_SALESDOCUMENT_CREATE" is incorrect:

In the function module interface, you can specify only

fields of a specific type and length under "SALES_HEADER_IN".

Although the currently specified field

"HEADER" is the correct type, its length is incorrect. "

Please help me. Am I missing any mandatory data.

Thanks,

Neelu.

 LOOP AT gt2_zprice INTO gs_zprice.

* header data
* Sales document type
        header-doc_type = 'ZMKD'.
        headerx-doc_type = 'X'.

* Sales organization
        header-sales_org = '0300'.
        headerx-sales_org = 'X'.

* Distribution channel
        header-distr_chan  = '10'.
        headerx-distr_chan = 'X'.

* Division
        header-division = '01'.
        headerx-division = 'X'.

        headerx-updateflag = 'I'.
*        append header.
*        append headerx.

* Partner data
* Sold to
        partner-partn_role = 'AG'.
        partner-partn_numb = gs_zprice-kunnr. "'0000001012'.
        APPEND partner.

* ITEM DATA
        itemx-updateflag = 'I'.

* Line item number.
        item-itm_number = '000010'.
        itemx-itm_number = 'X'.

* Material
        item-material = gs_zprice-matnr. "'000000000000063006'.
        itemx-material = 'X'.

* Plant
        item-plant    = 'INDY'.
        itemx-plant   = 'X'.

* Quantity
        item-target_qty = '0000000000090'.
        itemx-target_qty = 'X'.

        APPEND item.
        APPEND itemx.

*   Fill schedule lines
        lt_schedules_in-itm_number = '000010'.
        lt_schedules_in-sched_line = '0001'.
        lt_schedules_in-req_qty    = '0000000000090'.
        APPEND lt_schedules_in.

*   Fill schedule line flags
        lt_schedules_inx-itm_number  = '000010'.
        lt_schedules_inx-sched_line  = '0001'.
        lt_schedules_inx-updateflag  = 'X'.
        lt_schedules_inx-req_qty     = 'X'.
        APPEND lt_schedules_inx.

*      ENDLOOP.

        CALL FUNCTION 'SD_SALESDOCUMENT_CREATE'
           EXPORTING
*         SALESDOCUMENT                 =
             sales_header_in               = header
             sales_header_inx              = headerx
*         SENDER                        =
*         BINARY_RELATIONSHIPTYPE       = ' '
**         INT_NUMBER_ASSIGNMENT         = ' '
*         BEHAVE_WHEN_ERROR             = ' '
*         LOGIC_SWITCH                  = ' '
*         BUSINESS_OBJECT               = ' '
*         TESTRUN                       =
*         CONVERT_PARVW_AUART           = ' '
*         STATUS_BUFFER_REFRESH         = 'X'
          IMPORTING
            salesdocument_ex              = salesdocument
*         SALES_HEADER_OUT              =
          TABLES
            return                        = return
            sales_items_in                = item
            sales_items_inx               = itemx
            sales_partners                = partner
            sales_schedules_in            = lt_schedules_in
            sales_schedules_inx           = lt_schedules_inx

  "         sales_conditions_in           = order_conditions_in

*         SALES_CFGS_REF                =
*         SALES_CFGS_INST               =
*         SALES_CFGS_PART_OF            =
*         SALES_CFGS_VALUE              =
*         SALES_CFGS_BLOB               =
*         SALES_CFGS_VK                 =
*         SALES_CFGS_REFINST            =
*         SALES_CCARD                   =

  "          sales_text                    = order_text

*         SALES_KEYS                    =
*         SALES_CONTRACT_IN             =
*         SALES_CONTRACT_INX            =
*         EXTENSIONIN                   =
*         PARTNERADDRESSES              =
*         SALES_SCHED_CONF_IN           =
*         ITEMS_EX                      =
*         SCHEDULE_EX                   =
*         BUSINESS_EX                   =
*         INCOMPLETE_LOG                =
*         EXTENSIONEX                   =
*         CONDITIONS_EX                 =
*         BATCH_CHARC                   =
                .

* Check the return table.
        LOOP AT return WHERE type = 'E' OR type = 'A'.
          EXIT.
        ENDLOOP.

        IF sy-subrc = 0.

          WRITE: / 'Error in creating document'.

        ELSE.

* Commit the work.

          CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
   EXPORTING
     wait          = 'X'
* IMPORTING
*   RETURN        =
                    .




*    COMMIT WORK AND WAIT.
*
*   WRITE: / 'Document ', salesdocument, ' created'.
*
        ENDIF.
  ENDLOOP.