11-08-2006 3:37 AM
Hi everybody what is the main purpose of return code.
Data dictionary structures
-BAPIRETURN
-BAPIRETURN1
-BAPIRET1
-BAPRET2.
THANKS IN ADVANCE.
11-08-2006 2:27 PM
Hi nagini,
1. The only purpose is that they
have some more fields / extra fields / different fields.
2. Instead of enhancing the same structure,
SAP has created new structures,
so that the old ones are not distrubed.
(Since they are used in BAPI, its critial not to disturb them)
regards,
amit m.
11-08-2006 3:41 AM
Hi,
All the BAPIs will the return the success or error messages in the return parameter..
The sy-subrc will always be zero..
For checking if the BAPI is successful or not..do the following..
LOOP AT RETURN WITH TYPE = 'E' OR TYPE 'A'.
EXIT.
ENDLOOP.
IF SY-SUBRC <> 0.
SUCCESSFUL END OF TRANSACTION
ELSE.
TRANSACTION FAILED..
ENDIF.
Thanks,
Naren
11-08-2006 4:35 AM
Each BAPI has a return parameter that is either an export parameter or an export table.
A BAPI should be able to record and classify all possible errors that may occur.
You have to create a parameter named Return for every BAPI. This parameter returns exception messages or success messages to the calling program.
BAPIs themselves must not trigger any messages (such as MESSAGE xnnn) in the coding. In particular they must not generate terminations or display dialog boxes. Instead, all messages must be intercepted internally and reported back to the calling program in the Return parameter. Otherwise the BAPI will not be processed correctly and control may not be given back to the calling program.
The export parameter Return can be implemented as follows:
As a structure, whereby it must be defined in the function module as an export parameter, as well as in the method in the BOR.
As a table, whereby it must be defined in the function module as a table parameter, as well as in the method in the BOR as an export parameter.
Before filling the Return parameter you should either initialize the structure with CLEAR or the table with REFRESH and CLEAR.
If the return parameter is not set or is set to an initial value this means that no error has occurred.
The Return parameter may be based on the following reference structures:
BAPIRET2
You must use this reference structure when developing new BAPIS.
BAPIRET1, BAPIRETURN
These reference structures are still partly used in old BAPIs.
Both structures must be filled in the logon language.
Have a look at return parameters in below link.
http://help.sap.com/saphelp_nw04/helpdata/en/a5/3ec9f74ac011d1894e0000e829fbbd/frameset.htm
Best Regards,
Vibha
*Please mark all the helpful answers
11-08-2006 2:23 PM
do they have any particular situations to use particular return codes like BAPIRETURN1/BAPIRETURN/BAPIRET1/BAPIRET2
11-08-2006 2:27 PM
Hi nagini,
1. The only purpose is that they
have some more fields / extra fields / different fields.
2. Instead of enhancing the same structure,
SAP has created new structures,
so that the old ones are not distrubed.
(Since they are used in BAPI, its critial not to disturb them)
regards,
amit m.