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

Stoping mandatory fields

Hi Experts,

I know in WD abap i can check the mandatory fields using folowing method which i found in one of the thread......



view_controller = lo_view_controller

display_messages = abap_true


messages = lt_msg ).

But problem is that it is just displaing me an error message without stoping furthur navigation......

wht i m doing is i have a search button, when i click on that button i have to check mandatory fields and if mandatory fields are not filled i have to stop furthur processing...... i m using above code for that....... i think i missing something...... i tried searching it but have not got solution yet.......



Add a comment
10|10000 characters needed characters exceeded

Related questions

4 Answers

  • Best Answer
    Posted on Dec 21, 2008 at 05:25 AM

    Hi Amit,

    Check this code after checking for mandatory fields you have to just loop at the msg_tab it is like an internal table if you try to see it using a break point...... i hope this will solve your issue........

     data:lo_view_controller type ref to if_wd_view_controller,
           lv_flag type i,
            msg_tab type cl_wd_dynamic_tool=>t_check_result_message_tab.
      field-symbols: <lv_fs> type any.
      lo_view_controller = wd_this->wd_get_api( ).
        view_controller = lo_view_controller
        display_messages = abap_true
          messages = msg_tab ).
    loop at msg_tab assigning <lv_fs>.
      if <lv_fs> is initial.
      elseif <lv_fs> is not initial.
      lv_flag = 3.
     check lv_flag ne 3.
    data lo_componentcontroller type ref to ig_componentcontroller .
    lo_componentcontroller =   wd_this->get_componentcontroller_ctr( ).



    Add a comment
    10|10000 characters needed characters exceeded

    • Hi Amit,

      you have to made some changes in code thn.....

      declare an internal table and work area this way.....

          begin of t_check_result_message,
            t100_message      type symsg,
            context_element   type ref to if_wd_context_element,
            attribute_name    type string,
          end of t_check_result_message .
          Data msg_tab type standard table of t_check_result_message .
      data wa_msgtab TYPE t_check_result_message.

      now loop at msg_tab INTO wa_msgtab.

      this work area will now contain the field you are looking for.........

      but here also you will get the context attribute name.... now put some "if" condition or "case" and you can display the message.... before that in check_mandatory_attr_on_view you have to pass DISPLAY_MESSAGES = ABAP_FALSE.....



  • author's profile photo Former Member
    Former Member
    Posted on Dec 20, 2008 at 04:35 PM


    you may want to check this thread


    Bala Duvvuri

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 21, 2008 at 02:50 AM

    Hi Amit,

    I would suggest you to make a flag variable. Now if your code for checking mandatory fields returns an error, set the flag variable to '1'. After that write this line of code:

    CHECK lv_flag IS INITIAL.

    THis code will allow further execution only if the flag varaible is initial.

    I hope it helps.



    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 22, 2008 at 05:46 AM

    THANKSSSS A LOT EVERYONE..............


    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.