I'm new to using SAP products and am investigating using JCO (3.0.7) to execute BAPI functions.
From what I understand, each BAPI needs to define a return structure which can be of type: BAPIRETURN, BAPIRETURN1, BAPIRET1, BAPIRET2 or BAPIRET2_FIX.
As far as I can see from the documentation, regardless of which type is used, the return structure will always be available in the structure export parameter "RETURN".
Is this understanding correct?
Sorry if this is obvious/clearly documented somewhere.
Thanks in advance.
That's correct. A BAPI that is set-up according to the BAPI design specifications always returns a RETURN parameter. In older BAPIs, it returns a structure of type BAPIRETURN, but in newer BAPIs, it either returns a structure or table of type BAPIRET2.
Do note that it is not enforced in SAP/ABAP to build BAPIs this way. You may run into esp. custom BAPIs that are not following these guidelines and don't return the RETURN parameter.