SAP for Utilities Discussions
Connect with fellow SAP users to share best practices, troubleshoot challenges, and collaborate on building a sustainable energy future. Join the discussion.
cancel
Showing results for 
Search instead for 
Did you mean: 

BAPI or FM to change Payment Plan(EK94) in Budget Billing for a Contract

Former Member
0 Kudos

Hii,

I have a requirement where I have to enable Budget Billing for a Contract. When the Contract is new to Budget Billing, I have created a Payment Plan programmatically using FM ISU_PAYPLAN_SIMULATE.

Now consider a situation where a customer wants to update his/her Payment Plan say from 50$ to 60$. In that case I tried using FM ISU_PAYPLAN_ADJUST_ACTION but was not able to change the records.

I also tried using FKK_TRANSFER_DOC_TO_PHYSICAL and FKK_TRANSFER_DOC_TO_LOGICAL but could not get the results.

If anyone has done changing the Payment Plan programmatically please let me know the FM and BAPI for it. Moreover, the values to be passed in that particular FM or BAPI.

Thanks,

Manish Verma

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Solved myself.

Following is what needs to be done.

**--Function Module to fetch data on the basis of Payment Plan

     CALL FUNCTION 'FKK_READ_DOC_INTO_LOGICAL'

       EXPORTING

         i_opbel           = lv_opbel (BBP document)

         i_accumulate      = space

         ix_sample_flag    = 'X'

         i_select_locks    = 'X'

         i_select_dunndata = 'X'

       TABLES

         t_logfkkop        = lt_eabps

       EXCEPTIONS

         opbel_not_found   = 1

         OTHERS            = 2.

READ TABLE lt_eabps INTO ls_eabps WITH KEY potyp = 'W'.

       IF sy-subrc = 0.

         lv_opupw = ls_eabps-opupw.

         lv_opupk = ls_eabps-opupk.

       ELSE.

            response = All the items have been billed in the Payment Plan.

             EXIT.

        ENDIF.

CALL FUNCTION 'FKK_BP_LINE_ITEMS_SEL_LOGICAL'

         EXPORTING

           i_opbel        = lv_opbel

           ix_opbel       = 'X'

           ix_sample_flag = 'X'

         TABLES

           pt_logfkkop    = lt_musterfkkop.

DELETE lt_musterfkkop WHERE opupw <> lv_opupw.

       LOOP AT lt_musterfkkop INTO ls_musterfkkop.

         ls_musterfkkop-opupw = '000'.

         ls_musterfkkop-augst = ''.

         ls_musterfkkop-faedn = ls_musterfkkop-solldat.

         ls_musterfkkop-faeds = ls_musterfkkop-solldat.

         ls_musterfkkop-betrh = 0.

         ls_musterfkkop-betrw = bb_amount. (New amount to be updated)

         ls_musterfkkop-skfbt = bb_amount. (New amount to be updated)

         ls_musterfkkop-augbl = ''.

         ls_musterfkkop-xaugp = ''.

         MODIFY lt_musterfkkop FROM ls_musterfkkop INDEX sy-tabix.

       ENDLOOP.

LOOP AT lt_eabps INTO ls_eabps WHERE potyp = 'X'.

         ls_eabps-betrh = 0.

         ls_eabps-betro = ls_eabps-betrw.

         ls_eabps-betrho = ls_eabps-betrw.

         MODIFY lt_eabps FROM ls_eabps INDEX sy-tabix.

       ENDLOOP.

LOOP AT lt_eabps INTO ls_eabps WHERE potyp = 'W'.

         ls_eabps-betrh = 0.

         ls_eabps-betrw = bb_amount. (New amount to be updated)

         ls_eabps-betro = bb_amount.  (New amount to be updated)

         ls_eabps-betrho = ls_eabps-skfbt.

         MODIFY lt_eabps FROM ls_eabps INDEX sy-tabix.

       ENDLOOP.

