Greetings all
I would like to display an error message once some sort of validation is done. The code for my method is as follows:
-
method if_ex_hrbas00infty~before_output.
*Data declaration
data: lt_hrp1001 type table of hrp1001,
lv_sobid type sobid,
lv_sclas type sclas,
lv_rsign type rsign,
lv_relat type relat,
lv_otjid type otjid.
Clear the local table and local variables
refresh lt_hrp1001.
clear: lv_sobid, lv_sclas, lv_rsign, lv_relat, lv_otjid.
*Store the separated strings
lv_sclas = old_innnn-vdata+0(2).
lv_sobid = old_innnn-vdata+2(10).
lv_rsign = old_innnn-subty+0(1).
lv_relat = old_innnn-subty+1(3).
lv_otjid = old_innnn-otype.
*Check for existing relationships with other external objects
select * from hrp1001 into table lt_hrp1001
where plvar = old_innnn-plvar
and sobid = lv_sobid
and sclas = lv_sclas
and rsign = lv_rsign
and relat = lv_relat
and otjid = lv_otjid.
*Loop through the table and compare the existing relationship with the new one
loop at lt_hrp1001 where.
old_innnn-sobid = hrp1001-sobid.
old_innnn-sclas = hrp1001-sclas.
old_innnn-rsign = hrp1001-rsign.
old_innnn-relat = hrp1001-relat.
old_innnn-otjid = hrp1001-otjid.
If statement to compare the start and end dates
if lt_hrp1001-begda > old_innnn-endda
or old_innnn-endda < lt_hrp1001-begda
*Issue a warning informing the user about the overlap
message 'ZEXERCISE' type 'E' number '000'.
endif
endloop.
break lmandimika.
endmethod.
-
Ive created my message class which is ZEXERCISE but i have to declare the message somewhere using MESSAGE-ID ZEXERCISE. The only problem is that i cant declare it within this method. Any help as to where i can declare it.
In addition to that, my loop at doesnt work because it tells me LOOP AT itab one of the additions INTO, ASSIGNING or TRANSPORTING NO FIELDS is required. I want to loop through the local table lt_hrp1001 and compare old_innn with all the entries in the table.
Any help would be greatly appreciated.