Skip to Content
avatar image
Former Member

The Check exit posts several messages

Hello,

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>,

<statut>.

  • 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'

EXPORTING

i_area = 'ZHRADMS1'

i_plevel = 'PL102'

i_package = '0-ADHOC'

i_layout = 'MP202'

i_read_only = 'X'

TABLES

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.

endif.

endloop.

  • Error message only if needed

if l_subrc = 4. " and message_statut ne 'X'.

  • message_statut = 'X'.

message e002(ZHR) RAISING invalid.

ENDIF.

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?

Regards

Laurent

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • May 31, 2006 at 11:16 PM

    Hi Laurent,

    the validation exit is called for all parts of the layout. First the header combinations are validated, then all rows and finally the columns. For each call the is_chas records is fill differently depending on the part of the layout. So you have to look at the contents of is_chas and find one combination that you want to raise the error message for and disregard the other combinations.

    Regards,

    Marc

    SAP NetWeaver RIG

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 06, 2006 at 12:22 PM

    Hi Laurent,

    Please how did you use this code for your combination check? I am trying to achieve a similar combination check on some user enteries but I am not getting the exit called.

    I am wondering if this is the same kind of challenge that you faced here.

    Regards,

    Uche

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Uche,

      That works fine.

      You must set up a rule on the planning level itself, through the tabstrip Characteristic Rels.

      That should be called, no doubt on this. Are you sure that your Function Group and Function module are both activated?

      Regards