Application Development and Automation 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: 
Read only

function module for function location

Former Member
0 Likes
1,025

Hi All,

I want to implement locking concept in a report where I need to lock the function location (IL02), can any one please help me in getting the ENQUEUE AND DEQUEUE Function module .

Thanks

Shaw

3 REPLIES 3
Read only

Former Member
0 Likes
556

Hi kumar ,

You need to first go to transaction SE11 and then select the option lock.And in the tables option you need to place the table on to which the lock should be placed.While creating the lock you need to begin with the letter EZ which is the convention.Then while using it in the program you should call the lock as a FM - starting with ENQUEUE_LOCKNAME and DEQUEUE_FMNAME.

Regards,

varghese

Edited by: varghese oommen on Apr 28, 2009 6:13 PM

Read only

0 Likes
556

Thanks,

I am having just one confusion that, Is it be correct to implement customize lock object in the report.

I am just pointing this because in the existing report there is standard function module like

ENQUEUE_EIQMEL, DEQUEUE_EIQMEL for notification number.

Please Help me in this confusion

Thanks

shaw

Read only

former_member386202
Active Contributor
0 Likes
556

Hi,

Refer below code

ORM sub_update_database USING gt_hdrlog TYPE ty_t_monitor

gt_itmlog TYPE ty_t_error.

*--Local data declaration

DATA : ls_errormsg TYPE zapt_ar_error, "Error Table

ls_monitor TYPE zapt_ar_monitor. "Monitor table

*--Local Constant declaration

CONSTANTS : lc_x TYPE c VALUE 'X'.

*--Sort table by idoc number and legacy vendor

SORT gt_hdrlog BY doc_num altkn.

*--Delete Duplicate values from Header log internal table

DELETE ADJACENT DUPLICATES FROM gt_hdrlog COMPARING doc_num altkn.

*--Check if monitor table is initial

IF NOT gt_hdrlog[] IS INITIAL.

LOOP AT gt_hdrlog INTO ls_monitor.

*--Lock the DB table ZAPT_AR_MONITOR before updation

CALL FUNCTION 'ENQUEUE_EZAPT_AR_MONITOR'

EXPORTING

mode_zapt_ar_monitor = lc_x "Check

mandt = sy-mandt "Cient

doc_num = ls_monitor-doc_num "IDOC number

x_doc_num = lc_x "Check

EXCEPTIONS

foreign_lock = 1

system_failure = 2

OTHERS = 3.

IF sy-subrc NE 0.

WAIT UP TO 1 SECONDS.

ELSE.

*--If DB table is locked then insert data into custom table

INSERT into zapt_ar_monitor values ls_monitor.

IF sy-subrc NE 0.

*--Update custom table

UPDATE zapt_ar_monitor FROM ls_monitor.

ENDIF.

ENDIF.

*--Unlock the table after updation

CALL FUNCTION 'DEQUEUE_EZAPT_AR_MONITOR'

EXPORTING

mode_zapt_ar_monitor = lc_x "Check

mandt = sy-mandt "Client

doc_num = ls_monitor-doc_num "IDOC Number

x_doc_num = lc_x. "Check

*--Clear the work areas

CLEAR : ls_monitor.

ENDLOOP.

ENDIF.

*--Check if the internal table for error messages is initial

IF NOT gt_itmlog[] IS INITIAL.

LOOP AT gt_itmlog INTO ls_errormsg.

*--Lock the DB table ZAPT_AR_ERROR before updation

CALL FUNCTION 'ENQUEUE_EZAPT_AR_ERROR'

EXPORTING

mode_zapt_ar_error = lc_x "Check

mandt = sy-mandt "Client

idoc = ls_errormsg-idoc "IDOC Number

line_nbr = ls_errormsg-line_nbr "Line Number

err_nbr = ls_errormsg-err_nbr "error Number

x_idoc = lc_x "Check

x_line_nbr = lc_x "Check

x_err_nbr = lc_x "Check

EXCEPTIONS

foreign_lock = 1

system_failure = 2

OTHERS = 3.

IF sy-subrc NE 0.

WAIT UP TO 1 SECONDS.

ELSE.

*--If DB table is locked then modify the table

INSERT into zapt_ar_error values ls_errormsg.

IF sy-subrc NE 0.

*--Update custom table

UPDATE zapt_ar_error FROM ls_errormsg.

ENDIF.

ENDIF.

*--Unlock the table after modification

CALL FUNCTION 'DEQUEUE_EZAPT_AR_ERROR'

EXPORTING

mode_zapt_ar_error = lc_x "Check

mandt = sy-mandt "Client

idoc = ls_errormsg-idoc "IDOC Number

line_nbr = ls_errormsg-line_nbr "Line Number

err_nbr = ls_errormsg-err_nbr "Error Number

x_idoc = lc_x "Check

x_line_nbr = lc_x "Check

x_err_nbr = lc_x. "Check

*--Clear the work areas

CLEAR : ls_errormsg.

ENDLOOP.

ENDIF.

Regards,

Prashant