Skip to Content
author's profile photo Former Member
Former Member

Events in Table Maintenance

Hi all,

I have two non key checkboxes in table (of type XFELD) say control 1 and control2.

In table maintenance I have to validate that control 2 is checked only if control1 is checked i.e if control2 is checked without checking control2.

I have coded following lines in BeforeSave event:

LOOP AT extract.

MOVE extract TO zam_test1.

IF zam_test1-control2 EQ 'X'.

IF zam_test1-control1 NE 'X'.

DELETE extract.

MESSAGE e999 (/dceur/zais_msg) WITH 'error'.

ENDIF.

ENDIF.

ENDLOOP.

In this code if i give error message it is coming out to initial screen of SM30, if i am giving info message then it's saving the entries.

Please suggest me right event if above logic is correct or correct way of doing it.

Thanks in Advance,

Akash Modi

Hyderabad

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Posted on Jan 04, 2005 at 02:54 PM

    Hi Akash,

    try an info message in combination sy-subrc <> 0.

    Best regards Erik

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jan 04, 2005 at 03:44 PM

    Hi Akash,

    Here is how you should modify your code.

      LOOP AT extract.
        MOVE extract TO zam_test1.
        IF zam_test1-control2 EQ 'X' AND.
           zam_test1-control1 NE 'X'.
    *-- Do not delete the record, let the user correct it
    *   Just issue an message type 'S' and set the subrc to 
    *   a non-zero value
            sy-subrc = 4.
            MESSAGE s999 (/dceur/zais_msg) WITH 'error'.
        ENDIF.
      ENDLOOP.
    

    If this helps, please don't forget the points.

    Regards,

    Srinivas

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.