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: 

Problem in updating Billing plan while changing Sales order

Former Member
0 Kudos

Hi All,

I am using the BAPI 'BAPI_SALESORDER_CHANGE' to change a Prepaid Sale order.After calling this BAPI ,I am calling the function module <b>'BILLING_SCHEDULE_SAVE'</b> to update the Billing plan of the changed Sale order(Billing plan dates for Billing type ZF1 are changed).

The updated date values are getting reflected in the screen when I view through the transaction VA02 and the values are also updated in FPLT table but the values are not getting reflected in the table VKDFS.

Since the values are not getting reflectedin the table VKDFS the billing date is not correct while we view in the transaction VF04.

Please provide your valuable suggestions for updating the Billing date in VKDFS table.

Thanks in advance for your help.

Thanks and regards,

Siva

10 REPLIES 10

Former Member
0 Kudos

I have the same troubles using FM BILLING_SCHEDULE_SAVE.

How to update the netvalue ? as my VBAP-NETWR and VKDFS-NETWR are wrong, the values are the old ones.

Calling SD_ORDER_BILLING_SCHEDULE does not change anything .

Thank You,

John

0 Kudos

Hi

Try this

'SD_SALES_DOCUMENT_READ'

'SD_SALES_ITEM_LIST_READ'

loop at line items

'SD_SALES_BILLINGPLAN_READ'

'SD_SALES_BILLINGPLAN_CHANGE'

and finally

'SD_SALES_DOCUMENT_SAVE'

It works for me and do let me know if you need the sample code.

Regards

0 Kudos

Hi,

I had the same problem. Here is an example code to resolve it:

REPORT ytestfg.

DATA: i_bsid LIKE bsid OCCURS 0,

i_bsid2 LIKE bsid OCCURS 0.

TABLES: bsid.

DATA: doc LIKE vbak-vbeln,

pos(6) TYPE n.

DATA e_fpla LIKE fpla.

DATA e_fplt LIKE fpltvb OCCURS 0 .

DATA: zfpla LIKE fplavb OCCURS 0,

zfplt LIKE fpltvb OCCURS 0.

DATA zfplt2 LIKE fpltvb OCCURS 0 WITH HEADER LINE.

doc = 'G03060619'.

pos = '000010'.

CALL FUNCTION 'SD_SALES_DOCUMENT_READ'

EXPORTING

document_number = doc.

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 <> 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[].

READ TABLE zfplt2 INDEX 1.

zfplt2-afdat = '20080927'.

      • Very important to set field updkz = 'U' ***

zfplt2-updkz = 'U'. "--> UPDATE!!

MODIFY zfplt2 INDEX 1.

CALL FUNCTION 'BILLING_SCHEDULE_SAVE'

TABLES

fpla_new = zfpla

fpla_old = zfpla

fplt_new = zfplt2 " --> NEW

fplt_old = zfplt.

CALL FUNCTION 'SD_SALES_DOCUMENT_SAVE'.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

Regards,

Edited by: PHO_BA on Mar 9, 2009 5:28 PM

0 Kudos

After the 'BAPI_TRANSACTION_COMMIT', just call teh Below FM & it will adjust the VKDFS.

CALL FUNCTION 'RV_INDEX_REORG'
        EXPORTING
          vkdfs_correct = 'X'
        TABLES
          i_a           = i_a
          i_l           = i_l
          i_f           = i_f.

Data Declaration for FM call:

DATA : i_a TYPE RANGE OF vbak-vbeln,
               i_l  TYPE RANGE OF likp-vbeln,
               i_f  TYPE RANGE OF vbrk-vbeln.

DATA : i_a_line LIKE LINE OF i_a,
                i_l_line LIKE LINE OF i_l,
                i_f_line LIKE LINE OF i_f.

Fill the respective table as per the document type. i.e.

i_a for Sales document, i_l for Delivery, i_f for billing Document

This will adjust the Billing index table VKDFS.

Regards,

Bharat Bajaj

Former Member
0 Kudos

Hi Siva,

did you finally save on VKDFS?

How did you do it?

Thanks in advance,

Carlos.

I've followed REPORT ytestfg. but VKDFS is not changed.

Edited by: Carlos Alvarez on Jul 8, 2009 7:05 PM

Former Member
0 Kudos

Hi Siva,

Even i have the same issue. how are you updating the billing date. Please reply back.

Regards,

Gautham

Former Member
0 Kudos

Hi All,

I am using also the BAPI 'BAPI_SALESORDER_CREATEFROMDAT2' and use the the module fonction 'BILLING_SCHEDULE_SAVE' to upade the billing plan of the type FAZ) are changed.

The updated values are Ok for my document while displaying it (VA03)

When i want to use the transcation VF04, the billing doc does not appear because the table VKDFS is not updated (invoice index)

if i create the same order by using the transaction VA01 --> It's OK

Please, why this table is not updated ?

Is any suggestions for updating this table

Thanks in Advance,

Former Member
0 Kudos

Hi,

For the same problem, i have populated the billing date in user exit EXIT_SAPLV60F_001.

This exit is meant to change date. You need to basically make changes in the FM usered to update/create contract.

Keep a break point in the exit and test it. Dont forget to activate cumstomer exit.

Regards,

Gautham

Former Member
0 Kudos

Hi Siva,

Just follow the steps explained by Glass & then, follow the below instructions for adjusting VKDFS.

After the 'BAPI_TRANSACTION_COMMIT', just call the Below FM & it will adjust the VKDFS.

CALL FUNCTION 'RV_INDEX_REORG'
        EXPORTING
          vkdfs_correct = 'X'
        TABLES
          i_a           = i_a
          i_l           = i_l
          i_f           = i_f.

Data Declaration for FM call:

DATA : i_a TYPE RANGE OF vbak-vbeln,
               i_l  TYPE RANGE OF likp-vbeln,
               i_f  TYPE RANGE OF vbrk-vbeln.

DATA : i_a_line LIKE LINE OF i_a,
                i_l_line LIKE LINE OF i_l,
                i_f_line LIKE LINE OF i_f.

Fill the respective table as per the document type. i.e.

i_a for Sales document, i_l for Delivery, i_f for billing Document

This will adjust the Billing index table VKDFS.

Regards,

Bharat Bajaj

former_member503533
Participant
0 Kudos

For me, the function generate error, but I use the program RVV05IVB in my Z program. after the commit.