CALL FUNCTION 'FKK_TRANSFER_DOC_TO_PHYSICAL'

         EXPORTING

           mode          = 'V'

           accumulate    = 'X'

           i_calc_tax    = ''

           i_sample_flag = 'X'

         TABLES

           ifkkop        = lt_fkkop

           ifkkopw       = lt_fkkopw

           musterfkkop   = lt_musterfkkop

           logfkkop      = lt_eabps.

       CALL FUNCTION 'FKK_GET_PHYSICAL_VIEW_CHANGE'

         TABLES

           changed_ifkkop  = lt_fkkop

           insert_ifkkop   = lt_ins_fkkop (pass empty table)

           delete_ifkkop   = lt_del_fkkop (pass empty table)

           modify_ifkkop   = lt_mod_fkkop (pass empty table)

           changed_ifkkopw = lt_fkkopw

           insert_ifkkopw  = lt_ins_fkkopw (pass empty table)

           delete_ifkkopw  = lt_del_fkkopw (pass empty table)

           modify_ifkkopw  = lt_mod_fkkopw (pass empty table)

           musterfkkop     = lt_musterfkkop.

       CALL FUNCTION 'FKK_UPDATE_PHYSICAL_VIEW'

         EXPORTING

           ix_sample_flag    = 'X'

           ix_changedoc_flag = 'X'

         TABLES

           i_mod_ifkkop      = lt_musterfkkop

           i_mod_ifkkopw     = lt_mod_fkkopw (pass empty table)

           i_ins_ifkkop      = lt_ins_fkkop (pass empty table)

           i_ins_ifkkopw     = lt_ins_fkkopw (pass empty table)

           i_del_ifkkop      = lt_del_fkkop (pass empty table)

           i_del_ifkkopw     = lt_del_fkkopw (pass empty table)

           i_create_fkkop    = lt_fkkop

           i_create_fkkopw   = lt_fkkopw

           i_create_fkkopk   = lt_fkkopk (pass empty table)

         EXCEPTIONS

           error             = 1

           OTHERS            = 2.

       CALL FUNCTION 'FKK_TRANSFER_DOC_TO_LOGICAL'

         EXPORTING

           accumulate = ''

         TABLES

           ifkkop     = lt_fkkop

           ifkkopw    = lt_fkkopw

           logfkkop   = lt_logfkkop. (pass empty table)

COMMIT WORK AND WAIT.

Check the values in EK94. Amount will be updated for the non-billed periods.

Regards,

Manish Verma

View solution in original post

1 REPLY 1

Former Member
0 Kudos

Solved myself.

Following is what needs to be done.

**--Function Module to fetch data on the basis of Payment Plan

     CALL FUNCTION 'FKK_READ_DOC_INTO_LOGICAL'

       EXPORTING

         i_opbel           = lv_opbel (BBP document)

         i_accumulate      = space

         ix_sample_flag    = 'X'

         i_select_locks    = 'X'

         i_select_dunndata = 'X'

       TABLES

         t_logfkkop        = lt_eabps

       EXCEPTIONS

         opbel_not_found   = 1

         OTHERS            = 2.

READ TABLE lt_eabps INTO ls_eabps WITH KEY potyp = 'W'.

       IF sy-subrc = 0.

         lv_opupw = ls_eabps-opupw.

         lv_opupk = ls_eabps-opupk.

       ELSE.

            response = All the items have been billed in the Payment Plan.

             EXIT.

        ENDIF.

CALL FUNCTION 'FKK_BP_LINE_ITEMS_SEL_LOGICAL'

         EXPORTING

           i_opbel        = lv_opbel

           ix_opbel       = 'X'

           ix_sample_flag = 'X'

         TABLES

           pt_logfkkop    = lt_musterfkkop.

