‎2006 Oct 17 3:46 PM
Hello All,
I am working with a BAPI. While i am testing my BAPI I found that BAPI is failing to put the data in SAP. But still i am seeing that sy-subrc returned by BAPI is "0".
Why is it happening? How to fix it?
Thanks
SDN FAN
‎2006 Oct 17 4:25 PM
Hi,
If there is no row of type 'E' in the return internal table..WHich means it is successfully posted..
After calling the BAPI.
Call the function module 'BAPI_TRANSACTION_COMMIT' to commit the changes..Then check the database..
Thanks,
Naren
‎2006 Oct 17 3:49 PM
Hi,
Bapi will not set the sy-subrc if there is any exception or successful..Instead you have to look at the parameter RETURN..Which will have error messages if there is any..
Example of how to check the error messages..
READ TABLE T_RETURN WITH KEY TYPE = 'E'.
IF SY-SUBRC = 0.
Not successful.
ELSE.
Successfull.
ENDIF.
Thanks,
Naren
‎2006 Oct 17 4:06 PM
Naren,
That is what I doing checking for some exepection catching into Return table which is not happening even though the recording not posted.
I found the reason for Return table not being filled up due to sy-subrc = 0.
Why it is happening is biggg!!! wonder for me
‎2006 Oct 17 3:50 PM
‎2006 Oct 17 4:03 PM
Madhavi- My requirement was not save the record but to know why it is happening
‎2006 Oct 17 3:55 PM
Hi,
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT' after the BAPI call.
Check the BAPI table I_RETURN :
LOOP AT i_return INTO wa_return WHERE type = c_e AND
id <> c_mepo.
PERFORM populate_error_log USING c_fail
p_input-column1
ws_po
wa_return-message space space.
EXIT.
ENDLOOP.
Reward points if this helps.
Manish
‎2006 Oct 17 3:56 PM
Hello
Assuming that you have committed your BAPI call either success or failure will be returned as following:
- Success: either no return message at all or 'S'(uccess) message
- Failure: at least a single 'AEX' message (abort, error, X = dump)
Regards
Uwe
‎2006 Oct 17 4:25 PM
Hi,
If there is no row of type 'E' in the return internal table..WHich means it is successfully posted..
After calling the BAPI.
Call the function module 'BAPI_TRANSACTION_COMMIT' to commit the changes..Then check the database..
Thanks,
Naren