‎2007 Mar 13 7:57 AM
hi experts
i have an internal table, itab with 3 columns.
eid, ename and edearttment.
i also write a paramter statement
paramter: pid like eid.
now i write
loop at itab where eid = pid.
......................
......................
endloop.
now if pid not equal to eid i need an exception handling cx_hrpa_invalid_paramter.
if pid equals eid then it should proceed with its normal state.
how to do that
‎2007 Mar 13 7:59 AM
loop at itab where eid = pid.
......................
......................
endloop.
<b>if sy-subrc <> 0.
handle your exception logic here. If this is within a function module, you can simply raise an exception which can later be handled in the calling program
endif.</b>
Regards,
Ravi
‎2007 Mar 13 7:59 AM
loop at itab where eid = pid.
......................
......................
endloop.
<b>if sy-subrc <> 0.
handle your exception logic here. If this is within a function module, you can simply raise an exception which can later be handled in the calling program
endif.</b>
Regards,
Ravi
‎2007 Mar 13 8:11 AM
Let us this scenario:
In ITab you are having more than one entry of PID not equal to EID. then for the first occurance only you want to trigger exception and stop processing other entries? or you want to process all entires and just trigger exception in case you are having atleast one entry of "pid ne eid".
Let me know.
In first case you loop itab with out where. In loop use IF to chk the pid ne eid. In IF handle exception. and come out of loop
In other case also loop itba with out where. Use IF to know whether any entry is having PID ne EID. set a flag there. after the loop handle the exception
‎2007 Mar 13 8:08 AM
HI,
You can do it this way.
LOOP AT itab.
READ TABLE itab into wa WITH KEY eid = pid.
if sy-subrc <> 0.
raise exception type cx_hrpa_invalid_paramter.
else.
normal processing
endif.
ENDLOOP.
Regards,
Sesh
‎2007 Mar 13 2:40 PM
hi,
loop at itab where eid = pid.
......................
......................
endloop.
if sy-subrc <> 0. "This loop will return 4 if no entry found with eid = pid.
*throw your exception here.
endif.
Hope this helps.
Regards,
Richa
‎2007 Mar 14 6:26 AM
Hi,
As u have to raise an exception when eid <>pid u have to loop generally and then read other wise u may not be able to read the needed rows and raise exception for the else.
loop at itab.
READ TABLE itab into wa WITH KEY eid = pid.
if sy-subrc <> 0.
exception cx_hrpa_invalid_paramter have to be raised.
else.
process normally
endif.
ENDLOOP.
in this for every row it checks for feisibility.
Regards,
S.Ravi