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: 

sy_subrc

Former Member
0 Kudos

when we reading the data from application server, we r checking the conditoin like

sy_subrc...

y we are checking the condition?

can anybody explain about this ?

Reagards,

swathi.

1 ACCEPTED SOLUTION

0 Kudos

Hi,

How are you reading the Data from the application server?

Suppose that you are using a Funcion module call to read the data then

For that function module call you will have some Exceptions listed with a number assigned for each exception.

The function module when called, raises an exception then the number that you assign to that exception will be stored in SY-SUBRC.

SO you need to check SY-SUBRC to see if the function module call is succesful in which case the value of SY-SUBRC will be 0 else it will be the number of the exception that is raised by the Function module.

There are many statements that effect SY-SUBRC, so after a statement if your code has a check for SY-SUBRC then assume that you are checking if the previous statement was sucessful or not.

To see the complete list of commands that effect SY-SUBRC use transaction "ABAPDOCU" and goto "Appendix" there.

Regards,

Sesh

6 REPLIES 6

0 Kudos

Hi,

How are you reading the Data from the application server?

Suppose that you are using a Funcion module call to read the data then

For that function module call you will have some Exceptions listed with a number assigned for each exception.

The function module when called, raises an exception then the number that you assign to that exception will be stored in SY-SUBRC.

SO you need to check SY-SUBRC to see if the function module call is succesful in which case the value of SY-SUBRC will be 0 else it will be the number of the exception that is raised by the Function module.

There are many statements that effect SY-SUBRC, so after a statement if your code has a check for SY-SUBRC then assume that you are checking if the previous statement was sucessful or not.

To see the complete list of commands that effect SY-SUBRC use transaction "ABAPDOCU" and goto "Appendix" there.

Regards,

Sesh

0 Kudos

thank u for your reply ..

This is by using bdc..

Regards,

swathi

0 Kudos

thank u for your reply Sesh..

This is by using bdc..

Regards,

swathi

0 Kudos

Hi,

Then you must be using CALL TRANSACTION and this statement will set SY-SUBRC.

So in you case

CALL TRANSACTION with USING sets SY-SUBRC to 0 if processing was successful, otherwise <>0.

Hope this was helpful

Regards,

Sesh

0 Kudos

Hi.. Swathi..

To Open a file On Application Server we have the Commands.

We must check the SY-SUBRC to know whether a particular operation is successful.

Eg:

OPEN DATASET V_DSN FOR INPUT IN TEXT MODE ENCODING DEFAULT.

<b>IF SY-SUBRC NE 0. "TO CHECK FILE IS OPENED/EXISTS</b> Message 'File Not Opened' Type 'E'.

Endif.

Do.

Read dataset v_dsn into wa.

<b> IF SY-SUBRC NE 0. "To check END OF FILE</b>

EXIT.

ENDIF.

ENDDO.

<b>Reward if Helpful</b>

Former Member
0 Kudos

Hi Swathi

sy-subrc is for checking the result

if it is zero means successful

is this is ur req?

reward points to all helpful answers

kiran.M