‎2007 Aug 26 10:40 AM
Hi guys,
This is very very imp. plz help me.
i created a new function module. so that when i called that function module in some program its not displaying the " IF SY-SUBRC NE 0" at the end of the funtion module. how can i do it.
regards
venkat
‎2007 Aug 26 12:56 PM
Can you clarify the question please - are you saying you are calling the function module from a program, and then testing sy-subrc after the call? If so, then your function module needs to have a list of exceptions defined and then you use "raising <i>my_exception_name</i>." within the FM code and test this in your calling program e.g.
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
dyname = l_dyname
dynumb = l_dynumb
TABLES
dynpfields = lt_dynpfields
EXCEPTIONS
invalid_abapworkarea = 1
invalid_dynprofield = 2
invalid_dynproname = 3
invalid_dynpronummer = 4
invalid_request = 5
no_fielddescription = 6
invalid_parameter = 7
undefind_error = 8
double_conversion = 9
others = 10.
case sy-subrc.
when 0.
write: / 'all is good'.
when 1.
write: / 'invalid_abapworkarea found'.etc
Jonathan
‎2007 Aug 26 12:56 PM
Can you clarify the question please - are you saying you are calling the function module from a program, and then testing sy-subrc after the call? If so, then your function module needs to have a list of exceptions defined and then you use "raising <i>my_exception_name</i>." within the FM code and test this in your calling program e.g.
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
dyname = l_dyname
dynumb = l_dynumb
TABLES
dynpfields = lt_dynpfields
EXCEPTIONS
invalid_abapworkarea = 1
invalid_dynprofield = 2
invalid_dynproname = 3
invalid_dynpronummer = 4
invalid_request = 5
no_fielddescription = 6
invalid_parameter = 7
undefind_error = 8
double_conversion = 9
others = 10.
case sy-subrc.
when 0.
write: / 'all is good'.
when 1.
write: / 'invalid_abapworkarea found'.etc
Jonathan
‎2007 Aug 27 1:36 AM
Hi Venkat..
If i understood your question correct.. you are talking about the PATTERN button in the abap editor..
You are trying to add the code for calling your function module using the pattern button and it is not giving the statements for sy-subrc check while adding the code to your program.. am i right???
If i am correct.. The only possibility for this is... that your funtion module has no Exception..
When a function module has no exception defined, then it never changes the value of sy-subrc and thus the sy-subrc check after call to such a function module is not necessary..
Due to this.. while using patter you do not get the sy-subrc check lines..
Thanks and Best Regards,
Vikas Bittera..
**Award points for suitable answers**
‎2007 Aug 27 4:19 AM
Hello Venkat,
Since you have created the function module, then im sure that you haven't defined any exceptions
Edit your function in SE37 and click on the exceptions tab
here you can define exceptions. after doing this, saving and activating it, try calling it again with the Pattern button
‎2007 Aug 27 4:38 AM
Hii. Venkat..
Only when you add Exceptions while Creating FM , The system will add this condion (IF SY-SUBRC <> 0) while calling the FM using Pattern.
So Create the Exceptions if necessary if ur FM.
Otherwise it is not mandatory to check the Sy-subrc.
<b>reward if Helpful</b>