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

Problem in BDC

Former Member
0 Likes
2,372

Hii all,

I have develop a BDC for transaction pa30( for 2013 infotype ).

DATA: MODE1 TYPE C VALUE 'N',

UPDT1 TYPE C VALUE 'A'.

CALL TRANSACTION 'PA30' USING BDCDATA

MODE MODE1

UPDATE UPDT1

MESSAGES INTO MESSTAB.

If any one open pa30 for any employy and the same time if i run that bdc for that particular employee

it shows an error message.

Problem :If i try to upload data in pa30 for multiple employee and the first employee is lock by some other user then the erroe messege coming that all other employee also lock.

But if first employee is not locked but second employee locked then the the first employee's data update successfully,for second employee shows a message that the employee is locked by some other user.In the selection screen if there is 3rd employee that also update successfully.

plz help.

Edited by: sk2789 on Feb 18, 2011 5:07 AM

Moderator message: please use more descriptive subject lines for your posts.

Edited by: Thomas Zloch on Feb 18, 2011 3:23 PM

17 REPLIES 17
Read only

Former Member
0 Likes
2,137

null

Edited by: davuluria on Feb 18, 2011 5:39 AM

Edited by: davuluria on Feb 18, 2011 5:40 AM

Read only

0 Likes
2,137

wht is the meaning of null?

Read only

0 Likes
2,137

Nothing..lol!!

Read only

madhu_vadlamani
Active Contributor
0 Likes
2,137

Hi Sk,

When you are uploading this data day time or night . If it is a night time just run a back ground in time .

Regards,

Madhu.

Read only

vinod_vemuru2
Active Contributor
0 Likes
2,137

Hi,

How are you updating the records? Is it one by one or all employees at once? Do it in LOOP of employees so that if error comes for one record, it wont affect others.

LOOP AT employees

CALL BDC

ENDLOOP.

thanks,

Vinod.

Read only

0 Likes
2,137

Yes i have already use the loop statement.

This BDC update multiple employee's data at a time.

if the first employee has been locked by some one in the time of updation .Other employee's data not updated and showing

the message that othe employee also locked.

But if the first employee not locked then all other employee's data update successfully except the emloyee which is locked.

Read only

0 Likes
2,137

did you debug it and see whats happening , I mean when first employee is locked is the control coming out of loop?

Read only

0 Likes
2,137

Hi,

can you try with Synchronous update instead of asynchronous update?


DATA: MODE1 TYPE C VALUE 'N',
UPDT1 TYPE C VALUE 'S'.  "change to S

CALL TRANSACTION 'PA30' USING BDCDATA
MODE MODE1
UPDATE UPDT1
MESSAGES INTO MESSTAB.

Thanks,

Vinod.

Read only

0 Likes
2,137

Yes i check in dibugg mode.

it's not come out from the loop.

BDCDATA table alyz hold the first employee.

Read only

0 Likes
2,137

Hi,

Search some table/FM to check that record is locked by other user.

LOOP.

Peform Check_lock_data.

if v_lock_data = 'X'.

continue.

else.

BDC

endif.

ENDLOOP.

Reagrds,

Prasoon

Read only

Former Member
0 Likes
2,137

hi

send me code generated through recording.....

Edited by: Prabhakar.. on Feb 18, 2011 11:53 AM

Read only

0 Likes
2,137

<removed by moderator>

Moderator message: please post only relevant code parts, observe the maximum of 5000 characters per post to preserve formatting.

Edited by: Thomas Zloch on Feb 18, 2011 3:28 PM

Read only

0 Likes
2,137

LOOP AT employee.

PERFORM check_lock_data.

IF v_lock_flag = 'X'.

CONTINUE.

ELSE.

PERFORM bdc_upload.

ENDIF.

CLEAR v_lock_flag.

ENDLOOP.

FORM check_lock_data.

TABLES: rp50g.

rp50g-pernr = '00003'. "Your Pernr from LOOP

DATA message_handler TYPE REF TO if_hrpa_message_handler.

DATA message_list TYPE REF TO cl_hrpa_message_list.

DATA message_tab TYPE hrpad_message_tab.

DATA mess_wa TYPE hrpad_message.

DATA is_ok TYPE boole_d.

CREATE OBJECT message_list.

message_handler = message_list.

*ensure that sapfp50p is loaded

PERFORM do_nothing IN PROGRAM sapfp50p.

CALL METHOD cl_hrpa_masterdata_enq_deq=>enqueue_by_pernr

EXPORTING

tclas = 'A'

pernr = rp50g-pernr

message_handler = message_handler

IMPORTING

is_ok = is_ok.

IF is_ok NE 'X'.

  • Set your error flag

v_lock_flag = 'X'.

ENDIF.

ENDFORM.

Let me know if it works.

Thanks,

Prasoon Sahay

Edited by: Prasoon Sahay on Feb 18, 2011 5:30 PM

Read only

0 Likes
2,137

It's not working.

Read only

0 Likes
2,137

The logic goes like this -

1.First lock an employee record using FM BAPI_EMPLOYEE_ENQUEUE for update. Based on the return value you can perform the updation task. If employee record gets locked successfully, chances are that your update will be 99.99 % successful.

2. Then update the employee record either using BDC or the function module(recommended) HR_INFOTYPE_OPERATION.

3. After update to the DB table is done, unlock the employee using FM BAPI_EMPLOYEE_DEQUEUE.

Regards,

rumhat

Read only

0 Likes
2,137

I have solved the problem by myself.

Thak u all for reply.

Read only

Former Member
0 Likes
2,137

Hi I'm giving some sample code to enqueue and dequeue for the particular employee

LOOP AT itab.

clear user.

CALL FUNCTION 'HR_EMPLOYEE_ENQUEUE'

EXPORTING

number = itab-pernr

IMPORTING

RETURN = return

LOCKING_USER = user

.

IF user is not INITIAL.

*skip the particular record and add the user name to the error list if required and skip this line.

continue.

ENDIF.

********your bdc code

perform bdc_Data. "etc.

****your bdc processing code

*after you complete the updation of the bdc i.e. after call transaction statement

*this is a must after you have done with your processing you have to dequeue the pernr so that other users can update

  • this particular user.

CALL FUNCTION 'HR_EMPLOYEE_DEQUEUE'

EXPORTING

number = itab-pernr

IMPORTING

RETURN =

.

ENDLOOP.

hope this works for you.

ragards

gnaneswar