‎2015 Nov 10 11:05 AM
Hi All The past two days I have been learning how create SAPSCRIPTS preparing for an upcoming project.
I created a form with only three elements a graph(logo), our address and a main window.
When I do a test print the form comes out fine but on SE38 when I execute the below code I get the message that the elements are not defined in the program.
REPORT Z_DEMO_TESTSCRIPT.
*----------------------------------------------------------------------*
CALL FUNCTION 'OPEN_FORM'
EXPORTING
device = 'PRINTER'
form = 'Z_DEMO_TEMPLATE'. *
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'GRAPH1'
function = 'SET'
type = 'BODY'
window = 'MAIN' . *
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'OUR_ADDR'
function = 'SET'
type = 'BODY'
window = 'MAIN' .
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'LOGO'
function = 'SET'
type = 'BODY'
window = 'MAIN' .
CALL FUNCTION 'CLOSE_FORM'.
What could I be missing?
‎2015 Nov 10 11:14 AM
Hi khani,
In the form window you need to specify the element names graph1,logo,OUR_ADDR in the main window of the form.
/E GRAPH1
/E LOGO
/E OUR_ADDR.
‎2015 Nov 10 11:28 AM
Hi Chaitanya
I have them defined: You meant in this way right?
‎2015 Nov 10 12:22 PM
‎2015 Nov 10 12:29 PM
‎2015 Nov 10 1:13 PM
Hi Khani Ramatlo,
as i thought and as chaitanya mantripragada said. You need the element-statement inside the windows otherwise they dont get called.
for example:
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'LOGO'
function = 'SET'
type = 'BODY'
window = 'MAIN' .
in this example you need the window "MAIN"
and the command line /E LOGO insode the window main.
only if you do so, all the text after this command line gets printed.
or better to say: all text between this element-command-line and the next element-command-line
Regards
Stefan Seeburger
‎2015 Nov 10 3:34 PM
It makes sense now that the text elements carry what I need to output.
‎2015 Nov 10 1:18 PM
Hi Khani,
No need to create 3 window.
Just keep MAIN window and in Main Page Window define 3 elements
/E GRAPH1
/E LOGO
/E OUR_ADDR.
and then from your print program call as follows:
CALL FUNCTION 'OPEN_FORM'
EXPORTING
device = 'PRINTER'
form = 'Z_DEMO_TEMPLATE'. *
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'GRAPH1'
function = 'SET'
type = 'BODY'
window = 'MAIN' . *
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'OUR_ADDR'
function = 'SET'
type = 'BODY'
window = 'MAIN' .
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'LOGO'
function = 'SET'
type = 'BODY'
window = 'MAIN' .
CALL FUNCTION 'CLOSE_FORM'.
‎2015 Nov 10 3:33 PM
Aaaah thank you guys it now makes sense, I had misunderstood how the text elements work in this context. Thank you so much all the answers were helpful.
‎2015 Nov 10 3:35 PM
In this case I need to call the three windows in one page so instead of deleting them I will call different windows with each function module call. Thank you so much for brining this to my attention.