Application Development and Automation 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: 
Read only

Condition amount taken from Condition record using SD_SALESDOCUMENT_CREATE

Former Member
0 Likes
1,181

Hi Everyone,

I am creating an order with reference to a contract using the funciton module 'SD_SALESDOCUMENT_CREATE'. The amount of Conditions of an item is fetched from Condition record. I want the amount to be fetched from item of the Contract. Am I missing any parameter? I am not feeding any condition details as all the condition types and details are system generated.

When I create manually via VA01, it takes amount from Contract's Item conditions. I need to have same case using the function module.

Looking for your suggestions.

Thanks

Hi Everyone,

I am creating an order with reference to a contract using the funciton module 'SD_SALESDOCUMENT_CREATE'. The amount of Conditions of an item is fetched from Condition record. I want the amount to be fetched from item of the Contract. Am I missing any parameter? I am not feeding any condition details as all the condition types and details are system generated.

When I create manually via VA01, it takes amount from Contract's Item conditions. I need to have same case using the function module.

Looking for your suggestions.

Thanks

5 REPLIES 5
Read only

Former Member
0 Likes
915

Hi Bode

I'm not sure what version you're running but have you tried using the more specific and more recent Sales Order BAPI: BAPI_SALESORDER_CREATEFROMDAT2?
If you search SCN, you should find example programs.

Regards
Glen

Read only

0 Likes
915

The following SAP Note may also be useful:
https://service.sap.com/sap/support/notes/370988

Regards
Glen

Read only

Former Member
0 Likes
915

Hi ,

Please go through SAP LINK  http://scn.sap.com/thread/144871 .

Regards,

Yukti

Read only

madhu_vadlamani
Active Contributor
0 Likes
915

Hi Khanshi,

You just paste that piece of code.Why can not you try with bapi.

Regards,

Madhu.

Read only

Former Member
0 Likes
915

Hello Khanshi,

You need to create these references before calling the BAPI:

    • Add something like this *****

  • Assigning header.

  hdr-REF_DOC = i_vakgu-vbeln.  "assign quotation # to sales order  hdr-REFDOC_CAT = 'B'.         "assign Quotation to VBTYP_N.

  • Assigning ref doc to create line item entries in VBFA.

    itm-REF_DOC    = i_vakgu-vbeln.    itm-REF_DOC_IT = i_vbap-posnr.    itm-REF_DOC_CA = 'B'.    append itm.

    • Add something like this above *****

    • Now call BAPI with the References created in <b>hdr</b> and <b>itm</b>

  data: ret_text type BAPIRET2.

  CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'

    EXPORTING

      ORDER_HEADER_IN           = hdr

      convert                   = 'X'

    IMPORTING

      SALESDOCUMENT             = salesdoc

    TABLES

      return                    = ret_tbl

      ORDER_ITEMS_IN            = itm

      ORDER_PARTNERS            = prtnr

      ORDER_ITEMS_inx           = itmx

      ORDER_CONDITIONS_IN       = conds

      ORDER_CONDITIONS_INX      = condsx

      order_schedules_in        = schd_lin.

  if sy-subrc = 0

  and not salesdoc is initial.

    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

     EXPORTING

       WAIT          = 'X'

     IMPORTING

       RETURN        = ret_text.

Regards,

Yukti