‎2009 Feb 03 12:50 PM
HI,
This loop is inside method and i want to separate it and to put it in new method,
What is the best way to that?
Regards
LOOP AT lt_variant_content INTO line
LOOP AT line-paramtab INTO line2.
CASE line2-parname.
WHEN 'LT_MANAGER_DETAIL'.
ASSIGN line2-value_ref->* TO <ls_detail>.
WHEN 'LT_EMP_DETAILS'.
ASSIGN line2-value_ref->* TO <lt_details>.
WHEN 'LT_ITEMS'.
ASSIGN line2-value_ref->* TO <lt_b>.
ENDCASE.
ENDLOOP.Edited by: ricardo arona on Feb 3, 2009 1:50 PM
Edited by: Matt on Feb 3, 2009 2:50 PM - added tags
‎2009 Feb 03 1:59 PM
Hi,
You can create another method and call this method from the existing method. The parameters of this method will be the local data of the existing method.
example
class c1 implementation.
method meth1 "implementation.
call method meth2( ). " Call the method of the class.
endmethod.
method meth2 " implementation.
Loop ... endloop.
endmethod.
endclass.
regards,
Advait
Edited by: Advait Gode on Feb 3, 2009 3:03 PM
‎2009 Feb 03 1:00 PM
HI,
LOOP AT lt_variant_content INTO line
PERFROM <Method> table line-paramtab
ENDLOOP.
FROM <METHOD> TABLES LINE STRUCTURE <struc>.
DATE line2 like line-paramtab.
LOOP AT line-paramtab INTO line2.
CASE line2-parname.
WHEN 'LT_MANAGER_DETAIL'.
ASSIGN line2-value_ref->* TO <ls_detail>.
WHEN 'LT_EMP_DETAILS'.
ASSIGN line2-value_ref->* TO <lt_details>.
WHEN 'LT_ITEMS'.
ASSIGN line2-value_ref->* TO <lt_b>.
ENDCASE.
ENDLOOP.
ENDFORM.
‎2009 Feb 03 1:49 PM
Avinash - he wants a METHOD. Why have you answered with a PERFORM?
‎2009 Feb 03 1:59 PM
Hi,
You can create another method and call this method from the existing method. The parameters of this method will be the local data of the existing method.
example
class c1 implementation.
method meth1 "implementation.
call method meth2( ). " Call the method of the class.
endmethod.
method meth2 " implementation.
Loop ... endloop.
endmethod.
endclass.
regards,
Advait
Edited by: Advait Gode on Feb 3, 2009 3:03 PM