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: 

BILLING_SCHEDULE_SAVE - Problem

Former Member
0 Kudos
3,915

Hi,

I am using BILLING_SCHEDULE_SAVE Fm to create Invoicing Plans in PO, the FM is creating the records in FLPA and FLPT table but I am not able to see the Invoicing Plan in the PO Screen.

Any idea on this.

Thanks,

Krishna

1 ACCEPTED SOLUTION

Former Member
0 Kudos
1,083

see the following to add starting and endding date in invoice plan


DATA: doc LIKE vbak-vbeln,
v_order LIKE bapivbeln-vbeln,
pos(6) TYPE n.
DATA e_fpla LIKE fpla .
DATA hfplnr LIKE fpla-fplnr.

DATA i_fpla LIKE fpla .
DATA e_fplt LIKE fpltvb OCCURS 0 .
DATA: zfpla LIKE fplavb OCCURS 0 WITH HEADER LINE,
zfplt LIKE fpltvb OCCURS 0 WITH HEADER LINE.
DATA zfplt2 LIKE fpltvb OCCURS 0 WITH HEADER LINE.
DATA zfpla2 LIKE fplavb OCCURS 0 WITH HEADER LINE.
v_order = '1252004164'.
MOVE v_order TO doc .




doc = v_order.


break develoer.
CALL FUNCTION 'SD_SALES_DOCUMENT_READ'
  EXPORTING
    document_number = doc.

MOVE '000010' TO pos.
CALL FUNCTION 'SD_SALES_BILLINGPLAN_READ'
  EXPORTING
    i_vbeln                = doc
    i_posnr                = pos
  IMPORTING
    e_fpla                 = e_fpla
  TABLES
    e_fplt                 = e_fplt
  EXCEPTIONS
    no_billingplan_allowed = 1
    no_billingplan_found   = 2
    OTHERS                 = 3.

IF sy-subrc NE 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

* Read the billing plan
CALL FUNCTION 'BILLING_SCHEDULE_READ'
EXPORTING
fplnr = e_fpla-fplnr
* I_VFKDAT =
* I_BFKDAT =
TABLES
zfpla = zfpla
zfplt = zfplt
.

* Upddate the ZFPLT2 table with the new values
*MOVE zfplt TO zfplt2.
MOVE zfpla TO zfpla2.

*READ TABLE zfpla2 INDEX 1.
zfpla2-lodat = '20100101'.
zfpla2-tndat = '20101231'.
zfpla2-rfpln = ''.
zfpla2-lodar = ''.
zfpla2-tndar = ''.
zfpla2-fpart = 'yy'.
zfpla2-horiz = '91'.
*** Very important to set field updkz = 'U' ***
zfpla2-updkz = 'U'. "--> UPDATE!!

APPEND zfpla2.

CLEAR pos.
CALL FUNCTION 'BILLING_SCHEDULE_SAVE'
  TABLES
    fpla_new = zfpla2
    fpla_old = zfpla
    fplt_new = zfplt " --> NEW
    fplt_old = zfplt.

CALL FUNCTION 'SD_SALES_DOCUMENT_SAVE'
  EXPORTING
    i_no_messages = ' '.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
  EXPORTING
    wait = 'X'.

Edited by: kk.adhvaryu on Sep 22, 2010 1:14 PM

9 REPLIES 9

Former Member
0 Kudos
1,084

see the following to add starting and endding date in invoice plan


DATA: doc LIKE vbak-vbeln,
v_order LIKE bapivbeln-vbeln,
pos(6) TYPE n.
DATA e_fpla LIKE fpla .
DATA hfplnr LIKE fpla-fplnr.

DATA i_fpla LIKE fpla .
DATA e_fplt LIKE fpltvb OCCURS 0 .
DATA: zfpla LIKE fplavb OCCURS 0 WITH HEADER LINE,
zfplt LIKE fpltvb OCCURS 0 WITH HEADER LINE.
DATA zfplt2 LIKE fpltvb OCCURS 0 WITH HEADER LINE.
DATA zfpla2 LIKE fplavb OCCURS 0 WITH HEADER LINE.
v_order = '1252004164'.
MOVE v_order TO doc .




doc = v_order.


break develoer.
CALL FUNCTION 'SD_SALES_DOCUMENT_READ'
  EXPORTING
    document_number = doc.

MOVE '000010' TO pos.
CALL FUNCTION 'SD_SALES_BILLINGPLAN_READ'
  EXPORTING
    i_vbeln                = doc
    i_posnr                = pos
  IMPORTING
    e_fpla                 = e_fpla
  TABLES
    e_fplt                 = e_fplt
  EXCEPTIONS
    no_billingplan_allowed = 1
    no_billingplan_found   = 2
    OTHERS                 = 3.

IF sy-subrc NE 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

* Read the billing plan
CALL FUNCTION 'BILLING_SCHEDULE_READ'
EXPORTING
fplnr = e_fpla-fplnr
* I_VFKDAT =
* I_BFKDAT =
TABLES
zfpla = zfpla
zfplt = zfplt
.

* Upddate the ZFPLT2 table with the new values
*MOVE zfplt TO zfplt2.
MOVE zfpla TO zfpla2.

*READ TABLE zfpla2 INDEX 1.
zfpla2-lodat = '20100101'.
zfpla2-tndat = '20101231'.
zfpla2-rfpln = ''.
zfpla2-lodar = ''.
zfpla2-tndar = ''.
zfpla2-fpart = 'yy'.
zfpla2-horiz = '91'.
*** Very important to set field updkz = 'U' ***
zfpla2-updkz = 'U'. "--> UPDATE!!

APPEND zfpla2.

CLEAR pos.
CALL FUNCTION 'BILLING_SCHEDULE_SAVE'
  TABLES
    fpla_new = zfpla2
    fpla_old = zfpla
    fplt_new = zfplt " --> NEW
    fplt_old = zfplt.

CALL FUNCTION 'SD_SALES_DOCUMENT_SAVE'
  EXPORTING
    i_no_messages = ' '.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
  EXPORTING
    wait = 'X'.

Edited by: kk.adhvaryu on Sep 22, 2010 1:14 PM

0 Kudos
1,083

Dear Sir  , when i use this function  (BILLING_SCHEDULE_SAVE am be able to insert only one line item in the billing plan details, second time it only update the last inserted one .  

so can you please advice how can i insert new line item in the billing plane details not only update the

last one .

and how to regenerate the net value after modifying the details , thanks in advance for your support .

Former Member
0 Kudos
1,083

Will this update the BILLING PLAN NUMBER in PO??....

Thanks and regards,

Chaitanya

0 Kudos
1,083

yes u can update BILLING PLAN ALL DETAILS

Former Member
0 Kudos
1,083

See the problem is after using this function module, the field FPLNR in EKPO should get updated then only we will be able to see the Invocing plan Tab in the PO.

I am not seeing, the field is not getting updated after using all these FMs.

Any info on this??

Thanks and Regards,

Krishna

0 Kudos
1,083

please past your logic how to use and what u pass so i can give proper solution

Edited by: kk.adhvaryu on Sep 23, 2010 7:08 AM

Former Member
0 Kudos
1,083

Thank you ..... Solved on my own...

Krishna

0 Kudos
1,083

please explain how to solve your issue so it will help to any other person who face same problme

0 Kudos
1,083

How ?