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

Do while int_table is empty

hi,

im using a badi which is performing a lot of methods. Each method changes an Error_Table if something is going wrong.

Is there an easier way than this ?

if table is initial.

method1

else.

exit.

endif.

if table is initial.

method2

else.

exit.

endif.

I would like to exit the badi if the table contains an entry.

note: there is no loop step over the methods.

What about using "catch" or "while" or something else ?

Thx,

Gordon

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Posted on Aug 13, 2008 at 02:03 PM

    Yes, you can use exceptions classes and TRY..CATCH staetments to do this. Each method would need to raise an exception after writing to the ERROR_TAB, then in your main method, it would catch these exceptions.

    try.
    
      call method method1
      call method method2
      call method method3
      call method method4
    
    catch cx_some_exception.
       return
    endtry.

    So basically, if any of the methods raise the exception, then the rest of the methods will not be called.

    Regards,

    Rich Heilman

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 13, 2008 at 01:42 PM

    try this...

    if table[] is initial.

    method1.

    method2.

    else.

    exit.

    endif.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Aug 13, 2008 at 01:46 PM

    May be you can try with macro.

    Please find a the following macro i have used in on the program for updating tables

    * Macro for controling the update tables
      define updatetable.
        if v_eflg ne c_y.
          if not &2[] is initial.
            modify &1 from table &2.
            if sy-subrc ne 0.
              move c_y to v_eflg.
             if not &2[] is initial.
              i_idoc_status-docnum = v_docnum.
              i_idoc_status-status = '51'.
              i_idoc_status-msgty  = 'E'.
              i_idoc_status-msgid  = 'YCC'.
              i_idoc_status-msgno  = '733'.
              i_idoc_status-msgv1  = &3.
              i_idoc_status-msgv2  = ' '.
              i_idoc_status-msgv3  = ' '.
              i_idoc_status-msgv4  = ' '.
              append i_idoc_status.
             endif.
            else.
              i_idoc_status-docnum = v_docnum.
              i_idoc_status-status = '53'.
              i_idoc_status-msgty  = 'S'.
              i_idoc_status-msgid  = 'YCC'.
              i_idoc_status-msgno  = '736'.
              i_idoc_status-msgv1  = &3.
              i_idoc_status-msgv2  = ' '.
              i_idoc_status-msgv3  = ' '.
              i_idoc_status-msgv4  = ' '.
              append i_idoc_status.
            endif.
          endif.
        endif.
      end-of-definition.
    
    
    
      updatetable yattrid      i_yattrid      'YATTRID'.
    

    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.