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: 

BAPI_SALESORDER_CREATEFROMDAT2 AND Billing Plan

Former Member
0 Kudos

Hi to all,

I'm using bapi 'BAPI_SALESORDER_CREATEFROMDAT2' to create Sales Order in a program but the order that I'm creating don't have billing plan (tab is empty). I need a way to create billing plan in sales order starting from file.

Thanks in advance

Andrea

6 REPLIES 6

Former Member

Hi Andrea,

Unfortunately , BAPIs cannot process billing plan data. You can create orders or contracts and a billing plan scheme/rule can be determined if it's assigned to a item category. The price is taken from the according condition then.

System works differently while creating sales orders with Bapi's and VA01. BAPIs cannot process billing plan data. Please

check attached notes 550726 item 1 and 414058 item 2.

Thanks

Amber

0 Kudos

Ok, but I need to create Sales Order with billing plan (with different billing dates) starting from file and using BAPI (not

necessarily that in the subject )but also other bapis or FM ) but NOT using batch-input.

At the moment I'm able to create Sales Order without billing plan. I think it should be a workaround for bill plan ? I have to reply to

my functional collegues...

thanks in advance

Andrea

Former Member
0 Kudos

HI ,
I m even looking for a solution to update Bill plan using some BAPI / FM .
Can you tell me if you got the solution .

Manish

former_member182040
Active Contributor
0 Kudos

you can use following sequence wise FM:

CALL FUNCTION 'BILLING_SCHEDULE_READ'

CALL FUNCTION 'BILLING_SCHEDULE_MAINTAIN'

CALL FUNCTION 'SD_SALES_DOCUMENT_SAVE'

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

0 Kudos

Hi Krupa,

Thanks for the prompt reply.
But unfortunately it is not working.

Here is my code

  SELECT SINGLE * FROM vbkd INTO ls_vbkd

    WHERE vbeln = p_stop AND

          posnr = p_item1.



*  CALL FUNCTION 'SD_SALES_DOCUMENT_READ'

*    EXPORTING

*      document_number = p_stop

*    EXCEPTIONS

*      error_message   = 01.

*  IF sy-subrc NE 0.

*    PERFORM message_100 USING p_stop.

*    EXIT.

*  ENDIF.





  CALL FUNCTION 'BILLING_SCHEDULE_READ'

    EXPORTING

      fplnr          = ls_vbkd-fplnr

*   I_VFKDAT       =

*   I_BFKDAT       =

    TABLES

      zfpla          tfpla_old[]

      zfplt          ifplt_stop[].





  DATA: e_dataloss TYPE r185d-dataloss,

        e_upd_fpla TYPE  c ,

        e_upd_fplt TYPE  c .



  tfpla_new[] = tfpla_old[].

  break mnaharia.



  ifplt_stop_temp[] = ifplt_stop_temp_new[] = ifplt_stop[].



  LOOP AT ifplt_stop[] INTO ifplt_stop.

    IF ifplt_stop-korte = 'A' "  Correction date with inverted +/-

                AND ifplt_stop-fkdat >= lv_dismantle_date AND ifplt_stop-nfdat > lv_dismantle_date .

      ifplt_stop-fkarv = 'ZZZZ'.

    ENDIF.

    CALL FUNCTION 'BILLING_SCHEDULE_MAINTAIN'

      EXPORTING

        i_fplt        = ifplt_stop

        i_upd_fplt    = 'U'

        i_fplnr       = ls_vbkd-fplnr

      IMPORTING

        e_dataloss    = e_dataloss

        e_upd_fpla    = e_upd_fpla

        e_upd_fplt    = e_upd_fplt

      TABLES

        fpla_old      = tfpla_old[]

        fpla_new      = tfpla_new[]

        fplt_old      = ifplt_stop_temp[]

        fplt_new      = ifplt_stop_temp_new[]

      EXCEPTIONS

        error_message = 1

        OTHERS        = 2.

    IF sy-subrc NE 0.

      RAISE error_in_cancel.

    ENDIF.

  ENDLOOP.



  CALL FUNCTION 'SD_SALES_DOCUMENT_SAVE'

    EXCEPTIONS

      error_message = 01.

  IF sy-subrc NE 0.

    PERFORM message_100 USING p_stop.

    EXIT.

  ENDIF.



  CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

Would apprecite if you can help here.

0 Kudos

This message was moderated.