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

rcursion in abap

hi experts

i have this form:

form fill_tab using l_line_num

l_data.

DATA: l_datum TYPE datum,

l_erzet TYPE erzet,

l_dat1 TYPE string,

l_dat2 TYPE string.

CASE l_line_num.

WHEN '1'.

WHEN '2'.

wa_dat_dlv-delv_num = l_data.

WHEN '3'.

CONCATENATE l_data4(4) l_data2(2) l_data(2)

INTO wa_dat_dlv-delv_date.

wa_dat_dlv-delv_time = l_data+8.

WHEN '4'.

wa_dat_dlv-paz_ord_num = l_data.

WHEN '5'.

CONCATENATE l_data4(4) l_data2(2) l_data(2)

into wa_dat_dlv-order_date.

WHEN '6'.

wa_dat_dlv-cust_num = l_data.

WHEN '7'.

wa_dat_dlv-cust_desc = l_data.

WHEN '8'.

wa_dat_dlv-line_num = l_data.

WHEN '9'.

wa_dat_dlv-matnr = l_data.

WHEN '10'.

SPLIT l_data AT ' ' INTO l_dat1 l_dat2.

wa_dat_dlv-ord_amnt = l_dat1.

wa_dat_dlv-sup_amnt = l_dat2.

WHEN '11'.

wa_dat_dlv-u_o_m = l_data.

APPEND wa_dat_dlv TO it_dat_dlv.

WHEN OTHERS.

l_line_num = l_line_num - 4.

PERFORM fill_tab USING l_line_num l_data.

ENDCASE.

endform. " fill_tab

this form is a recursive form after l_line_num is greater than 11, when it happens l_line_num is updated to

l_line_num -4 and it calls the form again. but than the case don't stop.

what's the problem?

thank you

amit

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jan 30, 2008 at 06:57 AM

    define the interface variable l_line_num in changing mode because value has been chnging while exiting from the sub-routine

    dont forgot to reward points for helpful answers

    Regards,

    Surya

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      I donĀ“t know in which context you use this FORM routine, but, when using recursions it is extremely important to carefully define an exit condition to stop the recurssion. Otherwise you will end up in an endless recursion...

      You do not have an exit condition at all. In your case, the FORM routine is called over and over again.

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.