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

BDC Update Issue

Former Member
0 Likes
2,529

Hi,

                        I am having a weird problem in BDC. I am running a batch job every day in the production to perform Employee actions (Hiring, Job Change E.T.C) using an interface. The actual file comes from ADP. At some point in the program, I create a new position and I assign this position to create a new employee or perform a job change. For some reasons, after the position creation  BDC , the database table is not getting updated with the data . I am using a select statement right after the BDC to fetch the created position and assign it to the new employee as shown below. The Select statement Fails because it doesn't finds any record.  This is working fine in the foreground , Only batch jobs are failing . I Wonder Why ?  I even added COMMIT WORK, even though it is not related but No Luck.         

             

PERFORM bdc_transaction USING 'PP01'
CHANGING p_msg.

COMMIT WORK.

**** Create Relation-ships and Employee Group/ Sub group
** Read the Created Position from the Databse.
CLEAR : lv_objid.

SELECT otype objid INTO TABLE gt_pos
FROM hrp1000
WHERE plvar = '01'
AND   otype = 'S'
AND   istat = '1'
AND   endda = '99991231'
AND   aedtm = sy-datum
AND   uname = sy-uname
AND   short = lv_short.
IF sy-subrc = 0.

ENDIF.

FORM bdc_transaction  USING    tran

                       CHANGING p_msg TYPE  bdcmsgcoll .

DATA: p_mode TYPE CHAR1.

CLEAR: p_mode.

p_mode = 'N'.

  CALL TRANSACTION tran USING it_bdcdata

                                 MODE p_mode

                                 UPDATE 'S'

                                 MESSAGES INTO i_msg.

      REFRESH it_bdcdata.

ENDFORM.

9 REPLIES 9
Read only

0 Likes
2,177

Hi Vishnu,

Try WAIT  UP TO command before your select statement.

Sometime it takes time to update the data base table and you are reading the the database just after the CALL TRANSACTION.

Regards,

Abhishek

Read only

thangam_perumal
Contributor
0 Likes
2,177

This message was moderated.

Read only

Former Member
0 Likes
2,177

Thanks for your response Abishek and Thangam. I tried using Wait statement before Select but with no luck. I don't understand why it is only happening in the back ground.

Read only

0 Likes
2,177

hi,

database cursors get closed by COMMIT WORK statement, try to use SELECT.. ENDSELECT to fetch the records which you are updating through BDC CALL transactions.

and use of COMMIT WORK depends upon the updating mode,if you are using Asynchronous update  you need to put COMMIT WORK AND WAIT with explicit 3-4 seconds delay

or you can try using UPDATE mode as L i.e for local and with commit work and wait with explicit delay.

for synchronous mode COMMIT WORK works fine!!

thanks!!

Read only

0 Likes
2,177

Hi Vishnu,

Have you checked for any dump when running the BDC with background job. I must be giving "CNTL_SYSTEM_ERROR" runtime error.

There are some restriction with some tcodes which cannot be run with background job like enjoy transactions (MIGO,ME21N,etc) as they are using container element.

Regards

Abhishek

Read only

0 Likes
2,177

Hi Chintu Sharma,

                               I tried all of the methods that you mentioned. It is still the same. I don't understand why only with Job it is happening.

Thanks,

Vishnu

Read only

0 Likes
2,177

Does the database actually get updated? After the program is finished, if you select the data, do you see it?

Rob

Read only

Former Member
0 Likes
2,177

Hi Rob,

       The Database is not getting updated during the run time. It gets updated when i run the program  in the fore ground. Seems like the issue is with T-code as Abhishek said. Looks like PP01 cannot be used in the batch Job. I am trying to change my logic to use PP02 intead.

Thanks,

Vishnu

Read only

Former Member
0 Likes
2,177

Thank you all. the issue is fixed now. It is an issue with T-Code PP01, Seems like we cannot use PP01 in the back ground. I was able to achieve my requirement using PP02 instead.

Thanks,

Vishnu