SAPScript  / SmartForm - 2 Forms & 2 Printer

Hi All,
I have a requirement as below. Please suggest me a suitable solution.
1. The SAP Standard Program calls the Form. The Standard Form is modified to accommodate the client specific changes and added in Customization.
2. If the numbers of pages to be printed is with in one page, Form1 to be used to print the same using Printer A for printing this Form1.
2. If the numbers of pages to be printed are more than one page, Form2 to be used to print the same using Printer B for printing Form2.
3. Form1 and Form2 have different page windows. That is, both First page and Next page are of different Format for both the Forms.
Please write to me,
1. Is it possible to accommodate the above requirement in SAPScript?
1. Is it possible to accommodate the above requirement in SmartForm?
Thanks in Advance,
Kannan

Hello
Do you want to know the idea how find out which form should be called depending of number of pages?
But the question is:
How do you count number of pages ? Usually it's not possible to know that at program running.
Do you count the number of positions? it is not save but it could be use... in the worst case...
What would I do I would use surely ONLY smartform
if I do not want to change Standard program.
You can use in Smartform - COMMAND placed within MAIN Window of First page and with it control the flow of pages withouth any small change done in a Sap Standard Program.
With Command included in MAIN Window you can jump to the diffrent pages.
I think it is complicated but possible to manage...
I have a lot of experience in creating strange
Smartform Flows...
Try to create:
4 Pages
FIRST1 (Next page parked as Next1)
NEXT1  (Next page marked as Next1)
FIRST2 (Next page parked as Next2)
NEXT2  (Next page marked as Next2)
(All of them has the same MAIN window
and in that MAIN window depending on condition use
COMMAND at the beggining and jumb to the
requested PAGE accoring to condition
either FIRST1 or FIRST2)
You must try it and I cannot 100% assure you that it works
Create a simple Smartform and try to test it.
But I have no IDEA how to force printing it on diffrent printers... on diffrent trays it is possible but printers I have no idea...
Greetings
Bogusia [email protected]

