Formatting Script Output

Why does SQL Developer ignore
col name format a15 ?
col name format a15
col value format a15
select name,value from v$parameter
where name ='statistics_level'Each column length seems to default to 80 charaters.
I end up needing to use the hortizontal scroll bar to see the results in the Script Output window.

"col" is a SQL*Plus command. SQL Developer does understand a few SQL*Plus commands, but most of the formatting commands like "column" are not supported.

Similar Messages

  • SQL Developer formatting script output

    Im new to sql developer. I have been unable to format the script output to decrease the width of the column below.
    All numeric columns seem to use 22 underscores. I would like to format this to make it more presentable to users.
    I have tried column, substr, and the various trims. While these work in native unix, they do not seem to work in
    SQL Developer. Up till now I have found SQL Developer to be a very usefull tool. I hope this is just a matter of me not
    having enough knowledge of the product and not a problem with it.
    Any and all assistance greatly appreciated.
    MACCNO
    3021202

    788184 wrote:
    What I need is to produce the following (column is numeric 5)
    HEAD1
    12345
    instead of what comes out currently
    HEAD1
    12345
    Yes, have checked preferences but could not see anything to change.
    Edited by: 788184 on 12/08/2010 19:55I think the problem is related to SQL*PLUS. SQL Developer tries to mimick SQL*PLUS whan you run something as a script. The mimicking s not perfect though.
    The size of this line depends on the typeof the database field. For numbers a larger line is taken. For varchar2 it depends from the size of the values or the header.
    If you are absolutly sure that data inside this column is always smaller, then you could try the following thing.
    select cast(HEAD1 as varchar2(5)) as HEAD1 from yourTableBe careful since this will do a number to string conversion. But since it seems to be for reporting purposes that should be ok.

  • Format script output in SQL developer

    HI,
    when I use sql plus every column is separated while in sql developer is mixed, or coalesced.
    I cannot clearly see the columns in the output.
    tnx
    Edited by: user10491698 on 07-Sep-2011 06:37

    You could ask in the {forum:id=260} forum ;-)

  • To convert Sap Script output to PDF format and send it via email.

    Hi Friends,
    Could any one please tell me, how to convert the Sap Script output to PDF format and send it via email. If any one have the code, kindly mail me to [email protected]
    Thanks & Regards,
    John

    Plese check this sample code from other thread.
    REPORT zzz_jaytest .
    Types Declaration
    TYPES : BEGIN OF ty_pa0001,
    pernr TYPE pa0001-pernr,
    bukrs TYPE pa0001-bukrs,
    werks TYPE pa0001-werks,
    END OF ty_pa0001.
    Internal Table Declaration
    DATA : i_pa0001 TYPE STANDARD TABLE OF ty_pa0001, "For pa0001 Details
    i_otf TYPE STANDARD TABLE OF itcoo, "For OTF data
    i_content_txt TYPE soli_tab, "Content
    i_content_bin TYPE solix_tab, "Content
    i_objhead TYPE soli_tab,
    Work Area Declaration
    w_pa0001 TYPE ty_pa0001, "For pa0001 Details
    w_res TYPE itcpp, "SAPscript output
    "parameters
    w_otf TYPE itcoo, "For OTF
    w_pdf TYPE solisti1, "For PDF
    w_transfer_bin TYPE sx_boolean, "Content
    w_options TYPE itcpo, "SAPscript output
    "interface
    Variable Declaration
    v_len_in TYPE so_obj_len,
    v_size TYPE i.
    Constants Declaration
    CONSTANTS : c_x TYPE c VALUE 'X', "X
    c_locl(4) TYPE c VALUE 'LOCL', "Local Printer
    c_otf TYPE sx_format VALUE 'OTF', "OTF
    c_pdf TYPE sx_format VALUE 'PDF', "PDF
    c_printer TYPE sx_devtype VALUE 'PRINTER', "PRINTER
    c_bin TYPE char10 VALUE 'BIN', "BIN
    c_name TYPE string VALUE 'C:\ZZZ_JAYTEST.PDF',"Downloading
    "File Name
    c_form(11) TYPE c VALUE 'ZZZ_JAYTEST'. "Form Name
    START-OF-SELECTION.
    Selecting the records from pa0001
    SELECT pernr bukrs werks FROM pa0001
    INTO TABLE i_pa0001 UP TO 10 ROWS.
    Setting the options
    w_options-tdcopies = 1 ."Number of copies
    w_options-tdnoprev = c_x."No print preview
    w_options-tdgetotf = c_x."Return of OTF table
    w_options-tddest = c_locl."Spool: Output device
    Opening the form
    CALL FUNCTION 'OPEN_FORM'
    EXPORTING
    form = c_form
    device = c_printer
    language = sy-langu
    OPTIONS = w_options
    IMPORTING
    RESULT = w_res.
    LOOP AT i_pa0001 INTO w_pa0001.
    Writting into the form
    CALL FUNCTION 'WRITE_FORM'
    EXPORTING
    element = 'MAIN'
    window = 'MAIN'.
    ENDLOOP.
    Closing the form
    CALL FUNCTION 'CLOSE_FORM'
    IMPORTING
    RESULT = w_res
    TABLES
    otfdata = i_otf
    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.
    Converting OTF data to single line
    LOOP AT i_otf INTO w_otf.
    CONCATENATE w_otf-tdprintcom w_otf-tdprintpar
    INTO w_pdf.
    APPEND w_pdf TO i_content_txt.
    ENDLOOP.
    Converting to PDF Format
    CALL FUNCTION 'SX_OBJECT_CONVERT_OTF_PDF'
    EXPORTING
    format_src = c_otf
    format_dst = c_pdf
    devtype = c_printer
    CHANGING
    transfer_bin = w_transfer_bin
    content_txt = i_content_txt
    content_bin = i_content_bin
    objhead = i_objhead
    len = v_len_in
    EXCEPTIONS
    err_conv_failed = 1
    OTHERS = 2.
    v_size = v_len_in.
    Downloading the PDF File
    CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
    bin_filesize = v_size
    filename = c_name
    filetype = c_bin
    TABLES
    data_tab = i_content_bin.
    The extension is put the it_mailpack-obj_name parameter of 'SO_NEW_DOCUMENT_ATT_SEND_API1'.

  • PDF format of script output in irregular format

    Hi All,
    I am getting script output in OTF format in 'CLOSE_FORM'
    of standard sales order script.
    This,I am able to send in PDF format as mail attachment by using function module 'SO_NEW_DOCUMENT_ATT_SEND_API1'.
    But the alignment and format of data in the attachment doesn't exactly match with original script output.
    Can anyone help me in this regard? Thanks in advance
    - jawahar

    Hi,
        disregard my earlier mail.
       fill itcpo structure and try
      <b> itcpo-tdgetotf = 'X'.    
       xdevice = 'PRINTER'.  </b>   
      CALL FUNCTION 'OPEN_FORM'
           EXPORTING
                FORM           = TNAPR-FONAM
                LANGUAGE       = NAST-SPRAS
              <b>  OPTIONS        = ITCPO</b>
                ARCHIVE_INDEX  = TOA_DARA
                ARCHIVE_PARAMS = ARC_PARAMS
                DEVICE         = XDEVICE
                DIALOG         = ' '
           IMPORTING
                RESULT         = ITCPP
           EXCEPTIONS
                OTHERS         = 1.
        CALL FUNCTION 'SX_OBJECT_CONVERT_OTF_PDF'
             EXPORTING
                  FORMAT_SRC      = 'OTF'
                  FORMAT_DST      = 'PDF'
                  DEVTYPE         = 'HPLJ5SI'
             TABLES
                  CONTENT_IN      = CONTENT_IN
                  CONTENT_OUT     = CONTENT_OUT
             EXCEPTIONS
                  ERR_CONV_FAILED = 1
                  OTHERS          = 2.
        OBJBIN[] = CONTENT_OUT[].
    endif.
      DOC_CHNG-OBJ_NAME = TEXT-003.
    doc_chng-obj_descr = text-001.
      CONCATENATE TEXT-002 VBDKR-VBELN "zinvoice14-vessel
                          INTO DOC_CHNG-OBJ_DESCR SEPARATED BY SPACE.
      IF SY-SYSID NE 'S4P'.
        CONCATENATE DOC_CHNG-OBJ_DESCR TEXT-004 INTO DOC_CHNG-OBJ_DESCR
                                                    SEPARATED BY SPACE.
      ENDIF.
    OBJTXT = 'This is an example of a Sapscript emailed out of SAP'.
    APPEND OBJTXT.
      DESCRIBE TABLE OBJTXT LINES TAB_LINES.
      READ TABLE OBJTXT INDEX TAB_LINES.
      DOC_CHNG-DOC_SIZE = ( TAB_LINES - 1 ) * 255 + STRLEN( OBJTXT ).
    Fill the fields of the packing_list for the main document:
    It is a text document
      CLEAR OBJPACK-TRANSF_BIN.
    The document needs no header (head_num = 0)
      OBJPACK-HEAD_START = 1.
      OBJPACK-HEAD_NUM = 0.
    but it has a body
      OBJPACK-BODY_START = 1.
      OBJPACK-BODY_NUM = TAB_LINES.
    of type RAW
      OBJPACK-DOC_TYPE = 'RAW'.
      APPEND OBJPACK.
    Create the attachment (the list itself)
      IF NAST-KSCHL NE 'ZSTT'.
        DESCRIBE TABLE OBJBIN LINES TAB_LINES.
    Fill the fields of the packing_list for the attachment:
    It is binary document
        OBJPACK-TRANSF_BIN = 'X'.
    we need no header
        OBJPACK-HEAD_START = 1.
        OBJPACK-HEAD_NUM = 0.
    but a body
        OBJPACK-BODY_START = 1.
        OBJPACK-BODY_NUM = TAB_LINES.
    of type ALI
    IF NAST-KSCHL NE 'ZSTT'.
        OBJPACK-DOC_TYPE = 'PDF'.
        OBJPACK-OBJ_NAME = 'Attachment'.
        OBJPACK-OBJ_DESCR = 'PDF file'.
        READ TABLE OBJBIN INDEX TAB_LINES.
        DOC_SIZE = ( TAB_LINES - 1 ) * 255 + STRLEN( OBJBIN ).
        OBJPACK-DOC_SIZE = DOC_SIZE.
        APPEND OBJPACK.
      ENDIF.
    get E-mail address
    loop at t_tvbdkr.                                          "S4DK966284
      w_name = t_tvbdkr-tdname.                                "S4DK966284
        W_NAME = VBDKR-TDNAME.                                   "S4DK966284
        IF NAST-KSCHL EQ 'ZLEE'." or nast-kschl eq 'ZPRE'.
          PERFORM READ_TEXT USING W_NAME 'Z555' 'VBBK'.
        ENDIF.
        IF SY-SUBRC EQ 0.
          DELETE TDLINES WHERE TDFORMAT EQ '/*'
                          OR TDLINE EQ SPACE.
          LOOP AT TDLINES.
            RECIPIENT_INT-ADDRESS = TDLINES-TDLINE.
            RECLIST-RECEIVER = RECIPIENT_INT.
            RECLIST-REC_TYPE = 'U'.
            APPEND RECLIST.
          ENDLOOP.
        if sy-subrc eq 0.                                      "S4DK966284
          exit.                                                "S4DK966284
        endif.                                                 "S4DK966284
        ENDIF.
    endloop.                                                 
      LOOP AT T_TVBDPR.
        CHECK T_TVBDPR-TDNAME+0(10) = VBDKR-TDNAME.              "S4DK966284
        W_NAME = T_TVBDPR-TDNAME.
        IF NAST-KSCHL EQ 'ZLEE'.
          PERFORM READ_TEXT USING W_NAME 'Z558' 'VBBP'.
        ENDIF.
        IF SY-SUBRC EQ 0.
          DELETE TDLINES WHERE TDFORMAT EQ '/*'
                          OR TDLINE EQ SPACE.
          LOOP AT TDLINES.
            RECIPIENT_INT-ADDRESS = TDLINES-TDLINE.
            RECLIST-RECEIVER = RECIPIENT_INT.
            RECLIST-REC_TYPE = 'U'.
            APPEND RECLIST.
          ENDLOOP.
        if sy-subrc eq 0.                                      "S4DK966284
          exit.                                                "S4DK966284
        endif.                                                 "S4DK966284
        ENDIF.
      ENDLOOP.
    SEND THE DOCUMENT BY CALLING THE SAPOFFICE API1 MODULE
    FOR SENDING DOCUMENTS WITH ATTACHMENTS
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
           EXPORTING
                DOCUMENT_DATA              = DOC_CHNG
                PUT_IN_OUTBOX              = 'X'
           IMPORTING
                SENT_TO_ALL                = SENT_TO_ALL
           TABLES
                PACKING_LIST               = OBJPACK
                OBJECT_HEADER              = OBJHEAD
                CONTENTS_BIN               = OBJBIN
                CONTENTS_TXT               = OBJTXT
                RECEIVERS                  = RECLIST
           EXCEPTIONS
                TOO_MANY_RECEIVERS         = 1
                DOCUMENT_NOT_SENT          = 2
                OPERATION_NO_AUTHORIZATION = 4
                OTHERS                     = 99.
    Regards
    amole

  • Dispalying SAP script output in landscape format

    Hello All,
    Could anyone please tell me the step by step process to display a SAP Script output in landscape format?
    Also is it possible to display a column name in 2 lines if it does not fit into 1 line.
    Regards
    Indrajit.

    Hi,
    Here is the way to print the SAPSCRIPT in landscape ..
    Goto SE71, then give you layout name then press change, then press the Header button(CAP ICON), then you will get the Header infomation, then select the Basic Settings pushbutton, then there we have an option to Print the Layout in  Portrait format or Landscapr format, then select the LANDSCAPR format Radio button then activate it
    Regards
    Sudheer

  • Download script Output to XML format

    Dear friends,
    I want to download script output to xml format.
    Can you please help me regarding this issue.
    Its very Urgent.....
    Regards,
    Munna.G

    hi krishna,
    In Smartforms
    goto UTILITIES ---> download form.
    Browse the location and save the form.
    The saved form is in xml format.
    If you want to use that form,
    create a new form and go to utilities--> upload
    OR:
    Use function module FB_DOWNLOAD_FORM .
    Provide your form name as input for i_formname.
    you will get the output in xml format
    i think this will help u
    reward if help ful
    regards,
    sindhu.

  • Conky - script output and formatting?

    Hi, i made a small script that is outputting text to my conky, used like this:
    ${execi 3600 ~/scripts/horoscope.pl scorpio}
    The problem is that the text doesn't seem to be formatted (it goes off the edge of the conky).
    How can i get the output text to "fit" within my conky's width and not go off the screen?
    Here is the script:
    #!/usr/bin/env perl
    use strict;
    use warnings;
    use LWP::Simple;
    my $sign = $ARGV[0];
    my @signs = qw(
    aries taurus gemini cancer leo virgo
    libra scorpio sagittarius capricorn
    aquarius pisces
    sub horoscope($)
    our $data = get(
    'http://my.horoscope.com/astrology/free-daily-horoscope-' . $sign. '.html'
    if ($data =~ m/(.+)\ id=\"textline\">(.+)<\/div>(.+)/)
    our $msg = $2 ."\n";
    return $msg;
    } else
    return "Error retrieving horoscope.";
    package main;
    for my $val (@signs)
    if ($sign eq $val)
    print horoscope($val)

    That won't work, as i change conky often. I _don't want_ a script outputting "hard-formatted" text that will only fit one kind of conky unfortunately.
    If that was what i wanted to do i would have done it that way already...
    PS; i don't need to be told to read documentation. I wouldn't have bothered posting if i hadn't looked beforehand. It's rather annoying when you spend several hours searching through doc's, misc forums and tutorials trying to find a solution and when you post a thread about it someone asks you to RTFM.....

  • Changes are not reflected in Script output

    Hi All,
    i am facing a problem in SAPscript.
    I have made a Zscript by copying standard script F110_FR_CHEQUE. I have made the changes in the script as per requirement in development client and transported it to testing client to test (As i dont have any data in development client). But, surprisingly, when i run the program and check the output, the changes are not reflected in the script output.
    First i thought that my script was not triggered thats whay i m not getting any change, but later i changed the dimension of one of the window, in which some hard coded text is written, the differece i found was that, window size is changed, but the text written in that window is still same (what was in standard script.) .
    I am using standard texts for hard coding in script. Standard texts have been transported in testing client also.
    please help me in this regard.

    Hi,
    Could you plese Check NACE whether your script is confiugring or not.
    If it is configured well then Check Standard Text is available or not in Test client by open it in SO10.
    Check all the paragrah formats applied to Standard text are transferred to Test client which are in SE72.
    IF it is available in SO10 then debug the print program for that windows any standard conditions are calling to print the text.

  • Problem in script output sending mail

    hi ,
    I have a problem sending a mail with script output as attachment . I have searched in the forum for the answers but none is solved my question.
    I am sending the data to the otf and it is getting the otfdata. but it is not showing  the data on the script when it is sent as an attachment to the email , but it is showing only script with null values filled.( means i am getting the mail with attachment but in that attachment there is no data filled in the script send).
    the code is like this ..
    here i am filling the otfdata and i am exporting the otfdata
    CALL FUNCTION 'ZMM_ARRANG_ENTRY_ABR_NATRAB'
        EXPORTING
          i_nast       = nast
          i_fonam      = tnapr-fonam
          i_xscreen    = pi_xscreen
          i_arc_params = arc_params
          i_toa_dara   = toa_dara
        IMPORTING
          e_retcode    = px_retcode
        EXCEPTIONS
          OTHERS       = 1.
      IF ( sy-subrc <> 0 ).                "Fehler
        MOVE sy-subrc TO px_retcode.
        IF ( pi_xscreen = 'X' ).           "Ausgabe auf Bildschirm
          MESSAGE ID     sy-msgid
                  TYPE   sy-msgty
                  NUMBER sy-msgno
                  WITH   sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
      ELSE.
    *---Import OTFDATA from the memory
        IMPORT  it_otfdata FROM MEMORY ID 'OTF'.
      ENDIF.
      wa_maildata-obj_name = 'EMAIL'.
      wa_maildata-obj_descr = 'Settlement Details'.
    *-----mail contents
      it_mailtext-line = 'Sub-sequent settlement Details'.
      APPEND it_mailtext.
      DESCRIBE TABLE it_mailtext LINES v_lines.
      READ TABLE it_mailtext INDEX v_lines.
      wa_maildata-doc_size = ( v_lines - 1 ) * 255 + STRLEN( it_mailtext ).
    *Creation of the entry for the compressed document
      CLEAR it_mailpack-transf_bin.
      it_mailpack-head_start = 1.
      it_mailpack-head_num   = 0.
      it_mailpack-body_start = 1.
      it_mailpack-body_num   = v_lines.
      it_mailpack-doc_type   = 'RAW'.
      APPEND it_mailpack.
    *-----Get OTF data
      LOOP AT it_otfdata.
        it_mailcont-line = it_otfdata.
        APPEND it_mailcont.
      ENDLOOP.
    *---Move  OTF data into binary table
      LOOP AT it_mailcont.
        MOVE-CORRESPONDING it_mailcont TO it_mailbin.
        APPEND it_mailbin.
      ENDLOOP.
    *---Get no of lines in Binary data table
      DESCRIBE TABLE it_mailbin LINES v_lines.
    *---Fill name of the header of email
      it_mailhead = 'Subsequent Settlement Details.OTF'.
      APPEND it_mailhead.
    *---Creation of the entry for the compressed attachment
      it_mailpack-transf_bin   = 'X'.
      it_mailpack-head_start   = 1.
      it_mailpack-head_num     = 1.
      it_mailpack-body_start   = 1.
      it_mailpack-body_num     = v_lines.
      it_mailpack-doc_type     = 'OTF'.
      it_mailpack-obj_name     = 'EMAIL'.
      it_mailpack-obj_descr    = 'Settlement Details'.
      it_mailpack-doc_size     = v_lines * 255.
      APPEND it_mailpack.
    *----Get email address from the address number of vendor
      CALL FUNCTION 'ADDR_GET_REMOTE'
        EXPORTING
          addrnumber = l_adrnum
        TABLES
          adsmtp     = it_adsmtp.
    *----Get mail address
      READ TABLE it_adsmtp WITH KEY remark = 'AP_SUB_SETT'.
      IF sy-subrc = 0.
        it_mailrec-receiver   = it_adsmtp-smtp_addr.
        it_mailrec-rec_type   = 'U'.
        it_mailrec-com_type   = 'EXT'.
        APPEND it_mailrec.
    *---Send email with PDF attachment
        CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
          EXPORTING
            document_data = wa_maildata
            put_in_outbox = 'X'
            COMMIT_WORK   = 'X'
          TABLES
            packing_list  = it_mailpack
            object_header = it_mailhead
            contents_bin  = it_mailbin
            contents_txt  = it_mailtext
            receivers     = it_mailrec.
      ELSE.
        MESSAGE 'No email id Exist for the vendor' TYPE 'E'.
      ENDIF.
    please suggest me with your valuable answers .
    Regards,
    Venkat Appikonda.

    Hi venkat
    Just check if this helps you.
    The following part of the code does exactly that.
    Selecting details from the spool request table.
      SELECT * FROM tsp01 INTO TABLE tb_spool
               WHERE rqowner = sy-uname.
      IF sy-subrc EQ 0.
        SORT tb_spool DESCENDING BY rqcretime.
        CLEAR : tb_spool.
        READ TABLE tb_spool INDEX 1.
    convert spool into PDF format.
        CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
             EXPORTING
                  src_spoolid = tb_spool-rqident
             TABLES
                  PDF         = tb_lines.
      ENDIF.
    After this, on execution we get the below mentioned message.
    This indicates that a PDF of the SAP Script has been created which is in the format u201C132-long stringsu201D.
    In order to send the mail across, the mailing format of the PDF supports u201C255-long stringsu201D. So, the present u201C132-long stringsu201D needs to be converted into u201C255-long stringsu201D. This along with the mail code is mentioned below.
      DATA: lv_receiver(50) TYPE c.
      REFRESH: tb_obj_txt,
               tb_obj_bin,
               tb_obj_head,
               tb_paklist,
               tb_receiver.
      CLEAR: tb_obj_txt,
             tb_obj_bin,
             tb_paklist,
             tb_obj_head,
             tb_receiver.
      CLEAR: tb_adrc.
    IF NOT tb_adrc[] IS INITIAL.
    Reading the address table with the key as address number.
        READ TABLE tb_adrc WITH KEY addrnumber = tb_kna2-adrnr.
        IF sy-subrc EQ 0.
    Vendor Email ID.
          SELECT SINGLE smtp_addr
             FROM adr6
             INTO wf_mailaddr
             WHERE addrnumber = tb_adrc-addrnumber.
          IF sy-subrc EQ 0.
    Moving the mail address to the receiver itab
            MOVE wf_mailaddr TO tb_receiver-receiver.
            tb_receiver-rec_type = text-011.
            APPEND tb_receiver.
          ELSE.
            CONCATENATE text-004 tb_kna2-kunnr text-005 INTO lv_receiver
                                       SEPARATED BY space.
    If pa_call is initial, the receiver ID is printed; else an INVALID E-mail ID    message gets flashed.
            IF pa_call IS INITIAL.
              WRITE :/ lv_receiver.
            ENDIF.
            CLEAR: itab.
            itab-kunnr = tb_kna2-kunnr.
            itab-message = lv_receiver.
            APPEND itab.
            EXIT.   u201CNo mailing for invalid Email id
          ENDIF.
        ENDIF.
      ENDIF.
      wf_name = sy-uname.
      wf_year = tb_main-bldat(4).
      wf_mon = tb_main-bldat+4(2).
    *This FM gives the name of the months. 
    CALL FUNCTION 'MONTH_NAMES_GET'
           EXPORTING
                language    = sy-langu
           TABLES
                month_names = tb_months.
      IF sy-subrc EQ 0.
        READ TABLE tb_months WITH KEY mnr = wf_mon.
        IF sy-subrc EQ 0.
          wf_name = tb_months-ktx.
        ENDIF.
      ENDIF.
      CLEAR: tb_contp.
    IF NOT tb_contp[] IS INITIAL.
    *Reading the contp itab as per the customer entered on the selection screen.
        READ TABLE tb_contp WITH KEY bukrs = pa_bukrs
                                     kunnr =  tb_kna2-kunnr.
        IF sy-subrc EQ 0.
        CONCATENATE text-006 text-008 tb_contp-contp text-008 tb_kna2-kunnr
                              text-008 wf_name text-008 wf_year INTO wf_sub.
        ENDIF.
      ELSE.
        CONCATENATE text-006 text-008 tb_kna2-kunnr text-008 wf_name
                                        text-008 wf_year INTO wf_sub.
      ENDIF.
    Subject and Description
      CLEAR wa_docdata.
      wa_docdata-obj_name  = text-007.
      wa_docdata-obj_descr = wf_sub.
      wa_docdata-obj_langu = sy-langu.
    Write main body
      tb_obj_txt = text-009.
      APPEND tb_obj_txt.
      CLEAR tb_obj_txt.
      CLEAR  tb_paklist.
      tb_paklist-head_start = 1.
      tb_paklist-head_num   = 3.
      tb_paklist-body_start = 1.
      tb_paklist-body_num   = 60.
      tb_paklist-doc_type   = text-012.
      APPEND tb_paklist.
      CLEAR  tb_paklist.
    create PDF file
    Transfer the 132-long strings to 255-long strings
      LOOP AT tb_lines.
        TRANSLATE tb_lines USING ' ~'.
        CONCATENATE wf_buffer tb_lines INTO wf_buffer.
      ENDLOOP.
      TRANSLATE wf_buffer USING '~ '.
      DO.
        tb_obj_bin = wf_buffer.
        APPEND tb_obj_bin.
        SHIFT wf_buffer LEFT BY 255 PLACES.
        IF wf_buffer IS INITIAL.
          EXIT.
        ENDIF.
      ENDDO.
      DESCRIBE TABLE tb_obj_bin LINES lv_lines.
      READ TABLE tb_obj_bin INDEX lv_lines.
      lv_size = ( lv_lines - 1 ) * 255 + STRLEN( tb_obj_bin ).
    Create attachment notification
      tb_paklist-transf_bin = co_x.
      tb_paklist-head_start = 1.
      tb_paklist-head_num   = 0.
      tb_paklist-body_start = 1.
      tb_paklist-body_num   = lv_lines.
      tb_paklist-doc_type   = text-013.
      tb_paklist-obj_descr  = text-010.
      tb_paklist-obj_name   = text-010.
      tb_paklist-doc_size   = lv_size.
      APPEND tb_paklist.
    *mail the PDF to the receiver.
      CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
           EXPORTING
                document_data              = wa_docdata
                sender_address             = wf_name
                sender_address_type        = text-014
           TABLES
                packing_list               = tb_paklist
                object_header              = tb_obj_head
                contents_bin               = tb_obj_bin
                contents_txt               = tb_obj_txt
                receivers                  = tb_receiver
           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.
      IF sy-subrc <> 0.
        CONCATENATE text-003 tb_kna2-kunnr text-005 INTO lv_receiver
                                SEPARATED BY space.
        CLEAR: itab.
        itab-kunnr = tb_kna2-kunnr.
        itab-message = lv_receiver.
        APPEND itab.
        IF pa_call IS INITIAL.
          WRITE :/ lv_receiver.
        ENDIF.
      ELSE.
        CONCATENATE text-002 tb_kna2-kunnr text-005 INTO lv_receiver
                                SEPARATED BY space.
        CLEAR: itab.
        itab-kunnr = tb_kna2-kunnr.
        itab-message = lv_receiver.
        APPEND itab.
        IF pa_call IS INITIAL.
          WRITE :/ lv_receiver.
        ENDIF.
      ENDIF.
    Hope this helps.
    Harsh

  • Reg: Script Output in PDF form

    Hai..
    Can anybody tell me how we will get script output
    (P.order output) in PDF format and we need to downlaod this PDF to our local drives. plz tell me the function modules to be used for this requirement and paste the code if any of you worked on this earlier..
    Regards

    Check this link for sample program.
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/49e15474-0e01-0010-9cba-e62df8244556
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/downloadSAPScriptoutputtoPDF+file.&
    Function Module: CONVERT_OTF
    Regards,
    Maha

  • Sending SAP Script output as a PDF attachment through mail

    Dear Guru,
    I am using SAP 4.0B version, DATABASE Oracle 8i, OS is sun solaris 7.5.
    I want to send SAP script output as a
    PDF attachement through mail.Please suggest a solution.
    Regards,
    Rajesh

    Hi Rajesh,
    In your print program, while calling OPEN_FORM, pass options-TDGETOTF = 'X'. This is used for returning print output in OTF format.
    Then in CLOSE_FORM, get the table OTFDATA returned from the function module. for example
    DATA: OTF_DATA LIKE ITCOO OCCURS 0 WITH HEADER LINE.
        CALL FUNCTION 'CLOSE_FORM'
          IMPORTING
            RESULT  = RESULT
          TABLES
            OTFDATA = OTF_DATA.
    now you can convert this OTF data to PDF using function module CONVERT_OTF
    Then send this data as attachment to a mail using function module SO_NEW_DOCUMENT_ATT_SEND_API1
    Regards,
    Komal.

  • Reg : Sending Script output to email

    Hi,
    I need to send script output to email.I have written the code for this functionality.
    Functional guy has created output type ,but that output type is red in clor and when I click process log " it says Parameter DEVICE= is invalid "
    Is there anything to be done from abap point for this error.
    Actually I used these 2 fun.modules
    DATA: LVF_DEVICE LIKE ITCPP-TDDEVICE.
    DATA: LVS_ITCPO TYPE ITCPO,
    LVF_DIALOG(1) TYPE C VALUE ' ',
    LVS_RECIPIENT LIKE SWOTOBJID,
    LVS_SENDER LIKE SWOTOBJID,
    LVS_SNAST TYPE SNAST,
    LVF_PROGRAM LIKE SY-REPID,
    LVS_COMM_TYPE TYPE AD_COMM,
    LVS_COMM_VALUES TYPE SZADR_COMM_VALUES.
    DATA:
    W_DEPT LIKE KNVK-ABTNR, "Department
    W_PRSNR LIKE KNVK-PRSNR. "Person number
    reset return code
    RETCODE = 0.
    IF NOT NAST-TCODE IS INITIAL AND NAST-NACHA EQ '5'.
    SELECT SINGLE * FROM USR21 WHERE BNAME = SY-UNAME.
    CALL FUNCTION 'ADDR_GET_NEXT_COMM_TYPE'
    EXPORTING
    strategy = nast-tcode
    address_number = Kna1-adrnr
    IMPORTING
    comm_type = lvs_comm_type
    comm_values = lvs_comm_values
    TABLES
    STRATEGY_TABLE =
    EXCEPTIONS
    address_not_exist = 1
    person_not_exist = 2
    no_comm_type_found = 3
    internal_error = 4
    parameter_error = 5
    OTHERS = 6.
    convert communication data
    Always INT
    LVS_COMM_TYPE = 'INT'.
    clear LVS_COMM_VALUES-ADSMTP-SMTP_ADDR.
    Get Contact persons number from KNVK
    SELECT SINGLE * FROM KNVK WHERE KUNNR EQ NAST-PARNR
    AND ABTNR EQ W_DEPT.
    Get it from ADR6 table always
    Select single * from adr6 where addrnumber = kna1-adrnr
    AND PERSNUMBER = KNVK-PRSNR.
    IF SY-SUBRC EQ 0 AND adr6-Smtp_addr NE ' '.
    LVS_COMM_VALUES-ADSMTP-SMTP_ADDR = adr6-Smtp_addr.
    ENDIF.
    ENDIF.
    MOVE-CORRESPONDING nast TO LVS_SNAST .
    MOVE sy-repid TO LVF_PROGRAM.
    CALL FUNCTION 'CONVERT_COMM_TYPE_DATA'
    EXPORTING
    pi_comm_type = lvs_comm_type
    pi_comm_values = lvs_comm_values
    pi_country = kna1-land1
    pi_repid = LVF_PROGRAM
    pi_snast = LVS_SNAST
    IMPORTING
    pe_itcpo = lvs_itcpo
    pe_device = lvf_device
    pe_mail_recipient = lvs_recipient
    pe_mail_sender = lvs_sender
    EXCEPTIONS
    comm_type_not_supported = 1
    recipient_creation_failed = 2
    sender_creation_failed = 3
    OTHERS = 4.
    fill structure itcpo
    ITCPO = LVS_ITCPO.
    CALL FUNCTION 'OPEN_FORM'
    EXPORTING
    APPLICATION = 'TX'
    ARCHIVE_INDEX = TOA_DARA
    ARCHIVE_PARAMS = ARC_PARAMS
    DEVICE = LVF_DEVICE
    DIALOG = ' '
    FORM = TNAPR-FONAM
    LANGUAGE = NAST-SPRAS
    OPTIONS = LVS_ITCPO
    MAIL_SENDER = LVS_SENDER
    MAIL_RECIPIENT = LVS_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
    OTHERS = 8.
    IF SY-SUBRC NE 0.
    CASE SY-SUBRC.
    WHEN 7.
    RETCODE = SY-SUBRC.
    SYST-MSGID = 'VN'.
    SYST-MSGNO = '096'.
    SYST-MSGTY = 'E'.
    SYST-MSGV1 = NAST-KSCHL.
    SYST-MSGV2 = NAST-KAPPL.
    PERFORM PROTOCOL_UPDATE.
    WHEN OTHERS.
    RETCODE = SY-SUBRC.
    PERFORM PROTOCOL_UPDATE.
    ENDCASE.
    ENDIF.
    and one more query is :
    I want to know weather
    "Are there any settings need to be done by BASIS people."
    If Anyone has any idea plz reply.

    Hi
    Use the below peace of code,I was used to send sales order confirmation script output as email.
    Change History
    Programmer   Date     Change Request Description
    FKHURRAM     9/16/02  DU1K920151     Upgrade changes.
                                         Use ADRC for Address Data
                 Print of an order confirmation by SAPscript
    REPORT rvador01 LINE-COUNT 100 MESSAGE-ID vn.
    TABLES: komk,                          "Communicationarea for conditions
            komp,                          "Communicationarea for conditions
            komvd,                         "Communicationarea for conditions
            vbco3,                         "Communicationarea for view
            vbdka,                         "Headerview
            vbdpa,                         "Itemview
            vbdpau,                        "Subitemnumbers
            conf_out,                      "Configuration data
            sadr,                          "Addresses
            tvag,                          "Reason for rejection
            vedka,                         "Servicecontract head data
            vedpa,                         "Servicecontract position data
            vedkn,                         "Servicecontract head notice data
            vedpn,                         "Servicecontract pos. notice data
            vbpa,                          "Sales Document: Partner
            kna1,                          "General Data in Customer Master
            riserls,                       "Serialnumbers
            komser,                        "Serialnumbers for print
            tvbur,                         "Sales office
            tvko,                          "Sales organisation
            adrs,                          "Communicationarea for Address
            fpltdr.                        "billing schedules
    INCLUDE yzrvadtabl.
    *INCLUDE RVADTABL.
    INCLUDE yzrvdirekt.
    *INCLUDE RVDIREKT.
    INCLUDE yzvedadata.
    *INCLUDE VEDADATA.
    DATA: retcode   LIKE sy-subrc.         "Returncode
    DATA: repeat(1) TYPE c.
    DATA: xscreen(1) TYPE c.               "Output on printer or screen
    DATA: BEGIN OF steu,                   "Controldata for output
            vdkex(1) TYPE c,
            vdpex(1) TYPE c,
            kbkex(1) TYPE c,
            kbpex(1) TYPE c,
          END OF steu.
    DATA: BEGIN OF tvbdpa OCCURS 0.        "Internal table for items
            INCLUDE STRUCTURE vbdpa.
    DATA: END OF tvbdpa.
    DATA: BEGIN OF tkomv OCCURS 50.
            INCLUDE STRUCTURE komv.
    DATA: END OF tkomv.
    DATA: BEGIN OF tkomvd OCCURS 50.
            INCLUDE STRUCTURE komvd.
    DATA: END OF tkomvd.
    DATA: BEGIN OF tvbdpau OCCURS 5.
            INCLUDE STRUCTURE vbdpau.
    DATA: END   OF tvbdpau.
    DATA: BEGIN OF tkomcon OCCURS 50.
            INCLUDE STRUCTURE conf_out.
    DATA: END   OF tkomcon.
    DATA: BEGIN OF tkomservh OCCURS 1.
            INCLUDE STRUCTURE vedka.
    DATA: END   OF tkomservh.
    DATA: BEGIN OF tkomservp OCCURS 5.
            INCLUDE STRUCTURE vedpa.
    DATA: END   OF tkomservp.
    DATA: BEGIN OF tkomservhn OCCURS 5.
            INCLUDE STRUCTURE vedkn.
    DATA: END   OF tkomservhn.
    DATA: BEGIN OF tkomservpn OCCURS 5.
            INCLUDE STRUCTURE vedpn.
    DATA: END   OF tkomservpn.
    DATA: BEGIN OF tkomser OCCURS 5.
            INCLUDE STRUCTURE riserls.
    DATA: END   OF tkomser.
    DATA: BEGIN OF tkomser_print OCCURS 5.
            INCLUDE STRUCTURE komser.
    DATA: END   OF tkomser_print.
    DATA: BEGIN OF tfpltdr OCCURS 5.
            INCLUDE STRUCTURE fpltdr.
    DATA: END   OF tfpltdr.
    DATA: pr_kappl(01)   TYPE c VALUE 'V'. "Application for pricing
    DATA: BEGIN OF char_val OCCURS 0,
            atnam LIKE cabn-atnam,
            atwrt LIKE ausp-atwrt,
          END OF char_val.
    FORM entry USING return_code us_screen.
      CLEAR retcode.
      xscreen = us_screen.
      PERFORM processing.
      IF retcode NE 0.
        return_code = 1.
      ELSE.
        return_code = 0.
      ENDIF.
    ENDFORM.                    "ENTRY
          FORM PROCESSING                                               *
    FORM processing.
      PERFORM get_data.
      CHECK retcode = 0.
      PERFORM form_open USING xscreen vbdka-land1.
      CHECK retcode = 0.
      PERFORM logo_selection.
      PERFORM form_title_print.
      CHECK retcode = 0.
      PERFORM write_header_info.
      PERFORM validity_print.
      CHECK retcode = 0.
      PERFORM header_data_print.
      CHECK retcode = 0.
      PERFORM header_serv_print.
      CHECK retcode = 0.
      PERFORM header_notice_print.
      CHECK retcode = 0.
      PERFORM header_inter_print.
      CHECK retcode = 0.
      PERFORM header_text_print.
      CHECK retcode = 0.
      PERFORM item_print.
      CHECK retcode = 0.
      PERFORM end_print.
      CHECK retcode = 0.
      PERFORM form_close.
      CHECK retcode = 0.
    *********************changes on 12/04/2007****************
      TABLES: tsp01.
      TYPES: BEGIN OF t_spool,
             rqident TYPE tsp01-rqident,
            END OF t_spool.
      DATA: i_spool TYPE STANDARD TABLE OF t_spool,
            wa_spool TYPE t_spool.
      SELECT  rqident FROM tsp01
      INTO TABLE i_spool
    WHERE rqowner = sy-uname.
      SORT i_spool DESCENDING BY rqident.
      LOOP AT i_spool INTO wa_spool.
      ENDLOOP.
    data: l_rqident type tsp01-rqident.
    SELECT SINGLE rqident FROM tsp01 INTO l_rqident
    WHERE rqowner = sy-uname.
    DATA: l_spoolno LIKE tsp01-rqident VALUE '0000024884'.
      TYPES: l_ty_tab_pdf TYPE tline OCCURS 0.
      DATA: l_pdf TYPE l_ty_tab_pdf,
            l_spool TYPE tsp01-rqident.
    Type for binary attachment table.
      TYPES: l_ty_tab_objbin TYPE solisti1 OCCURS 0.
      DATA: l_objbin TYPE l_ty_tab_objbin.
    l_spool = l_spoolno.
      l_spool = l_rqident.
      l_spool = wa_spool-rqident.
    **/ Call the standard function
      CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'             "#EC ARGCHECKED
          EXPORTING
            src_spoolid                    = l_spool
            no_dialog                      = ' '
          DST_DEVICE                     =
          PDF_DESTINATION                =
         IMPORTING
           pdf_bytecount                  = numbytes
           pdf_spoolid                    = pdfspoolid
          LIST_PAGECOUNT                 =
           btc_jobname                    = jobname
           btc_jobcount                   = jobcount
          TABLES
            pdf                            = l_pdf
          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.
      IF sy-subrc <> 0.
        WRITE: / 'error', sy-subrc.
      ENDIF.
    **/ Convert the PDF format to the table type required for the
    *attachment.
      CALL FUNCTION 'QCE1_CONVERT'
        TABLES
          t_source_tab         = l_pdf
          t_target_tab         = l_objbin
        EXCEPTIONS
          convert_not_possible = 1
          OTHERS               = 2.
      IF sy-subrc <> 0.
        WRITE: / 'error', sy-subrc.
      ENDIF.
      TABLES : soli.
      TABLES : zpsdsalrep.
      DATA: v_email TYPE soli-line.
      DATA: v_email1 TYPE soli-line.
      DATA: l_adrnr LIKE kna1-adrnr.
      DATA: l_objky TYPE nast-objky.
      DATA: l_zzterrmg TYPE zpsdsalrep-zzterrmg.
      DATA: l_zsupervisor TYPE zpsdsalrep-zsupervisor.
      DATA: l_kunnr TYPE kna1-kunnr.
      DATA: l_kunnr1 TYPE vbak-kunnr.
      SELECT SINGLE kunnr FROM vbak INTO l_kunnr1
             WHERE vbeln = nast-objky.
      SELECT SINGLE adrnr FROM kna1 INTO l_adrnr
             WHERE kunnr = l_kunnr1.
      CHECK sy-subrc IS INITIAL.
      SELECT SINGLE smtp_addr FROM adr6 INTO v_email
             WHERE addrnumber = l_adrnr.
      SELECT SINGLE zzterrmg FROM zpsdsalrep INTO l_zzterrmg
             WHERE zzsalesrep = l_kunnr1.
      SELECT SINGLE zsupervisor FROM zpsdsalrep INTO l_zsupervisor
          WHERE  zzterrmg = l_zzterrmg.
      SELECT SINGLE kunnr FROM kna1 INTO l_kunnr
            WHERE sortl = l_zsupervisor.
      SELECT SINGLE adrnr FROM kna1 INTO l_adrnr
             WHERE kunnr = l_kunnr.
      CHECK sy-subrc IS INITIAL.
      SELECT SINGLE smtp_addr FROM adr6 INTO v_email1
             WHERE addrnumber = l_adrnr.
      DATA: l_reclist LIKE somlreci1 OCCURS 0 WITH HEADER LINE.
      DATA: l_objtxt    LIKE solisti1 OCCURS   0 WITH HEADER LINE.
      DATA: l_objpack   LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE.
      DATA: l_doc_chng  LIKE sodocchgi1.
      DATA: l_objhead   LIKE solisti1 OCCURS   0 WITH HEADER LINE.
      DATA: l_tab_lines LIKE sy-tabix.
      CONSTANTS: k_true TYPE boolean_flg VALUE 'X'.
      DATA: l_mail TYPE somlreci1-receiver.
      DATA: l_mail1 TYPE somlreci1-receiver.
      DATA: k_mail2 TYPE somlreci1-receiver.
      DATA: k_mail TYPE somlreci1-receiver.
      l_mail = v_email.
      l_mail1 = v_email1.
      k_mail2 = text-006.
      k_mail = text-007.
    Creation of the document to be sent
    File Name
      l_doc_chng-obj_name = 'SENDFILE'.
    Mail Subject
      l_doc_chng-obj_descr = text-001.
    Completing the recipient list
      l_reclist-receiver = l_mail.
      l_reclist-rec_type = 'U'.
      APPEND l_reclist.
      l_reclist-receiver = l_mail1.
      l_reclist-rec_type = 'U'.
      APPEND l_reclist.
      l_reclist-receiver = k_mail.
      l_reclist-rec_type = 'U'.
      APPEND l_reclist.
      l_reclist-receiver = k_mail2.
      l_reclist-rec_type = 'U'.
      APPEND l_reclist.
    Mail Contents
      l_objtxt = text-002.
      APPEND l_objtxt.
      CLEAR l_objtxt.     " put in a blank line
      APPEND l_objtxt.
      l_objtxt = text-003.
      APPEND l_objtxt.
      l_objtxt = text-004 .
      APPEND l_objtxt.
    Calculate email size in bytes
      DESCRIBE TABLE l_objtxt LINES l_tab_lines.
      READ TABLE l_objtxt INDEX l_tab_lines.
      l_doc_chng-doc_size = ( l_tab_lines - 1 ) * 255 + STRLEN( l_objtxt ).
    Creation of the entry for the compressed document
    for the email text
      CLEAR l_objpack-transf_bin.
      l_objpack-head_start = 1.
      l_objpack-head_num = 0.
      l_objpack-body_start = 1.
      l_objpack-body_num = l_tab_lines.
      l_objpack-doc_type = 'RAW'.
      APPEND l_objpack.
    Creation of the document attachment
    (Assume that the data in OBJBIN is in BMP format)
      DESCRIBE TABLE l_objbin LINES l_tab_lines.
      l_objhead = text-001  .
      APPEND l_objhead.
      CLEAR l_objpack.
    **/ Creation of the entry for the compressed/attached document
      l_objpack-transf_bin = k_true.
      l_objpack-head_start = 1.
      l_objpack-head_num = 1.
      l_objpack-body_start = 1.
      l_objpack-body_num = l_tab_lines.
      l_objpack-doc_type = 'PDF'.
      l_objpack-obj_name = text-005.
      l_objpack-obj_descr = text-001.
      l_objpack-doc_size = l_tab_lines * 255.
      APPEND l_objpack. "/ .
    Sending the document
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1' "/ .
        EXPORTING
          document_data              = l_doc_chng
          put_in_outbox              = 'X'
        TABLES
          packing_list               = l_objpack
          object_header              = l_objhead
          contents_bin               = l_objbin
          contents_txt               = l_objtxt
          receivers                  = l_reclist
        EXCEPTIONS
          too_many_receivers         = 1
          document_not_sent          = 2
          operation_no_authorization = 4
          OTHERS                     = 99.
      IF sy-subrc <> 0.
        WRITE: / 'unsuccessful', sy-subrc.
      ELSE.
        WRITE:  / 'successful'.
      ENDIF.
    **/Take_note it is a requirement to do a commit work for the
    email to go into transaction SOST.
      COMMIT WORK.   "/Take_note .
    ENDFORM.                    "PROCESSING
          S U B R O U T I N E S                                         *
          FORM ALTERNATIVE_ITEM                                         *
          A text is printed, if the item is an alternative item.        *
    FORM alternative_item.
      CHECK vbdpa-grpos CN '0'.
      CALL FUNCTION 'WRITE_FORM'
        EXPORTING
          element = 'ALTERNATIVE_ITEM'
        EXCEPTIONS
          element = 1
          window  = 2.
      IF sy-subrc NE 0.
        PERFORM protocol_update.
      ENDIF.
    ENDFORM.                    "ALTERNATIVE_ITEM
          FORM CHECK_REPEAT                                             *
          A text is printed, if it is a repeat print for the document.  *
    FORM check_repeat.
      CLEAR repeat.
      SELECT * INTO *nast FROM nast WHERE kappl = nast-kappl
                                    AND   objky = nast-objky
                                    AND   kschl = nast-kschl
                                    AND   spras = nast-spras
                                    AND   parnr = nast-parnr
                                    AND   parvw = nast-parvw
                                    AND   nacha BETWEEN '1' AND '4'.
        CHECK *nast-vstat = '1'.
        repeat = 'X'.
        EXIT.
      ENDSELECT.
    ENDFORM.                    "CHECK_REPEAT
          FORM DELIVERY_DATE                                            *
          If the delivery date in the item is different to the header   *
          date and there are no scheduled quantities, the delivery date *
          is printed in the item block.                                 *
    FORM delivery_date.
      IF vbdka-lfdat =  space AND
         vbdpa-lfdat NE space AND
         vbdpa-etenr_da = space.
        CALL FUNCTION 'WRITE_FORM'
          EXPORTING
            element = 'ITEM_DELIVERY_DATE'
          EXCEPTIONS
            element = 1
            window  = 2.
        IF sy-subrc NE 0.
          PERFORM protocol_update.
        ENDIF.
      ENDIF.
    ENDFORM.                    "DELIVERY_DATE
          FORM DIFFERENT_CONSIGNEE                                      *
          If the consignee in the item is different to the header con-  *
          signee, it is printed by this routine.                        *
    FORM different_consignee.
      CHECK vbdka-name1_we NE vbdpa-name1_we
        OR  vbdka-name2_we NE vbdpa-name2_we
        OR  vbdka-name3_we NE vbdpa-name3_we
        OR  vbdka-name4_we NE vbdpa-name4_we.
      CHECK vbdpa-name1_we NE space
        OR  vbdpa-name2_we NE space
        OR  vbdpa-name3_we NE space
        OR  vbdpa-name4_we NE space.
      CALL FUNCTION 'WRITE_FORM'
        EXPORTING
          element = 'ITEM_CONSIGNEE'
        EXCEPTIONS
          element = 1
          window  = 2.
      IF sy-subrc NE 0.
        PERFORM protocol_update.
      ENDIF.
    ENDFORM.                    "DIFFERENT_CONSIGNEE
          FORM DIFFERENT_REFERENCE_NO                                   *
          If the reference number in the item is different to the header*
          reference number, it is printed by this routine.              *
    FORM different_reference_no.
      CHECK vbdpa-vbeln_vang NE vbdka-vbeln_vang
        OR  vbdpa-vbtyp_vang NE vbdka-vbtyp_vang.
      CALL FUNCTION 'WRITE_FORM'
        EXPORTING
          element = 'ITEM_REFERENCE_NO'
        EXCEPTIONS
          element = 1
          window  = 2.
      IF sy-subrc NE 0.
        PERFORM protocol_update.
      ENDIF.
    ENDFORM.                    "DIFFERENT_REFERENCE_NO
          FORM DIFFERENT_TERMS                                          *
          If the terms in the item are different to the header terms,   *
          they are printed by this routine.                             *
    FORM different_terms.
      DATA: us_vposn   LIKE vedpa-vposn.
      DATA: us_text(1) TYPE c.             "Flag for Noticetext was printed
      IF vbdpa-zterm NE vbdka-zterm AND
         vbdpa-zterm NE space.
        CALL FUNCTION 'WRITE_FORM'
          EXPORTING
            element = 'ITEM_TERMS_OF_PAYMENT'
          EXCEPTIONS
            element = 1
            window  = 2.
        IF sy-subrc NE 0.
          PERFORM protocol_update.
        ENDIF.
      ENDIF.
      IF vbdpa-inco1 NE space.
        IF vbdpa-inco1 NE vbdka-inco1 OR
           vbdpa-inco2 NE vbdka-inco2.
          CALL FUNCTION 'WRITE_FORM'
            EXPORTING
              element = 'ITEM_TERMS_OF_DELIVERY'
            EXCEPTIONS
              element = 1
              window  = 2.
          IF sy-subrc NE 0.
            PERFORM protocol_update.
          ENDIF.
        ENDIF.
      ENDIF.
    Print different validity-data for the position
      READ TABLE tkomservp WITH KEY vbdpa-posnr.
      IF sy-subrc EQ 0.
        vedpa = tkomservp.
        IF vedpa-vbegdat NE space       AND
           vedpa-venddat NE space       AND
           NOT vedpa-vbegdat IS INITIAL AND
           NOT vedpa-venddat IS INITIAL.
          CALL FUNCTION 'WRITE_FORM'
            EXPORTING
              element = 'ITEM_TERMS_OF_SERV1'
            EXCEPTIONS
              element = 1
              window  = 2.
          IF sy-subrc NE 0.
            PERFORM protocol_update.
          ENDIF.
        ELSEIF vedpa-vbegdat NE space AND
               NOT vedpa-vbegdat IS INITIAL.
          CALL FUNCTION 'WRITE_FORM'
            EXPORTING
              element = 'ITEM_TERMS_OF_SERV2'
            EXCEPTIONS
              element = 1
              window  = 2.
          IF sy-subrc NE 0.
            PERFORM protocol_update.
          ENDIF.
        ELSE.
          CALL FUNCTION 'WRITE_FORM'
            EXPORTING
              element = 'ITEM_TERMS_OF_SERV3'
            EXCEPTIONS
              element = 1
              window  = 2.
          IF sy-subrc NE 0.
            PERFORM protocol_update.
          ENDIF.
        ENDIF.
      ENDIF.
    Notice-rules for the positions.
      MOVE vbdpa-posnr TO us_vposn.
      CLEAR us_text.
      LOOP AT tkomservpn WHERE vposn = us_vposn.
        vedpn = tkomservpn.
        IF us_text IS INITIAL.
          CALL FUNCTION 'WRITE_FORM'
            EXPORTING
              element = 'ITEM_TERMS_OF_NOTTXT'
            EXCEPTIONS
              element = 1
              window  = 2.
          IF sy-subrc NE 0.
            PERFORM protocol_update.
          ENDIF.
          us_text = charx.
        ENDIF.
        CALL FUNCTION 'WRITE_FORM'
          EXPORTING
            element = 'ITEM_TERMS_OF_NOTICE'
          EXCEPTIONS
            element = 1
            window  = 2.
        IF sy-subrc NE 0.
          PERFORM protocol_update.
        ENDIF.
      ENDLOOP.
      IF NOT us_text IS INITIAL.
        CALL FUNCTION 'WRITE_FORM'
          EXPORTING
            element = 'EMPTY_LINE'
          EXCEPTIONS
            element = 1
            window  = 2.
        IF sy-subrc NE 0.
          PERFORM protocol_update.
        ENDIF.
      ENDIF.
    ENDFORM.                    "DIFFERENT_TERMS
          FORM END_PRINT                                                *
    FORM end_print.
      PERFORM get_header_prices.
      CALL FUNCTION 'CONTROL_FORM'
        EXPORTING
          command = 'PROTECT'.
      PERFORM header_price_print.
      CALL FUNCTION 'WRITE_FORM'
        EXPORTING
          element = 'END_VALUES'.
      CALL FUNCTION 'CONTROL_FORM'
        EXPORTING
          command = 'ENDPROTECT'.
      CALL FUNCTION 'WRITE_FORM'
        EXPORTING
          element = 'SUPPLEMENT_TEXT'
        EXCEPTIONS
          element = 1
          window  = 2.
      IF sy-subrc NE 0.
        PERFORM protocol_update.
      ENDIF.
    ENDFORM.                    "END_PRINT
          FORM FORM_CLOSE                                               *
          End of printing the form                                      *
    FORM form_close.
      CALL FUNCTION 'CLOSE_FORM'
        EXCEPTIONS
          OTHERS = 1.
      IF sy-subrc NE 0.
        PERFORM protocol_update.
        retcode = 1.
      ENDIF.
      SET COUNTRY space.
    ENDFORM.                    "FORM_CLOSE
          FORM FORM_OPEN                                                *
          Start of printing the form                                    *
    -->  US_SCREEN  Output on screen                                   *
                     ' ' = printer                                      *
                     'X' = screen                                       *
    -->  US_COUNTRY County for telecommunication and SET COUNTRY       *
    FORM form_open USING us_screen us_country.
      INCLUDE yzrvadopfo.
    INCLUDE RVADOPFO.
    ENDFORM.                    "FORM_OPEN
          FORM FORM_TITLE_PRINT                                         *
          Printing of the form title depending of the field VBTYP       *
    FORM form_title_print.
      CASE vbdka-vbtyp.
        WHEN 'A'.
          CALL FUNCTION 'WRITE_FORM'
            EXPORTING
              element = 'TITLE_A'
              window  = 'TITLE'
            EXCEPTIONS
              element = 1
              window  = 2.
          IF sy-subrc NE 0.
            PERFORM protocol_update.
          ENDIF.
        WHEN 'B'.
          CALL FUNCTION 'WRITE_FORM'
            EXPORTING
              element = 'TITLE_B'
              window  = 'TITLE'
            EXCEPTIONS
              element = 1
              window  = 2.
          IF sy-subrc NE 0.
            PERFORM protocol_update.
          ENDIF.
        WHEN 'C'.
          CALL FUNCTION 'WRITE_FORM'
            EXPORTING
              element = 'TITLE_C'
              window  = 'TITLE'
            EXCEPTIONS
              element = 1
              window  = 2.
          IF sy-subrc NE 0.
            PERFORM protocol_update.
          ENDIF.
        WHEN 'E'.
          CALL FUNCTION 'WRITE_FORM'
            EXPORTING
              element = 'TITLE_E'
              window  = 'TITLE'
            EXCEPTIONS
              element = 1
              window  = 2.
          IF sy-subrc NE 0.
            PERFORM protocol_update.
          ENDIF.
        WHEN 'F'.
          CALL FUNCTION 'WRITE_FORM'
            EXPORTING
              element = 'TITLE_F'
              window  = 'TITLE'
            EXCEPTIONS
              element = 1
              window  = 2.
          IF sy-subrc NE 0.
            PERFORM protocol_update.
          ENDIF.
        WHEN 'G'.
          CALL FUNCTION 'WRITE_FORM'
            EXPORTING
              element = 'TITLE_F'
              window  = 'TITLE'
            EXCEPTIONS
              element = 1
              window  = 2.
          IF sy-subrc NE 0.
            PERFORM protocol_update.
          ENDIF.
        WHEN 'H'.
          CALL FUNCTION 'WRITE_FORM'
            EXPORTING
              element = 'TITLE_H'
              window  = 'TITLE'
            EXCEPTIONS
              element = 1
              window  = 2.
          IF sy-subrc NE 0.
            PERFORM protocol_update.
          ENDIF.
        WHEN 'K'.
          CALL FUNCTION 'WRITE_FORM'
            EXPORTING
              element = 'TITLE_K'
              window  = 'TITLE'
            EXCEPTIONS
              element = 1
              window  = 2.
          IF sy-subrc NE 0.
            PERFORM protocol_update.
          ENDIF.
        WHEN 'L'.
          CALL FUNCTION 'WRITE_FORM'
            EXPORTING
              element = 'TITLE_L'
              window  = 'TITLE'
            EXCEPTIONS
              element = 1
              window  = 2.
          IF sy-subrc NE 0.
            PERFORM protocol_update.
          ENDIF.
        WHEN OTHERS.
          CALL FUNCTION 'WRITE_FORM'
            EXPORTING
              element = 'TITLE_OTHERS'
              window  = 'TITLE'
            EXCEPTIONS
              element = 1
              window  = 2.
          IF sy-subrc NE 0.
            PERFORM protocol_update.
          ENDIF.
      ENDCASE.
      IF repeat NE space.
        CALL FUNCTION 'WRITE_FORM'
          EXPORTING
            element = 'REPEAT'
            window  = 'REPEAT'
          EXCEPTIONS
            element = 1
            window  = 2.
        IF sy-subrc NE 0.
          PERFORM protocol_update.
        ENDIF.
      ENDIF.
    ENDFORM.                    "FORM_TITLE_PRINT
          FORM GET_DATA                                                 *
          General provision of data for the form                        *
    FORM get_data.
      DATA: us_veda_vbeln     LIKE veda-vbeln.
      DATA: us_veda_posnr_low LIKE veda-vposn.
      CALL FUNCTION 'RV_PRICE_PRINT_REFRESH'
        TABLES
          tkomv = tkomv.
      CLEAR komk.
      CLEAR komp.
      vbco3-mandt = sy-mandt.
      vbco3-spras = nast-spras.
      vbco3-vbeln = nast-objky.
      vbco3-kunde = nast-parnr.
      vbco3-parvw = nast-parvw.
      CALL FUNCTION 'RV_DOCUMENT_PRINT_VIEW'
        EXPORTING
          comwa = vbco3
        IMPORTING
          kopf  = vbdka
        TABLES
          pos   = tvbdpa.
    Fetch servicecontract-data and notice-data for head and position.
      us_veda_vbeln     = vbdka-vbeln.
      us_veda_posnr_low = posnr_low.
      CALL FUNCTION 'SD_VEDA_GET_PRINT_DATA'
        EXPORTING
          i_document_number = us_veda_vbeln
          i_language        = sy-langu
          i_posnr_low       = us_veda_posnr_low
        TABLES
          print_data_pos    = tkomservp
          print_data_head   = tkomservh
          print_notice_pos  = tkomservpn
          print_notice_head = tkomservhn.
      PERFORM get_controll_data.
      PERFORM sender.
      PERFORM check_repeat.
      PERFORM tvbdpau_create.
    ENDFORM.                    "GET_DATA
          FORM GET_ITEM_BILLING_SCHEDULES                               *
          In this routine the billing schedules are fetched from the    *
          database.                                                     *
    FORM get_item_billing_schedules.
      REFRESH tfpltdr.
      CHECK NOT vbdpa-fplnr IS INITIAL.
      CALL FUNCTION 'BILLING_SCHED_PRINTVIEW_READ'
        EXPORTING
          i_fplnr    = vbdpa-fplnr
          i_language = nast-spras
        TABLES
          zfpltdr    = tfpltdr.
    ENDFORM.                    "GET_ITEM_BILLING_SCHEDULES
    *&      Form  ITEM_BILLING_SCHEDULES_PRINT
          This routine prints the billing shedules of a salesdocument    *
          position.                                                      *
    FORM  item_billing_schedules_print.
      DATA: first_line(1) TYPE c.
      first_line = charx.
      LOOP AT tfpltdr.
        fpltdr = tfpltdr.
      Output of the following printlines
        IF NOT fpltdr-perio IS INITIAL.
        periodische Fakturen
          CALL FUNCTION 'WRITE_FORM'
            EXPORTING
              element = 'ITEM_BILLING_SCHEDULE_PERIODIC'
            EXCEPTIONS
              element = 1
              window  = 2.
          IF sy-subrc NE 0.
            PERFORM protocol_update.
          ENDIF.
        bei periodischen nur eine Zeile
          EXIT.
        ELSEIF fpltdr-fareg CA '14'.
        prozentuale Teilfakturierung
          IF NOT first_line IS INITIAL.
            CLEAR first_line.
            CALL FUNCTION 'WRITE_FORM'
              EXPORTING
                element = 'ITEM_BILLING_SCHEDULE_PERCENT_HEADER'
              EXCEPTIONS
                element = 1
                window  = 2.
            IF sy-subrc NE 0.
              PERFORM protocol_update.
            ENDIF.
          ELSE.
            CALL FUNCTION 'WRITE_FORM'
              EXPORTING
                element = 'ITEM_BILLING_SCHEDULE_PERCENT'
              EXCEPTIONS
                element = 1
                window  = 2.
            IF sy-subrc NE 0.
              PERFORM protocol_update.
            ENDIF.
          ENDIF.
        ELSEIF fpltdr-fareg CA '235'.
        wertmäßige  Teilfakturierung
          IF NOT first_line IS INITIAL.
            CLEAR first_line.
            CALL FUNCTION 'WRITE_FORM'
              EXPORTING
                element = 'ITEM_BILLING_SCHEDULE_VALUE_HEADER'
              EXCEPTIONS
                element = 1
                window  = 2.
            IF sy-subrc NE 0.
              PERFORM protocol_update.
            ENDIF.
          ELSE.
            CALL FUNCTION 'WRITE_FORM'
              EXPORTING
                element = 'ITEM_BILLING_SCHEDULE_VALUE'
              EXCEPTIONS
                element = 1
                window  = 2.
            IF sy-subrc NE 0.
              PERFORM protocol_update.
            ENDIF.
          ENDIF.
        ELSEIF fpltdr-fareg CA '3'.
        Schlußrechnung
        ENDIF.
      ENDLOOP.
    ENDFORM.                    "ITEM_BILLING_SCHEDULES_PRINT
    *eject
          FORM GET_ITEM_CHARACTERISTICS                                 *
          In this routine the configuration data item is fetched from   *
          the database.                                                 *
    FORM get_item_characteristics.
      REFRESH tkomcon.
      CHECK NOT vbdpa-cuobj IS INITIAL.
      CALL FUNCTION 'CUD0_GET_CONFIGURATION'                    "#EC EXISTS
        EXPORTING
          instance      = vbdpa-cuobj
          language      = nast-spras
        TABLES
          configuration = tkomcon
        EXCEPTIONS
          OTHERS        = 4.
    ENDFORM.                    "GET_ITEM_CHARACTERISTICS
          FORM GET_ITEM_PRICES                                          *
          In this routine the price data for the item is fetched from   *
          the database.                                                 *
    FORM get_item_prices.
      CLEAR: komp,
             tkomv.
      IF komk-knumv NE vbdka-knumv.
        CLEAR komk.
        komk-mandt = sy-mandt.
        komk-kalsm = vbdka-kalsm.
        komk-kappl = pr_kappl.
        komk-waerk = vbdka-waerk.
        komk-knumv = vbdka-knumv.
        komk-vbtyp = vbdka-vbtyp.
      ENDIF.
      komp-kposn = vbdpa-posnr.
      CALL FUNCTION 'RV_PRICE_PRINT_ITEM'
        EXPORTING
          comm_head_i = komk
          comm_item_i = komp
          language    = nast-spras
        IMPORTING
          comm_head_e = komk
          comm_item_e = komp
        TABLES
          tkomv       = tkomv
          tkomvd      = tkomvd.
    ENDFORM.                    "GET_ITEM_PRICES
          FORM GET_HEADER_PRICES                                        *
          In this routine the price data for the header is fetched from *
          the database.                                                 *
    FORM get_header_prices.
      CALL FUNCTION 'RV_PRICE_PRINT_HEAD'
        EXPORTING
          comm_head_i = komk
          language    = nast-spras
        IMPORTING
          comm_head_e = komk
        TABLES
          tkomv       = tkomv
          tkomvd      = tkomvd.
    ENDFORM.                    "GET_HEADER_PRICES
    *&      Form  HEADER_DATA_PRINT
          Printing of header data like terms, weights ....               *
    FORM header_data_print.
      CALL FUNCTION 'WRITE_FORM'
        EXPORTING
          element = 'HEADER_DATA'
        EXCEPTIONS
          element = 1
          window  = 2.
      IF sy-subrc NE 0.
        PERFORM protocol_update.
      ENDIF.
    ENDFORM.                               " HEADER_DATA_PRINT
          FORM HEADER_PRICE_PRINT                                       *
          Printout of the header prices                                 *
    FORM header_price_print.
      LOOP AT tkomvd.
        AT FIRST.
          IF komk-supos NE 0.
            CALL FUNCTION 'WRITE_FORM'
              EXPORTING
                element = 'ITEM_SUM'.
          ELSE.
            CALL FUNCTION 'WRITE_FORM'
              EXPORTING
                element = 'UNDER_LINE'
              EXCEPTIONS
                element = 1
                window  = 2.
            IF sy-subrc NE 0.
              PERFORM protocol_update.
            ENDIF.
          ENDIF.
        ENDAT.
        komvd = tkomvd.
        IF komvd-koaid = 'D'.
          CALL FUNCTION 'WRITE_FORM'
            EXPORTING
              element = 'TAX_LINE'.
        ELSE.
          CALL FUNCTION 'WRITE_FORM'
            EXPORTING
              element = 'SUM_LINE'.
        ENDIF.
      ENDLOOP.
      DESCRIBE TABLE tkomvd LINES sy-tfill.
      IF sy-tfill = 0.
        CALL FUNCTION 'WRITE_FORM'
          EXPORTING
            element = 'UNDER_LINE'
          EXCEPTIONS
            element = 1
            window  = 2.
        IF sy-subrc NE 0.
          PERFORM protocol_update.
        ENDIF.
      ENDIF.
    ENDFORM.                    "HEADER_PRICE_PRINT
          FORM HEADER_TEXT_PRINT                                        *
          Printout of the headertexts                                   *
    FORM header_text_print.
      CALL FUNCTION 'WRITE_FORM'
        EXPORTING
          element = 'HEADER_TEXT'
        EXCEPTIONS
          element = 1
          window  = 2.
      IF sy-subrc NE 0.
        PERFORM protocol_update.
      ENDIF.
    ENDFORM.                    "HEADER_TEXT_PRINT
          FORM ITEM_CHARACERISTICS_PRINT                                *
          Printout of the item characteristics -> configuration         *
    FORM item_characteristics_print.
      LOOP AT tkomcon.
        conf_out = tkomcon.
        IF sy-tabix = 1.
          CALL FUNCTION 'WRITE_FORM'
            EXPORTING
              element = 'ITEM_LINE_CONFIGURATION_HEADER'
            EXCEPTIONS
              OTHERS  = 1.
          IF sy-subrc NE 0.
            PERFORM protocol_update.
          ENDIF.
        ELSE.
          CALL FUNCTION 'WRITE_FORM'
            EXPOR

  • How to script output to email

    hi,
    Can anyone give me information or documentation on
    "SENDING SCRIPT OUTPUT TO EMAIL"??
    if possible plz send the code also.
    waiting for your replies
    bye
    ARJUN

    Hi,
    Could you please expalain , is it ABAP Scripts?, or any other if other ,what is the format??
    If ABAP script
    http://help.sap.com/saphelp_nw2004s/helpdata/en/0e/56373f7853494fe10000000a114084/content.htm
    Sending SAP SCRIPT to mail
    sending sap script to mail id
    Problem Sending SAP Script as a PDF attachment to external mail
    Sending SAP Script Output to Mail & Fax
    sending a script in mail (outside SAP)
    How To send SAP SCRIPT AS an email.
    Regards
    Chilla

  • SCCM Script Output automation

    Hi ,
    We are trying to automate SCCM script deployment .
    Say i have script and i need to run it in a particular computers  where sccm agents are installed .
    Upto my understanding  once the script package is deployed , i will be able to get the error code (success / failure).
    But is there any possible we can get the output of the script from the sccm agent computer back to the sccm server.
    We tried to save the script output in a file and get it back to sccm server using smb . but in production environment the smb is not always open between computers .
    Is there any way we can tackle this problem .
    Thanks and Regards

    You can do one of two things (using built-in ConfigMgr facilities) depending upon what what exactly is in the output file:
    - File collection. This is a feature of software inventory and will literally collect the specified files and return them to the site server.
    - MIF files. These are specially formatted files that are collected at the end of a program's execution that return extended information about the program's execution to ConfigMgr.
    Without knowing what you are going to do with these files or what's in them, I don't know which is better for your scenario.
    Jason | http://blog.configmgrftw.com | @jasonsandys

Maybe you are looking for

  • Location of external display

    I'm using 22" ViewSonic as a external display with my MacBok and it's working fine with one exception. It is on the left side of my MacBook and to move cursor or any window to it, i have to move in the oposite direction. I'm new to mac and know I was

  • When Scaling Image, Cannot See All Of Image

    I want to allow the user to zoom into an image. Using drawImage(Image img, int x, int y, int width, int height, ImageObserver observer) achieves this, however it displays the scaledImage on background that is of the same size as the original image. i

  • Why can't I install system updates?

    Hi all, I realized today that my system updates haven't actually been 'installing' for awhile. Whoops. Basically, I have a slew up updates that need to be installed, and I get a message that I need to restart my computer for this install to happen. I

  • Can't open attachments In gmail

    gmail attachment is .jpg and will not display photo.

  • System time was set externally in the past.

    Hi Gurus, In our production system,several warning messages have come up System time was set externally in the past. Wait 1 second(s). But when i checked the system time it showing the same as OS's. Could you please throw some information around this