‎2009 Feb 16 8:04 AM
Hi Experts,
In my program recursive call was used. that perform will call upto infinite time running,
I am using this is first time can u plz help. I given below code.
LOOP AT i_orgeh INTO wa_orgeh.
PERFORM set_node_level USING wa_orgeh-orgeh 0.
ENDLOOP.
FORM set_node_level USING
fp_orgson TYPE ty_orgeh_rel-orgson
fp_level TYPE ty_orgeh_rel-level.
DATA : l_1levelup TYPE ty_orgeh_rel-level.
LOOP AT i_orgeh_rel INTO wa_orgeh_rel
WHERE orgson = fp_orgson.
IF fp_level < wa_orgeh_rel-level.
wa_orgeh_rel-level = fp_level.
MODIFY i_orgeh_rel FROM wa_orgeh_rel
INDEX sy-tabix
TRANSPORTING level.
ENDIF.
l_1levelup = fp_level + 1.
v_1levelup = l_1levelup.
PERFORM set_node_level USING fp_orgson l_1levelup.
ENDLOOP.
ENDFORM. " SET_NODE_LEVEL
‎2009 Feb 16 8:06 AM
Hi,
U are calling form within form defintion also,give a condition to exit.
‎2009 Feb 16 8:08 AM
hi
In the form use if sy-subrc ne 0 .
exit.
endif.
so it will exit.
Thanks
Viquar Iqbal
‎2009 Feb 16 8:24 AM
Hi,
LOOP AT i_orgeh INTO wa_orgeh.
PERFORM set_node_level USING wa_orgeh-orgeh 0 sy-tabix.
ENDLOOP.
FORM set_node_level USING
fp_orgson TYPE ty_orgeh_rel-orgson
fp_level TYPE ty_orgeh_rel-level
fp_tabix type sy-tabix.
DATA : l_1levelup TYPE ty_orgeh_rel-level,
l_tabix like sy-tabix.
LOOP AT i_orgeh_rel INTO wa_orgeh_rel FROM fp_tabix
WHERE orgson = fp_orgson.
IF fp_level < wa_orgeh_rel-level.
wa_orgeh_rel-level = fp_level.
MODIFY i_orgeh_rel FROM wa_orgeh_rel
INDEX sy-tabix
TRANSPORTING level.
ENDIF.
l_1levelup = fp_level + 1.
v_1levelup = l_1levelup.
PERFORM set_node_level USING fp_orgson l_1levelup l_tabix.
ENDLOOP.
ENDFORM. " SET_NODE_LEVELThis should not give an infinite call to recursion... please check.
if its changing the requirement then please do let us know about the requirement.... with example.
Regards,
Siddarth
‎2009 Feb 16 9:19 AM
Hi siddarth,
As per you send that code also giving same problem. If yuou have any idea plz help me.
‎2009 Feb 16 9:33 AM
Hi ,
I am geting problem in " IF fp_level < wa_orgeh_rel-level." this condition.
Thanks
Srinu
‎2009 Feb 16 12:31 PM
Hi,
I tried finding out the reason, but unable to as i dont have the table fields and other things,
if possible would you please paste the whole code so that I can look into it and then give you the right solution of it...
Regards,
Siddarth
‎2009 Feb 16 1:09 PM
Hi siddarth,
can u give me u r mail id. i will sent code. that is better for us.
‎2009 Feb 16 1:16 PM
Hi,
I think it would be better if we can do this in forum as it would be against the rule of the sdn forum...
you can paste the code here, or code which ever is necessary to run and get the desired result and also please tell me the exact requirement as well
Regards,
Siddarth
‎2009 Feb 16 8:31 AM
Hi Srinu ,
you please try this -
* LOOP AT i_orgeh INTO wa_orgeh. " Comment that
PERFORM set_node_level USING wa_orgeh-orgeh 0.
*ENDLOOP. " Comment that
FORM set_node_level USING
fp_orgson TYPE ty_orgeh_rel-orgson
fp_level TYPE ty_orgeh_rel-level.
DATA : l_1levelup TYPE ty_orgeh_rel-level.
LOOP AT i_orgeh_rel INTO wa_orgeh_rel
WHERE orgson = fp_orgson.
IF fp_level < wa_orgeh_rel-level.
wa_orgeh_rel-level = fp_level.
MODIFY i_orgeh_rel FROM wa_orgeh_rel
INDEX sy-tabix
TRANSPORTING level.
ENDIF.
l_1levelup = fp_level + 1.
v_1levelup = l_1levelup.
If sy-index = 1. " Add this line
PERFORM set_node_level USING fp_orgson l_1levelup.
endif. " Add this line
ENDLOOP.
ENDFORM. " SET_NODE_LEVELThanks and regards
Pinaki
‎2009 Feb 16 1:14 PM
Any organization has only few levels .. say upto 10 or 20 levels (top or bottom) .. please check how
many levels are there in your org ..
else there is some error in picking up of data in your internal table "i_orgeh"
check as below ..
if l_1levelup > some_number.
exit.
endif.
‎2009 Mar 04 1:15 PM