2012 Aug 24 2:16 PM
Hello Experts,
I have a problem, i want to create a class (in SE24) through program. In that am having no problem. But the problem coming in how to put the multiple lines of code into method. I can put say single line to the work area and pass it to the FM which will create the method with lines, of that work area or table, as source code.
eg:
class name = 'ZCLASS1'.
method name = 'Method1'.
ls_string = 'NEW-LINE'.
append ls_string to lt_string.
Result:
Method1
NEW-LINE.
EndMethod1.
So if its a single line, we can do this way. But if we have multiple line of code then how will i pass it ???
<Priority normalized by moderator>
Regards,
Ankur Sharma
Message was edited by: Vinod Kumar
2012 Aug 24 2:21 PM
In simple words, if i dynamically get multiple lines of code then how to put it into internal table ?
2012 Aug 24 2:29 PM
Hi,
Do this. Assume you multiple lines of input code is in table input_string.
loop at input_string into ls_input_string.
ls_string = ls_input_string.
append ls_string to lt_string.
endloop.
2012 Aug 24 2:33 PM
Ankur,
Did you try to write multiple lines in the Method??
You can write any # of lines...
If you want skip multiple lines using your method, then either call the method inside a Do-.. ENDDO for those many times or write a DO .. ENDDO inside your method .. and pass the number of iteration of DO loop as a parameter to your method...
If this is not what you are looking for, please explain your problem in deatil
2012 Aug 24 2:51 PM
Hello Harshad Bhingarkar, Thanks for quick reply.
how will i do this: ls_string = ' DATA: X TYPE I. '.
ls_string = ' WRITE: 'X'. '.
.
.
.
It will show error.
My only aim is to put pass the code like this to some Itab and pass that Itab to class creation FM.
Hope it gives more help to understand.
Regards,
Ankur Sharma
2012 Aug 24 6:24 PM
in my understanding, you are trying to pass multiple lines to an FM.
probably a table type of string lines.
you can fill the data in string table, and pass the table-type to any FM or methods.
2012 Aug 25 7:04 AM
Hello Madhu B,
Thanks Madhu but how will i put the lines in WA ? As shown in above post, if i put lines like that it will show error.
Please suggest.
2012 Aug 25 7:22 AM
For eg: i want to put this code in some itab, then how to do it ?
' DATA: BEGIN OF LINE,
LAND(3) TYPE C,
NAME(10) TYPE C,
AGE TYPE I,
WEIGHT TYPE P DECIMALS 2,
END OF LINE.
DATA ITAB LIKE SORTED TABLE OF LINE
WITH NON-UNIQUE KEY LAND NAME AGE WEIGHT. '
2012 Aug 25 7:31 AM
Dear,
append into itab and pass this internal table to your FM.
2012 Aug 25 8:12 AM
Dear Bharat Rathod ,
i know append, BUT the problem is try to put the code in ' ... ' and assign it to WA. It will show error.
2012 Aug 25 8:17 AM
2012 Aug 25 8:35 AM
As mentioned in above post, how will i do this ?
ls_string = ' DATA: LT_STRING TYPE TABLE OF STRING, LT_SOURCE TYPE SEO_METHOD_SOURCE_TABL.
DATA: LS_ATTR TYPE LINE OF SEOO_ATTRIBUTES_R,
LS_METH TYPE LINE OF SEOO_METHODS_R . . . '
I want to put multiple lines of code into table, for that i need to get this into WA.
2012 Aug 31 1:31 PM
2012 Sep 17 8:37 AM
Hello S. Spronk,
So sorry for such a late reply.
SEO_CLASS_CREATE is FM which will create the class.
You can check the function groups: SEOC, SEOO, SEOQ, SEOD.
Regards,
Ankur Sharma