In BDC Call transaction for MBST reversal postings After the BDC Success posting the indicator field from Ztable should update to blank and I need to print the error records and success records as well. I am sending the steps that I am doing. Please validate.
1) Fethcing the records from Z (BUKRS,BDS RefNo,Budat ) where indicator is 'X'.
2) Based on Budat and bds reference number I am fetching records from MSEG and MKPF by joining these two tables into an final internal table.
3) looping to the final internal table I am doing the BDC posting the data to MBST.
4) inside the call transaction if sy-subrc = 0 then for that success records I need to set the Z table indicator as Blank. for this I am using the query
UPDATE z SET filed = ' '
WHERE key fields in Z table.
I am able to get the records are posted but the indicator is setting as it is and it is not moving blank after posting.
Could you please help me asap.
Are you sure sy-subrc is 0 after a successful call to the transaction? Some transactions return 0 when they fail, so I assume, that it could be non-zero even though it works. The safest thing to do is to put the messages returned from the transaction into a table and then analyze the table to see if the transaction worked or not.
Take care of 2 things.
1. Your update statement should be called after successful posting within the loop..endloop statement where you are calling BDC.
UPDATE Ztable SET field_indicator = ' '
WHERE key1 = ztable-field1 AND
key2 = ztable-field1 AND
keyn = ztable-fieldn.
and check the sy-subrc after Update statement in debug mode.
Pls reward for helpful replies!!