Application Development and Automation 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: 
Read only

SAP functions without exceptions

Former Member
0 Likes
1,254

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
Read only

Former Member
0 Likes
826

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
Read only

uwe_schieferstein
Active Contributor
0 Likes
826

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

Read only

0 Likes
826

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.

Read only

Former Member
0 Likes
827

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.

Read only

0 Likes
826

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.