‎2009 Mar 30 9:47 AM
Hi,
I am using F.M. like
CALL FUNCTION 'ARCHIVOBJECT_STATUS'
EXPORTING
ARCHIV_DOC_ID = IT_toa02-ARC_DOC_ID
ARCHIV_ID = IT_toa02-ARCHIV_ID
IMPORTING
DOCUMENT_TYPE = l_doc_type
TABLES
AL_COMPONENTS = IT_COMP
EXCEPTIONS
ERROR_ARCHIV = 1
ERROR_COMMUNICATIONTABLE = 2
ERROR_KERNEL = 3
OTHERS = 4.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
and when ever sy-subrc is not equal to zero. sy-msgty is 'W' (warning) but program still issues the a ERROR message.
Please let me know why is that happening and I want to make it as warning message only.
regards,
Prabhu
‎2009 Mar 30 9:52 AM
You are populating the error message through the below statement. Try replacing
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
with
MESSAGE ID SY-MSGID TYPE ''W' NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
‎2009 Mar 30 9:52 AM
You are populating the error message through the below statement. Try replacing
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
with
MESSAGE ID SY-MSGID TYPE ''W' NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
‎2009 Mar 30 9:59 AM
Hi guys,
The message type might differ it may be a warning or error based on the input of the F.M., I have debugged but no I idea why the message type 'W' is giving an error message and the message is related to some authorization I think.
regards,
Prabhu
‎2009 Mar 30 10:12 AM
Messages behave differently according to the context its use.
On selection-screen Error/Warning message behave differently.
Error:cannot execute further.
warning: With enter you as bypass the message.
While printing list Warning/Error messages behaves same(i.e as Error message).
Message and return to program.
Its just the context where you are using the message the behavior differs.
Regards,
Gurpreet
‎2009 Mar 30 10:22 AM
Hi Gurpreet,
Thank U, Is there any way to control it .
regards,
Prabhu
‎2009 Mar 30 10:27 AM
Its is the general behavior you cannot control it instead there is a work around.
If SY-SUBRC NE 0.
MESSAGE 'XXXX' type 'S' Display like 'W' . " Success message will be displayed like Warning
leave list-processing.
ENDIF.OR
If SY-SUBRC NE 0.
MESSAGE 'XXXX' type 'S' Display like 'E' . " Success message will be displayed like Error
leave list-processing.
ENDIF.Both the cases the control will flow to selection screen.
Regards,
Gurpreet
‎2009 Mar 30 9:53 AM
After Selection screen is executed you display either Waring message of Error message both will display as Error message on the list.
Check in debugging mode what exactly the value of SY-MSGTY is
CALL FUNCTION 'ARCHIVOBJECT_STATUS'
EXPORTING
ARCHIV_DOC_ID = IT_toa02-ARC_DOC_ID
ARCHIV_ID = IT_toa02-ARCHIV_ID
IMPORTING
DOCUMENT_TYPE = l_doc_type
TABLES
AL_COMPONENTS = IT_COMP
EXCEPTIONS
ERROR_ARCHIV = 1
ERROR_COMMUNICATIONTABLE = 2
ERROR_KERNEL = 3
OTHERS = 4.
IF SY-SUBRC 0. " Set a break point and check at runtime the value of SY-MSGTY.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIFOR Use.
IF SY-SUBRC 0.
MESSAGE ID SY-MSGID TYPE 'W' NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIFregards,
Gurpreet
‎2009 Mar 30 9:53 AM
Write your own message with the Error option
MESSAGE E001(ZM) WITH ' no result found'
‎2009 Mar 30 10:01 AM