Send 255 char by mail attchmnt in text file using FM 'SO_NEW_DOCUMENT_ATT

Hi,
I need to send some data an email attachment in a text file (notepad). However, the data exceeds 255 chars which is why most of it gets truncated.
I am using the function module 'SO_NEW_DOCUMENT_ATT_SEND_API1'.
Kindly provide solution for the problem. Relevant code samples would be appreciated.
Regards,
Smruthi.

Hello Smrithi
it is always good to search before you post a query in SCN
find the below search
http://www.sdn.sap.com/irj/scn/advancedsearch?query=emailwithmorethan255+char
cheers
S.Janagar

Similar Messages

  • Attaching text file using SO_NEW_DOCUMENT_ATT_SEND_API1

    hello guys, i'm a newbie here.
    I'm having trouble attaching an existing text file using function 'SO_NEW_DOCUMENT_ATT_SEND_API1'. It seems i can't find the right combination of parameters that are being passed to this function.
    first, i'm using WS_UPLOAD to upload the text file to an internal table then i'm creating all the neccessary internal tables that will be use by this function..
    By the way, i'm trying to send mail w/ attachments to external mail and SAPids. Below is my code.
    REPORT ZHR_TESTEMAIL .
    TABLES: USR02, PA0105, SOSU, SOUC, RLGRAP, IBIPPARMS, DYNPREAD, RSCSEL.
    DATA: FOLD_YR(2) TYPE C,
          FOLD_TYPE(3) TYPE C,
          G_HEADER LIKE SOOD2,
          G_FOLMAM LIKE SOFM2,
          METHOD1 LIKE SY-UCOMM,
          G_DOCUMENT LIKE SOOD4,
          G_USER LIKE SOUDNAMEI1,
          FOLD_NUMBER(12) TYPE C,
          G_NEW_PARENT LIKE SOODK,
          G_OWNER LIKE SOUD-USRNAM,
          G_REF_DOCUMENT LIKE SOOD4,
          G_USER_DATA LIKE SOUDATAI1,
          G_AUTHORITY LIKE SOFA-USRACC,
          G_OBJCNT LIKE SOLI OCCURS 0 WITH HEADER LINE,
          G_OBJHEAD LIKE SOLI OCCURS 0 WITH HEADER LINE,
          G_OBJPARA LIKE SELC OCCURS 0 WITH HEADER LINE,
          G_OBJPARB LIKE SOOP1 OCCURS 0 WITH HEADER LINE,
          G_RECIPIENTS LIKE SOOS1 OCCURS 0 WITH HEADER LINE,
          G_REFERENCES LIKE SOXRL OCCURS 0 WITH HEADER LINE,
          G_ATTACHMENTS LIKE SOOD5 OCCURS 0 WITH HEADER LINE.
    DATA: BEGIN OF G_FILES OCCURS 10 ,
          TEXT(4096) TYPE C,
          END OF G_FILES.
    DATA: BEGIN OF IT_WS_FILE OCCURS 0,
          WS_FILE LIKE RLGRAP-FILENAME,
          END OF IT_WS_FILE.
    DATA: BEGIN OF IT_SAPID OCCURS 0,
          SAPID LIKE USR02-BNAME,
          END OF IT_SAPID.
    DATA: BEGIN OF IT_EMAIL OCCURS 0,
          EMAILADD LIKE PA0105-USRID_LONG,
          END OF IT_EMAIL.
    DATA: BEGIN OF IT_TSP01 OCCURS 0.
            INCLUDE STRUCTURE TSP01.
    DATA: END OF IT_TSP01.
    DATA: BEGIN OF TAB2 OCCURS 50,
          TEXT(200) TYPE C,
          END OF TAB2.
    DATA: V_DOCDATA TYPE SODOCCHGI1,
          V_OBJPACK LIKE SOPCKLSTI1 OCCURS 0 WITH HEADER LINE,
          V_OBJHEAD LIKE SOLISTI1   OCCURS 0 WITH HEADER LINE,
          V_OBJTXT  LIKE SOLISTI1   OCCURS 0 WITH HEADER LINE,
          V_OBJBIN  LIKE SOLISTI1   OCCURS 0 WITH HEADER LINE,
          V_OBJHEX  LIKE SOLIX      OCCURS 0 WITH HEADER LINE,
          IT_RECVRS TYPE SOMLRECI1  OCCURS 0 WITH HEADER LINE,
          IT_CONTNT TYPE SOLISTI1   OCCURS 0 WITH HEADER LINE,
          IT_BODY   LIKE SOLISTI1   OCCURS 10 WITH HEADER LINE,
          V_TLIN    TYPE I,
          V_LINE    TYPE I.
    DATA: BEGIN OF IT_TEXTLINE OCCURS 500,
          TEXTLINE(5000),
          END OF IT_TEXTLINE.
    DATA: FYL LIKE RLGRAP-FILENAME,
          GV_SUBNO LIKE SOSU-SUBNO,
          GV_EMAIL LIKE PA0105-USRID_LONG,
          GV_NEXTDAY LIKE SY-DATUM,
          YEAR(4) TYPE C,
          RECFLAG TYPE C.
    SELECTION-SCREEN BEGIN OF BLOCK PARAM WITH FRAME TITLE TEXT-001.
    PARAMETERS: SUBJ(254) TYPE C OBLIGATORY,            "Subject
                DESC(254) TYPE C.                       "Message
    SELECT-OPTIONS: SAPID FOR USR02-BNAME NO INTERVALS. "Recipient's SAP ID
    SELECT-OPTIONS: EMAILADD FOR PA0105-USRID_LONG NO INTERVALS.
    SELECTION-SCREEN END OF BLOCK PARAM.
    SELECTION-SCREEN BEGIN OF BLOCK PARAM2 WITH FRAME TITLE TEXT-002.
    SELECT-OPTIONS: WS_FILE FOR DYNPREAD-FIELDNAME NO INTERVALS.
    SELECTION-SCREEN END OF BLOCK PARAM2.
    SELECTION-SCREEN BEGIN OF BLOCK PARAM3 WITH FRAME TITLE TEXT-003.
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETERS: RBUT1 RADIOBUTTON GROUP A USER-COMMAND BUT. "Local PC
    SELECTION-SCREEN COMMENT 5(20) FOR FIELD RBUT1.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETERS: RBUT2 RADIOBUTTON GROUP A.                  "Server
    SELECTION-SCREEN COMMENT 5(20) FOR FIELD RBUT2.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETERS: RBUT3 RADIOBUTTON GROUP A.                  "Spool
    SELECTION-SCREEN COMMENT 5(20) FOR FIELD RBUT3.
    PARAMETERS: SPOOLNUM LIKE RSPOTYPE-RQNUMBER.            "Spool Number
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN END OF BLOCK PARAM3.
    SELECTION-SCREEN BEGIN OF BLOCK PROC WITH FRAME TITLE TEXT-004.
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETER: BPROC AS CHECKBOX USER-COMMAND BCK. "Background Processing
    SELECTION-SCREEN COMMENT 5(50) FOR FIELD BPROC.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN END OF BLOCK PROC.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR WS_FILE-LOW.
      DATA: WS_FILE_TEMP TYPE IBIPPARMS-PATH.
      CLEAR: WS_FILE_TEMP.
      CALL FUNCTION 'F4_FILENAME'
           EXPORTING
                PROGRAM_NAME  = SY-REPID
                DYNPRO_NUMBER = SY-DYNNR
                FIELD_NAME    = 'WS_FILE'
           IMPORTING
                FILE_NAME     = WS_FILE_TEMP.
      WS_FILE-LOW = WS_FILE_TEMP.
    AT SELECTION-SCREEN.
      SELECT SAPNAM FROM SOUC
          INTO TABLE IT_SAPID
          WHERE SAPNAM IN SAPID
            AND DELETED = ''.
      GV_NEXTDAY = SY-DATUM + 1.
      LOOP AT EMAILADD.
        IT_EMAIL-EMAILADD = EMAILADD-LOW.
        APPEND IT_EMAIL.
        CLEAR: IT_EMAIL.
      ENDLOOP.
      IF NOT BPROC IS INITIAL.
        CLEAR: RBUT1, RBUT3.
        RBUT2 = 'X'.
      ELSE.
        CLEAR: RBUT2.
      ENDIF.
      IF NOT RBUT3 IS INITIAL.
        REFRESH: WS_FILE.
      ENDIF.
      IF SAPID IS INITIAL AND EMAILADD IS INITIAL.
        MESSAGE E000(ZZ) WITH TEXT-201.
      ELSEIF NOT SAPID IS INITIAL AND EMAILADD IS INITIAL.
        CLEAR IT_SAPID.
        READ TABLE IT_SAPID.
        SELECT SINGLE SUBNO FROM SOSU
          INTO GV_SUBNO
          WHERE USRNO IN ( SELECT USRNO FROM SOUC
                             WHERE SAPNAM = IT_SAPID-SAPID ).
        IF SY-SUBRC NE 0.
          MESSAGE E000(ZZ) WITH TEXT-202.
        ENDIF.
        CLEAR: IT_SAPID.
      ELSEIF NOT SAPID IS INITIAL AND NOT EMAILADD IS INITIAL.
        CLEAR: IT_SAPID, IT_EMAIL.
        READ TABLE IT_SAPID.
        READ TABLE IT_EMAIL.
        SELECT SINGLE SUBNO FROM SOSU
          INTO GV_SUBNO
          WHERE USRNO IN ( SELECT USRNO FROM SOUC
                             WHERE SAPNAM = IT_SAPID-SAPID ).
        IF SY-SUBRC NE 0.
          SUBMIT RSSOADM0 WITH USRNAM EQ IT_SAPID-SAPID
                          WITH NEW_SUBS EQ IT_EMAIL-EMAILADD
                          WITH SUB_ESC EQ 'U'
                          WITH EDAT EQ SY-DATUM
                          WITH BDAT EQ SY-DATUM
                         WITH BDAT EQ GV_NEXTDAY
                         WITH EDAT EQ '99991231'
                          WITH BTIM EQ SY-UZEIT
                          WITH ETIM EQ '240000'
                          WITH FORW_ALL EQ 'X'
                          WITH PSTHR2 EQ ''
                          AND RETURN.
        ENDIF.
        CLEAR: IT_SAPID.
      ELSEIF NOT EMAILADD IS INITIAL AND SAPID IS INITIAL.
        RECFLAG = 'X'.
      ENDIF.
    START-OF-SELECTION.
        PERFORM B_SENDMAIL.
    FORM B_SENDMAIL.
      YEAR = SY-DATUM+0(4).
      LOOP AT WS_FILE.
        CLEAR: FYL.
        FYL = WS_FILE-LOW.
        REFRESH: TAB2.
        CALL FUNCTION 'WS_UPLOAD'
             EXPORTING
                  FILENAME = FYL
                  FILETYPE = 'BIN'
             TABLES
                  DATA_TAB = TAB2.
        IT_TEXTLINE[] = TAB2[].
    DOCUMENT_DATA (SUBJECT OF MAIL)
        V_DOCDATA-OBJ_NAME   = DESC.
        V_DOCDATA-OBJ_DESCR  = SUBJ.
        V_DOCDATA-OBJ_LANGU  = SY-LANGU.
        V_DOCDATA-SENSITIVTY = 'C'.
        V_DOCDATA-OBJ_PRIO   = '1'.
    BODY OF MAIL
        IT_BODY-LINE = 'Collection Report'.
        APPEND IT_BODY.
    CONTENTS_TXT (Attachments)
        IT_CONTNT[] = IT_TEXTLINE[].
        DESCRIBE TABLE IT_CONTNT LINES V_LINE.
        READ TABLE IT_CONTNT INDEX V_LINE.
    PACKING_LIST
        V_OBJPACK-DOC_SIZE = ( V_LINE - 1 ) * 255 + STRLEN( IT_CONTNT ).
        V_OBJPACK-TRANSF_BIN = 'X'.
        V_OBJPACK-HEAD_START = 1.
        V_OBJPACK-HEAD_NUM   = 0.
        V_OBJPACK-BODY_START = 1.
        V_OBJPACK-BODY_NUM   = V_LINE.
        V_OBJPACK-DOC_TYPE   = 'TXT'.
        V_OBJPACK-OBJ_NAME   = 'ATTACHMENT'.
        V_OBJPACK-OBJ_DESCR  = 'Attached Document'.
        APPEND V_OBJPACK.
        CLEAR  V_OBJPACK.
    RECEIVERS of mail
        IF RECFLAG IS INITIAL.
          LOOP AT IT_SAPID.
            IT_RECVRS-RECEIVER   = IT_SAPID-SAPID.
            IT_RECVRS-REC_TYPE   = 'B'.
            IT_RECVRS-COM_TYPE   = ''.
            IT_RECVRS-EXPRESS    = 'X'.
            IT_RECVRS-NO_FORWARD = ''.
            IT_RECVRS-NO_PRINT   = ''.
            APPEND IT_RECVRS.
            CLEAR IT_RECVRS.
          ENDLOOP.
        ELSE.
          LOOP AT EMAILADD.
            IT_RECVRS-RECEIVER   = EMAILADD-LOW.
            IT_RECVRS-REC_TYPE   = 'U'.
            IT_RECVRS-COM_TYPE   = 'INT'.
            IT_RECVRS-EXPRESS    = 'X'.
            APPEND IT_RECVRS.
            CLEAR IT_RECVRS.
          ENDLOOP.
        ENDIF.
    OBJECT_HEADER (Filename)
        CONCATENATE 'Collection Report' '_'
                     SY-DATUM+4(4) YEAR '.TXT'
                     INTO V_OBJHEAD-LINE.
       V_OBJHEAD-LINE = FYL+16(25).
        APPEND V_OBJHEAD.
        CLEAR V_OBJHEAD.
    Function Module For Sending Mail with Attachment
        CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
             EXPORTING
                  DOCUMENT_DATA              = V_DOCDATA
             TABLES
                  PACKING_LIST               = V_OBJPACK
                  OBJECT_HEADER              = V_OBJHEAD
                  CONTENTS_HEX               = IT_CONTNT
                  CONTENTS_TXT               = IT_BODY
                  RECEIVERS                  = IT_RECVRS
             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.
          MESSAGE S000(ZZ) WITH TEXT-005.
        ELSE.
          MESSAGE S000(ZZ) WITH TEXT-006.
        ENDIF.
      ENDLOOP.
    end of my code *
    please help me guys... when i run this program,    DOCUMENT_NOT_SENT is what i always get.. 
    waiting for ur reply... thank you vey much and godbless.

    Hi,
    Try this sample code.
    FORM SEND_TO_EMAIL USING zFName.
      DATA: OBJPACK LIKE SOPCKLSTI1 OCCURS 2 WITH HEADER LINE.
      DATA: OBJHEAD LIKE SOLISTI1 OCCURS 1 WITH HEADER LINE.
      DATA: OBJBIN LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.
      DATA: OBJTXT LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.
      DATA: RECLIST LIKE SOMLRECI1 OCCURS 5 WITH HEADER LINE.
      DATA: DOC_CHNG LIKE SODOCCHGI1.
      DATA: TAB_LINES LIKE SY-TABIX.
      DATA: ctmp(50) TYPE C.
    Creation of the document to be sent
      DOC_CHNG-OBJ_NAME = 'JOURNAL'.
      CONCATENATE 'SAP Payroll Journal file Period' pybegda INTO ctmp
                  SEPARATED BY SPACE.
      DOC_CHNG-OBJ_DESCR = cTmp.
      OBJTXT = 'SAP Payroll Journal'.
      APPEND OBJTXT.
      CONCATENATE 'For Period' pybegda INTO ctmp
                  SEPARATED BY SPACE.
      OBJTXT = ctmp.
      APPEND OBJTXT.
      CONCATENATE 'Attached File :' zFname INTO ctmp
                  SEPARATED BY SPACE.
      OBJTXT = ctmp.
      APPEND OBJTXT.
      OBJTXT = 'Please find the attachment.'.
      APPEND OBJTXT.
      DESCRIBE TABLE OBJTXT LINES TAB_LINES.
      READ TABLE OBJTXT INDEX TAB_LINES.
      DOC_CHNG-DOC_SIZE = ( TAB_LINES - 1 ) * 255 + STRLEN( OBJTXT ).
    Creation of the entry for the compressed document
      CLEAR OBJPACK-TRANSF_BIN.
      OBJPACK-HEAD_START = 1.
      OBJPACK-HEAD_NUM = 0.
      OBJPACK-BODY_START = 1.
      OBJPACK-BODY_NUM = TAB_LINES.
      OBJPACK-DOC_TYPE = 'RAW'.
      APPEND OBJPACK.
    Creation of the document attachment
      <b>LOOP AT xMail.
        CONDENSE xMail-aline.
        OBJBIN = xMail-aline.
        APPEND OBJBIN.
        CLEAR OBJBIN.
      ENDLOOP.</b>
      DESCRIBE TABLE OBJBIN LINES TAB_LINES.
      OBJHEAD = zFname. APPEND OBJHEAD.
    Creation of the entry for the compressed attachment
      OBJPACK-TRANSF_BIN = 'X'.
      OBJPACK-HEAD_START = 1.
      OBJPACK-HEAD_NUM = 1.
      OBJPACK-BODY_START = 1.
      OBJPACK-BODY_NUM = TAB_LINES.
      OBJPACK-DOC_TYPE = 'RAW'.
      OBJPACK-OBJ_NAME = 'DATA'.
      OBJPACK-OBJ_DESCR = 'SAP Payroll File'.
      OBJPACK-DOC_SIZE = TAB_LINES * 255.
      APPEND OBJPACK.
    Completing the recipient list
      LOOP AT PENERIMA.
        CONDENSE PENERIMA-PNRM.
        RECLIST-RECEIVER = PENERIMA-PNRM.
        RECLIST-REC_TYPE = 'U'.
        APPEND RECLIST.
      ENDLOOP.
    Sending the document
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
           EXPORTING
                DOCUMENT_DATA              = DOC_CHNG
                PUT_IN_OUTBOX              = ' '
           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.
      CASE SY-SUBRC.
        WHEN 0.
          WRITE: / 'Result of the send process:'.
          LOOP AT RECLIST.
            WRITE: / RECLIST-RECEIVER(48), ':'.
            IF RECLIST-RETRN_CODE = 0.
              WRITE / 'The document was sent'.
            ELSE.
              WRITE / 'The document could not be sent'.
            ENDIF.
          ENDLOOP.
        WHEN 1.
          WRITE: / 'Too many receiver'.
        WHEN 2.
          WRITE: / 'Document could not be sent to any recipient'.
        WHEN 4.
          WRITE: / 'No send authorization'.
        WHEN OTHERS.
          WRITE: / 'Error occurred while sending'.
      ENDCASE.
    ENDFORM.

  • Report the size of all SharePoint Databases in a text file using PowerShell?

    I am new to Powershell. please help me for following question with step by step process.
    How to report the size of all SharePoint Databases in a text file using PowerShell?

    Hi Paul,
    Here is the changed script, which will also include the size for the Config DB.
    Please let me know if it worked:
    #Get SharePoint Content database sizes
    Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
    $date = Get-Date -Format "dd-MM-yyyy"
    #Variables that you can change to fit your environment
    $TXTFile = "D:\Reports\SPContentDatabase_$date.txt"
    $SMTPServer = "yourmailserver"
    $emailFrom = "[email protected]"
    $emailTo = "[email protected]"
    $subject = "Content & Config Database size reports"
    $emailBody = "Daily/Weekly/Monthly report on Content & Config databases"
    $webapps = Get-SPWebApplication
    $configDB = Get-SPDatabase | ?{$_.Name -eq ((Get-SPFarm).Name)}
    $ConfigDBSize = [Math]::Round(($configDB.disksizerequired/1GB),2)
    Add-Content -Path $TXTFile -Value "Config Database size: $($ConfigDBSize)GB"
    Add-Content -Path $TXTFile -Value ""
    foreach($webapp in $webapps)
    $ContentDatabases = $webapp.ContentDatabases
    Add-Content -Path $TXTFile -Value "Content databases for $($webapp.url)"
    foreach($ContentDatabase in $ContentDatabases)
    $ContentDatabaseSize = [Math]::Round(($ContentDatabase.disksizerequired/1GB),2)
    Add-Content -Path $TXTFile -Value "- $($ContentDatabase.Name): $($ContentDatabaseSize)GB"
    if(!($SMTPServer) -OR !($emailFrom) -OR !($emailTo))
    Write-Host "No e-mail being sent, if you do want to send an e-mail, please enter the values for the following variables: $SMTPServer, $emailFrom and $emailTo."
    else
    Send-MailMessage -SmtpServer $SMTPServer -From $emailFrom -To $emailTo -Subject $subject -Body $emailBody -Attachment $TXTFile
    Nico Martens - MCTS, MCITP
    SharePoint 2010 Infrastructure Consultant / Trainer

  • How to print a text file using Java

    How can I print a text file using Java without converting the output to an image format. Is there anyway I can send the characters in the text file as it is for a print job? I did get a listing doing this ... but that converted the text to an image format before printing....
    THanks,.

    Hi I had to write a print api from scratch, and I did not convert the output to image. Go and read up on the following code. I know there is a Tutorial on Sun about the differant sections of the snippet.
    private void printReport()
         Frame tempFrame = new Frame(getName());
         PrintJob printerJob = Toolkit.getDefaultToolkit().getPrintJob(tempFrame, "Liesltext", null);
         Graphics g = printerJob.getGraphics();
                    //I wrote the method below for calculations
         printBasics(g);
         g.dispose();
         printerJob.end();
    }This alone wont print it you have to do all the calculations in the printBasics method. And as I said I wrote this from scratch and all I did was research first the tutorial and the white papers
    Ciao

  • How to call text file using Script in Data Integrator

    Dear All,
    Can any one assit me in how to call a text file using script with the help of Data Integrator.
    and one question ?
    M having 32 csv files i want to club thos 32 csv files into one table with the help of Data Integrator, can
    any one assist me.

    mary,
    since you knew the file name ,when clicked in name send to server,read the file and write to servlet outputstream.
    I think this would help you.
    If anything wrong in mycode ..forums will help you further
    BufferedInputStream bis=null;
    BufferedOutputStream bos=null;
    int bytesRead=0;
    byte buff[]=new byte[1024];
    File f=new File(test.txt);
    try{
         bis= new BufferedInputStream(new FileInputStream(f));
         bytesRead=bis.read(buff,0,buff.length);
         if(bytesRead!=-1){
              // create a BufferedOutputStream from ServletOutputStream
              bos=new BufferedInputStream(response.getOutputStream());
              do{
                   bos.write(buff,0,bytesRead);
              }while((bytesRead=bis.read(buff,0,buff.length))!=-1)
    }catch(Exception e){
         ////error handling
         }

  • Spool SQl data into text file using dynamic sql

    Hi,
    I am spooling output data into text file using command
    select 'select t.mxname,bo.lxtype,t.mxrev'||chr(10)||'from mx_1234567'||chr(10)||
    'where <condition>';
    here mxname varchar(128),lxtype(128),mxrev(128) all are of varchar type.I want the output in format
    e.g Part|1211121313|A
    but due to column width the output,I am getting is with spaces.
    "Part then blank spaces |1211121313 then blank spaces |A"
    how can I remove these spaces between columns.I used set space 0 but not working.
    Thanks in advance.
    Your help will be appreciated.

    Hi Frank,
    I have seen your reply for SET LINE SIZE function. But, I could not be able to understand it.
    I am facing similar kind of issue in my present project.
    I am trying spool more than 50 columns from a table into flat file. Because of more column lengths in few columns, i am getting space. There are so many columns with the same issue. I want to remove that space.so that, data can fit perfectly in one line in .txt file without any wrap text.
    Below is my sample query.sql. Please let me know the syntax. My mail id : [email protected]
    --Created : Sep 22,2008, Created By : Srinivasa Bojja
    --Export all Fulfillments
    --Scheduled daily after 1:00am and should complete before 3:30am
    WHENEVER SQLERROR EXIT SQL.SQLCODE
    SET LINESIZE 800
    SET WRAP OFF
    SET PAGESIZE 800
    SET FEEDBACK OFF
    SET HEADING ON
    SET ECHO OFF
    SET CONCAT OFF
    SET COLSEP '|'
    SET UNDERLINE OFF
    SPOOL C:\Fulfillment.txt;
    SELECT SRV.COMM_METHOD_CD AS Method,
    SRV.SR_NUM AS "Fulfillment Row_Id",
    CON.LAST_NAME AS "Filled By"
    SRV.SR_TITLE AS Notes,
    SRVXM.ATTRIB_04 AS "Form Description"
    FROM SIEBEL.S_SRV_REQ SRV,
    SIEBEL.S_SRV_REQ_XM SRVXM,
    SIEBEL.S_USER USR,
    SIEBEL.S_CONTACT CON
    WHERE SRV.ROW_ID = SRVXM.PAR_ROW_ID AND
    SRV.OWNER_EMP_ID = USR.ROW_ID AND
    CON.ROW_ID= SRV.CST_CON_ID;
    SPOOL OFF;
    EXIT;

  • Generating text file using PL/SQL

    can any body send sample program how to generate text file using PL/SQL program.I want to store table data into that text file.

    Hi,
    try this.
    Thanks
    CREATE OR REPLACE procedure write_index (TABLE_NAME_ACCEPT VARCHAR2) IS
    id UTL_FILE.FILE_TYPE;
    name VARCHAR2(20) := 'e:\db_coca\input';      
    err VARCHAR2(100);      
    ColNameLength Integer;
    NumberoFColumns Integer;
    num NUMBER;           
    i integer;
    loc_query VARCHAR2(2000);
    cursor_name INTEGER;
    ret INTEGER;
    l_const_name VARCHAR2(30);
    CURSOR c_columns(i_Constraint_name VARCHAR2) IS
         SELECT *
         FROM     all_cons_columns
         WHERE     CONSTRAINT_NAME = i_Constraint_name
         order by table_name;
    BEGIN
    DBMS_OUTPUT.PUT_LINE('BEFORe OPEN');
    --id := UTL_FILE.FOPEN('e:\db_coca\input',name,'w');          
         --IF UTL_FILE.IS_OPEN(id) THEN
         --     DBMS_OUTPUT.PUT_LINE('Opened');
         --ELSE
         --     DBMS_OUTPUT.PUT_LINE('Still Closed');           
         --END IF;          
    DBMS_OUTPUT.PUT_LINE('AFTER OPEN');
    --The table generation script
         loc_query := 'Select CONSTRAINT_NAME from user_constraints ';
         loc_query := loc_query || ' where owner = ' || '''CPS''';
         loc_query := loc_query || ' AND CONSTRAINT_TYPE = ' || '''P''';
         dbms_output.put_line('TABLE_NAME_ACCEPT = ' || TABLE_NAME_ACCEPT);
         IF NOT (TABLE_NAME_ACCEPT IS NULL ) THEN
              loc_query := loc_query || ' AND TABLE_NAME like ''';
              loc_query := loc_query || TABLE_NAME_ACCEPT ;
              loc_query := loc_query || '''';
         END IF;
         cursor_name := DBMS_SQL.OPEN_CURSOR;
    dbms_output.put_line('Query = ' || loc_query);
         DBMS_SQL.PARSE(cursor_name, loc_query, DBMS_SQL.v7);
    dbms_output.put_line('After parse');
         dbms_sql.DEFINE_COLUMN(cursor_name, 1,l_const_name, 30);
         ret := DBMS_SQL.EXECUTE(cursor_name);
    --     IF ret > 0 THEN
         LOOP
         dbms_output.put_line('return = ' || ret);
              IF DBMS_SQL.FETCH_ROWS(cursor_name) > 0 THEN
                   dbms_sql.COLUMN_VALUE(cursor_name, 1,l_const_name);
              --     dbms_sql.BIND_VARIABLE(cursor_name,
    l_const_name,CONSTRAINT_NAME);
              --     FOR C10 in Table_Loop Loop          --The cursor
    for the table name
                   Select COunt(*) INTO NumberoFColumns from
                   all_cons_columns
                   Where CONSTRAINT_NAME = l_const_name;
         --          FOR C11 IN c_columns(l_const_name) LOOP
         --          End loop;
         --          UTL_FILE.PUT(id, ');');
              ELSE EXIT;
              END if;     --THe 1 st cursor if is closed
         End Loop;     --The table loop ends here
              DBMS_SQL.CLOSE_CURSOR(cursor_name);
    --     END IF;     
    --     UTL_FILE.PUT_LINE(id,name);
    --     UTL_FILE.PUT(id,'It worked and wrote to this file');
         UTL_FILE.FCLOSE(id);
         DBMS_OUTPUT.PUT_LINE('Successful write to file');          
    EXCEPTION     
    WHEN OTHERS THEN               
         err := SQLERRM;          
         num := SQLCODE;
         DBMS_OUTPUT.PUT_LINE(err);          
         DBMS_OUTPUT.PUT_LINE(num);
         DBMS_OUTPUT.PUT_LINE('Error in writing to file');     
    END write_index;

  • How to download a text file using classes

    Hi Guys
    I want to download a text file using classes.
    Any idea how to do it ?
    Thanks
    Sameer

    HI sameer,
       It is no different from using a Function module.
    example:
      CALL METHOD cl_gui_frontend_services=>gui_download
        EXPORTING
          filename                  = w_fpath
        append                    = SPACE
          write_field_separator     = 'X'
        CHANGING
          data_tab                  = it_download
        EXCEPTIONS
          file_write_error          = 1
          no_batch                  = 2
          gui_refuse_filetransfer   = 3
          invalid_type              = 4
          no_authority              = 5
          unknown_error             = 6
          header_not_allowed        = 7
          separator_not_allowed     = 8
          filesize_not_allowed      = 9
          header_too_long           = 10
          dp_error_create           = 11
          dp_error_send             = 12
          dp_error_write            = 13
          unknown_dp_error          = 14
          access_denied             = 15
          dp_out_of_memory          = 16
          disk_full                 = 17
          dp_timeout                = 18
          file_not_found            = 19
          dataprovider_exception    = 20
          control_flush_error       = 21
          not_supported_by_gui      = 22
          error_no_gui              = 23
          OTHERS                    = 24
    Regards,
    ravi

  • How to read a tab seperated data from a text file using utl_file

    Hi,
    How to read a tab seperated data from a text file using utl_file...
    I know if we use UTL_FILE.get_line we can read the whole line...but i need to read the tab separated value separately.....
    Thanks in advance...
    Naveen

    Naveen Nishad wrote:
    How to read a tab seperated data from a text file using utl_file...
    I know if we use UTL_FILE.get_line we can read the whole line...but i need to read the tab separated value separately.....If it's a text file then UTL_FILE will only allow you to read it a line at a time. It is then up to you to split that string up (search for split string on this forum for methods) into it's individual components.
    If the text file contains a standard structure on each line, i.e. it is a fixed delimited structure, then you could use external tables to read the data instead.

  • How to read some lines from a text file using java.

    hi,
    i m new to java and i want to read some lines from a text file based on some string occurrence in the file. This file to be read in steps.
    we only want to read the file upto the first Occurrence of "TEXT" string.
    How to do it ,,,
    Kinldy give the code
    Regards,
    Sagar
    this is the text file
    dfgjdjj
    sfjhjkd
    ghjkdg
    hjkdgh TEXT
    ikeyt
    ujt
    jk
    tyk TEXT
    rukl
    r

    Hendawy wrote:
    Since the word "TEXT" is formed of 4 letters, you would read the text file 4 bytes by four bytes. Wrong on two counts. First, the file may not be encoded 1 byte per character. It could be utf-16 in which case it would be two byte per character. Second, even if it were 1 byte per character, the string "Text" may not start on a 4 byte boundary.
    Consider a FileInputStream object "fis" that points to your text file. use fis.read(byte[] array, int offset, int len) to read every four bytes. Convert the "TEXT" String into a byte array "TEXT".getBytes(), and yous the Arrays class to compare the equality of the read bytes with your "TEXT".getBytes()Wrong since it relies on my second point and will fail when fis.read(byte[] array, int offset, int len) does not read 4 bytes (as is no guaranteed to). Check the Javadoc. Also, the file may not be encoded with the default character encoding.
    The problem is easily solved by reading a line at a time using a BufferedReader wrapping an InputStreamReader wrapping a FileInputStream and specifying the correct character encoding.
    Edited by: sabre150 on Apr 29, 2009 2:13 PM

  • I was given an assingment, but have no idea where to begin. The assingment is to create a text file using notepad with all of my digital inputs and some how make those imputs show up on my digital indicators on my control pannel

    I was given an assingment, but have no idea where to begin. The assingment is to create a text file using notepad with all of my digital inputs and some how make those imputs show up on my digital indicators on my control pannel.
    When it was explained to me it didn't sound to hard of a task, I have no LabVIEW experience and the tutortial sucks.

    StevenD: FYI, I did NOT give you the one star rating. I would never do that!
    StevenD wrote:
    Ow. Someone is grumpy today.
    Well, this is an assignment, so it is probably homework.
    Why else would anyone give HIM such an assigment, after all he has no LabVIEW experience and the tutorials are too hard for him?
    This would make no sense unless all of it was just covered in class!
    This is not a free homework service with instant gratification.
    OK! Let's do it step by step. I assume you already have a VI with the digital indicators.
    "...but have no idea where to begin".
    open notepad.
    decide on a format, possibly one line per indicator.
    type the document.
    close notepad.
    open LabVIEW.
    Open the existing VI with all the indicators.
    (are you still following?)
    look at the diagram.
    Who made the program?
    Does the code make sense so far?
    Is it a statemachine or just a bunch of crisscrossed wires?
    Where do you want to add the file read?
    How should the file be read (after pressing a read button, at the start of the program ,etc.)
    See how far you get!
    Message Edited by altenbach on 06-24-2008 11:23 AM
    LabVIEW Champion . Do more with less code and in less time .

  • How to display the out put of the sql query in a text file using forms

    I want to display the out put of the sql query in a text file using forms 6.0.Same could be done using spool command in sqlplus but i want it using forms....Fiaz

    Have a look at the text_io package:
    http://www.oracle.com/webapps/online-help/forms/10g/state?navSetId=_&navId=3&vtTopicFile=f1_help/oraini/c_text_io.html&vtTopicId=
    cheers

  • How to convert a HTML files into a text file using Java

    Hi guys...!
    I was wondering if there is a way to convert a HTML file into a text file using java programing language. Likewise I would also like to know if there is a way to convert any type of file (excel, power point, and word) into text using java.
    By the way, I really appreciated the help that you guys gave me on my previous topic on how to extract tests from a pdf file.
    Thank you....

    HTML files are already text files. What do you mean you want to convert them?
    I think if you search the web, you can find things for converting those MS Office files to text (or extracting text from them, as I assume you mean).

  • Deleting a column in a text file using LabVIEW

    Hello all,
    I'm trying to delete the first column of my tab delimited text file using LabVIEW and then save it under the same file name.  Can someone show me a quick way to perform this operation.  Is this even possible with LabVIEW?  Any help would be much appreciated.
    My purpose is to automate this operation for hundreds of daily text files containing data that needs processing.  I'm currently using LabVIEW 8.2.
    Thanks!
    -noviceLabVIEWuser

    If the file is relatively small:
    Read the file using the Read from Spreadsheet File VI to get 2D array.
    Remove the column from the 2D array.
    Write out new 2D array to new file using Write to Spreadsheet File VI.
    If the file is relatively large then you will likely run into memory issues. In this case you will need to read the file in chunks. You can decide how many lines to read at a time. Use a for-loop that's set to run for the number of chunks to read (based on the total number of lines and the number of lines you want to read at a time). Hint: Quotient & Remainder function. In the loop use the Read Text File VI to read your set number of lines. Convert the lines to a 2D array delete your column, and write out that chunk of data to the new file. Rinse and repeat.

  • How to read a text file using Java

    Guys,
    Good day!
    Please help me how to read a text file using Java and create/convert that text file into XML.
    Thanks and God Bless.
    Regards,
    I-Talk

         public void fileRead(){
                 File aFile =new File("myFile.txt");
             BufferedReader input = null;
             try {
               input = new BufferedReader( new FileReader(aFile) );
               String line = null;
               while (( line = input.readLine()) != null){
             catch (FileNotFoundException ex) {
               ex.printStackTrace();
             catch (IOException ex){
               ex.printStackTrace();
         }This code is to read a text file. But there is no such thing that will convert your text file to xml file. You have to have a defined XML format. Then you can read your data from text files and insert them inside your xml text. Or you may like to read xml tags from text files and insert your own data. The file format of .txt and .xml is far too different.
    cheers
    Mohammed Jubaer Arif.

Maybe you are looking for

  • Itunes causing desktop crash/restart

    Just did a sizable Java and iTunes update to 10.7 (21) a little earlier today. For some reason, the finder keeps crashing or restarting every 30 seconds or so. Its not a big issue, it's just really annoying.

  • Solaris 10 - print services not running

    Hi One of our servers has just been upgraded from Solaris 9 to 10 but we are having problems getting the lp scheduler to start. We have tried starting the service manually by issuing *'svcadm -v enable application/print/server'* which returns '*svc:/

  • How to use a excel sheet as a database.

    Using JSP i have to use a Excel sheet as a database.ie, i have to store and fetch data into or from a Excel Sheet and execute SQL Queries. Is it possible? If possible please give a sample code for that if anybody have the sample code.

  • I did something stupidish

    I recently updated my Macbook Air to Mavericks. I figured I should make a backup before I did that. So I used an external drive that I had been using to store some data at the root level - almost 200 GB of data. I used Carbon Copy Cloner to make the

  • PS CC Freezes on start up.

    I've read the other threads... but this is freezing on start up. I have New Refurbished Dell Latitude Laptop PC Win 7, 16GB, NIVIDA Video card.  I am in the process of slowly installing software and only have installed a few programs so far.  I insta