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: 

SD_SALESDOCUMENT_CREATE

sreemsft
Contributor
0 Kudos
1,439

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

1 ACCEPTED SOLUTION

Former Member
0 Kudos
379

Hi Sreekanth,

From the code it appears you are doing every thing right,

Two things to quickly check,

See first of all if your IF condition for AUGRU is matched and the data gets filled int IT_BAPI_EXTN at the time of SD_SALESDOCUMENT_CREATE fm call.

Next put a breakpoint in subroutine MS_MOVE_EXTENSIONIN inside function module SD_SALESDOCUMENTE_CREATE and see whether the data is passed on to E_VBAKKOM and E_VBAKKOMX properly.

Also check whether these fields exist in E_VBAKKOM and E_VBAKKOMX.

Hope this helps..

Sri

5 REPLIES 5

Former Member
0 Kudos
379

Hi.

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.

<b> Append r_bape_vbakx.</b>

ENDIF.\

Former Member
0 Kudos
380

Hi Sreekanth,

From the code it appears you are doing every thing right,

Two things to quickly check,

See first of all if your IF condition for AUGRU is matched and the data gets filled int IT_BAPI_EXTN at the time of SD_SALESDOCUMENT_CREATE fm call.

Next put a breakpoint in subroutine MS_MOVE_EXTENSIONIN inside function module SD_SALESDOCUMENTE_CREATE and see whether the data is passed on to E_VBAKKOM and E_VBAKKOMX properly.

Also check whether these fields exist in E_VBAKKOM and E_VBAKKOMX.

Hope this helps..

Sri

0 Kudos
379

Two things are getting successfully.

Getting values into E_VBAKKOM and E_VBAKKOMX.

Is there anything else i missed out??

Thanks,

Sreekanth G

0 Kudos
379

Hi,

Then put a breakpoint in subroutine <b>VBAK_FUELLEN_VBAKKOM</b> in program <b>SAPFV45K</b> and see whether your Z fields are filled into VBAK by the end of the routine. If not, I guess you have to use <b>USEREXIT_MOVE_FIELD_TO_VBAKKOM</b> in program <b>SAPMV45A</b> to move fields from VBAKKOM to VBAK.

Hope this helps..

Sri

0 Kudos
379

Thanks Sri.