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

check value and diffrent error messege

Former Member
0 Likes
911

Hellow I have a program that check an error in the select I check value and if sy subrc<>0 I sent an error messege like the firset select and the thirhd. but in the seconed select I hae 2 condtion how can I do for wa_itab-<b>personnel_area</b> and for <b>wa_itab-personnel_subarea</b> different error messege thankes.

LOOP AT itab INTO wa_itab.

IF wa_itab-action = 'Y1'

OR wa_itab-action = 'Y2'

OR wa_itab-action = 'Y3'.

*----


CLEAR wa_error_itab.

SELECT SINGLE ansvh

FROM t542a

INTO wa_itab-ansvh

WHERE molga ='IL'

AND ansvh = wa_itab-ansvh.

IF sy-subrc <> 0.

MOVE-CORRESPONDING wa_itab TO wa_error_itab.

wa_error_itab-description = text-001.

APPEND wa_error_itab TO error_itab.

ENDIF.

*----


CLEAR wa_error_itab.

SELECT SINGLE werks btrtl

FROM t001p

INTO (<b>wa_itab-personnel_area, wa_itab-personnel_subarea)</b> WHERE molga ='IL'

AND werks = wa_itab-personnel_area

AND btrtl = wa_itab-personnel_subarea.

IF sy-subrc <> 0.

MOVE-CORRESPONDING wa_itab TO wa_error_itab.

<b>wa_error_itab-description = text-002.</b>

APPEND wa_error_itab TO error_itab.

ENDIF.

*----


CLEAR wa_error_itab.

SELECT SINGLE objid

FROM hrp1000

INTO wa_itab-plans

WHERE otype = 'S'

AND objid = wa_itab-plans

AND begda <= currnt_date

AND endda >= currnt_date.

IF sy-subrc <> 0.

MOVE-CORRESPONDING wa_itab TO wa_error_itab.

wa_error_itab-description = text-003.

APPEND wa_error_itab TO error_itab.

ENDIF.

*----


ENDIF.

ENDLOOP.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
880

Hi,

Why don't you use Function Module to raise error message and you can pass the Error Message number and it would transalate in the language you login.

But even if it is in eglish i hope it would transalate automatically when you login using different language.

Please Confirm it.

Thanks,

Prashanth

7 REPLIES 7
Read only

Former Member
0 Likes
880

Hi

Please try to use it this way:

SELECT SINGLE werks btrtl

FROM t001p

INTO (wa_itab-personnel_area, wa_itab-personnel_subarea) WHERE molga ='IL'

AND werks = wa_itab-personnel_area

AND btrtl = wa_itab-personnel_subarea.

IF sy-subrc <> 0.

MOVE-CORRESPONDING wa_itab TO wa_error_itab.
<b>*wa_error_itab-description = text-002.
concantenate 
  'Wrong Per_Area:' wa_itab-personnel_area
  '& Per_Sub_Area:' wa_itab-personnel_subarea 
  into wa_error_itab-description 
  separated by space.</b>
APPEND wa_error_itab TO error_itab.

ENDIF.

Kindly close your earlier threads when answered.

Kind Regards

Eswar

Read only

0 Likes
880

hi aswar i wont diffrent error messege for the two condition if the dont take place ex.if personal area is not o.k. put a meesege for personal area and if personal sub area is isnt o.k. put messege for him and if both isnt o.k. for both conctente is good for both but not for every one alone

regards

Read only

0 Likes
880

HI

How about doing it this way:

<b>data: l_p_area like itab-personnel_area,

l_p_sarea liek itab-personnel_subarea.</b>

SELECT SINGLE werks btrtl

FROM t001p

INTO (<b>l_p_area, l_p_sarea</b>) WHERE molga ='IL'

AND werks = wa_itab-personnel_area <b>OR

*AND</b>

btrtl = wa_itab-personnel_subarea.

IF sy-subrc <> 0.

MOVE-CORRESPONDING wa_itab TO wa_error_itab.
*wa_error_itab-description = text-002.
<b>if l_p_area is initial and l_p_sarea is initial.
concantenate 
  'Wrong Per_Area:' wa_itab-personnel_area
  '& Per_Sub_Area:' wa_itab-personnel_subarea 
  into wa_error_itab-description 
  separated by space.
elseif l_p_area is initial.
concantenate 
  'Wrong Per_Area:' wa_itab-personnel_area
  into wa_error_itab-description 
  separated by space.
else.
concantenate 
  'Per_Sub_Area:' wa_itab-personnel_subarea 
  into wa_error_itab-description 
  separated by space.
endif.</b>
APPEND wa_error_itab TO error_itab.

Kindly close your threads when answered.

Kind Regards

Eswar

Read only

0 Likes
880

aswar thankes your answer is been very halpful for me .

if you see in my program i use text-001 ...becouse i wont to translate the words of the error messege if some one login withe other langu then english ,i try to concatnete with text 002 instead of 'Wrong Per_Area:' and...

how can i do it with error messege that i can to translete like i can do with text 001 and 003.

regards

Read only

Former Member
0 Likes
881

Hi,

Why don't you use Function Module to raise error message and you can pass the Error Message number and it would transalate in the language you login.

But even if it is in eglish i hope it would transalate automatically when you login using different language.

Please Confirm it.

Thanks,

Prashanth

Read only

0 Likes
880

how can i use function module i new with abap yuo can give an ex.thankes

Read only

0 Likes
880

Hi again,

Try this Function Module 'CALL_MESSAGE_SCREEN'.

This i have used for RF Programming but hope could also use for other transaction.

Also try these FM,

AD_DISP_MESSAGES

BUS_MESSAGE_CALL_POP

Thanks,

Prashanth