2015 Dec 24 6:56 PM
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.
2015 Dec 25 5:21 AM
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
2015 Dec 25 5:46 AM
2015 Dec 25 9:43 PM
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.
2015 Dec 26 6:26 AM
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!!
2015 Dec 26 9:12 AM
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
2015 Dec 28 5:49 PM
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
2015 Dec 28 6:43 PM
Does the database actually get updated? After the program is finished, if you select the data, do you see it?
Rob
2015 Dec 28 7:23 PM
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
2015 Dec 29 12:43 AM
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