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

Error message with internal table values

Former Member
0 Likes
2,648

Hi experts,

I have validated the field Inco terms in tcodes me21n,me22n,me23n...

I have one set name with 3 inco terms values.

based on some conditions...if the user enter the inco terms value other than values which have maiantained SET...it should give the error messge with 'Please select XXXXXXXX values'. (XXXXX = all values from set).

But as of now i have hardcoded as MESSAGE 'Please Select Inco-terms CPT or DAP or FCA. ' TYPE 'E'.

but this not required...bcoz in feture if they will add one more value that should be also displayed in error mesgg...

how can i achive this.....

can any body plzzz help me???

6 REPLIES 6
Read only

Former Member
0 Likes
1,200

Hi ,

May be you can try like this.

Get all possible values in an internal table it_vals.

Then loop at the table and concatenate all possible values in a variable and then give the message.


l_ps_vals(50) type C.
loop at it_vals.
 concatenate l_ps_vals it_vals-inco into l_ps_vals separated by 'AND'.
endloop.

MESSAGE 'Please Select Inco-terms' l_ps_vals.type 'E'.

Regards,

Himanshu Verma

Read only

0 Likes
1,200

Hi varma...

Thanks for giving your reply...

As you said it is working.....but supoose if they add 10 values ..it will display like

please select a or b or c or d or e or f or like taht.....as status error message...

Read only

0 Likes
1,200

Hi varma,

loop at LT_SETLEAF_INCO into LS_SETLEAF_INCO.

if lv_MSG is not INITIAL.

CONCATENATE lv_MSG Ls_SETLEAF_INCO-valfrom into lv_MSG SEPARATED BY ' or '.

else.

lv_MSG = Ls_SETLEAF_INCO-valfrom.

endif.

endloop.

CLEAR: LS_SETLEAF_INCO.

CONCATENATE 'Please Select Inco-terms' lv_MSG into lv_MSG1 SEPARATED BY space.

MESSAGE lv_MSG1 TYPE 'E'.

output:

Please select Inco-terms CPT or A or B or C or Dor E......

space is not coming bt D and E? is there any restricted lenght for error message?

can you plz tell me

Read only

0 Likes
1,200

Hi,

I think could be because you need to have space on both side of OR like below:


CONCATENATE lv_MSG Ls_SETLEAF_INCO-valfrom into lv_MSG SEPARATED BY '  or  '.

But i think this is not the right way because it would not be possible to accomodate all inco types if they have a lot in number.It would be better if you give a message like 'Please select a valid value from table ZTABINCO' You can also provide an F4 help of the field where the value has to be selected.

Regards,

Himanshu

Read only

0 Likes
1,200

Hi,

create a message in message class...and provide a long text to the messgae..

In the long text Using command--> Enter &V1& in symbols...

And pass the concatencated string to the message as varibale 1. and enter in the short text..please check the long text!!

i think it will solve the issue..

regards,

Yadesh

Read only

former_member193284
Active Participant
0 Likes
1,200

Hi Veena,

Just follow below mentioned steps and it should resolve your issue.

Create a message class ZE1 in SE91 and a message number as mentioned below.

001 Please Select Inco-terms & or & or &.

& in the message will hold the dynamic values of the fields you pass as mentioned below.

Then in your program show an error mesage using statement

Message E001(ZE1) with <Field1> <Field2> <Field3>.

<Field1>

<Field2>

<Field3> will be name of your internal table fields.

Thanks

Edited by: Sumit Naik on Jan 7, 2011 12:41 PM