Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

SAP functions without exceptions

Former Member
0 Kudos

Hello,

how can I check sy-subrc

on a SAP function which has no exceptions?

e.g. function "PM_PARTNER_DELETE_PARVW".

If I try to check the sy-subrc after calling this function,

I will get following error on the code inspector:

No EXCEPTION to set SY_SUBRC Declared for CALL FUNCTION 'PM_PARTNER_DELETE_PARVW'.

Thanks for your help.

Ibrahim.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Instead of,

CALL FUNCTION 'PM_PARTNER_DELETE_PARVW'

EXPORTING

objnr = ls_equi-objnr

parvw = ls_ihpa-parvw.

use as

CALL FUNCTION 'PM_PARTNER_DELETE_PARVW'

EXPORTING

objnr = ls_equi-objnr

parvw = ls_ihpa-parvw

EXCEPTIONS

others = 1.

This will avoid the message.

4 REPLIES 4

uwe_schieferstein
Active Contributor
0 Kudos

Hello Ibrahim

Using this fm I assume you have to use at least two more fm's:

PM_PARTNER_UPDATE
BAPI_TRANSACTION_COMMIT

Eventually you can evaluate the RETURN message of the BAPI to see if the DB update worked.

Regards

Uwe

0 Kudos

Hello Uwe,

my code looks like following lines:

*The internal table contains all relevant partners

LOOP AT lt_ihpa_comp

INTO ls_ihpa.

CALL FUNCTION 'PM_PARTNER_DELETE_PARVW'

EXPORTING

objnr = ls_equi-objnr

parvw = ls_ihpa-parvw.

*my problem is here

IF sy-subrc <> 0.

CONTINUE.

ENDIF.

ENDLOOP.

*this function calls also the partner update function

CALL FUNCTION 'PM_PARTNER_CALL_VB'

EXPORTING

objnr = ls_equi-objnr.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

Do you have any idea?

Thanks and regards,

Ibrahim.

Former Member
0 Kudos

Hi,

Instead of,

CALL FUNCTION 'PM_PARTNER_DELETE_PARVW'

EXPORTING

objnr = ls_equi-objnr

parvw = ls_ihpa-parvw.

use as

CALL FUNCTION 'PM_PARTNER_DELETE_PARVW'

EXPORTING

objnr = ls_equi-objnr

parvw = ls_ihpa-parvw

EXCEPTIONS

others = 1.

This will avoid the message.

0 Kudos

EXCEPTIONS

others = 1.

This will avoid the message.

True, but there's no point in it (at least until some exceptions are added to the function later in time).

If certain function has no exceptions defined, there's no point to code conditions over SY-SUBRC value.