cancel
Showing results for 
Search instead for 
Did you mean: 

Error Handling for Replication of R/3 Organization Address in SRM

Former Member
0 Kudos

Hi All,

We have successfully coded R/3 Enterprise METHOD ADDRESS1_SAVED using customized BADI Z_ADDRESS_UPDATE to replicate Ship-to address type ME01 addresses in SRM via RFC calls to BAPI's (add, change, delete) in SRM.

The problem I am having is with errors (TYPE 'E' or 'A') that might occur during the program run. At first, I set out using the MESSAGE ID... TYPE 'E' program command to capture the error and return the user to the screen to make corrections. The problem with using TYPE 'E' or TYPE 'A' is that the user is first presented with the error message and then kicked out of the MEAN transaction after pressing the <Enter> key and back to the main SAP R/3 screen, thus losing any address data entered on the screen. The functional people want the user returned to the address screen to make any corrections necessary, if possible.

If I use a MESSAGE TYPE 'I', the user is returned to the address screen in R/3, but can then save the address in R/3, by merely pressing the <Enter> key, but the corresponding address is NOT saved in SRM (we use a ROLLBACK WORK command in the remote BAPI if any errors occur. If the address cannot be saved in SRM, the functional people do NOT want the address saved in R/3.

As I write this note, it occurs to me that recovery from error messages of TYPE 'E' or 'A' may not be possible, since the error is coming from the remote BAPI and therefore is not correctable in R/3.

Is my thinking correct, or is there some solution I have not thought about?

As a side note, I also used the TRY-ENDTRY, RAISE EXCEPTION, CATCH commands to capture errors that were returned by the remote BAPI as follows:

TRY.

  • ----------------- *

  • Protected section *

  • ----------------- *

*---- Raise the exception cx_bapi_error

RAISE EXCEPTION TYPE CX_BAPI_ERROR

EXPORTING

t100_msgid = c_cl

t100_msgno = c_msg_001

t100_msgv1 = text-004

t100_msgv2 = SPACE

t100_msgv3 = SPACE

t100_msgv4 = SPACE

STATUS = t_return.

  • ------------ *

  • Handler code *

  • ------------ *

CATCH CX_BAPI_ERROR INTO ex_bapi_error.

LOOP AT ex_bapi_error->STATUS INTO ls_return.

CALL FUNCTION 'POPUP_DISPLAY_MESSAGE'

EXPORTING

MSGID = ls_return-id

MSGTY = ls_return-type

MSGNO = ls_return-number

MSGV1 = ls_return-message_v1.

MESSAGE ID ls_return-id

TYPE ls_return-type

NUMBER ls_return-number

WITH ls_return-message_v1

ls_return-message_v2

ls_return-message_v3

ls_return-message_v4.

CLEAR ls_return.

ENDLOOP.

CLEANUP.

CLEAR: t_return,

ls_return.

REFRESH t_return.

ENDTRY.

This OO code also works, but it causes the same problem when used in conjuction with the MESSAGE ID...TYPE 'E' and 'A' ... command; i.e. the user is presented with an error message and then kicked out of the SAP MEAN transaction after pressing the <Enter> key.

Thanks in advance.

Jim.

Message was edited by: Jim Isbell

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

How did you throw the error message and stop saving the data in DB .?