DELETE lt_musterfkkop WHERE opupw <> lv_opupw.

       LOOP AT lt_musterfkkop INTO ls_musterfkkop.

         ls_musterfkkop-opupw = '000'.

         ls_musterfkkop-augst = ''.

         ls_musterfkkop-faedn = ls_musterfkkop-solldat.

         ls_musterfkkop-faeds = ls_musterfkkop-solldat.

         ls_musterfkkop-betrh = 0.

         ls_musterfkkop-betrw = bb_amount. (New amount to be updated)

         ls_musterfkkop-skfbt = bb_amount. (New amount to be updated)

         ls_musterfkkop-augbl = ''.

         ls_musterfkkop-xaugp = ''.

         MODIFY lt_musterfkkop FROM ls_musterfkkop INDEX sy-tabix.

       ENDLOOP.

LOOP AT lt_eabps INTO ls_eabps WHERE potyp = 'X'.

         ls_eabps-betrh = 0.

         ls_eabps-betro = ls_eabps-betrw.

         ls_eabps-betrho = ls_eabps-betrw.

         MODIFY lt_eabps FROM ls_eabps INDEX sy-tabix.

       ENDLOOP.

LOOP AT lt_eabps INTO ls_eabps WHERE potyp = 'W'.

         ls_eabps-betrh = 0.

         ls_eabps-betrw = bb_amount. (New amount to be updated)

         ls_eabps-betro = bb_amount.  (New amount to be updated)

         ls_eabps-betrho = ls_eabps-skfbt.

         MODIFY lt_eabps FROM ls_eabps INDEX sy-tabix.

       ENDLOOP.

CALL FUNCTION 'FKK_TRANSFER_DOC_TO_PHYSICAL'

         EXPORTING

           mode          = 'V'

           accumulate    = 'X'

           i_calc_tax    = ''

           i_sample_flag = 'X'

         TABLES

           ifkkop        = lt_fkkop

           ifkkopw       = lt_fkkopw

           musterfkkop   = lt_musterfkkop

           logfkkop      = lt_eabps.

       CALL FUNCTION 'FKK_GET_PHYSICAL_VIEW_CHANGE'

         TABLES

           changed_ifkkop  = lt_fkkop

           insert_ifkkop   = lt_ins_fkkop (pass empty table)

           delete_ifkkop   = lt_del_fkkop (pass empty table)

           modify_ifkkop   = lt_mod_fkkop (pass empty table)

           changed_ifkkopw = lt_fkkopw

           insert_ifkkopw  = lt_ins_fkkopw (pass empty table)

           delete_ifkkopw  = lt_del_fkkopw (pass empty table)

           modify_ifkkopw  = lt_mod_fkkopw (pass empty table)

           musterfkkop     = lt_musterfkkop.

       CALL FUNCTION 'FKK_UPDATE_PHYSICAL_VIEW'

         EXPORTING

           ix_sample_flag    = 'X'

           ix_changedoc_flag = 'X'

         TABLES

           i_mod_ifkkop      = lt_musterfkkop

           i_mod_ifkkopw     = lt_mod_fkkopw (pass empty table)

           i_ins_ifkkop      = lt_ins_fkkop (pass empty table)

           i_ins_ifkkopw     = lt_ins_fkkopw (pass empty table)

           i_del_ifkkop      = lt_del_fkkop (pass empty table)

           i_del_ifkkopw     = lt_del_fkkopw (pass empty table)

           i_create_fkkop    = lt_fkkop

           i_create_fkkopw   = lt_fkkopw

           i_create_fkkopk   = lt_fkkopk (pass empty table)

         EXCEPTIONS

           error             = 1

           OTHERS            = 2.

       CALL FUNCTION 'FKK_TRANSFER_DOC_TO_LOGICAL'

         EXPORTING

           accumulate = ''

         TABLES

           ifkkop     = lt_fkkop

           ifkkopw    = lt_fkkopw

           logfkkop   = lt_logfkkop. (pass empty table)

COMMIT WORK AND WAIT.

Check the values in EK94. Amount will be updated for the non-billed periods.

Regards,

Manish Verma