cancel
Showing results for 
Search instead for 
Did you mean: 

How to read ABAP return parameter into java code

Former Member
0 Kudos

Hi all,

How JAVA environment can trap an error returned from abap code?

E.g.:

From a BAPI wrapper written like this:

"function zpm_gi_create .

*"----


""Interfaccia locale:

*" IMPORTING

*" VALUE(ZBAPIGOODSMVT) TYPE ZBAPIGOODSMVT

*" EXPORTING

*" VALUE(RETURN) TYPE BAPIRET2

*" VALUE(PO_NUMBER_ES) TYPE ZBAPIEKKO-PO_NUMBER

*" TABLES

*" GOODSMVT_ITEM STRUCTURE ZGOODSMVT_ITEM

*"----


data: goodsmvt_header type bapi2017_gm_head_01,

return2 type bapiret2 occurs 0 with header line,

....

call function 'BAPI_GOODSMVT_CREATE'

exporting

goodsmvt_header = goodsmvt_header

goodsmvt_code = zbapigoodsmvt-gm_code

testrun = 'X'

importing

  • GOODSMVT_HEADRET GM =

materialdocument = matdoc

matdocumentyear = matyear

tables

goodsmvt_item = gm_item

  • GOODSMVT_SERIALNUMBER =

return = return2.

...

Our return (for istance is):

"EBM 312The (internal) unit xx has not been maintained in

the unit table"

How JAVA environment can trap this error or interpret the BAPIRET2 structure?

Is there something to do in the corresponding syncBO?

regards,

eliana

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

hello elaina,

i'll assume that you are using SmartSync framework and want

to "trap" or get the BAPIRET2 result in the client.

for technical errors and BAPI exceptions, you can use the

<a href="https://media.sdn.sap.com/javadocs/NW04/SPS15/me/com/sap/ip/me/api/smartsync/MessageReply.html">MessageReply</a> API which can be monitored thru a MessageReplyObserver.

for other results like "successfully updated", you can use

<a href="https://media.sdn.sap.com/javadocs/NW04/SPS15/me/com/sap/ip/me/api/smartsync/SyncReply.html">SyncReply</a> and its corresponding SyncReplyObserver to get that info.

regards

jo

Former Member
0 Kudos

thanks jo,

problem solved:

steps:

0: abap EXPORTING VALUE(RETURN) TYPE BAPIRET2

1: my class implements SyncBoInDeltaObserver

2: my class has registered observer : SmartSyncRuntime.getInstance().getInboxNotifier().registerSyncBoInDeltaObserver(this);

3: method receivedSyncBoInDelta() print the msg returned from abap function:

syncBoInDelta.getSyncReply().getText()

eliana

Answers (1)

Answers (1)

kishorg
Advisor
Advisor
0 Kudos

Hi elina ,

these topic is already discussed in forum.

Jo has replied to this doubt in these links.

just note this..

have to change like this , when u follow the help.

if (messageReply.getType() == MessageReplyType.SYNC_BEGIN) {

}

if (messageReply.getType() == MessageReplyType.SYNC_END) {

}

Regards

Kishor Gopinathan