Skip to Content
0
Dec 29, 2005 at 04:03 PM

SD_SALESDOCUMENT_CREATE

762 Views

Hi,

I am using the function module SD_SALESDOCUMENT_CREATE to create a salesdocument.

With this i need to update some Zfields into the Database.

I populated Zfields into extension segment(IT_BAPI_EXTN).

I have populated both header and item extension segments in the above internal table.

After running the FM, i was able to update only my item extension, it was not updating my Header extension segment.

My Function module is like this...

    CALL FUNCTION 'SD_SALESDOCUMENT_CREATE'
         EXPORTING
              SALES_HEADER_IN     = R_BAPISDHEAD
              BUSINESS_OBJECT     = 'BUS2094'
         IMPORTING
              SALESDOCUMENT_EX    = SALESDOCUMENT
         TABLES
              RETURN              = RETURN
              SALES_ITEMS_IN      = IT_BAPIITEMIN
              SALES_PARTNERS      = IT_PARTNERS
              SALES_CONDITIONS_IN = IT_BAPICOND
              SALES_TEXT          = IT_BAPITEXT
              EXTENSIONIN         = IT_BAPI_EXTN.

I've populated my Extension segment like this...

  CLEAR: R_BAPE_VBAK,
         R_BAPE_VBAKX.

*--  Append Reference to external source of claim
  MOVE:   P_ORDER_HEADER_IN-ZZEXTSRCECLM   TO  R_BAPE_VBAK-ZZEXTSRCECLM
.
  IF P_ORDER_HEADER_IN-AUGRU = K_205.
*-- Append Installation Year
    MOVE: P_ORDER_HEADER_IN-ZVINSTYR       TO  R_BAPE_VBAK-ZVINSTYR,
*-- Append Installation Month
          P_ORDER_HEADER_IN-ZVINSTMO       TO  R_BAPE_VBAK-ZVINSTMO,
*-- Append Reported Year
          P_ORDER_HEADER_IN-ZVRPTONYR      TO  R_BAPE_VBAK-ZVRPTONYR,
*-- Append Reported Month
          P_ORDER_HEADER_IN-ZVRPTONMO      TO  R_BAPE_VBAK-ZVRPTONMO.
  ENDIF.

  MOVE: 'BAPE_VBAK'                TO  P_BAPI_EXTN-STRUCTURE,
         R_BAPE_VBAK               TO  P_BAPI_EXTN+30.

  APPEND P_BAPI_EXTN.
  CLEAR: P_BAPI_EXTN,
         R_BAPE_VBAK.

  MOVE:    K_X                       TO  R_BAPE_VBAKX-ZZEXTSRCECLM.

  IF P_ORDER_HEADER_IN-AUGRU = K_205.
    MOVE:  K_X                       TO  R_BAPE_VBAKX-ZVINSTYR,
           K_X                       TO  R_BAPE_VBAKX-ZVINSTMO,
           K_X                       TO  R_BAPE_VBAKX-ZVRPTONYR,
           K_X                       TO  R_BAPE_VBAKX-ZVRPTONMO.
  ENDIF.
  MOVE:  'BAPE_VBAKX'                TO  P_BAPI_EXTN-STRUCTURE,
         R_BAPE_VBAKX                TO  P_BAPI_EXTN+30.

  APPEND P_BAPI_EXTN.
  CLEAR: P_BAPI_EXTN,
         R_BAPE_VBAKX.

Can somebody help me on this?

Thanks,

Sreekanth Gollamudi

Intelligroup