Application Development and Automation 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: 
Read only

Warning message conflicts with Error message

Former Member
0 Likes
1,385

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,123

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.

8 REPLIES 8
Read only

Former Member
0 Likes
1,124

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.

Read only

0 Likes
1,123

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

Read only

0 Likes
1,123

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

Read only

0 Likes
1,123

Hi Gurpreet,

Thank U, Is there any way to control it .

regards,

Prabhu

Read only

0 Likes
1,123

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

Read only

Former Member
0 Likes
1,123

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.
ENDIF

OR Use.

IF SY-SUBRC 0.                          
MESSAGE ID SY-MSGID TYPE 'W' NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF

regards,

Gurpreet

Read only

former_member222860
Active Contributor
0 Likes
1,123

Write your own message with the Error option

MESSAGE E001(ZM) WITH ' no result found'

Read only

Former Member
0 Likes
1,123

Possibly the function itself is triggering the message.