cancel
Showing results for 
Search instead for 
Did you mean: 

Raising Error messages...

Former Member
0 Kudos

Hi,

I have an error structure which is getting returned by a function module in main program.

The returned error structure s_err has following values in its fields:

Requi....Unique....Fname

x........................STCD1

Now I have to read the structure s_err.

For the value in Fname column (here STCD1) read the status of its Requi and Unique flag.

Since Requi field is 'X'

raise error message 'stcd1 is required field'

If returned err_sturcture is:

REQUI....Unique....Fname

............X............STCD2

Read the structure s_err.

For the value in Field column (here STCD2) read the status of the Requi and Unique flag.

Since Unique field is 'X'

raise error message 'stcd2 is unique field'

So depending upon the statuses of values in fnames in structure the error message is formulated.

How do I do this in ABAP ?

Can someone tell me considering above stucture in mind.

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

Hi Tushar,

1. what is ur exact requireemnt?

2. As suggested by others, we can definitely

loop at the internal table

and issue MESSAGE statemetn.

3. however, only ONE MESSAGE will be seen on screen.

ie. the last one.

4. Do u want to construct all mesasges ( more than 1)

and show ALL at a time, to the user?

Like a message box having more than 1 line

of information...

regards,

amit m.

Former Member
0 Kudos

Hi Amit,

I want to do exactly what you are saying

Former Member
0 Kudos

Hi again,

1. There are two things involved.

2. a) based on if conditions, detect the error messages

b) displaying the list of messsages.

3. a) this is very simple using if condition

i assume u can do this.

Just create an internal table

of required columns

and append the messages to this internal table.

4. Afterwards use the concept of ALV list.

to display this messages

(Even standard transcctions like MIGO

do this )

Alv - u must be knowing this.

5. To give a good look-and-feel effect,

show this alv in SMALL WINDOW.

6. To do this use the parameters of the fm

REUSE_ALV_LIST_DISPLAY

The parameters are :

I_SCREEN_START_COLUMN

I_SCREEN_START_LINE

I_SCREEN_END_COLUMN

I_SCREEN_END_LINE

7. These parameters will display in a

small window (instead of fulll screen)

I hope it helps.

regards,

amit m.

sreemsft
Contributor
0 Kudos

Hi,

 

I did not get what exactly your problem is.

Anyhow you cannot read a structure. You can read an internal table.

If your return parameter is a structure you can do like this:

If s_err-Requi = 'x'.
*  Give some error message.
endif.

IF your return parameter is an internal table, do like this.

Read table itab with key Requi = 'x'.
if sy-subrc = 0.
*  Give error message.
endif.

Thanks,

Sreekanth G

Former Member
0 Kudos

any more suggestions..

Former Member
0 Kudos

data: wa_err type s_err .

loop at s_err into wa_err .

if wa_err-requi eq 'X' .

message e00(000) with wa_err-fname ' is required field' .

endif .

if wa_err-unique eq 'X'.

message e00(000) with wa_err-fname ' is unique field' .

endif.

clear wa_err .

endloop .

athavanraja
Active Contributor
0 Kudos

data: err type s_err .

loop at s_err into err .

if err-requi eq 'X' .

message e00(000) with err-fname ' is required field' .

endif .

clear err .

endloop .

Regards

Raja

Message was edited by: Durairaj Athavan Raja

Former Member
0 Kudos

Can anyone help me out....