Similar Messages

  • Print Currency as symbols in SAPSCRIPT/Smartforms

    Hi all,
    My customer want to print currency not as text but as symbols , for example "S" instead of "USD" .
    Does somebody know how to make it?
    Is there a dynamic solution ?
    Best regards.

    Hi
    U should check if in your system there's the currency symbol and if it supports it.
    The other problem can be in the printer, it need to know if it can understand that symbol.
    U can get all symbols available in your system from table TCP01.
    Here the symbol corresponds to a number has to be used in the sapscript/smartform.
    For example Euro sing is 156, so in the sapscript it need to insert <156>, the dollar shoul be 36, so <036>.
    Anyway you can't be sure your device can print the symbol.
    Max

  • SAPScript Form - Check Print

    Hi. I am trying to create SAPScript Form to print checks and need your help.
    I am very new to the SAPscript, so I have one general question and one specific question.
    1. Is there a really good tutorial for creating a check form?
    2. Currently, AP in our company uses two checks per legal paper.
       Do you know how/what format I need to set up page format to print two checks at a time in one paper?
    Thank you in advance.
    John

    Thank you, but I am little confused.
    Let me try to explain little more detail of my need.
    We have legal size paper containing two blank checks and space to write invoice items below each check.
    If open item has one check to write, just print one check.
    If invoice items goes over length of space allowed, void next check and continue with invoice items.
    If it needs to print two or more checks,
    print first check, print invoice items, print second check (on same legal paper) and invoice items.
    Go to next legal size paper and print third check, etc...
    How do I set up to print second check on same paper below contining to next paper?
    What page format do I need to use?
    I hope this clarifies my need.
    Thanks.
    John

  • Smartform or Sapscript- Does it diifer in printing barcodes.?

    Hi All,
    Does the output of a barcode differ, if smartform or a sapscript is used.
    Does smartform take care of the printers barcode printing..
    One of our barcodes only get printed in a specific printer, so in that case would it work better if we made a smartform.
    Please let me know.
    Thanks,
    Vinotha M

    Yes.
    If you have Barcode in SAPScript, than you need some specific kind of hardware to be present in the Printer to be able to print. Barcode in the SAPScript is being printed with the OLD technology. So, SAP sends OTF data of the Barcode to the Printer and Printer must understand it to be able to print.
    Whereas SmartForm uses the new technology of the Barcode priting. In the new technology, SAP process that barcode as the Image instead of the raw OTF. So, SmartForm is able to print the Barcode irrespective to the Printer hardware.
    Please check this help:
    http://help.sap.com/saphelp_nw04/helpdata/en/d9/4a94c851ea11d189570000e829fbbd/frameset.htm
    Also, check the OSS note 645158.
    Regards,
    Naimesh Patel

  • SAPSCRIPT,SMARTFORMS,PDFFORMS

    Hi SDN Friends!
    I had this question.
    Given a SAP Script or SMART Form ... how do we identify (table names?)
    The Print program associated with them?  Also, how does that concept differ from PDF forms?
    Any body can answer please........
    Markiv

    hi,
    Interactive Forms based on Adobe software is SAP's new solution for forms development. Its first release has the focus on interactive use of forms. High-volume printing is supported in principle, but - being a new solution - the performance has not yet reached the same level as Smart Forms or SAPscript, two established solutions that had years to grow. Interactive Forms is the only solution that will continue to be enhanced with new features, while SAPscript and Smart Forms will be supported without limitations.
    When (or if) to move to Interactive Forms depends on your requirements. For interactive forms usage, i.e. the new functions, you have no choice, as the existing solutions don't support it. High-volume print scenarios need to be carefully analyzed to see whether your concrete requirements can be met at this point.
    However, it is possible to move to Smart Forms and design your forms in such a way that a migration at any point in the future would be but a small step. Smart Forms offers from Web AS 6.40 a migration wizard to Interactive Forms. Technically, everything can be migrated, but we recommend against things like ABAP program nodes, for example.
    You are not forced to ever go to Interactive Forms if you don't want to. It really depends on whether your client needs any of the new features in Interactive Forms. Also, if they are currently working with JetForms, they could enquire with Adobe directly what migration path they offer to the joint solution.
    It is impossible to make a blanket statement on what needs to be done in each of the applications using a form for output. Despite the same underlying technology, forms handling has always been a decision for each SAP application: Some do it through customizing, some through coding, some in yet anither way.
    What I CAN say from a technology pespective is that all applications are in the process of creating their forms based on Interactive Forms so that by 2007 pretty much all SAP forms will be PDF-based. Obviously, each application does it within the framework of their application - but they all use Interactive Forms.
    By the way, be aware that in ERP 2004 this forms solution is subject to a limitation for high-volume printing scenarios as we cannot ensure that ALL customers will be content with the performance in ALL scenarios with this release. (see SAP Note 863893).
    creating :
    To get an overview idea about Adobe forms ,
    Using SFP , first you need to create a interface . in interface you can declare the import and export parameters and also the declaration part, coding etc : This is nothing but similar to Function module interface.
    And now we have to create the Form which is interactive. Create the form and enter the interface name which you have created in first step, so that the parameters , declarations of fields etc : will be copied and available in the form layout. So that you can drag and drop these declared fields ( dclared fields of interface ) to the layout.
    Create the context and layout in the form.
    The layout generated can be previewed and saved as PDF output.
    Now we need to integrate the driver program and the PDF form to get the final output as per the requirement.
    On activating and executing the form you will get a function module name just similar to smartforms.
    The driver program needs to call this FM.
    Refer to the below sample code :
    DATA : is_customer TYPE scustom.
    DATA : it_bookings TYPE ty_bookings.
    DATA : iv_image_url TYPE string.
    DATA : iv_sending_country TYPE adrc-country.
    DATA : it_sums TYPE TABLE OF flprice_t.
    DATA : docparams TYPE sfpdocparams.
    DATA : formoutput TYPE fpformoutput.
    DATA : outputparams TYPE sfpoutputparams.
    PARAMETERS : pa_cusid TYPE scustom-id.
    SELECT SINGLE * FROM scustom INTO is_customer
    WHERE id = pa_cusid.
    SELECT * FROM sbook
    INTO CORRESPONDING FIELDS OF TABLE it_bookings
    WHERE customid = pa_cusid.
    outputparams-nodialog = 'X'.
    outputparams-getpdf = 'X'.
    *outputparams-adstrlevel = '02'.
    CALL FUNCTION 'FP_JOB_OPEN'
    CHANGING
    ie_outputparams = outputparams
    EXCEPTIONS
    cancel = 1
    usage_error = 2
    system_error = 3
    internal_error = 4
    OTHERS = 5.
    IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    docparams-langu = 'E'.
    docparams-country = 'US'.
    docparams-fillable = 'X'.
    CALL FUNCTION '/1BCDWB/SM00000043'
    EXPORTING
    /1bcdwb/docparams = docparams
    is_customer = is_customer
    it_bookings = it_bookings
    IV_IMAGE_URL =
    iv_sending_country = 'US'
    IT_SUMS =
    IMPORTING
    /1bcdwb/formoutput = formoutput
    EXCEPTIONS
    usage_error = 1
    system_error = 2
    internal_error = 3
    OTHERS = 4
    IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    CALL FUNCTION 'FP_JOB_CLOSE'
    IMPORTING
    E_RESULT =
    EXCEPTIONS
    usage_error = 1
    system_error = 2
    internal_error = 3
    OTHERS = 4
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    use link
    http://help.sap.com/saphelp_nw04/helpdata/en/d2/4a94696de6429cada345c12098b009/frameset.htm
    regards,
    Prabhu
    reward if it is helpful

  • Rightfax commands in Sapscript/Smartforms

    Hi,
    We are using RIGHTFAX with SAP ECC 5.0 for fax sending functionality.
    I have read all the threads related to RIGHTFAX functionality but would like to have answers for the following.
    1) Where exactly in a SAPSCRIPT / SMARTFORM form do I add the fax control commands (FCL Commands)so that RIGHTFAX connector for SAP R/3 recognise them?
    For eg: I want RIGHTFAX to include a particular cover sheet.For that I need to write the fax control command RFSAP_FCSFILE:file name. But where do I write that inside sapscript/smartform?
    Thanks,
    Bhaskar Pal.
    This message is not answered.Somehow it is showing as being answered already. I would appreciate your help/input on this issue. Please respond.

    Hi.  First try to set your post as unsolved.  There should be a radiobutton on the left of your post to do so.
    TO answer your questions,  what you need to do is to create a page, this page will be printed first.  Put your FCL commands in this page.  When the document is send to the printer device(the one setup for RIGHTFAX), it will have this coding on the first page.  Once it reaches RightFax,  the software will recognize that there is FCL code on this page and will except it, get the values, apply them, and then it strips off this first page.  This is good because we don't want the end user to see this anyway.  So, create a page in your sapscript called FAXPAGE,  put your commands in there and always start your printing at this page. 
    Regards,
    RIch Heilman

  • Script, , smartforms , adobe forms

    hi friends,
                       i know about script and smartforms,
                       can you clearly tell about adobe forms(pdf)
                       what, where , why ?
    thanks

    Hi,
    t.code SFP.
    definition:
    Interactive Forms based on Adobe software is SAP's new solution for forms development. Its first release has the focus on interactive use of forms. High-volume printing is supported in principle, but - being a new solution - the performance has not yet reached the same level as Smart Forms or SAPscript, two established solutions that had years to grow. Interactive Forms is the only solution that will continue to be enhanced with new features, while SAPscript and Smart Forms will be supported without limitations.
    When (or if) to move to Interactive Forms depends on your requirements. For interactive forms usage, i.e. the new functions, you have no choice, as the existing solutions don't support it. High-volume print scenarios need to be carefully analyzed to see whether your concrete requirements can be met at this point.
    However, it is possible to move to Smart Forms and design your forms in such a way that a migration at any point in the future would be but a small step. Smart Forms offers from Web AS 6.40 a migration wizard to Interactive Forms. Technically, everything can be migrated, but we recommend against things like ABAP program nodes, for example.
    You are not forced to ever go to Interactive Forms if you don't want to. It really depends on whether your client needs any of the new features in Interactive Forms. Also, if they are currently working with JetForms, they could enquire with Adobe directly what migration path they offer to the joint solution.
    go thru this links
    http://help.sap.com/saphelp_nw04/helpdata/en/d2/4a94696de6429cada345c12098b009/frameset.htm
    example
    To get an overview idea about Adobe forms ,
    Using SFP , first you need to create a interface . in interface you can declare the import and export parameters and also the declaration part, coding etc : This is nothing but similar to Function module interface.
    And now we have to create the Form which is interactive. Create the form and enter the interface name which you have created in first step, so that the parameters , declarations of fields etc : will be copied and available in the form layout. So that you can drag and drop these declared fields ( dclared fields of interface ) to the layout.
    Create the context and layout in the form.
    The layout generated can be previewed and saved as PDF output.
    Now we need to integrate the driver program and the PDF form to get the final output as per the requirement.
    On activating and executing the form you will get a function module name just similar to smartforms.
    The driver program needs to call this FM.
    Refer to the below sample code :
    DATA : is_customer TYPE scustom.
    DATA : it_bookings TYPE ty_bookings.
    DATA : iv_image_url TYPE string.
    DATA : iv_sending_country TYPE adrc-country.
    DATA : it_sums TYPE TABLE OF flprice_t.
    DATA : docparams TYPE sfpdocparams.
    DATA : formoutput TYPE fpformoutput.
    DATA : outputparams TYPE sfpoutputparams.
    PARAMETERS : pa_cusid TYPE scustom-id.
    SELECT SINGLE * FROM scustom INTO is_customer
    WHERE id = pa_cusid.
    SELECT * FROM sbook
    INTO CORRESPONDING FIELDS OF TABLE it_bookings
    WHERE customid = pa_cusid.
    outputparams-nodialog = 'X'.
    outputparams-getpdf = 'X'.
    *outputparams-adstrlevel = '02'.
    CALL FUNCTION 'FP_JOB_OPEN'
    CHANGING
    ie_outputparams = outputparams
    EXCEPTIONS
    cancel = 1
    usage_error = 2
    system_error = 3
    internal_error = 4
    OTHERS = 5.
    IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    docparams-langu = 'E'.
    docparams-country = 'US'.
    docparams-fillable = 'X'.
    CALL FUNCTION '/1BCDWB/SM00000043'
    EXPORTING
    /1bcdwb/docparams = docparams
    is_customer = is_customer
    it_bookings = it_bookings
    IV_IMAGE_URL =
    iv_sending_country = 'US'
    IT_SUMS =
    IMPORTING
    /1bcdwb/formoutput = formoutput
    EXCEPTIONS
    usage_error = 1
    system_error = 2
    internal_error = 3
    OTHERS = 4
    IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    CALL FUNCTION 'FP_JOB_CLOSE'
    IMPORTING
    E_RESULT =
    EXCEPTIONS
    usage_error = 1
    system_error = 2
    internal_error = 3
    OTHERS = 4
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    Reward points
    Regards
    pc

  • Help reqd to display the form without print preview call

    Hi all,
    I did one gate pass form and i want to view the form in my selection screen or output screen(just in monitor) as a display by giving one Z-code.
    i.e, we can view the form thru Print preview...the same preview, i want to display after i give my parameter in the selection screen.
    For example.ZGPOUT if i enter as a t-code.
    it should ask my Gate Pass number in the Selection screen...if its right then my Form will come out to the display screen. (instead of going by Print method).,
    Pls post ur comment and reply me with examples of code,if possible.
    thanks & regards
    sankar.

    the following code are suitable for SMARTFORMS print,please refer to the BOLD section:
    call function 'SSF_FUNCTION_MODULE_NAME'
        exporting
          formname                 = v_form_name
      VARIANT                  = ' '
      DIRECT_CALL              = ' '
        importing
          fm_name                  = v_fm_name
       exceptions
         no_form                  = 1
         no_function_module       = 2
         others                   = 3.
      if sy-subrc <> 0.
        message id sy-msgid type sy-msgty number sy-msgno
               with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      endif.
    *Call Smart form
      <b>data: t_control like ssfctrlop.</b>
      if not p_fax is initial.
        t_control-device = 'TELEFAX'.
      endif.
    <b>  t_control-PREVIEW = ' '.    "space means no print preview.</b>
      call function v_fm_name
      exporting
      ARCHIVE_INDEX              =
      ARCHIVE_INDEX_TAB          =
      ARCHIVE_PARAMETERS         =
        <b>control_parameters          = t_control</b>
      MAIL_APPL_OBJ              =
      MAIL_RECIPIENT             =
      MAIL_SENDER                =
      OUTPUT_OPTIONS             =
      USER_SETTINGS              = 'X'
    IMPORTING
      DOCUMENT_OUTPUT_INFO       =
      JOB_OUTPUT_INFO            =
      JOB_OUTPUT_OPTIONS         =
        tables
          l_xcredit                = icredit
    EXCEPTIONS
      FORMATTING_ERROR           = 1
      INTERNAL_ERROR             = 2
      SEND_ERROR                 = 3
      USER_CANCELED              = 4
      OTHERS                     = 5
      if sy-subrc <> 0.
        message id sy-msgid type sy-msgty number sy-msgno
                with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      endif.

  • Sapscript/Smartform via mail with PDF attachment: logo is missing

    Hi all
    I'm implementing my function to send Sapscript/smartform via mail.
    I need to do it because when a message needs to be sent, I have to insert the message as attachment but also to add a text in the body mail.
    So I've just created a simple sapscript having a logo (as graphic) and a little text.
    I use the fm CONVERT_OTF to convert the OTF to PDF format and the following code to increase the pdf string from 132 to 255 char:
    LOOP AT t_pdf.
          TRANSLATE t_pdf USING ' ~'.
          CONCATENATE l_buffer t_pdf INTO l_buffer.
        ENDLOOP.
        TRANSLATE l_buffer USING '~ '.
        DO.
          MOVE l_buffer TO l_attachment.
          APPEND l_attachment TO x_attachment.
          SHIFT l_buffer LEFT BY 255 PLACES.
          IF l_buffer IS INITIAL.
            EXIT.
          ENDIF.
        ENDDO.
    All seem to work fine, but as soon as I open the pdf file attached to the mail I can't see the logo
    So after calling fm CONVERT_OTF, I've created a pdf file by method GUI_DOWNLOAD, and then upload this file (by GUI_UPLOAD) into internal table for attachment and send the mail.
    Now really all work very fine, becaus I can see the logo
    Of course I don't want to dowload the file before sending a mail, but I need to send my print directly as pdf attachment
    The two ways seem to be equal, they use the same print and the same functions, only the way to upload the internal table for attachment is different:
    1) tha abap code above to expand the line from 132 to 255
    2) the method GUI_UPLOAD
    So something seems to be wrong in the first way because ithe logo is missing in the pdf attachment generated for the mail
    Max

    Hi
    I'm not working on unicode system, anyway I didn't see that parameter BIN_FILE, so I didn't use it
    I've read the note 1324547 and I've done just as it explaines: now works fine
    I don't know why it doesn't work with old manner (i.e data is treated as character-type), but it worls with the new one (If the data is treated as xstring-type)
    I can only suppose the data are corrupted while being elaborated for expand to 255 char....but I don't why
    Anyway your suggestion works for me
    Thank
    Max

  • Copying from Sapscript to Smart form with d same windows

    I hav created my sapsccript till now i want to copy my sapscript windows n text elements n other attributes of that sapscript to smart forms.So please help me to copy sapscript to smart form,Please help me out.
    Thanks & regards
    santhosh kumar.

    check the link below it provides steps to convert sap scripts to smartforms
    http://www.ficoexpertonline.com/downloads/Iyer_SmartForms.pdf
    Check these threads.
    Smartforms -> sapscript
    Re: Convert SapScript to Smartforms ?
    Regards,
    Sooness

  • Problem in Smart form while printing it in POLISH language

    Hi All,
    I am facing a problem in SMARTFORM and SAP SCRIPT.
    I have developed a form in EN language and converted that in POLISH language using SE63 . When the form is printed in the POLISH language "#" is coming for some special characters of POLISH Language . ( e.g. 'Length' should get printed as 'D&#321;UGO&#346;&#262;' ' but it is coming as 'D#UGO##'')
    Please tell me how to handle these special characters in POLISH Language.
    Thanks

    Hi,
    To solve this Basis need to create a new output device type which supports Latin-2 character set (Device type to I2HP4) or change the existing one to support Latin-2 character set.
    Thanks
    Edited by: dipesh kothari on May 6, 2008 5:33 PM
    Edited by: dipesh kothari on May 6, 2008 5:34 PM

  • Develop a form and print program using VBAP, VBAK, MRKT.

    I have 2 tables VBAK [fields: VBELN, ERDAT, ERNAM, AUDAT, VBTYP, VKORG] and VBAP [Fields: POSNR, MATNR, CHARG, WAERK] and In output(form) i need the following fields,
    Output table:
    -VBELN
    -ERDAT
    -VKORG
    -POSNR
    -MATNR
    -MAKTX <- this field is from table MAKT. (I need the Material descriptions too for all the materials.)
    Form Layout should have Header, Logo (SAP ENJOY), Main, Footer.
    Problem is that i need footer only after the End of Complete data in Main Window, thats is footer should be placed only in last window. How should i do that ?
    Logic which i thot to make the print program is : First declare an internal table itab1 with VBAP, VBAP using the above fields from two tables and fetch the product based on matnr.
    declare one internal table itab2 and select the records from the table makt by checking the condition itab1 is not initial.
    sample code.
    IF ITAB1 IS NOT INITIAL.
    SELECT FIELD LIST FROM MAKT INTO TABLE ITAB2 WHERE MATNR EQ ITAB1-MATNR.
    ENDIF.
    hope this shuld work. ?????

    Hi
    see the sample script program and do accordingly
    *& Report  ZTEST12121
    *& SAPScripts Example 1
    REPORT  ztest12121.
    *DATABASE TABLES
    TABLES: ekko,ekpo,lfa1.
    *INTERNAL TABLES AND STRUCTURES
    DATA i_ekko LIKE ekko.
    DATA i_ekpo LIKE ekpo OCCURS 0 WITH HEADER LINE.
    DATA i_lfa1 LIKE lfa1.
    *PARAMETERS
    PARAMETERS: p_ebeln LIKE ekko-ebeln.
    *VARIABLES
    DATA MAT TYPE STRING VALUE 'MAT NO'.
    DATA iTe TYPE STRING VALUE 'ITEM NO'.
    DATA QTY TYPE STRING VALUE 'QTY'.
    DATA UOM TYPE STRING VALUE 'UOM'.
    DATA NET TYPE STRING VALUE 'NET PRICE'.
    Data var type integer value 0.
    *DATABASE SELECTS
    *Header data
    SELECT SINGLE * FROM ekko INTO i_ekko WHERE ekko~ebeln = p_ebeln.
    IF sy-subrc = 0.
    *Item Data
      SELECT * FROM ekpo INTO  TABLE i_ekpo WHERE ekpo~ebeln = p_ebeln.
      IF sy-subrc NE 0.
        WRITE 'PURCHASE DOCUMENT ITEM DATA ERROR'.
      ELSE.
    *Vendor Details
        SELECT SINGLE * FROM lfa1 INTO i_lfa1 WHERE lfa1~lifnr = i_ekko-lifnr.
        IF sy-subrc NE 0.
          WRITE 'VENDOR DOCUMENT ITEM DATA ERROR'.
        ENDIF.
      ENDIF.
    ELSE.
      WRITE 'THIS PURCHASE DOCUMENT NUMBER DOESNOT EXISTS'.
    ENDIF.
    CALL FUNCTION 'OPEN_FORM'
    EXPORTING
      APPLICATION                       = 'TX'
      ARCHIVE_INDEX                     =
      ARCHIVE_PARAMS                    =
      DEVICE                            = 'PRINTER'
      DIALOG                            = 'X'
        form                              = 'ZSCRIPT_1'
        language                          = sy-langu
      OPTIONS                           =
      MAIL_SENDER                       =
      MAIL_RECIPIENT                    =
      MAIL_APPL_OBJECT                  =
      RAW_DATA_INTERFACE                = '*'
      SPONUMIV                          =
    IMPORTING
      LANGUAGE                          =
      NEW_ARCHIVE_PARAMS                =
      RESULT                            =
    EXCEPTIONS
      CANCELED                          = 1
      DEVICE                            = 2
      FORM                              = 3
      OPTIONS                           = 4
      UNCLOSED                          = 5
      MAIL_OPTIONS                      = 6
      ARCHIVE_ERROR                     = 7
      INVALID_FAX_NUMBER                = 8
      MORE_PARAMS_NEEDED_IN_BATCH       = 9
      SPOOL_ERROR                       = 10
      CODEPAGE                          = 11
      OTHERS                            = 12
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    CALL FUNCTION 'WRITE_FORM'
    EXPORTING
       ELEMENT                        = 'OFFICEAD'
       FUNCTION                       = 'SET'
       TYPE                           = 'BODY'
       WINDOW                         = 'OFFICEAD'
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    CALL FUNCTION 'WRITE_FORM'
    EXPORTING
       ELEMENT                        = 'PODET'
       FUNCTION                       = 'SET'
       TYPE                           = 'BODY'
       WINDOW                         = 'PODET'
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    CALL FUNCTION 'WRITE_FORM'
    EXPORTING
       ELEMENT                        = 'TOP'
       FUNCTION                       = 'SET'
       TYPE                           = 'TOP'
       WINDOW                         = 'MAIN'
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    LOOP AT I_EKPO.
    var = i_ekpo-netpr * i_ekpo-menge.
    CALL FUNCTION 'WRITE_FORM'
    EXPORTING
       ELEMENT                        = 'BODY'
       FUNCTION                       = 'SET'
       TYPE                           = 'BODY'
       WINDOW                         = 'MAIN'
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ENDLOOP.
    CALL FUNCTION 'CLOSE_FORM'
    IMPORTING
      RESULT                         =
      RDI_RESULT                     =
    TABLES
      OTFDATA                        =
    EXCEPTIONS
      UNOPENED                       = 1
      BAD_PAGEFORMAT_FOR_PRINT       = 2
      SEND_ERROR                     = 3
      SPOOL_ERROR                    = 4
      CODEPAGE                       = 5
      OTHERS                         = 6
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    Structure of a print program
    OPEN_FORM function
    CLOSE_FORM function
    WRITE_FORM
    START_FORM function
    END_FORM function
    CONTROL_FORM function
    The print program is used to print forms. The program retieves the necesary data from datbase tables, defines the order of in which text elements are printed, chooses a form for printing and selects an output device and print options.
    Function modules in a printprogram:
    • When you print a form you must used the staments OPEN_FORM and CLOSE_FORM. To combine forms into a single spool request use START_FORM and END_FORM.
    • To print textelements in a form use WRITE_FORM. The order in which the textelements are printed, is determined by the order of the WRITE_FORM statements. Note: for printing lines in the body, you can also use the WRITE_FORM_LINES function module.
    • To transfer control command to a form use CONTROL_FORM.
    Structure of a print program
    Read data
    Tables: xxx.
    SELECT *
    FROM xxx.
    Open form printing - Must be called before working with any of the other form function modules.
    Must be ended with function module CLOSE FORM
    call function 'OPEN_FORM'.....
    To begin several indentical forms containing different data within a single spool request, begin each form using START_FORM, and end it using END_FORM
    call funtion 'START_FORM'.....
    Write text elements to a window of the form
    call function 'WRITE_FORM'.....
    Ends spool request started with START_FORM
    call funtion 'END_FORM'.....
    Closes form printing
    call function 'CLOSE_FORM'...
    OPEN_FORM function
    Syntax:
    CALL FUNCTION 'OPEN_FORM'
    EXPORTING
    APPLICATION = 'TX'
    ARCHIVE_INDEX =
    ARCHIVE_PARAMS =
    DEVICE = 'PRINTER'
    DIALOG = 'X'
    FORM = ' '
    LANGUAGE = SY-LANGU
    OPTIONS =
    MAIL_SENDER =
    MAIL_RECIPIENT =
    MAIL_APPL_OBJECT =
    RAW_DATA_INTERFACE = '*'
    IMPORTING
    LANGUAGE =
    NEW_ARCHIVE_PARAMS =
    RESULT =
    EXCEPTIONS
    CANCELED = 1
    DEVICE = 2
    FORM = 3
    OPTIONS = 4
    UNCLOSED = 5
    MAIL_OPTIONS = 6
    ARCHIVE_ERROR = 7
    INVALID_FAX_NUMBER = 8
    MORE_PARAMS_NEEDED_IN_BATCH = 9
    SPOOL_ERROR = 10
    OTHERS = 11
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    Some important parameters:
    FORM Name of the form
    DEVICE • PRINTER : Print output using spool
    • TELEFAX: Fax output
    • SCREEN: Output to screen
    OPTIONS Used to control attrubutes for printing or faxing (Number of copies, immediate output....
    The input for the parameter is structure ITCPO.
    CLOSE_FORM function
    CALL FUNCTION 'CLOSE_FORM'
    IMPORTING
    RESULT =
    RDI_RESULT =
    TABLES
    OTFDATA =
    EXCEPTIONS
    UNOPENED = 1
    BAD_PAGEFORMAT_FOR_PRINT = 2
    SEND_ERROR = 3
    SPOOL_ERROR = 4
    OTHERS = 5
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    Paramerters:
    RESULT Returns status information and print/fax parameters after the form has been printed. RESULT is of structure ITCPP.
    WRITE_FORM function
    CALL FUNCTION 'WRITE_FORM'
    EXPORTING
    ELEMENT = ' '
    FUNCTION = 'SET'
    TYPE = 'BODY'
    WINDOW = 'MAIN'
    IMPORTING
    PENDING_LINES =
    EXCEPTIONS
    ELEMENT = 1
    FUNCTION = 2
    TYPE = 3
    UNOPENED = 4
    UNSTARTED = 5
    WINDOW = 6
    BAD_PAGEFORMAT_FOR_PRINT = 7
    SPOOL_ERROR = 8
    OTHERS = 9
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    Some important parameters:
    ELEMENT Specifies which textelement is printed
    WINDOW Specifies which window is printed
    TYPE Specifies the output area of the main window. This can be:
    • TOP - Used for headers
    • BODY
    • BOTTOM - Used for footers
    FUNCTION Specifies whether text is to be appended, replaced or added
    Example of how to use the WRITE_FORM function module together with a script.
    Form layout of the MAIN window
    /E INTRODUCTION
    Dear Customer
    /E ITEM_HEADER
    IH Carrier, Departure
    /E ITEM_LINE
    IL &SBOOK-CARRID&, &SPFLI-DEPTIME&
    /E CLOSING_REMARK
    The print program
    Writing INTRODUCTION
    CALL FUNCTION 'WRITE_FORM'
    EXPORTING
    ELEMENT = 'INTRODUCTION'
    FUNCTION = 'SET'
    TYPE = 'BODY'
    WINDOW = 'MAIN'
    EXCEPTIONS
    OTHERS = 8
    Writing ITEM_HEADER
    CALL FUNCTION 'WRITE_FORM'
    EXPORTING
    ELEMENT = 'ITEM_HEADER'
    FUNCTION = 'SET'
    TYPE = 'BODY'
    WINDOW = 'MAIN'
    EXCEPTIONS
    OTHERS = 8
    Set ITEM_HEADER into TOP area of main window for subsequent pages
    CALL FUNCTION 'WRITE_FORM'
    EXPORTING
    ELEMENT = 'ITEM_HEADER'
    FUNCTION = 'SET'
    TYPE = 'TOP'
    WINDOW = 'MAIN'
    EXCEPTIONS
    OTHERS = 8
    Write ITEM_LINE
    LOOP AT .....
    CALL FUNCTION 'WRITE_FORM'
    EXPORTING
    ELEMENT = 'ITEM_LINE'
    FUNCTION = 'SET'
    TYPE = 'BODY'
    WINDOW = 'MAIN'
    EXCEPTIONS
    OTHERS = 8.
    ENDLOOP.
    Delete ITEM_HEADER from TOP area of main window
    CALL FUNCTION 'WRITE_FORM'
    EXPORTING
    ELEMENT = 'ITEM_HEADER'
    FUNCTION = 'DELETE'
    TYPE = 'TOP'
    WINDOW = 'MAIN'
    EXCEPTIONS
    OTHERS = 8
    Print CLOSING_REMARK
    CALL FUNCTION 'WRITE_FORM'
    EXPORTING
    ELEMENT = 'CLOSING_REMARK'
    FUNCTION = 'SET'
    TYPE = 'BODY'
    WINDOW = 'MAIN'
    EXCEPTIONS
    OTHERS = 8
    START_FORM function
    CALL FUNCTION 'START_FORM'
    EXPORTING
    ARCHIVE_INDEX =
    FORM = ' '
    LANGUAGE = ' '
    STARTPAGE = ' '
    PROGRAM = ' '
    MAIL_APPL_OBJECT =
    IMPORTING
    LANGUAGE =
    EXCEPTIONS
    FORM = 1
    FORMAT = 2
    UNENDED = 3
    UNOPENED = 4
    UNUSED = 5
    SPOOL_ERROR = 6
    OTHERS = 7
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    END_FORM function
    CALL FUNCTION 'END_FORM'
    IMPORTING
    RESULT =
    EXCEPTIONS
    UNOPENED = 1
    BAD_PAGEFORMAT_FOR_PRINT = 2
    SPOOL_ERROR = 3
    OTHERS = 4
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    CONTROL_FORM function
    The CONTROL_FORM function module alows you to create SapScript control statements from within an APAB program.
    Syntax:
    CALL FUNCTION 'CONTROL_FORM'
    EXPORTING
    command =
    EXCEPTIONS
    UNOPENED = 1
    UNSTARTED = 2
    OTHERS = 3
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    Example:
    Protecting the text element ITEM_LINE
    CALL FUNCTION 'CONTROL_FORM'
    EXPORTING
    COMMAND = 'PROTECT'.
    CALL FUNCTION 'WRITE_FORM'
    EXPORTING
    TEXELEMENT = 'ITEM_LINE'.
    CALL FUNCTION 'CONTROL_FORM'
    EXPORTING
    COMMAND = 'ENDPROTECT'.
    Regards
    Anji

  • Smartform: Blank page gets Printed

    Hi All,
    in my smart form i have two pages, Second page contains main window.
    i have restricted my first page with some conditions , so that first page data will not be printed.
    if i execute the smartform first page is printed blank without any data.
    is there any option to avoid the blank page getting printed????
    Regards,
    Dinesh R

    Hi Dinesh,
    One reason for getting a blank page is if the windows are overlapped in the page layout. Please check and see if any window is overlapping.
    Else, check for "page break" . This is a check box . Once this is activated for a text or window or page, it directs you to a new page. Probably this might be the problem.
    Hope this helps.
    Thanks,
    Prisford Pereira.

  • Smartforms : How to include Printer commands in smartforms

    I want to include printer command <esc>&l1T at the end of the smartform so that the printer can staple the form after printing.
    Can any one please let me know how to include this in smart form ..?
    Is there any way ..?

    You should use the following way:
    - Copy the device type into the Customer name space.
    - Go via transaction SPAD - Device types into the device type and
    here to tab strip 'Print controls'. Here add a print control
    with the following contents: \e&l1T
    (without flag 'Hexadecimal'; the \e is the escape character)
    - Now go to your Smartform and add a command node (right-click
    on the tree, Create - Flow logic - Command) and enter the print
    control name into the field 'Include Printer Control'.
    This adds the print control at this point. You only have to
    select the right position of the command node in the tree
    (and therefore the point of time, when the sequence shall be sent).
    - If you want to check the print data, which the SAP sends to the
    printer (and therefore whether the escape sequence was included
    correctly), you can use note 5799, method 2.

  • SmartForms field : How to print "PO number" on CREDIT MEMO

    If i create a CREDIT MEMO REQUEST ( VA01 - Order Type: CR )
    on the first screen, i have "PO Number"
    ( that is below "Sold-to party" "Ship-to party" )
    How can i modify the CREDIT MEMO form in SMARTFORMS  in order to print "PO Number" ?

    hi,
    CALL FUNCTION 'ME_READ_PO_FOR_PRINTING'
    EXPORTING
    ix_nast = nast
    ix_screen = ent_screen
    IMPORTING
    ex_retco = ent_retco
    ex_nast = v_nast
    doc = v_doc
    CHANGING
    cx_druvo = v_druvo
    cx_from_memory = l_from_memory.
    How can i get PO partner functions using FM ME_READ_PO_FOR_PRINTING
    http://sap.ittoolbox.com/groups/technical-functional/sap-log-mm/tcode-me9f-user-exit-exit_saplmedruck_001-617362
    thanks.

Maybe you are looking for

  • Block creation problem in member formula

    Hi, I have a member formula as below : IF(.....) x = a/b; ENDIF where a,b have their own member formulas. There is no issue with the calculations of x,a or b, but I am facing an issue with block creation of x. Is there a way to handle block creation

  • Invoice clearing issue.

    Hello Experts : Is there anyway to create a dummy clearing document which will make SAP think that a payment has been made? We have 2 different SAP system , And Invoice is created in SAP 1 and replicating in SAP 2 via Interface, so both system have s

  • Im getting an not enough memory to complete this scanning operation error

    I am using a WIA-HP CLJ CM1312 Scanner with Adobe Acrobat 9 Standard Version 9.4.6 This machine is Windows XP with 3gigs of RAM and plenty of HDD space.... When I try to make a color copy at a Resolution of 1200DPI I get an error saying that - "There

  • Upgrading to Crystal Reports 2011 from Crystal Reports XI

    Hi, I hope someone can provide some assistance.  I am a current user of Crystal Reports XI and am upgrading my notebook to Windows 7 so therefore need to upgrade my version of Crystal. I have downloaded a trail of CR2011 and installed.  I am wanting

  • How to resize and edit multiple photos then save all at once?

    Photoshop CS6 MacBook Pro ================ Hi I have a bunch of product photos that I need to resize to a square (1200x1200). I thought I might be able to import them all into Photoshop, resize them to fit the canvas.... center them all, one by one (