04-12-2008 8:00 AM
HI to all
There is one existing BDC program.
coding as follows...
FORM f_update_pa9015 USING f_ovtm STRUCTURE t_ovtm.
DATA : l_date TYPE char10,
l_value TYPE char10,
l_opt TYPE ctu_params,
e_mess TYPE bdcmsgcoll OCCURS 40 WITH HEADER LINE.
CLEAR: bdcdata, bdcdata[], l_date, l_value, e_mess, e_mess[].
CALL FUNCTION 'CONVERSION_EXIT_PDATE_OUTPUT'
EXPORTING
input = f_ovtm-datum
IMPORTING
output = l_date.
l_value = f_ovtm-ovrtm.
PERFORM bdc_dynpro USING 'SAPMP50A' '1000'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=INS'.
PERFORM bdc_field USING 'RP50G-PERNR'
keytable-pernr.
PERFORM bdc_field USING 'BDC_SUBSCR'
'/1PAPAXX/HDR_19000A 0100SUBSCR_HEADER'.
PERFORM bdc_field USING 'BDC_SUBSCR'
'SAPMP50A 0320SUBSCR_ITMENU'.
PERFORM bdc_field USING 'BDC_SUBSCR'
'SAPMP50A 0330SUBSCR_TIME'.
PERFORM bdc_field USING 'BDC_SUBSCR'
'SAPMP50A 0350SUBSCR_ITKEYS'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RP50G-SUBTY'.
PERFORM bdc_field USING 'RP50G-CHOIC'
'9015'.
PERFORM bdc_dynpro USING 'MP901500' '2000'.
PERFORM bdc_field USING 'BDC_CURSOR'
'P9015-BEGDA'.
PERFORM bdc_field USING 'BDC_OKCODE'
'UPD'.
PERFORM bdc_field USING 'P9015-BEGDA'
l_date.
PERFORM bdc_field USING 'P9015-ENDDA'
l_date.
PERFORM bdc_field USING 'P9015-ESTDT'
l_date.
PERFORM bdc_field USING 'P9015-BETRG'
l_value.
PERFORM bdc_field USING 'P9015-WAERS'
'INR'.
PERFORM bdc_field USING 'P9015-YYREASN'
f_ovtm-ovtxt.
l_value = f_ovtm-apphr.
PERFORM bdc_field USING 'P9015-YYACTHR'
l_value.
CLEAR l_value.
l_value = f_ovtm-anzhl.
PERFORM bdc_field USING 'P9015-YYCALHR'
l_value.
CLEAR : l_opt.
l_opt-dismode = 'N'.
l_opt-updmode = 'S'.
l_opt-defsize = 'X'.
l_opt-racommit = 'X'.
bold PERFORM f_dequeue_employee USING keytable-pernr.
CALL TRANSACTION 'PA30' USING bdcdata OPTIONS FROM l_opt
MESSAGES INTO e_mess.
PERFORM f_enqueue_employee USING keytable-pernr.
bold
LOOP AT e_mess WHERE msgtyp = 'E' OR msgtyp = 'A'.
EXIT.
ENDLOOP.
IF sy-subrc = 0.
e_mess-msgtyp = 'E'.
e_mess-msgid = '333'.
e_mess-msgnr = 'S1'.
e_mess-msgv1 = 'Error in Posting OT Tracking for Date'.
e_mess-msgv2 = l_date.
APPEND e_mess. CLEAR e_mess.
PERFORM f_display_errors TABLES e_mess.
ENDIF.
ENDFORM. " f_update_pa9015
I am getting the error 'Personal number(s) could not be locked'.
message appeared.
It post the data in screen.
I want to stop processing if some other person is working on same PERNR(Emp no).
Is it the right to use first dequeue and then enqueue function module.
Please guide me where is the problem.
Regards
Anubhav Gupta
04-13-2008 7:54 AM
Dear Anubhav,
Call transaction starts a new session. So if you lock the person number using f_enqueue before calling the transaction and if the transaction again tries to lock the person number using enqueue, it will fail and give the message "The personal number could not be locked".
There is no guaranteed method to do what you want. What you can do is to reduce the chance of getting this error.
Call enqueue. If you can successfully lock the personal number, call dequeue and call this transaction. In case of failure, just call dequeue and give the message and exit.
so the code should be like.
Call enqueue
If success
call dequeue
call transaction.
else
call dequeue.
endif
Why it is not guaranteed. It is possible that between your dequeue and the enqueue of the transaction, someone else locks it again. But you know the chances are less.
Please note: I made one assumption in the above description: the transaction PA30 also enqueues the personal number, but it looks logical from your question.
Last words: Try to find a BAPI to post the data into the system. BAPIs are much more better and faster in doing the job. For getting the right BAPI, try to post a query in relevant section (I don't know which section). As BAPIs works in the same session as caller, you can directly use enqueue before calling the BAPI and dequeue later for achieving your goal.
Regards, Rakesh
04-12-2008 8:56 AM
Hi Anubhav Gupta, Reverse the operation .First Enquee second Dequee. Just check the documentation. [http://help.sap.com/saphelp_46c/helpdata/en/af/22ab01dd0b11d1952000a0c929b3c3/content.htm|http://help.sap.com/saphelp_46c/helpdata/en/af/22ab01dd0b11d1952000a0c929b3c3/content.htm] Thanks, Venkat.O
04-13-2008 7:54 AM
Dear Anubhav,
Call transaction starts a new session. So if you lock the person number using f_enqueue before calling the transaction and if the transaction again tries to lock the person number using enqueue, it will fail and give the message "The personal number could not be locked".
There is no guaranteed method to do what you want. What you can do is to reduce the chance of getting this error.
Call enqueue. If you can successfully lock the personal number, call dequeue and call this transaction. In case of failure, just call dequeue and give the message and exit.
so the code should be like.
Call enqueue
If success
call dequeue
call transaction.
else
call dequeue.
endif
Why it is not guaranteed. It is possible that between your dequeue and the enqueue of the transaction, someone else locks it again. But you know the chances are less.
Please note: I made one assumption in the above description: the transaction PA30 also enqueues the personal number, but it looks logical from your question.
Last words: Try to find a BAPI to post the data into the system. BAPIs are much more better and faster in doing the job. For getting the right BAPI, try to post a query in relevant section (I don't know which section). As BAPIs works in the same session as caller, you can directly use enqueue before calling the BAPI and dequeue later for achieving your goal.
Regards, Rakesh
04-14-2008 8:08 AM
Hello Rakesh
Thanks For your reaponse.
Actually after getting 'Personal no. could not be locked' Error message, Over time is posted and again it shows in uapproved list.
My requirement is that if that message appeares, it should stop processing and should not process further.
Please guide.
Regards
Anubhav Gupta
04-14-2008 8:31 AM
hi,
After displaying that error message write the following statement :
STOP.
Regards,
Raghu.