Skip to Content

Common Include

HI Guys,

i have written a common include which should be used by any program. The include consists of generating the spool and writing to PDF.

But i have a problem with the piece of code below

IF WF_VALID <> SPACE.

NEW-PAGE PRINT ON PARAMETERS WF_PARAMS NO DIALOG.

LOOP AT IT_EMP INTO WA_EMP.

WRITE:/ WA_EMP-ORT01, WA_EMP-ORT02 " Output written to Spool

ENDLOOP.

NEW-PAGE PRINT OFF.

ENDIF .

The write statement cannot be common for all the programs. And i cannot write this in the main programs as it is in the middle of the include. Is there any solution for this.

Thanks in advance

madhu reddy

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Sep 10, 2007 at 03:22 PM

    Then simply write the condition :

    <b>if sy-cprog = program name</b>. ( Here you can mention program names which ever you want)

    LOOP AT IT_EMP INTO WA_EMP.

    WRITE:/ WA_EMP-ORT01, WA_EMP-ORT02 " Output written to Spool

    ENDLOOP.

    endif.

    Thanks

    Seshu

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member madhu reddy

      Hello Madhu,

      Yes,because you said that you will not modify in main program then best would be maintain the condition in include.

      if you use SY-CPROG then it gets the program name from called program(Main program),

      so you can write the condition so that your write statement will trigger only few programs.

      Thanks

      Seshu

  • author's profile photo Former Member
    Former Member
    Posted on Sep 10, 2007 at 03:30 PM

    Hi madhu ,

    You can copy this include in your program and perform and delete unwanted write statements.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Sep 10, 2007 at 03:32 PM

    HI,

    you can do like this.

    if you include name is Zinclude, then,

    Perform print_program(Zinclude) using ls_data

    changing lt_output.

    Regards,

    Niyaz

    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.