The Check exit posts several messages
In a web interface, my users are allowed to add new lines (HR management for adding new combinations of Fonction/Status of employee with the number of employee).
I use the exit at the planning area level (within Characteristic Relationsships) to check the entry againts a layout offering the allowed combinations (a kind of layout for customizing).
It works well, even too much. In fact, for one wrong data entry (at the same time, only one data entry is possible), I get several time the same error message (4 times exactly).
Here is my abap code. Can someone please help me?
DATA : etk_row LIKE upc_ys_api_row OCCURS 0 WITH HEADER LINE,
etk_row2 LIKE upc_ys_api_row OCCURS 0 WITH HEADER LINE,
l_subrc like sy-subrc value 0.
FIELD-SYMBOLS : <fonction>,
check message_statut ne 'X'.
Read the user entry
ASSIGN COMPONENT :
'0JOB' OF STRUCTURE is_chas TO <fonction>,
'0EMPLSGROUP' OF STRUCTURE is_chas TO <statut>.
Execution of the layout for data control
CALL FUNCTION 'API_SEMBPS_GETDATA'
i_area = 'ZHRADMS1'
i_plevel = 'PL102'
i_package = '0-ADHOC'
i_layout = 'MP202'
i_read_only = 'X'
etk_row = etk_row.
Organization of the data : makes it eaysier
etk_row2 = etk_row.
delete : etk_row where chanm ne '0JOB',
etk_row where CHAVLEXT ne <fonction>,
etk_row2 where chanm ne '0EMPLSGROUP',
etk_row2 where CHAVLEXT ne <statut>.
l_subrc = 4.
Loop on the right data
loop at etk_row.
Do I find the right status at least once?
read table etk_row2 with key row = etk_row-row.
Keep a trace of one good record
if sy-subrc = 0.
move sy-subrc to l_subrc.
Error message only if needed
if l_subrc = 4. " and message_statut ne 'X'.
message_statut = 'X'.
message e002(ZHR) RAISING invalid.
I have that flag message_statut in order to occur only once the message raising the exception invalid, but if I uncomment that part of Abap, then I do not get any message any more ... So my abap works, but this function is called too many times...
I activated the debug in transaction SE80 on the BSP application, and I could count the number of execution of the exit function : 34 times!!!
Can I get some help?