Dynamic tray selection - SAPScript

Hi,
I need to dynamically select a tray to print a form using SAPScript, depending on some condition.
Need to know how to do this?
Thanks in advance!
regards,
Karen

There are 2 options. The first one I have not used before but I think it is the better way.
Example: You want print out an invoice on different paper.
In SAPscript you have in this invoice 2 pages:  "FIRST" and "NEXT"
Salesorganization 1000 = TRY01
Salesorganization 2000 = TRY02
**************************************************************************************** 1st option
1st option: (As mentioned in this thread): Create not 2 but 4 pages:
F_01 and N_01          both with Resource Name = TRY01
F_02 and N_02          both with Resource Name = TRY02
Page F_01:   in field "Next page":  N_01
Page N_01:   in field "Next page":  N_01
Page F_02:   in field "Next page":  N_02
Page N_02:   in field "Next page":  N_02
In the print-program you have to decide if you want to have page F_01 and N_01 or F_02 and N_02.
For this reason call function  "OPEN_FORM"  without the name of the form (SAPscript) because in
call function START_FORM you can export the page.
data:   GV_STARTPAGE type TDPAGE.
if vbdkr-vkorg = '1000'.
  GV_STARTPAGE = 'F_01'.
endif.
if vbdkr-vkorg = '2000'.
  GV_STARTPAGE = 'F_02'.
endif.
call function START_FORM
  FORM = name of form
  LANGUAGE = nast-spras
  STARTPAGE = GV_STARTPAGE
  and so on
  call function WRITE_FORM
  call function WRITE_FORM
  call function WRITE_FORM
call function END_FORM.
call fuction CLOSE_FORM.
**************************************************************************************** 2st option
Short description:
Normal SAPscript only FIRST and NEXT, both with same tray.
ABAP: Do not print, only get OTF-data.
Change the tray in OTF-data.
Print OTF-data.
I have done this before and I know it works. But I think the 1st option is better.
You can change the field for the "Recource name" from TRY01 to TRY02 in the print program but only with a trick.
Do not print out in a normal way (Open_form; write_form; close_form).
Solution:
In function OPEN_FORM     set field    OPTIONS-TDGETOTF to 'X'.
This means: The function CLOSE_FORM will not print into spool and maybe from spool to the printer but the print data will only be stored into a table.
In SAPscript you have 2 Pages. FIRST and NEXT; both with Recource name = 'TRY01'.
At the end nn CLOSE_FORM you can receive the table OTFDATA.
data: GS_OTFDATA type ITCOO,
        GT_OTFDATA type standard table of ITCOO.
call function CLOSE_FORM
  tables OTFDATA = GT_OTFDATA.
* Up to now no data have been sent to spool.
* If you have a look now into table GT_OTFDATA (field TDPRINTPAR) you will
* find in the first lines  "TRY01"
* You can change this
If vbdkr-vkorg = '2000'.
  loop at GT_OTFDATA into GS_OTFDATA.
*   Find the pattern "TRY01" in GS_OTFDATA-TDPRINTPAR
*   with commands FIND or SEARCH or something like that.
*   Change the pattern "TRY01" in GS_OTFDATA-TDPRINTPAR to "TRY02"
*   and take over this change to table GT_OTFDATA with command "MODIFY".
*   Please notice: In table GT_OTFDATA the pattern "TRY01" can occure more than 1 time.
    modify GT_OTFDATA from GS_OTFDATA.
  endloop.
endif.
* Now print the OTF-Data
call function PRINT_OTF
* the paramters are   PRINTOPTIONS (same as in OPEN_FORM)
*                   and tables OTF = GT_OTFDATA.
Ok, I know the problem and the thread are very old but maybe someone wants to have a more detailed solution.
Keywords in English: SAP ABAP SAPscript  Resource Name ITCTG-TDPAPERRES   from program dynamically dynamic dynamically
TRAY  TRY01 TRY02 TRY03
Keywords in German: SAP ABAP SAPscript  Resourcenname   ITCTG-TDPAPERRES vom Programm aus dynamisch TRAY  TRY01 TRY02 TRY03 Druckerschacht Schachtsteuerung Druckerschachtsteuerung verschiedenes Papier
best regards
Norbert Zanders

