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: 

FM or BAPI for Invoice Lock

sudipkumarpatra
Explorer
0 Kudos

Hi Experts,

Could you please anyone suggest any Function Module name or BAPi name to put invoice lock in contract account level.

Regards,

Sudip

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Sudip,

     Please find the code as below.

  DATA: lv_result TYPE char01.

   DATA l_tfk047s TYPE tfk047s.

   DATA: l_loobj  TYPE dfkklocks-loobj1.

   DATA: l_fkklock TYPE dfkklocks,

         lv_gpart TYPE fkkvkp-gpart.

   STATICS: stat_lockr  TYPE tfk047s-mansp.

   CONSTANTS: con_final_day TYPE datum VALUE '99991231'.

   SELECT SINGLE gpart FROM fkkvkp INTO lv_gpart WHERE vkont = p_vkont.

* Build the key for the lock object

   l_loobj = p_vkont.

   l_loobj+12 = lv_gpart.

* Build complete key of DFKKLOCKS entry

   l_fkklock-client = sy-mandt.

   l_fkklock-loobj1 = l_loobj.

   l_fkklock-lotyp = '06'.

   l_fkklock-proid = '05'.

   l_fkklock-lockr = '3'.

   l_fkklock-fdate = sy-datum.

   l_fkklock-tdate = con_final_day.

   l_fkklock-gpart = lv_gpart.

   l_fkklock-vkont = p_vkont.

   CALL FUNCTION 'FKK_S_LOCK_CREATE'

     EXPORTING

       i_loobj1              = l_fkklock-loobj1

       i_gpart               = l_fkklock-gpart

       i_vkont               = l_fkklock-vkont

       i_proid               = l_fkklock-proid

       i_lotyp               = l_fkklock-lotyp

       i_lockr               = l_fkklock-lockr

       i_fdate               = l_fkklock-fdate

       i_tdate               = l_fkklock-tdate

     EXCEPTIONS

       already_exist         = 1

       imp_data_not_complete = 2

       no_authority          = 3

       enqueue_lock          = 4

       wrong_data            = 5

       OTHERS                = 6.

Let me know if you face any problem.

Thanks

Rout

View solution in original post

2 REPLIES 2

Former Member
0 Kudos

Hi Sudip,

     Please find the code as below.

  DATA: lv_result TYPE char01.

   DATA l_tfk047s TYPE tfk047s.

   DATA: l_loobj  TYPE dfkklocks-loobj1.

   DATA: l_fkklock TYPE dfkklocks,

         lv_gpart TYPE fkkvkp-gpart.

   STATICS: stat_lockr  TYPE tfk047s-mansp.

   CONSTANTS: con_final_day TYPE datum VALUE '99991231'.

   SELECT SINGLE gpart FROM fkkvkp INTO lv_gpart WHERE vkont = p_vkont.

* Build the key for the lock object

   l_loobj = p_vkont.

   l_loobj+12 = lv_gpart.

* Build complete key of DFKKLOCKS entry

   l_fkklock-client = sy-mandt.

   l_fkklock-loobj1 = l_loobj.

   l_fkklock-lotyp = '06'.

   l_fkklock-proid = '05'.

   l_fkklock-lockr = '3'.

   l_fkklock-fdate = sy-datum.

   l_fkklock-tdate = con_final_day.

   l_fkklock-gpart = lv_gpart.

   l_fkklock-vkont = p_vkont.

   CALL FUNCTION 'FKK_S_LOCK_CREATE'

     EXPORTING

       i_loobj1              = l_fkklock-loobj1

       i_gpart               = l_fkklock-gpart

       i_vkont               = l_fkklock-vkont

       i_proid               = l_fkklock-proid

       i_lotyp               = l_fkklock-lotyp

       i_lockr               = l_fkklock-lockr

       i_fdate               = l_fkklock-fdate

       i_tdate               = l_fkklock-tdate

     EXCEPTIONS

       already_exist         = 1

       imp_data_not_complete = 2

       no_authority          = 3

       enqueue_lock          = 4

       wrong_data            = 5

       OTHERS                = 6.

Let me know if you face any problem.

Thanks

Rout

AmlanBanerjee
Active Contributor
0 Kudos

Sudip,

Don't know whether, your requirement to put the invoice lock is through some event or custom program.

However, if its a standard one, you can use std t.code FKLOCK2 for placing the invoicing locks.

Or, as mentioned in the above post use FM FKK_S_LOCK_CREATE to place the locks.

Hope it helpss...

Thanks,

Amlan