PLS SEND ME A SAP SCRIPT DRIVER PROGRAM.........

I CANNOT RUN ANY OF THE CODING ...........

hi
this is an ex.. but u definitely need to go through the links
REPORT ZPSAPSCRIPT.
TABLES : EKKO,
EKPO,
KNA1,
USR01,
MARA,
MAKT.
DATA : BEGIN OF ZOPTION.
INCLUDE STRUCTURE ITCPO.
DATA : END OF ZOPTION.
PARAMETERS: P_EBELN LIKE EKKO-EBELN,
P_EBELP LIKE EKPO-EBELP.
CLEAR EKPO.
SELECT SINGLE * FROM EKPO
WHERE EBELN = P_EBELN AND
EBELP = P_EBELP.
CLEAR KNA1.
SELECT SINGLE NAME1 FROM KNA1
INTO KNA1-NAME1
WHERE KUNNR = EKPO-KUNNR.
CLEAR MAKT.
SELECT SINGLE MAKTX FROM MAKT
INTO MAKT-MAKTX
WHERE MATNR = EKPO-MATNR AND
SPRAS = SY-LANGU.
CLEAR USR01.
SELECT SINGLE * FROM USR01 WHERE BNAME = SY-UNAME.
ZOPTION-TDDEST = USR01-SPLD. "Output device (printer)
ZOPTION-TDIMMED = 'X'. "Print immediately
ZOPTION-TDDELETE = 'X'. "Delete after printing
ZOPTION-TDPROGRAM = 'ZPQRPRNT'. "Program Name
CALL FUNCTION 'OPEN_FORM'
EXPORTING
APPLICATION = 'TX'
ARCHIVE_INDEX = ' '
ARCHIVE_PARAMS = ' '
DEVICE = 'PRINTER'
DIALOG = ' '
FORM = 'Z_TESTSCRIPT'
LANGUAGE = SY-LANGU
OPTIONS = ZOPTION
IMPORTING
LANGUAGE = SY-LANGU
EXCEPTIONS
OTHERS = 1.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'HEADER'
FUNCTION = 'SET'
TYPE = 'BODY'
WINDOW = 'HEADER'
EXCEPTIONS
ELEMENT = 1.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'MAIN'
FUNCTION = 'SET'
TYPE = 'BODY'
WINDOW = 'MAIN'
EXCEPTIONS
ELEMENT = 1.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'FOOTER'
FUNCTION = 'SET'
TYPE = 'BODY'
WINDOW = 'FOOTER'
EXCEPTIONS
ELEMENT = 1.
CALL FUNCTION 'CLOSE_FORM'
EXCEPTIONS
UNOPENED = 1
OTHERS = 2.
also you can check at
http://help.sap.com/saphelp_47x200/helpdata/en/d6/0dc169494511d182b70000e829fbfe/frameset.htm
http://www.sapmaterial.com/sap_scripts.html
regards
asha

