Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Printing !

Former Member
0 Likes
626

Hi all,

I would like to print text on a printer from my ABAP program.

I know the NEW-PAGE PRINT ON/OFF syntax which, I think , send to the printer all the text used with a WRITE statement between the NEW-PAGE PRINT ON instruction and the NEW-PAGE PRINT OFF instruction.

My problem is that I want to use a fonction module (that I will create)

to print a text contained in a parameter, so, a varaiable text.

My question : is it possible to print a text contained in a structure/variable ? Or is it possible to print some text using a fonction module ?

Thanks a lot !

Regards,

--Yohann.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
547

Yes but the text I want to print will come from the program that call the fonction module , this is my problem..

The program defines the text to print, the fonction module print it...and so i can reuse this fonction module.

3 REPLIES 3
Read only

naimesh_patel
Active Contributor
0 Likes
547

Yes. You can use the NEW-PAGE ... syntax in the Function Module also.

Give a try..

Regards,

Naimesh Patel

Read only

Former Member
0 Likes
548

Yes but the text I want to print will come from the program that call the fonction module , this is my problem..

The program defines the text to print, the fonction module print it...and so i can reuse this fonction module.

Read only

0 Likes
547

I don't think this is a problem.

I have created this test FM:


FUNCTION ZTEST_NP_WRITE.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  IMPORTING
*"     REFERENCE(I_NAME1) TYPE  CHAR30
*"     REFERENCE(I_NAME2) TYPE  CHAR30
*"----------------------------------------------------------------------

  DATA:  PRI_PARAMS TYPE PRI_PARAMS.

  NEW-PAGE PRINT ON  PARAMETERS PRI_PARAMS
                               NO DIALOG.
  WRITE: / I_NAME1, I_NAME2.

  NEW-PAGE PRINT OFF.

ENDFUNCTION.

Used it in the program.


  DATA: L_NAME1 TYPE CHAR30,
        L_NAME2 TYPE CHAR30.

  L_NAME1 = 'Naimesh'.
  L_NAME2 = 'Patel'.

  CALL FUNCTION 'ZTEST_NP_WRITE'
    EXPORTING
      I_NAME1 = L_NAME1
      I_NAME2 = L_NAME2.

It has generated the Spool, which I had expected.

Regards,

Naimesh Patel