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: 

what is meant by sy-subrc = 1

Former Member
0 Kudos

Hi experts,

when sy-subrc = 1 case occurs in ABAP.

please let me clarify this.

thanks in advance

cheers

sailekha

11 REPLIES 11

Former Member
0 Kudos

hi,

It depends where that occurs ...in the sense if i use FM GUI_DOWNLOAD and get SY-SUBRC as 1 then it means that the file is already opened by someone ..so tell us the instance where you are getting this error ..


CALL FUNCTION 'GUI_DOWNLOAD'
   EXPORTING
        filename         = ld_fullpath
        filetype         = 'ASC'
*       APPEND           = 'X'
        write_field_separator = 'X'
*       CONFIRM_OVERWRITE = 'X'
   TABLES
        data_tab         = it_datatab[]     "need to declare and populate
   EXCEPTIONS
        file_open_error  = 1
        file_write_error = 2
        OTHERS           = 3.

0 Kudos

Hi

*"----


""Lokale Schnittstelle:

*" IMPORTING

*" VALUE(I_INFOCUBE) TYPE RSINFOCUBE

*" EXCEPTIONS

*" ILLEGAL_INPUT

*" REQUEST_NOT_CLOSED

*" INHERITED_ERROR

*"----


DATA: l_s_cube TYPE rsd_s_cube,

l_t_dummy TYPE rsdri_t_rfcdata,

l_s_rsapoadm TYPE rsapoadm,

l_nothing_found TYPE rs_bool.

  • get type of cube

CALL FUNCTION 'RSD_CUBE_GET_ONLY_DB'

EXPORTING

i_infocube = i_infocube

i_objvers = rs_c_objvers-active

i_with_atr_nav = rs_c_false

i_with_message = rs_c_false

IMPORTING

e_s_cube = l_s_cube

EXCEPTIONS

infocube_not_found = 1

illegal_input = 2

OTHERS = 3.

CASE sy-subrc.

WHEN 0.

WHEN 1.

<b>RAISE illegal_input</b>

WHEN OTHERS.

RAISE inherited_error.

ENDCASE.

In the short dump I observed that the porgram get intrupted at <b>RAISE illegal_input</b> when sy-subrc = 1.

please let me clarify thi as soon as possible.

cheers

sailekha

0 Kudos

It looks like you are passing invalid data in the field i_infocube. Put a breakpoint just before the function call and debug through the code to check that the field has been filled before the function is called.

- April

0 Kudos

hi,

chk the lines from 32 in that function module

IF i_infocube = space.

IF i_with_message = rs_c_true.

MESSAGE s867 RAISING illegal_input.

ELSE.

<b> RAISE illegal_input.</b>

ENDIF.

ENDIF.

0 Kudos

I got the problem in the Production System.......... I won't get any confirmation from my customer to debug the program in the Poduction.

In BW I have to load the data every day using the process chain. in the monitor I can't find any problem every thing is working fine. status is green.. and loads the data into ODS successfully. But the job runs more than 6 Hrs and automatically an E-mail is sent to us that the processing takes long time.But it loads the data successfully into ODS.

Since 10 days everyday we got a mail with the same problem. My customer asked me tTo analyse the problem.

I check the short dump there I found that due to some problem the program get intrupted.

I need to analyse this......... whay is so happened...............

Any one of you face the same problem............... if so please let me give your valuble suggestions regarding this.

Cheers

sailekha

0 Kudos

Which program is being interrupted? Do you mean the one that loads the data into ODS, or the one that is using this infocube data? Do you have some other way to verify that all of the data is correct in ODS and that there aren't any corrupt or invalid entries?

- April

alex_m
Active Contributor
0 Kudos

Occurs of Sy-SUBRC 1 will varry statement to statement, whats your place.

Former Member
0 Kudos

hi,

It depends on the ABAP statement that we are using , check F1 help on each abap statement so that you will get to know the SY-SUBRC values of that statement

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Well, usually SY-SUBRC would be set to 1 when an exception of a function module of class/method is mapped to sy-subrc =1.

For example.........

  
  call function 'ZTEST'
     exceptions
         not_found   = 1
         not_here     = 2
         not_there     = 3.

case sy-subrc.
    when '1'.
        
    when '2'.
   
    when '3'.
 
endcase.


Regards,

RIch HEilman

ferry_lianto
Active Contributor
0 Kudos

Hi,

Please check this information regarding SY-SUBRC perhaps they may help.

SY-SUBRC is one of the abap system field. ABAP system fields are always available in ABAP programs. The runtime system fills them according to context. They can then be used in programs to query the system status. System fields are variables but you should always treat them as though they were constants, and only read them. If you change their values, important information for the flow of the program may be lost. In exceptional circumstances, system fields may be overwritten in an ABAP program to control the system – for example, SY-LSIND (for navigating to a detail list).

SY-SUBRC

Return value set by the following ABAP statements. In general, a content of 0 means that the statement was executed without problems.

· ASSIGN sets SY-SUBRC to 0 if assignment to field symbol is possible, otherwise 4.

· ASSIGN dref->* sets SY-SUBRC to 0 if dereferencing is possible, otherwise 4.

