‎2005 Jul 11 8:53 AM
Hi, I have create a smart form that have one text element and one command. The command is for do a page break.
I have seen that you can call the smart form from a program doing:
1.-'SSF_FUNCTION_MODULE_NAME'
2.-call function fm_name
That is not ok for me because I want to call to the smart forms manually as befores it done with sap-script, open form, write , close form...
What function Have I to use to call to the text element?
What function Have I to use to call to the command?
Someone have and example calling a smart form from an abap.
Thanks in advance.
MANUEL
‎2005 Jul 11 9:05 AM
Look at the reports sf_example_01 and sf_example_02.
About your questions i think that smartforms does that automatically, so it's not possible to control it from abap code.
Best wishes,
Alejandro
‎2005 Jul 11 9:01 AM
Hello,
I'm not sure you could do that, why don't you call your text-element or anything else in the smartforms ?
regards
Frédéric
‎2005 Jul 11 9:05 AM
Look at the reports sf_example_01 and sf_example_02.
About your questions i think that smartforms does that automatically, so it's not possible to control it from abap code.
Best wishes,
Alejandro
‎2005 Jul 11 9:37 AM
Hi, if you look inside the function module that automatically is generated when you create some smartform, you will see that is possible to control the smart form, it is using functions to open, to close...
I need to do that because I want to pass data from a program to the smart forms and control when the page have to break to a new one.
MANUEL
‎2005 Jul 11 9:46 AM
Hi Manuel,
I think you can still control the page break inside the smartforms. Pass all your data into the smartforms and use the LOOP (if the data is in an internal table) and COMMMAND nodes to control your page break. You have all the flexibility of writing ABAP code in smartforms.
Thanks
Vinod
‎2005 Jul 11 9:57 AM
Hi Vinod, I do not understand very good that you propose.
I explain more details of I have to do:
I have a abap program that read and write some data, I want to pass every line of the report to smart form, and in some lines comes a break page that I have to force also in the smart form, the idea
LOOP AT ITAB.
IF ITAB-LINE EQ '<BREAK>'.
BREAK PAGE IN SMART FORM
ELSE.
PASS ITAB-LINE TO SMART FORM
ENDIF.
ENDLOOP.
In order to do that I have created in the smart forms one text element X_LINE that represents every line and a command NEWPAGE that force page break.
Is possible to do that I want by the way that you propose?
Thanks in advance.
MANUEL
‎2005 Jul 11 10:02 AM
Hi,
In smartforms,if you right click main window,then you can find create program lines.Here you can write your ABAP code.
Check this link.
‎2005 Jul 11 10:12 AM
Hi Manuel,
This can be done inside the smartform itself.
Instead of passing each line (like SAPScript) to the smartform (not sure whether this will work), pass the whole internal table itself using the smartform TABLE parameter. This you can find in the 'Form Interface'.
Then create a LOOP node in the MAIN window and give this internal table as the operand. You have to give a work area for the LOOP. For this go to the Global Definition -> Global Data and declare your workarea same as the internal table structure. If the structure is defined in your main program, you have to create a TYPE in the smartform for reference. Inside the LOOP you can have a COMMAND node for page break and give your condition in the CONDITION tab. The fields in the internal table can be displayed using a TEXT node. You have to write like this &Workarea-fieldname&.
Should you require more help please let me know?
Thanks
Vinod
‎2005 Jul 11 1:35 PM
Hi Vinod, lot of thanks for your answer is very helpful for me I have done that you say me.
All is ok but I have problems with the page break command.
I have created an abap program to test the module, on it I fill a internal table and call the smart form. When I execute the program an exception is raised "
Invalid partial field access: Length 0"
The definition for the command is the following:
- Check new page is marked.
- I have put the actual page as the next. I only have one page.
- I have put two conditions refering to the itab.
Nothing more. I have sure that is the command that cause the problem because I have delete it and all is ok.
Thanks in advance.
MANUEL
‎2005 Jul 11 4:27 PM
All is ok, I have deleted the command and I have inserted it again and works properly, you do not ask me why but...
Thanks for all information.
MANUEL