2005 Jun 28 2:42 PM
Hi,
I'm trying to call a sapscript from a class method like:
method mymethod.
call function 'OPEN_FORM'.....
call function 'START_FORM'......
call function 'WRITE_FORM'....
.....
endmethod.
The layout and the fixed texts comes out correctly and I can print the form;
BUT
All the variable fields are lost!
In a normal program I define:
data: mymara type mara.
perform: fill_mymara.
call function 'WRITE_FORM'
...and mymara is available in the script and I can use it like:
&mymara-matnr&
But If I do the same inside a method..... NOTHING!
So the question:
Do you know I can I pass the data to a form from a OO class method?
Many thanks,
Lorenzo
2005 Jun 28 2:52 PM
2005 Jun 28 3:05 PM
2005 Jun 28 3:13 PM
Ooooops! I can't!
I have no main program. There's no "outside". My transaction calls directly a method of my "handler" class.....
Well, I think I can create a main program but doing it just for this.... I don't like it at all.
Do you think that moving to smartform I can find better luck? (I'm just at the early development of the form). I've never done a smartform but maybe it worth a try...
Thanks,
Lorenzo
2005 Jun 28 3:21 PM
Yep, that would be a problem if calling the method directly.
I've messed with Smartforms a little, but never really did a smartform that is in use in a productive system. I am not sure if they are as "picky" as sapscript forms. I would give it a try if you have the time.
Also, I realize that you probably want to use OO because its "new", I feel the same way, but in this particular case, you would probably be better off writing the print program in classic ABAP. Especially, if the output is to be trigger by configuration. In some cases, the configuration may only handle "regular" programs with the SAPscript form. Just a suggestion.
Regards,
Rich Heilman
2005 Jun 28 3:38 PM
Rich,
you're being very helpful.
As a matter of fact, even though I have been in SAP since 1998 (MM, SD..), I've been "messing around" in ABAP only for a year or so. Since I have to learn ABAP almost "from scratch" I thought of jumping straight to OO, since I see a lot of potential advantages.
As a matter of fact I have to jump in an out of OO for almost all of GUI controls, but I've wrapped most of them.
I've no idea of what do you mean by "configuration" but I have the feeling it is not my case...
Regarding smartforms: I've migrated my draft sapscript to a smartform and put a "call function" from my OO method and it works smoothly.
I like that you have to pass explicitly in the call all the parameters/tables you want to print. Much more clean in my opinion.
So I think I'm going in that direction. I suppose it'll be a little effort at the beginning but otherwise programming would be boring....
I'll write my results later.
Ciao,
Lorenzo
2012 Nov 22 5:39 PM
Hello Lorenzo & Rich,
I am having exact requirement except that the output type i.e RAW_DATA_INTERFACE in OPEN_FORM is I (IDOC) for me.
All my variables declared in the method are not getting printed but those STATIC variables of the class mentioned as ZCL_CLASS=>FIELD1 are printed correctly.
How did you manage to print the normal variables ? Did you define them outside of CLASS definition / implementation ?
I am not sure I can add the variable definitions outside class as my class is generated from SE24 and i have no idea how to navigate to the source code.
Really appreciate your replies.
Thanks
BR
Nilesh