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

Print selection SAP Script

Former Member
0 Likes
1,473

Hi ,

I am not able to select pages while printing labels through SAP script. If I provide a value in page selection(ITCPP-TDPAGESLCT), it is not taking that value and printing all the pages.

Has anyone faced the similar problem, if yes, how did you solve it?

12 REPLIES 12
Read only

former_member241258
Active Participant
0 Likes
1,380

in ur script one page for printing for mutliple printings?

may that give ur error.

Read only

0 Likes
1,380

Hi Krishna,

No, there are different pages and I want to print only starting 2 pages.

Read only

0 Likes
1,380

HI,

Se this article

http://wiki.scn.sap.com/wiki/x/EQLVDw

Regards,

LeoBuryan

Read only

0 Likes
1,380

Hi Leonardo,

That is for Smartform, I am looking for to do it in Script.

Read only

0 Likes
1,380

Can detail the code into your OPEN_FORM and CLOSE_FORM ?

Regards,

LeoBuryan

Read only

0 Likes
1,380

OPEN_FORM and CLOSE_FORM FM are called as below


CALL FUNCTION 'OPEN_FORM'
     EXPORTING
       form   = 'Z_QM_UD_LABEL_SF'   " Script Name
       options = lv_option.
   IF sy-subrc <> 0.
   ENDIF.


CALL FUNCTION 'CLOSE_FORM'
       IMPORTING
         result                   = itcpp
       TABLES
         otfdata                  = lt_otfdata
       EXCEPTIONS
         unopened                 = 1
         bad_pageformat_for_print = 2
         send_error               = 3
         spool_error              = 4
         codepage                 = 5
         OTHERS                   = 6.

Read only

0 Likes
1,380

Hi Anil,

Try to fill :

lv_option-TDPAGESLCT = 'page number'.

Regards.

Read only

0 Likes
1,380

I want to put the page no in Dialog box which appear during print. I do not want to pass from program. And the pages I put in dialog, it should print based on that.

Read only

0 Likes
1,380

And also, this page number is not passing when I print. (even if I fill lv_option-TDPAGESLCT = 'page number'.) it is still printing all the pages

Read only

0 Likes
1,380

Try include in open_form

IMPORTING

             result                      = itcpp

CALL FUNCTION 'OPEN_FORM'

     EXPORTING

       form   = 'Z_QM_UD_LABEL_SF'   " Script Name

       options = lv_option

IMPORTING

             result                      = itcpp.

   IF sy-subrc <> 0.

   ENDIF.



Regards.

Read only

0 Likes
1,380

Still it is not working

DATA: lv_option TYPE itcpo,
         itcpp    TYPE itcpp.

* Open the Script
   CALL FUNCTION 'OPEN_FORM'
     EXPORTING
       form    = 'Z_QM_UD_LABEL_SF'   " Script Name
       options = lv_option
     IMPORTING
       result  = itcpp.
   IF sy-subrc <> 0.
   ENDIF.


I am not passing any values either in options or in result parameters of OPEN_FORM Function Module

Read only

0 Likes
1,380

Hi Anil,

maybe you could add the exceptions to the call function 'open_form' and then check sy-subrc.

One of the exceptions is OPTIONS and documentation says, that one of the reasons for this exception could be:

"The field TDPAGESLCT for selecting the pages to be printed contains invalid characters."

Best regards,

Dominik