Skip to Content
author's profile photo Former Member
Former Member

Problem in BDC program

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    Posted on Apr 13, 2008 at 06: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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 12, 2008 at 07: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

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.