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

Printing lists in ABAP without using the standard button

Dear community,

i've got a little problem and I can't fix it on my own.

Some user in our company gave me the instruction to extend an existing SAP Programmm with some defined functionalities.

They want to implement an new button for printing in the gui status and when someone uses the buttons they want to count down a number and print the generated list of the report.

I created also the new button in the gui status with a own functioncode and in the report i implemented an own AT USER-Command event:

*&----


**& Event

*&----


AT USER-Command.

CASE sy-ucomm.

WHEN 'PRVR'.

CALL FUNCTION 'PRINT_REPORT'

EXPORTING

report = sy-cprog

EXCEPTIONS

OTHERS = 99.

When I push my own print button th reports jumps in the At-user-command event.

The window for chosing the print properties will appear immediatly and I cn start printing.

But only the spool-order will only appear when I leave the list-view with the button "back", "exit", or "cancel".

Has anyone an idea why the output appears only when I go back to the selection screen?

Can anybody tell me how to create an printing function to print out the list of an abap-report? I don't wnt to use the normal print-button!

Many thanks in advance.

Michael

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jan 09, 2007 at 01:42 PM

    Try this...

            NEW-PAGE PRINT ON
            DESTINATION P_DEST2
            IMMEDIATELY ' '
            KEEP IN SPOOL ' '
            LINE-SIZE 100
            NEW LIST IDENTIFICATION 'X'
            NO DIALOG.
    
    * You report
    
            NEW-PAGE PRINT OFF.
    

    That way...You report would be printed as soon as you press the button -;)

    P.S: If you wanted to keep it in Spool...KEEP IN SPOOL 'X'.

    Greetings,

    Blag.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 09, 2007 at 04:19 PM

    Hi Michael,

    i have tried it with this code:

    REPORT ZGRO_TEST1.

    *

    TABLES: MARA.

    *

    START-OF-SELECTION.

    *

    SELECT * FROM MARA UP TO 100 ROWS.

    WRITE: MARA-MATNR.

    ENDSELECT.

    *

    AT USER-COMMAND.

    *

    <b> SY-LSIND = 0.</b>*

    CASE SY-UCOMM.

    WHEN 'PRPV'.

    CALL FUNCTION 'PRINT_REPORT'

    EXPORTING

    • NO_DIALOG = 'X'

    <b> REPORT = SY-REPID.</b> ENDCASE.

    Perhaps you have to set SY-LSIND = 0.

    Hope it helps.

    regards, Dieter

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Dear Dieter,

      I'm very gradefull about your answer.

      But I don't understand the coding. What does the value SY-LSIND mean and why have I got to set it to 1?

      I hope you can explain me. 😊

      Many thanks and bye...

      Michael

  • author's profile photo Former Member
    Former Member
    Posted on Jan 10, 2007 at 07:58 AM

    Hi Michael,

    sy-lsind is the list-id. If you set it to 0 or 1 it jumps (when using BACK)

    to the first output-list.

    Here a short demo-code to understand it.

    Make severeal time doubleclick in the outputline and

    look at the changing output.

    try it with:

    • sy-lsind = 1

    and

    sy-lsind = 1.

    *

    REPORT ZGRO_TEST1.

    *

    data: dc type i value 1.

    START-OF-SELECTION.

    *

    WRITE: / 'List:', dc, 'SY-LSIND:', SY-LSIND.

    HIDE: SY-LSIND.

    *

    AT LINE-SELECTION.

    dc = dc + 1.

    • sy-lsind = 1.

    WRITE: / 'List:', dc, 'SY-LSIND:', SY-LSIND.

    HIDE: SY-LSIND.

    *

    Hope it helps.

    Regards, Dieter

    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.