· AUTHORITY-CHECK sets SY-SUBRC to 0 if the user has the necessary authorization, otherwise 4, 8, 12, 16, 24, 28, 32, or 36 depending on the cause.

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

· CALL FUNCTION sets SY-SUBRC according to the exception handling.

· CALL METHOD sets SY-SUBRC according to the exception handling.

· CALL SELECTION-SCREEN sets SY-SUBRC to 0 if the user chose Enter or Execute and 4 if the user chose Cancel.

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

· CATCH SYSTEM-EXCEPTIONS sets SY-SUBRC if there are runtime errors after the ENDCATCH statement. The value is specified in the program.

· COMMIT WORK sets SY-SUBRC to 0.

· COMMIT WORK AND WAIT sets SY-SUBRC to 0 if update was successful, otherwise <>0.

· COMMUNICATION INIT DESTINATION … RETURNCODE sets SY-SUBRC as specified.

· CONCATENATE sets SY-SUBRC to 0 if the result fits into target variable, otherwise 4.

· CREATE OBJECT sets SY-SUBRC if the exceptions of the instance constructor are handled.

· CREATE OBJECT in OLE2 sets SY-SUBRC to 0 if an external object was created, otherwise 1,2, 3 with different causes.

· DELETEsets SY-SUBRC to 0 if operation was successful, otherwise 4 or <> 0 depending on cause.

· DEMAND … MESSAGES INTO sets SY-SUBRC to 0 if a message table is empty, otherwise <> 0.

· DESCRIBE LIST sets SY-SUBRC to 0 if row or list exists, otherwise 4 or 8.

· EXEC SQL - ENDEXEC sets SY-SUBRC to 0 in almost all cases. Only if no set was read with FETCH is SY-SUBRC 4.

· FETCHsets SY-SUBRC to 0 if at least one row was read, otherwise 4.

· GENERATE SUBROUTINE POOL sets SY-SUBRC to 0 if generation was successful, otherwise 8.

· GET CURSOR sets SY-SUBRC to 0 if the cursor is correctly positioned, otherwise 4.

· GET PARAMETER sets SY-SUBRC to 0 if value found in SAP Memory, otherwise 4.

· IMPORTsets SY-SUBRC to 0 if import of data objects was successful, otherwise 4.

· INSERTsets SY-SUBRC to 0 if operation was successful, otherwise 4.

· LOAD REPORT sets SY-SUBRC to 0 if operation was successful, otherwise 4 or 8 depending on cause.

· LOOPsets SY-SUBRC to 0 if loop over extract was passed at least once, otherwise 4.

· LOOP ATsets SY-SUBRC to 0 if loop over internal table was passed at least once, otherwise 4.

· MODIFYsets SY-SUBRC to 0 if operation was successful, otherwise 4.

· MODIFY LINE sets SY-SUBRC to 0 if list row was changed, otherwise <> 0.

· MODIFYsets SY-SUBRC to 0 if operation was successful, otherwise 4.

· OLE2 automation, bundled commands set SY-SUBRC to 0 if all were successfully executed, otherwise 1, 2, 3, 4 depending on cause.

· OPEN DATASET sets SY-SUBRC to 0 if the file was opened, otherwise 8.

· Open SQL commands set SY-SUBRC to 0 if operation was successful, otherwise <>0.

· OVERLAYsets SY-SUBRC to 0 if at least one character is overlayed, otherwise 4.

· READ DATASET sets SY-SUBRC to 0 if the read operation was successful, otherwise 4 or 8 depending on cause.

· READ LINE sets SY-SUBRC to 0 if list row exists, otherwise <> 0.

· READ TABLE sets SY-SUBRC to 0 if the table row was found, otherwise 2, 4, 8 depending on cause.

· REPLACEsets SY-SUBRC to 0 if search string could be replaced, otherwise <> 0.

· ROLLBACK WORK always sets SY-SUBRC to 0.

· SCROLLsets SY-SUBRC to 0 if scrolling in list successful, otherwise 4 or 8 depending on cause.

· SEARCHsets SY-SUBRC to 0 if search string was found, otherwise 4.

· SELECTsets SY-SUBRC to 0 if at least one row was read, otherwise 4 or even 8 with SELECT SINGLE FOR UPDATE.

· SET COUNTRY sets SY-SUBRC to 0 if country ID was found in table T005X, otherwise 4.

· SET BITsets SY-SUBRC to 0 if bit was set, otherwise <> 0.

· SET TITLEBAR sets SY-SUBRC to 0 if title exists, otherwise 4.

· SHIFT … UP TO sets SY-SUBRC to 0 if position was found in character string, otherwise 4.

· SPLITsets SY-SUBRC to 0 if size of target fields is sufficient, otherwise 4.

· UPDATEsets SY-SUBRC to 0 if operation successful, otherwise 4.

· WRITE … TO sets SY-SUBRC to 0 if assignment successful, otherwise 4.

With one exception the names and data types of the system fields are stored in the ABAP Dictionary in the SYST structure and realized as components of the predefined structure SY in ABAP programs.

Regards,

Ferry Lianto

Former Member
0 Kudos

Hi there. It depends on what you are trying to do when you get that return code. If you are trying to read in a file or something like that, a return code of 1 can mean that the file wasn't found. If you are calling a function module, the module may have a specific exception assigned to that return code.

- April King