I'm looking at the description of CALL - System Function Call in the SAP ABAP Keyword Definition. Such calls have the format CALL 'xxx' ID 'yyy' FIELD 'zzz'.
The ABAP Keyword Definition does not mention that sy-subrc
is set by calling a system function. But somehow, I suspect that it is.
sy-subrc
not mentioned => not set) Note that I'm not an ABAP programmer and I usually handle third-party ABAP programs in Java as text / parse tree. I know that one usually should not call system functions, but the ABAP code I look at might have such calls. Furthermore, I'm not interested in the actual value a specific system call sets sy-subrc
to, just in the fact whether system calls set/alter sy-subrc
or not.
Well, as you are asking this question you are already aware this is NOT recommended approach to use direct SYSTEM calls. However, if you still want to use them...
By using CALL
statement SAP kernel C-modules are called and without knowing the source we can not interpret the returning value confidently, either it's 0 or 1.
Despite there are examples (see line 230 of DYNP_VALUES_READ
FM) where sy-subrc
value is checked after system calls, nobody except SAP knows which value to check in certain case. Nor we.
Also there were reports ( 1 , 2 ) about ambiguous meaning of these values during tests.
So the answer is NO , sy-subrc
in this context brings no meaningful information.
PS Answering your questions:
SYSTEM
function. It calls arbitrary Unix command.
For example, you can move files stored on your ABAP Server like this:
CALL 'SYSTEM'
ID 'COMMAND'
FIELD 'mv /usr/sap/temporary
/usr/sap/definite'.
Now this should be a safe call that works on any system:
DATA: dbserver TYPE char255.
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'SAPDBHOST'
ID 'VALUE' FIELD dbserver.
As you probably already know there are some exceptions that can occur. As for sy-subrc
, when a command sets sy-subrc
it is usually explicitly mentioned in the documentation including which values it can hold and their meaning. But don't quote me on that.
Simple (harmless) function modules are RH_GET_DATE_DAYNAME
that requires the language and 10 character date (eg. 26.10.2016
) as input fields and DATE_TO_DAY
that only requires the 10 character date as input. The sy-subrc
should be returned as 0
if a valid date is entered.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.