Similar Messages

  • Dynamic Tray Selection in Smartforms

    Hi all,
    I am looking for a solution, to set the tray in a Smartform dynamically.
    It is not sufficient to set the Tray statically on the "Output Options" tab -> Ressource Name.
    Can anybody help me?!?
    Thanks and best regards,
    SteCee

    Normally, tray selection is done using GET_PRINT_PARAMETER FM.
    Refer to these threads, may be helpful -
    Print to different output tray in SAPscript/Print Workbench
    Automatic tray selection for printing
    Regards,
    Amit

  • Smart form dynamic tray selection on printing

    Hi Experts,
    I have a requirement in smart form that need to output the a particular invoice to a particular tray a printer. For e.g. tray 2.
    I have added TRY02 to the resource name of the pages in the smartform, but still the invoice is being printed to the default tray of the printer.
    I have done a test to that printer by printing the SAPCRIPT-TRAYTEST from SO10, and the output is being printed correctly i.e. to the different trays. So I guess the printer has been configured correctly.
    Is there any additional configurations that need to be done for smart forms for the tray selection works correctly? And, is it correct the way I implemented the functionality in the smart form?
    Can someone help please?
    Thanks in advance
    Regards,
    Zaheed

    Hi Experts,
    I have a requirement in smart form that need to output the a particular invoice to a particular tray a printer. For e.g. tray 2.
    I have added TRY02 to the resource name of the pages in the smartform, but still the invoice is being printed to the default tray of the printer.
    I have done a test to that printer by printing the SAPCRIPT-TRAYTEST from SO10, and the output is being printed correctly i.e. to the different trays. So I guess the printer has been configured correctly.
    Is there any additional configurations that need to be done for smart forms for the tray selection works correctly? And, is it correct the way I implemented the functionality in the smart form?
    Can someone help please?
    Thanks in advance
    Regards,
    Zaheed

  • SAPScript and dynamic tray selection

    Hi,
    A customer of mine has 2 identical SAPScript layout sets defined with 1 minor difference - within the page attributes a different printer tray has been defined (attribute called resource name) in order to choose a different printer tray ...
    I was wondering wether this value could not be dynamically set by the SAPScript output program (when opening the layout set or using a specific command) ?
    I didn't really find any special function or parameter in the open_form function module ... I find it a shame that only for the tray functionality we have to maintain 2 layout sets ...
    Or can this be achieved in a total different way?
    Thanks,
    Steven

    I am not sure if you can change Tray attribute on a page dynamically from print program.
    But I have a suggestion, Why don't you create two pages identical in one single SAPScript just with the Tray different on each one. And call appropriate page while printing dynamically from your program using Function "CONTROL_FORM".
    Advantage in this approach is, you do not need to maintain two different SAPScripts. And all code maintenance in SAPScript is common to both the pages, so do not need to make changes twice.
    Limitation is if you resize any window in one page need to do the same on the other page too. This is still OK because usually you do not resize as often as you make changes in the code.
    Shashi Reddy

  • Dynamic Tray Selection

    Hi All,
    When the print out is issued from the SMARTFORM, it should automatically determine the tray for the paper (based on a pre-defined logic):
    The trays can be:
    Tray 1
    Tray 2
    Manual Feed
    I tried sending Dynamic Value in RESOURCE NAME field of Smartform Page. The Value i tried in TRY1, TRY2. But printer is not selecting according to the value passed at runtime in field RESOURCE NAME. Could someone please let me know about the exact name to be specified in RESOURCE NAME as the field is 20 characters long.
    If GET_PRINT_PARAMETERS is to be used, please let me know where should i pass the internal table which i get from GET_PRINT_PARAMETERS FM.
    Thanks,
    Best regards,
    Prashant

    Hai prashant,
    Do you want to define the tray statically?.
    Then you can mention the tray at the page level.
    Select the page and select 'output options' tab.
    There you can mention the tray name with the resource field.
    if you want to select the tray dynamically then ,refer the OSS note 367128 and apply the OSS note which is applicable for release 4.6 C.
    Implement the program correction. Afterwards, you can also enter a field (for example, ) in field 'Resource'. This field must be defined in a global manner (the type must be RSPORESNAM). You must set the value of this field before you call up the page. That is, you must either supply the value on the first page via the interface or you must set it during the initialization. If you call a page via an explicit page break, you must have set the value before the page break.
    I hope this should resolve your issue.
    You can even try using cal functions.
    CALL FUNCTION 'GET_PRINT_PARAMETERS'
    GET_PRINT_PARAMETERS
    Regards,
    Srikanth.
    Please reward points If it is helpful

  • Can we change tray selection dynamically?

    Hello experts,
    is it possible to change the tray selection dynamically? That is to say, via the driver program.
    For example the default tray on the SAPscript  form is TRY02. So if there are less than 20 lines on a form, it'll use TRY02 containing paper with pre-printed text. However, if there are more lines, then, I would like it to use TRY03 containing blank paper, for the rest of the information.
    Is this possible via programming or any other way for that matter?
    Your help is greatly appreciated.
    Edited by: Goharjou ardavan on Oct 29, 2008 11:07 AM

    Hi,
    Tray Options are available in the Output Device. You can't control it from the SAP Script. In Output device Tray's will be defined, But there is no option to shift the Tray based on the lines.
    But If you guys can define two output device, one with tray TRY02 and other device with tray TRY03. Then in the program based on the how many lines, Pass the Respective Output device to the Spool structures in the program.

  • Tray selection with LOCL in sapscript

    I want to print the document from Tray 2 always and so I set the resource name in the sapscript to TRY02. When I put the printer name in, it works fine and prints from tray 2. But when I put LOCL as the output device, it always prints from the default tray. Does anyone have a solution to this?

    I think this is because of your local printer configuration
    Please find the documentation related to this-> this documentation i found in start> printer and faxes>select your default printer> right click> properties> help> index --> find tab > type tray> Selecting paper by type or source
    If your application supports printing by paper type or source, make the selections from your application. Application settings override printer driver settings.
    You can configure the printer to select paper by Type (such as Plain or Letterhead) or Source (such as Tray 1 or Tray 2). If you frequently use several different kinds of paper, once trays are set up correctly from the printer control panel, you do not have to check which paper is loaded in each tray before you print.
    Your paper trays must be configured from the printer control panel before you can print by type. To configure your paper trays, see the printer user guide.

  • Tray selection for sapscript

    I am working on tray selection for an invoice sapscript. It should print in Tray 2 and so I have set Resource Name in Sapscript form to TRY02.
    It works in one client and not in another client. Does anyone have an idea why this could be?

    Please check thru transaction code SPAD
    In SPAD > select the printer>. On the output devicescreen,--> menu selection Goto --> Device Type. This will allow youenter specific PCL code for all Print Controls.
    SE71 -> on page layout, --> give a tray name (TRY01) in the resource name to all pages in the sapscript.
    But you should know the printer PCL codes (basis can help you on this)

  • Printer tray selection in smartforms

    Hi All,
    I have a requirement that for a particluar printer the smartform should be printed using a particular tray (for ex. Tray4). How can this be achieved?
    Regards..

    Refer these threads,
    Print to different output tray in SAPscript/Print Workbench
    Automatic tray selection for printing
    Regards,
    Joan

  • Tray selection of printer doesn't work with printing order confirmation

    Hello,
    When we try to print output for the order confirmation document (BA00 and custom ZBA0) on a different paper tray (e.g. tray 2 for printer avbekyo-01_tray2 in SAP R/3) then the ouput is printed to tray 1 in stead. We have defined two different printers in SAP for the tray selection. We tested the ouput on different printers, besides the avbekyo-01 and went wrong on the others also. When we print out an invoice (ZRD0) to the printer on the second tray, the invoice is printed correctly from the second tray. With an ABAP developer we debugged the print process, but no code leads to the fact that the output for the order confirmation should be printed to the first tray, while the second tray was selected in the output record. In the code still the second tray is processed, but printed on the first. The only difference we can find is that the order confirmation is SAPScript and the invoice is a Smartform. Does anyone know a solution?.
    Kind regards

    Unfortunately the setting doesn't resolve the problem. We also have activated the settings of Tray2 in the option Tray Info.
    Edited by: Chantal Polman FUNC ACCOUNT on Jun 4, 2008 2:32 PM

  • Impose tray selection

    Hi,
    I was looking for a way to make a tray selection and eventually ended up in property that exists in the Print dialog box: "Choose paper source by PDF paper size".
    If we have a pdf with 2 different page sizes across the document and a printer with 2 corresponding trays predefined to these page sizes then each page will print to the right tray determined by the current page's page size.
    But if all pages in the pdf have the same size e.g. A4 and we still want tray selection on certain pages? For example in the first tray we have blue A4 and in the second tray yellow A4?
    I thought that some good idea is to rotate 90 degrees of pages that intended for the second tray. For example we suppose that tray 1 has predefined page size 21x29,7 and tray 2 to 29,7x21. In the first tray will be printed the original A4 (portrait) and in the second tray the rotated (landscape) pages. The only
    drawback of this method is that the output pages from the second tray must un rotated.
    Am I right or it will recognize the trays as same?  Has anyone other solution?

    Please check thru transaction code SPAD
    In SPAD > select the printer>. On the output devicescreen,--> menu selection Goto --> Device Type. This will allow youenter specific PCL code for all Print Controls.
    SE71 -> on page layout, --> give a tray name (TRY01) in the resource name to all pages in the sapscript.
    But you should know the printer PCL codes (basis can help you on this)

  • Printer Tray Selection in xml-Source

    I want to print my AdobeForm only at the Tray1. When there is another Paper in the primary Tray the printer have to print the AdobeForm in Tray1 not in the primary Tray.
    Who can tell me whats the source Code. PrinterProtocoll is PCL5e.
    Thx

    Refer these threads,
    Print to different output tray in SAPscript/Print Workbench
    Automatic tray selection for printing
    Regards,
    Joan

  • Wrong automatic paper tray selection in HP LaserJet M3035 printer.

    Hello,
    I have a printer (this one http://h10010.www1.hp.com/wwpc/us/en/sm/WF06b/18972-18972-3328064-12004-3328083-2512333-2512337-3435... ) shared in Active Directory by several users (running Windows XP machines). The thing is that no matter how many times I try to set the source paper tray to a specific one, it seems it doesnt apply/store the changes, and it comes back to Auto tray selection  (and it always selects tray #1, which is the one im trying to avoid), causing an issue which needs to be solved by hand.
    Thanks a lot in advance.

    1. Go into your SETUP MENU on your printer.
    2. Choose PREFERENCES
    3. Choose DEFAULT TRAY.
    Try it and let me know what happens, thanks.
    **Click the KUDOS star on the left to say 'Thanks'**
    Please mark a reply "ACCEPTED AS SOLUTION" if it solved your problem, so others can find it.

  • Does the Officejet 8600 Pro Premium N911n printer perform auto tray selection?

    I have an Officejet 8600 Pro Pemium N911n printer,  CN577A with two trays. My Operating Sysem is Win8,64bit,there are no error messages, no system changes.
    The HP Officejet Pro 8600 e-All-in One series User Guide states that By default, the printer draws media from Tray1.If Tray1 is empty, the printer draws media from Tray2(if it is installed and loaded with media. I have Tray lock disabled ,Tay1 the default Tray and Automatic Tray Selection enabled.Prior to making these selections,I contacted HP support via email to report that this option was not working. I received a response that there is no method that will automatically select a tray when one tray is empty. The User 's manual states otherwise..This option might not work but it is part of this series of printers. I have both trays loaded and I will determine if it works after Tray1 is empty. Does anyone have one of these printers and the auto Tray function works? Thanks.
    This question was solved.
    View Solution.

    Hello wardell1,
    Please take a look at this document and let me know if the troubleshooting steps help resolve your issue.
    Good luck!
    ↙-----------How do I give Kudos?| How do I mark a post as Solved? ----------------↓

  • Dynamic bandwidth selection for PPPoE over Ethernet/VLAN

    Hello all, hope you are doing great.
    I'm planning to deploy PPPoE Server (Cisco Router 7609) for a ISP. This ISP will provide Internet connection for customer over Ethernet.
    I have to provide a solution to assign bandwidth to each customer by RADIUS and I find some clues that Dynamic Bandwidth Selection (DBS) should be the answer. Unfortunately, DBS only support PPPoA or PPPoE over ATM.
    If you have any experience with equivalent function, please help me. Thank you very much.
    Regards,
    Hiep Nguyen.

    Hiep,
    I think I have figured this out.  Here is the test config on my PPPoE server:
    int lo1
      ip address 172.25.25.25 255.255.255.255
    ip radius source-interface Loopback1
    aaa new-model
    radius-server host 172.16.1.55 auth-port 1812 acct-port 1813 key cisco$$$
    aaa group server radius RADIUS-ACT
     server 172.16.1.55 auth-port 1812 acct-port 1813  
    aaa authentication login default group RADIUS-ACT local
    aaa authorization exec default group RADIUS-ACT local
    aaa accounting exec default start-stop group RADIUS-ACT
    aaa accounting delay-start
    aaa authentication ppp default if-needed group RADIUS-ACT local
    aaa authorization network default group RADIUS-ACT local
    aaa accounting network default start-stop group RADIUS-ACT
    aaa accounting update periodic 5
    bba-group pppoe global
     virtual-template 1
    interface fa0/1
     pppoe enable group global
     ip address 172.30.0.1 255.255.0.0
     no shut
    interface Virtual-Template1
     mtu 1492
     ip unnumbered FastEthernet0/1
     peer default ip address pool GLOBALPOOL
     ppp authentication chap
    ip local pool GLOBALPOOL 172.30.0.2 172.30.127.255
    policy-map POLICE-128K
     class class-default
        police 128000
    policy-map POLICE-512K
     class class-default
        police 512000
    Here are the attributes on the radius server, for a group the PPPoE customer belonged to:
    Service-Type = Framed
    Framed-Protocol = PPP
    cisco-avpair="ip:sub-policy-In=POLICE-128K"
    cisco-avpair+="ip:sub-policy-Out=POLICE-512K"
    Here is the show policy-map on the virtual-access interface the client connected on:
    sho policy-map int virtual-a 3
     Virtual-Access3
      Service-policy input: POLICE-128K
        Class-map: class-default (match-any)
          1000 packets, 1402000 bytes
          5 minute offered rate 0 bps, drop rate 0 bps
          Match: any
          police:
              cir 128000 bps, bc 4000 bytes
            conformed 799 packets, 1120198 bytes; actions:
              transmit
            exceeded 201 packets, 281802 bytes; actions:
              drop
            conformed 0 bps, exceed 0 bps
      Service-policy output: POLICE-512K
        Class-map: class-default (match-any)
          911 packets, 1137746 bytes
          5 minute offered rate 0 bps, drop rate 0 bps
          Match: any
          police:
              cir 512000 bps, bc 16000 bytes
            conformed 799 packets, 1136178 bytes; actions:
              transmit
            exceeded 0 packets, 0 bytes; actions:
              drop
            conformed 0 bps, exceed 0 bps
    I was able to generate enough traffic with ping to meet the exceed action in and have it drop packets.

Maybe you are looking for

  • Error while installing a packaged application

    Hi I am getting the following error while trying to install the "Sample Master Detail" application in my apex oracle account on the web. All the others install without problem. What could it be ? Thanks Juan Execution of the statement was unsuccessfu

  • Writing HTML code in groovyscript.

    Hello, af:table has following line: emptyText="#{bindings.CountrySetupVO1.viewable ? 'No data to display.' : 'Access Denied.'}" I'm required to display 'No data to display' in RED color. So tried using <span class="AFErrorText">No data to display</sp

  • Live Capture Plus, CatDV and FCPX Import Files

    I have tested my workflow process as set out in thread: Re: Is my workflow reasonable for a beginner? capturing Sony handycam DV using Live Capture Plus - that seems to work fine. Files set up in CatDV under the appropriate directory structure as mov

  • Modifyg data type in view

    Dear all I need a solution to modify the data type in view.I am herewith the example Create table T1(F1 Number(20)) create materialized view t1_view as select f1 from t1; sql>desc t1_view ------------------=------ F1 NUMBER(20) I need the output like

  • Quick / Direct Approval not possible for Bid Approval

    Dear Friends, The Direct Approval/Rejection buttons are disabbled while approving Bid in managers Approval inbox. Is this a standard functionality? that the manager has to get in the Bid details and then Approve or Reject the Bid. However the same ma