Skip to Content
author's profile photo Former Member
Former Member

Program to Print sapscript

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?

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Nov 10, 2015 at 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.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 10, 2015 at 01: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'.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.