Skip to Content

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

Add a comment
10|10000 characters needed characters exceeded

Related questions

6 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Dec 08, 2009 at 11:56 AM

    Hi!

    What do you mean on tray? There are no trays on SAPScripts (AFAIK).

    Regards

    Tamá

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 08, 2009 at 01:13 PM

    See [sap library - sapscript - page|http://help.sap.com/saphelp_nw04/helpdata/en/d1/802e77454211d189710000e8322d00/frameset.htm] (tray must be entered in "resource" field in page attributes)

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 08, 2009 at 01:59 PM

    If you have to do it dynamically, you could create different PAGEs with the resource set for different trays. In your SAPscript logic you can check the conditions, and then issue a NEW-PAGE command with the page you need.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 09, 2009 at 07:49 AM

    Hi

    Their is no Dynamic Tray selction in SAPSCRIPT , but u can check with your BASIS consultant and ask him to print those particular SCripts to a specific tray , which he can do... but via program u cannot do dynamic selection of program in scripts.

    surya

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 10, 2009 at 10:55 AM

    Hi,

    Check out SAPSCRIPT-TRAYTEST in so10, this shows how you can select trays.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 25, 2012 at 09:05 AM

    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

    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.