09-30-2008 12:15 PM
hai friends,
i have a scenario like, to check the whether the given value is vaild or not.
company code , controlling area, po type, purchase group.
if one value is wrong i have show the error message as
Company Code BP09 is not valid
or
if two value is wrong i have to show the error message cobmine
from as
Purchase Organization: BP09, Purchase Group: 005, PO Type:
ef not valid in .
pls help me how to make it.
regards,
selvamuthukumar.n
09-30-2008 12:20 PM
Hello,
Try this:
DATA:
lv_message TYPE C LENGTH 72.
CLEAR lv_message.
IF field1 NE '01'.
CONCATENATE 'FIELD1 =' field1 INTO lv_message.
ENDIF.
IF field2 NE 'aa'.
CONCATENATE lv_message ', field2 =' field2 INTO lv_message.
ENDIF.
* NEXT FIELD...
*Outside the if structures
CONCATENATE lv_message 'is not valid.' INTO lv_message.
Regards.
09-30-2008 12:24 PM
hii
I think this code could help you:
types: begin of it_desc,
WA_DESC1(100) TYPE C,
wa_desc5(100) type c,
wa_desc(100) TYPE C,
WA_DESC2(100) TYPE C,
WA_DESC3(100) TYPE C,
wa_desc4(100) type c,
wa_desc6(100) type c,
wa_desc7(100) type c,
wa_desc8(100) type c,
ER_CNT TYPE I,
end of it_desc.
*******************************Validation Of Cost Center********************************
if wa_item-costcenter is not initial.
select kostl from csks up to 1 rows into it_csks where kostl = wa_item-costcenter.
endselect.
if sy-subrc <> 0.
MOVE 'E' TO WA_item-procc.
it_desc-wa_desc5 = 'Invalid Cost Center. Please Check.'.
concatenate it_desc-wa_desc5 wa_item-costcenter into it_desc-wa_desc5 separated by ':'.
endif.
endif.
*******************************************************************************************
**********************************Validation Of WBS ELEMENT********************************
if wa_item-wbselement is not initial.
select pspnr from prps up to 1 rows into it_desc-wa_desc6 where pspnr = wa_item-wbselement.
endselect.
if sy-subrc <> 0.
MOVE 'E' TO WA_item-procc.
it_desc-wa_desc6 = 'Invalid WBS Element. Please Check.'.
concatenate it_desc-wa_desc6 wa_item-wbselement into it_desc-wa_desc6 separated by ':'.
endif.
endif.
******************************************************************************************
concatenate it_desc-wa_desc2 it_desc-wa_desc3 it_desc-wa_desc4 it_desc-wa_desc5 it_desc-wa_desc6 into it_desc-wa_desc9 separated by ' '.
Regards,
Vishwa.
09-30-2008 12:27 PM
check for company code
if <f1> ne 0.
var1 = company code
endif.
if <f2> ne 0.
var2 = controlling area
endif.
if <f3> ne 0.
var3 = po type
endif.
if var1 ne ' ' or var2 ne ' ' or var3 ne ' ' .
message v1 v2 v3............
endif.
Regards
Anbu B
01-19-2009 10:51 AM