Similar Messages

  • Script -driver program

    Hi,
       I am working on dunning. i need to find the driver program of the script. i went to insert->symbol->program symbol..theres no program..i went to TNAPR table and gave the form name..i get no entries...i went to NACE..but am not sure of the application area and the output type..can pls help

    Hi,
    Plz check the following link :
    PLS SEND ME A SAP SCRIPT DRIVER PROGRAM.........
    Hope it will help you.
    Thanks & Regards,
    Sarita Singh Rathour

  • List of standard sap scripts/print programs in SAP MM and SD modules ??

    Hi,
    I have worked in medruck only. Can anyone give me a list of other standard sap scripts/print program names in SAP MM, FI/CO and SD modules, which often needs to be  modified by the client ?
    thanks

    press f4 in SE71
    then press application heirarchy, expand the modules which ever u want.
    regards.
    santhosh reddy
    Reward if useful

  • Reg : modification in sap script driver prog

    Hi folks,
    need some help regarding sap scripts
    i havecopied the standard layout medruck to my layout
    and made some changes.
    now i have to modify the driver program
    in the tnapr table the driver prog for medruck is
    given as sapfm06p
    but when i see the source code for that in the
    editor
    evrthing is like included functions there
    in the incuded there is a form named with "entry_neu"
    which has some code calling few functions
    but...
    there is no openform,no write form etc.
    where should i give the name of the form name that i have
    i have developed(changes made to the copy of the medruck)
    where should i make the changes in the prog
    how about going at modifying the driver program
    do i have to assign the o/p type using the tcode nace.
    please give me the steps
    please treat it as very urgent
    expecting a promt responses from u
    thanks & regards,
    annamreddy

    We modified the driver program because there was a requirement to add stuff that was not available in the standard driver program.  Here is what we did.
    First,  Copied the SAPFM06P program to SAPFZM06P.  Did not copy all of the includes. Copied only the FM06PE02 include program to ZFM06PE02.
    Second,  in the include ZFM06PE02,   there is a form call ENTRY_NEU,  this is the entry point to print the form, notice that there is a function module in this form called ME_PRINT_PO.  This is the function module that will print the PO.  Eventually, you will want to call a Z version of that funciton module.
    Third,  copy the entire funtion group MEDRUCK into ZMEDRUCK.  This is the function group which has the function module ME_PRINT_PO.  Don't copy the includes into Z versions.  You don't need to modify all of them.  Only copy them when needed.  Save and Activate.
    Finally,  go back to that include program ZFM06PE02,  now make the call to ME_PRINT_PO to the Z version, in my case it is ZME_PRINT_PO.  Save and activate.
    Make sure that you change your configuration in SPRO to use the SAPFZM06P program instead of the standard.  Now your form should be printing from the custom driver program.  Modify away!!!!
    Please don't forget to award points for helpful answers.  Thanks.
    Regards,
    Rich Heilman

  • Reg: SAP Scripts abap program

    Hi experts,
                   i have requirement in QM report i need to show some additional fields in print out ,
    here i know the form name but i don't no from which program in SAP Script form fetching values  can any one suggest how to find out programs for SAP script form.
        i know inside of SAP script we can c perform action but in my case there is no perform action written in script,
    they are directly using call function open form in pgm .
    Regards
    Srinivasan.R
    Moderator Message: Please search for available information before posting.
    Edited by: kishan P on Jun 3, 2011 11:41 AM

    Hi,
    Your question is not very clear....
    but if you want to Spell out a Number (Amount in your case) you can use the function Module
    CALL FUNCTION 'SPELL_AMOUNT'
    EXPORTING
       AMOUNT          =  (Amount to be printed)
       CURRENCY        = ' '
       FILLER          = ' '
       LANGUAGE        = SY-LANGU
    IMPORTING
       IN_WORDS        = (Amount in words)
    EXCEPTIONS
       NOT_FOUND       = 1
       TOO_LARGE       = 2
       OTHERS          = 3
    Reward if useful !!
    Regards,
    Gaurav

  • Attaching Script & Driver Program to Transaction QM03 (Quality Management)

    Hi Experts,
    I have created a new script with a driver program. I need to attach it to tha transaction QM01, QM02, QM03. I have assingned it to the transaction & its working fine till the time of Print Privew. But When I give the Print command for that it is not going to the printer & giving me the following error:
    1) The first error it gives : SHOP PAPER WILL NOT BE PRINTED.
    2) & the second one is :   Express document "Update was terminated" received from author "XXXXXX".
    Please help as its a go-live issue.
    Regards,
    Raman.

    Hi Biju,
    Please check that in ur driver program whether u have created the Entry routine in that u can call ur smartform.
    Put breakpoint before u r calling ur smartform in driver program an chk whether data is populating correct in ur variables or internal table.
    Then chk the variable and internal table which u r passing are correct and compare with import,export and table parameter of smartform.
    See standard progarm 'RLB_INVOICE' for ur refference.
    Reward if useful.
    Edited by: Anil Mane on Apr 3, 2008 7:34 AM

  • SAP Script & Dialog programming

    Hi,
    How Can u pass data to SAPScript other than using function modules?
    How can u pass data from programs to screens in dialog progarmming?
    Thanks in advance,
    K P

    Hi KP,
    U can use form routines instead of using FMs to pass the data in Script layoutset.
    For Ex:
    u can write the ligic in Program-->
    FORM XXXX(form name) TABLES INPUT  STRUCTURE ITCSY
                                OUTPUT STRUCTURE ITCSY.
    Script-->
    /:  DEFINE &XXX_XXXXX& = ' '.                          
    /:  PERFORM XXXX IN PROGRAM PROGNAME
    /:  USING &XXXX_XXXXX&                                
    /:  CHANGING &XXX_XXXXX&                                
    /:  ENDPERFORM                                        
    Hope it'll be helpfull.
    Cheers.. ByE....suresh

  • Line Alignment Problem while sending Fax from SAP Script

    Moderator message: please do not post the same question in different forums
    Hi Experts,
    While sending fax the horizontal lines are not displaying till the end of the page.
    But in the print preview the lines are displying till the end.
    If this is printed using local printer the lines are printing fine but the problem is with the fax.
    Please provide me a solution for this.
    Regards,
    Rajesh.
    Edited by: Matt on Nov 25, 2008 2:51 PM

    Puzzling.
    I've seen where the printed output doesn't match the print preview but not a fax not matching a print.
    Do you use SAPConnect or the older SAPComm method for faxing?
    How do you produce the horizontal lines? BOX commands, ULINE, '-', etc.?

  • Problems with SAP Script print program

    Hi,
    I have the following scenario:
    I have a workflow which prints a sapscript with data stored in the workflow container.
    The workflow method 'executeform' populates a selection table and submits it to the print program using:
    SUBMIT ZPRINT_FORM WITH SELECTION-TABLE sel_table
    This print program then populates the form with data and calls the OPEN_FORM/WRITE_FORM/CLOSE_FORM FM's.
    My problem is that some of the variables in the workflow container are CHAR255, when these get moved to the selection table (seltab-low) they get truncated as seltab-low is a CHAR45.   Is there a way round this??
    This is the first time I have used sapscript, I notice that the variables printed on the form correspond to the parameters defined in the Print Program.  I assume therefore that this is why the
    SUBMIT ZPRINT_FORM WITH SELECTION-TABLE sel_table
    has been used and why the OPEN_FORM/WRITE_FORM/CLOSE_FORM was not coded directly in the workflow executeform method.
    Any guidance on how to proceed with this would be appreciated.
    Many Thanks,
    Paul

    Hi Paul,
       In general, in the statement
    SUBMIT ZPRINT_FORM WITH SELECTION-TABLE sel_table.
    sel_table is an internal table with the structure RSPARAMS.
    This variant allows you to set the names and contents of the parameters and selection options dynamically at runtime.
    You can use the function module RS_REFRESH_FROM_SELECTOPTIONS to read the contents of the parameters and selection options of the current program into an internal table seltab with the structure RSPARAMS. By using SUBMIT ... WITH SELECTION-TABLE seltab, you can then pass these values on directly.
    The work around for the variables that cannot be passed using the submit statement, can be exported to Global memory ids and the same can be retrieved in the print progra.
    The syntax for the export and import statements is something like this.
    TABLES INDX.
    TYPES: BEGIN OF ITAB3_TYPE,
              CONT(4),
           END OF ITAB3_TYPE.
    DATA: INDXKEY LIKE INDX-SRTFD VALUE 'KEYVALUE',
          F1(4), F2 TYPE P,
          ITAB3 TYPE STANDARD TABLE OF ITAB3_TYPE WITH NON-UNIQUE
                     DEFAULT KEY INITIAL SIZE 2,
          WA_INDX TYPE INDX.
    Fill the data fields before CLUSTR
    before the actual export
    INDX-AEDAT = SY-DATUM.
    INDX-USERA = SY-UNAME.
    Export der Daten.
    EXPORT F1    FROM F1
           F2    FROM F2
           ITAB3 FROM ITAB3
           TO DATABASE INDX(ST)  FROM WA_INDX ID INDXKEY.
    *********************************************************TYPES: BEGIN OF TAB3_TYPE,
              CONT(4),
           END OF TAB3_TYPE.
    DATA: INDXKEY LIKE INDX-SRTFD,
          F1(4), F2 TYPE P,
          TAB3 TYPE STANDARD TABLE OF TAB3_TYPE WITH
                    NON-UNIQUE DEFAULT KEY,
          WA_INDX TYPE INDX.
    INDXKEY = 'INDXKEY'.
    IMPORT F1   = F1
           F2   = F2
           TAB3 = TAB3 FROM DATABASE INDX(ST) ID INDXKEY
           TO WA_INDX.
    Regards,
    Ravi

  • Problem in SAP-Script

    Hi All,
    I am creating one report form using SAP Script, it is a replacement of standard SAP Script and which uses standard driver program. I am getting one dump while running SAP Script, it shows like "variable with name 'XXX' has not been used in so and so window".
    In that window there is a code block like,
    /: IF XXX == 'yes'
    /: ENDIF
    As I dont want this block I have commented this like,
    /* IF XXX == 'yes'
    /* ENDIF
    Please let me know how to overcome this short-dump and provide solution why such dump is comming?
    <<removed by moderator>>
    Edited by: kishan P on Sep 13, 2010 4:19 PM

    Hi,
    This is one of the problem of Standard SAP Script driver program, we can over come easily, we no need to comment anything rather do follow the code you can easily solve your issue, I also face the same issue previously.
    your code is,
    /: IF XXX = 'Yes'
    /: ENDIF
    like this means, then change the code like this,
    /: IF 1 = 2
    /: IF XXX = 'Yes'
    /: ENDIF
    /: ENDIF
    here, you didnt write any comment, also the code will never execute.
    Why we are doing this means, driver program expects particular variable has to be used in particular window, but it never expects that variable has to be executed. By using this code you can use the variable also it will never be executed.
    Hope it will be helpful. If you find any other solution please let me know, Thank you:)

  • Driver program for the Dunning letter SAP Script

    Hello All,
    Can someone please tell me how to find the "Driver program for the Dunning letter SAP Script". I checked the Transaction OB96 but I dont find any Dunning scripts here i.e., the standard Dunning letter SAP Script F150_DUNN_01.
    Is there any Transaction like NACE of logistics for FI module to find the Driver programs. My requirement is to find the Driver program for the Dunning letter SAP Script and have a new Driver program instead of the standard SAP given driver program. Example is in transaction NACE we can change the driver program for Invoice like from RVADIN01 to ZRVADIN01.
    Thanks and Regards,
    SNK.

    Yes you can, using FIBF, change the FM associated with event 1720 like when SapScript is replaced with SmartForms. Look at [Define Dunning Forms (with SAP Smart Forms)|http://help.sap.com/saphelp_46c/helpdata/es/7d/c7a0a535e1d311ba4d0800060d888b/content.htm] for reference.
    But notice
    - PRINT_DUNNING_NOTICE call many FM of the same FG which share the same global data area.
    - During following upgrades of your system you will have to manage a copy of standard.
    Regards,
    Raymond

  • Driver program for NACHA format

    Hello Friends – We need to send ACH Payments in NACHA format. Can you pls let me know if this driver program is already available given by SAP. If so, Pls let me know the driver program I should assign at Payment Methods at Country level.
    Thanks

    Hi,
    Kindly use PMW format ACH_FG_BULK. You need to assign this format in Payment method in Country.
    Documentation of this format specify it is in accordance with version 004000 and conforms to the specifications of the National Automated Clearing House Association (NACHA).
    Please find below screen shot for the same:-
    Regards,
    Anand Raichura

  • Urgent ...how to send output of sap through mail

    Could you please guide me how to send output of SAP Script  through mail in PDF format.
    Thanks in Advance....
    Regards,
    Kumar.

    *& Report  ZSPOOLTOPDF                                                 *
    *& Converts spool request into PDF document and emails it to           *
    *& recipicant.                                                         *
    *& Execution                                                           *
    *& This program must be run as a background job in-order for the write *
    *& commands to create a Spool request rather than be displayed on      *
    *& screen                                                              *
    REPORT  zspooltopdf.
    PARAMETER: p_email1 LIKE somlreci1-receiver,
               p_sender LIKE somlreci1-receiver,
                   p_delspl  AS CHECKBOX.
    *DATA DECLARATION
    DATA: gd_recsize TYPE i.
    Spool IDs
    TYPES: BEGIN OF t_tbtcp.
            INCLUDE STRUCTURE tbtcp.
    TYPES: END OF t_tbtcp.
    DATA: it_tbtcp TYPE STANDARD TABLE OF t_tbtcp INITIAL SIZE 0,
          wa_tbtcp TYPE t_tbtcp.
    Job Runtime Parameters
    DATA: gd_eventid LIKE tbtcm-eventid,
          gd_eventparm LIKE tbtcm-eventparm,
          gd_external_program_active LIKE tbtcm-xpgactive,
          gd_jobcount LIKE tbtcm-jobcount,
          gd_jobname LIKE tbtcm-jobname,
          gd_stepcount LIKE tbtcm-stepcount,
          gd_error    TYPE sy-subrc,
          gd_reciever TYPE sy-subrc.
    DATA:  w_recsize TYPE i.
    DATA: gd_subject   LIKE sodocchgi1-obj_descr,
          it_mess_bod LIKE solisti1 OCCURS 0 WITH HEADER LINE,
          it_mess_att LIKE solisti1 OCCURS 0 WITH HEADER LINE,
          gd_sender_type     LIKE soextreci1-adr_typ,
          gd_attachment_desc TYPE so_obj_nam,
          gd_attachment_name TYPE so_obj_des.
    Spool to PDF conversions
    DATA: gd_spool_nr LIKE tsp01-rqident,
          gd_destination LIKE rlgrap-filename,
          gd_bytecount LIKE tst01-dsize,
          gd_buffer TYPE string.
    Binary store for PDF
    DATA: BEGIN OF it_pdf_output OCCURS 0.
            INCLUDE STRUCTURE tline.
    DATA: END OF it_pdf_output.
    CONSTANTS: c_dev LIKE  sy-sysid VALUE 'DEV',
               c_no(1)     TYPE c   VALUE ' ',
               c_device(4) TYPE c   VALUE 'LOCL'.
    *START-OF-SELECTION.
    START-OF-SELECTION.
    Write statement to represent report output. Spool request is created
    if write statement is executed in background. This could also be an
    ALV grid which would be converted to PDF without any extra effort
      WRITE 'Hello World'.
      new-page.
      commit work.
      new-page print off.
      IF sy-batch EQ 'X'.
        PERFORM get_job_details.
        PERFORM obtain_spool_id.
    Alternative way could be to submit another program and store spool
    id into memory, will be stored in sy-spono.
    *submit ZSPOOLTOPDF2
           to sap-spool
           spool parameters   %_print
           archive parameters %_print
           without spool dynpro
           and return.
    Get spool id from program called above
    IMPORT w_spool_nr FROM MEMORY ID 'SPOOLTOPDF'.
        PERFORM convert_spool_to_pdf.
        PERFORM process_email.
        if p_delspl EQ 'X'.
          PERFORM delete_spool.
        endif.
        IF sy-sysid = c_dev.
          wait up to 5 seconds.
          SUBMIT rsconn01 WITH mode   = 'INT'
                          WITH output = 'X'
                          AND RETURN.
        ENDIF.
      ELSE.
        SKIP.
        WRITE:/ 'Program must be executed in background in-order for spool',
                'request to be created.'.
      ENDIF.
          FORM obtain_spool_id                                          *
    FORM obtain_spool_id.
      CHECK NOT ( gd_jobname IS INITIAL ).
      CHECK NOT ( gd_jobcount IS INITIAL ).
      SELECT * FROM  tbtcp
                     INTO TABLE it_tbtcp
                     WHERE      jobname     = gd_jobname
                     AND        jobcount    = gd_jobcount
                     AND        stepcount   = gd_stepcount
                     AND        listident   <> '0000000000'
                     ORDER BY   jobname
                                jobcount
                                stepcount.
      READ TABLE it_tbtcp INTO wa_tbtcp INDEX 1.
      IF sy-subrc = 0.
        message s004(zdd) with gd_spool_nr.
        gd_spool_nr = wa_tbtcp-listident.
        MESSAGE s004(zdd) WITH gd_spool_nr.
      ELSE.
        MESSAGE s005(zdd).
      ENDIF.
    ENDFORM.
          FORM get_job_details                                          *
    FORM get_job_details.
    Get current job details
      CALL FUNCTION 'GET_JOB_RUNTIME_INFO'
           IMPORTING
                eventid                 = gd_eventid
                eventparm               = gd_eventparm
                external_program_active = gd_external_program_active
                jobcount                = gd_jobcount
                jobname                 = gd_jobname
                stepcount               = gd_stepcount
           EXCEPTIONS
                no_runtime_info         = 1
                OTHERS                  = 2.
    ENDFORM.
          FORM convert_spool_to_pdf                                     *
    FORM convert_spool_to_pdf.
      CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
           EXPORTING
                src_spoolid              = gd_spool_nr
                no_dialog                = c_no
                dst_device               = c_device
           IMPORTING
                pdf_bytecount            = gd_bytecount
           TABLES
                pdf                      = it_pdf_output
           EXCEPTIONS
                err_no_abap_spooljob     = 1
                err_no_spooljob          = 2
                err_no_permission        = 3
                err_conv_not_possible    = 4
                err_bad_destdevice       = 5
                user_cancelled           = 6
                err_spoolerror           = 7
                err_temseerror           = 8
                err_btcjob_open_failed   = 9
                err_btcjob_submit_failed = 10
                err_btcjob_close_failed  = 11
                OTHERS                   = 12.
      CHECK sy-subrc = 0.
    Transfer the 132-long strings to 255-long strings
      LOOP AT it_pdf_output.
        TRANSLATE it_pdf_output USING ' ~'.
        CONCATENATE gd_buffer it_pdf_output INTO gd_buffer.
      ENDLOOP.
      TRANSLATE gd_buffer USING '~ '.
      DO.
        it_mess_att = gd_buffer.
        APPEND it_mess_att.
        SHIFT gd_buffer LEFT BY 255 PLACES.
        IF gd_buffer IS INITIAL.
          EXIT.
        ENDIF.
      ENDDO.
    ENDFORM.
          FORM process_email                                            *
    FORM process_email.
      DESCRIBE TABLE it_mess_att LINES gd_recsize.
      CHECK gd_recsize > 0.
      PERFORM send_email USING p_email1.
    perform send_email using p_email2.
    ENDFORM.
          FORM send_email                                               *
    -->  p_email                                                       *
    FORM send_email USING p_email.
      CHECK NOT ( p_email IS INITIAL ).
      REFRESH it_mess_bod.
    Default subject matter
      gd_subject         = 'Subject'.
      gd_attachment_desc = 'Attachname'.
    CONCATENATE 'attach_name' ' ' INTO gd_attachment_name.
      it_mess_bod        = 'Message Body text, line 1'.
      APPEND it_mess_bod.
      it_mess_bod        = 'Message Body text, line 2...'.
      APPEND it_mess_bod.
    If no sender specified - default blank
      IF p_sender EQ space.
        gd_sender_type  = space.
      ELSE.
        gd_sender_type  = 'INT'.
      ENDIF.
    Send file by email as .xls speadsheet
      PERFORM send_file_as_email_attachment
                                   tables it_mess_bod
                                          it_mess_att
                                    using p_email
                                          'Example .xls documnet attachment'
                                          'PDF'
                                          gd_attachment_name
                                          gd_attachment_desc
                                          p_sender
                                          gd_sender_type
                                 changing gd_error
                                          gd_reciever.
    ENDFORM.
          FORM delete_spool                                             *
    FORM delete_spool.
      DATA: ld_spool_nr TYPE tsp01_sp0r-rqid_char.
      ld_spool_nr = gd_spool_nr.
      CHECK p_delspl <> c_no.
      CALL FUNCTION 'RSPO_R_RDELETE_SPOOLREQ'
           EXPORTING
                spoolid = ld_spool_nr.
    ENDFORM.
    *&      Form  SEND_FILE_AS_EMAIL_ATTACHMENT
          Send email
    FORM send_file_as_email_attachment tables it_message
                                              it_attach
                                        using p_email
                                              p_mtitle
                                              p_format
                                              p_filename
                                              p_attdescription
                                              p_sender_address
                                              p_sender_addres_type
                                     changing p_error
                                              p_reciever.
      DATA: ld_error    TYPE sy-subrc,
            ld_reciever TYPE sy-subrc,
            ld_mtitle LIKE sodocchgi1-obj_descr,
            ld_email LIKE  somlreci1-receiver,
            ld_format TYPE  so_obj_tp ,
            ld_attdescription TYPE  so_obj_nam ,
            ld_attfilename TYPE  so_obj_des ,
            ld_sender_address LIKE  soextreci1-receiver,
            ld_sender_address_type LIKE  soextreci1-adr_typ,
            ld_receiver LIKE  sy-subrc.
    data:   t_packing_list like sopcklsti1 occurs 0 with header line,
            t_contents like solisti1 occurs 0 with header line,
            t_receivers like somlreci1 occurs 0 with header line,
            t_attachment like solisti1 occurs 0 with header line,
            t_object_header like solisti1 occurs 0 with header line,
            w_cnt type i,
            w_sent_all(1) type c,
            w_doc_data like sodocchgi1.
      ld_email   = p_email.
      ld_mtitle = p_mtitle.
      ld_format              = p_format.
      ld_attdescription      = p_attdescription.
      ld_attfilename         = p_filename.
      ld_sender_address      = p_sender_address.
      ld_sender_address_type = p_sender_addres_type.
    Fill the document data.
      w_doc_data-doc_size = 1.
    Populate the subject/generic message attributes
      w_doc_data-obj_langu = sy-langu.
      w_doc_data-obj_name  = 'SAPRPT'.
      w_doc_data-obj_descr = ld_mtitle .
      w_doc_data-sensitivty = 'F'.
    Fill the document data and get size of attachment
      CLEAR w_doc_data.
      READ TABLE it_attach INDEX w_cnt.
      w_doc_data-doc_size =
         ( w_cnt - 1 ) * 255 + STRLEN( it_attach ).
      w_doc_data-obj_langu  = sy-langu.
      w_doc_data-obj_name   = 'SAPRPT'.
      w_doc_data-obj_descr  = ld_mtitle.
      w_doc_data-sensitivty = 'F'.
      CLEAR t_attachment.
      REFRESH t_attachment.
      t_attachment[] = it_attach[].
    Describe the body of the message
      CLEAR t_packing_list.
      REFRESH t_packing_list.
      t_packing_list-transf_bin = space.
      t_packing_list-head_start = 1.
      t_packing_list-head_num = 0.
      t_packing_list-body_start = 1.
      DESCRIBE TABLE it_message LINES t_packing_list-body_num.
      t_packing_list-doc_type = 'RAW'.
      APPEND t_packing_list.
    Create attachment notification
      t_packing_list-transf_bin = 'X'.
      t_packing_list-head_start = 1.
      t_packing_list-head_num   = 1.
      t_packing_list-body_start = 1.
      DESCRIBE TABLE t_attachment LINES t_packing_list-body_num.
      t_packing_list-doc_type   =  ld_format.
      t_packing_list-obj_descr  =  ld_attdescription.
      t_packing_list-obj_name   =  ld_attfilename.
      t_packing_list-doc_size   =  t_packing_list-body_num * 255.
      APPEND t_packing_list.
    Add the recipients email address
      CLEAR t_receivers.
      REFRESH t_receivers.
      t_receivers-receiver = ld_email.
      t_receivers-rec_type = 'U'.
      t_receivers-com_type = 'INT'.
      t_receivers-notif_del = 'X'.
      t_receivers-notif_ndel = 'X'.
      APPEND t_receivers.
      CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
           EXPORTING
                document_data              = w_doc_data
                put_in_outbox              = 'X'
                sender_address             = ld_sender_address
                sender_address_type        = ld_sender_address_type
                commit_work                = 'X'
           IMPORTING
                sent_to_all                = w_sent_all
           TABLES
                packing_list               = t_packing_list
                contents_bin               = t_attachment
                contents_txt               = it_message
                receivers                  = t_receivers
           EXCEPTIONS
                too_many_receivers         = 1
                document_not_sent          = 2
                document_type_not_exist    = 3
                operation_no_authorization = 4
                parameter_error            = 5
                x_error                    = 6
                enqueue_error              = 7
                OTHERS                     = 8.
    Populate zerror return code
      ld_error = sy-subrc.
    Populate zreceiver return code
      LOOP AT t_receivers.
        ld_receiver = t_receivers-retrn_code.
      ENDLOOP.
    ENDFORM.
    regards,
    venkat

  • DEMO PROGARM FOR SAP SCRIPT

    HAI,
            WHICH IS THE DEMO OR EXAMPLE PROGRAM FOR SAP SCRIPT IN SAP
    THANK YOU

    Hi
    See the sample code for Script driver Program to display the PO details
    You have to design the Script layout in SE71 and see the output
    *& 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.
    SAPScripts
    http://esnips.com/doc/1ff9f8e8-0a4c-42a7-8819-6e3ff9e7ab44/sapscripts.pdf
    http://esnips.com/doc/1e487f0c-8009-4ae1-9f9c-c07bd953dbfa/script-command.pdf
    http://esnips.com/doc/64d4eccb-e09b-48e1-9be9-e2818d73f074/faqss.pdf
    http://esnips.com/doc/cb7e39b4-3161-437f-bfc6-21e6a50e1b39/sscript.pdf
    http://esnips.com/doc/fced4d36-ba52-4df9-ab35-b3d194830bbf/symbols-in-scripts.pdf
    http://esnips.com/doc/b57e8989-ccf0-40d0-8992-8183be831030/sapscript-how-to-calculate-totals-and-subtotals.htm
    SAP SCRIPT FIELDS
    http://help.sap.com/saphelp_erp2005vp/helpdata/en/d1/8033ea454211d189710000e8322d00/content.htm
    scripts easy material
    http://www.allsaplinks.com/sap_script_made_easy.html
    Reward points if useful
    Regards
    Anji

  • All sap script commands are supported by smartform?

    hi experts
    pls answer me
    all sap script commands are supported by smartform?
    rewads apply.
    thanks.
    naresh.

    pls chk the link below:
    http://www.geekinterview.com/question_details/37873
    1.SCRIPTS ARE CLIENT DEPENDENT
      SMARTFORMS ARE CLIENT INDEPENDENT
    2.WE CANNOT ADD COLORS IN SCRIPTS
       WE CAN ADD COLORS IN SMARTFORMS
    3.WE CANNOT GET THE FUNCTION MODULE WHEN WE ACTIVATE THE PROGRAM
       WHEN WE ACTIVATE THE PROGRAM WE GET FUNCTION MODULE
    4.WE CAN WRITE ENTIRE CODE IN SMARTFROM ITSELF
    with luck,
    pritam.

Maybe you are looking for