Internal table to E-M-A-I-L as a flat file

Hi,
I want to send the internal table as a flat structure to E-M-A-I-L
i used following function module to achieve that and its working fine..
  create document from internal table with text
       CALL FUNCTION 'SAP_CONVERT_TO_TEX_FORMAT'
       EXPORTING
            i_field_seperator    = '|'
        TABLES
            i_tab_sap_data       = ierr_tab
        CHANGING
            i_tab_converted_data = text_lv
        EXCEPTIONS
            conversion_failed    = 1
            OTHERS               = 2.
It has two flaws.
1) its not displaying the Column names at the top.
2) its ommiting the spaces. If length of field is 20 and actuall data is of 14. it shows only 14.
Current Output is : (No column name is displayed at top, just data is displayed). I can hard code the column names but then length of data varies which spoil all the formatting of my E-M-A-I-L
829418651952|P|MK00071LE|Vendor|1223434648080|Vendor Code not found in SAP
Required Output: We can say that i want to fix the length of data and column based on length of fields in internal table.
coum1     |    Columm 2   |    colum3    |
data11     |       34           |     345435  |
Even sdn is removing extra spaces in above output
Regards
Inder

Hi Kulwinder Grewal,
is it an option to send it in HTML? Then you can control the headings, spacing, etc.
Cheers,
Stefan

Similar Messages

  • How to upload a flat file into a Z DB table

    Hi All,
    For a planning application I would like to permit our users to upload a flat file to a internal table to be persisted on to any given database Z Table. From here we would use it in a planning application.
    Please kindly share the code and approach to implement this in BSP.
    Thanks
    Karen

    Hi Karen,
    Check the links mentioned below.
    [Excel to internal table|Excel to Internal table in BSP;
    [upload excel into BSP|upload excel sheet into BSP application;
    The two links show how to convert an excel file data to internal table in BSP application.Similarly you can convert the flat file data to internal table and then modify the Z DB table to store the data from internal table.
    Regards,
    Anubhav

  • Error while uploading a textfile into internal table.

    Hello,
    i am uploading a textfile into an internal table and i have used the 'CALL METHOD cl_gui_frontend_services=>gui_upload' for uploading of the file into the internal table. But instead i am getting sumthing lyke 
    CTTL#1001#BANK-0014393-PP-LHR#|#2000#112312#CCL00#29.08.2006#|Cash In </b>. I have the following internal table,
    [code]
    begin of ls_cashrec,
         bukrs type char30,        " company code
         cjnr type char30,         " cash journal number
         cjtranstxt type char30,   " business transaction
         cjamount type wrbtr,      " amount
         dzuonr type char30,       " assignment
         prctr type char6,         " profit center
         budat type sy-datum,      " posting date
         cjpostext type char30,    " text
      end of ls_cashrec.
    and
    DATA:
      gt_cashrec TYPE STANDARD TABLE OF ls_cashrec.
    where am i wrong ?
    Regard and Thanks,
    Shehryar

    Hi again,
    1. The best thing is that the
       data format in text file is
       YYYYMMDD  (8 characters only)
    (Then in that case, we can directly
      declare our field in internal table type sy-datum.
    2. Other wise,
       we have to declare the field in internal table
       as character format and length
       (based upon the text file field length,
       including DOTS / etc)
      Then we have to finally convert in YYYYMMDD
      format in to other field,
      which we will finally use as sy-datum field.
    regards,
    amit m.

  • Upload an XML file into the Internal table

    Hi Guys,
    I want to know, how to upload an xml file into the Internal table through ABAP programming

    you just wanted to load the xml file into internal table (as a table of binary strings)or load the xml data mapped to itab row columns
    for the first one you can simply use gui_upload
    and for the second one you need to load the xml file using gui_upload and use XLST program to transform into an itab
    Regards
    Raja

  • FM to get Data from Sheet of an excel file to Internal table??

    Hello Champs!!!
    I have a problem in Excel File's Data Getting.
    There are diffrent Sheets in a single Excel file. I need data of a perticular sheet into an internal Table.
    Like there are 2 Sheets in an Excel file EXCEL1, Sheet1 & Sheet2. Both Sheet have diffrent Data in it.
    Now i only need Data of Sheet1 of this Excel FIle Excel1.
    How can i get it?
    Can you please help me in this?
    Thanks in Advance!!!!
    Girija Shankar

    Welcome to SCN
    Please search before you post next time:BDC, upload data from multi excel sheets

  • Internal table to file - SE16N extract format

    Hello experts,
    I have a few records in my internal table and would like to throw these records into a file on my PC without displaying these records. The format of the output file should be identical to the format that we get from Export -> Localfile -> unconverted functionality in SE16N. Any thoughts / suggestions please? Thanks.

    Hi Ritesh,
    Upload data to application server in a specific format
    CG3Z -  to upload file from presentation server to application server.
    Upload a empty .txt file any path in the application server using CG3Z tcode and use this path in the program
    Thanks
    Naveen khan

  • Update & Insert into Internal table

    Dear Abapers,
    Is it possible to update a entry in the internal table if exists, otherwise inserts a new one.
    I think MODIFY <Internal Table> will not insert new one if the matching entry is not there.
    MODIFY <database_table> have this facility.
    Thanks in advance,
    Satish

    Hi,
    i dont know what type of fields u r having but about collect statement i am correct
    The following special statement allows you to summate entries in an internal table:
    COLLECT wa INTO itab.
    itab must have a flat line type, and all of the fields that are not part of the table key must have a numeric type (f, i, p). You specify the line wathat you want to add as a work area that is compatible with the line type of itab.
    When the line is inserted, the system checks whether there is already a table entry that matches the key. If there is no corresponding entry already in the table, the COLLECT statement has the same effect as inserting the new line. If an entry with the same key already exists, the COLLECT statement does not append a new line, but adds the contents of the numeric fields in the work area to the contents of the numeric fields in the existing entry.
    REPORT demo_int_tables_COLLECT .
    DATA: BEGIN OF line,
    col1(3) TYPE c,
    col2(2) TYPE n,
    col3 TYPE i,
    END OF line.
    DATA itab LIKE SORTED TABLE OF line
    WITH NON-UNIQUE KEY col1 col2.
    line-col1 = 'abc'. line-col2 = '12'. line-col3 = 3.
    COLLECT line INTO itab.
    WRITE / sy-tabix.
    line-col1 = 'def'. line-col2 = '34'. line-col3 = 5.
    COLLECT line INTO itab.
    WRITE / sy-tabix.
    line-col1 = 'abc'. line-col2 = '12'. line-col3 = 7.
    COLLECT line INTO itab.
    WRITE / sy-tabix.
    LOOP AT itab INTO line.
    WRITE: / line-col1, line-col2, line-col3.
    ENDLOOP.
    The list output is:
    1
    2
    1
    abc 12 10
    def 34 5
    The example fills a sorted table. The first two COLLECT statements work like normal insertion statements. In the third COLLECTstatement, the first line of itab is modified.
    Regards

  • FROM EXCEL FILE TO INTERNAL TABLE

    HI GURU'S,
    i'm using the following code to conver the excel file into internal table.
    CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
        EXPORTING
         I_FIELD_SEPERATOR          = 'X'
        I_LINE_HEADER              =
          I_TAB_RAW_DATA             = IT_TAB_RAW_DATA
          I_FILENAME                 = P_FILE
        TABLES
          I_TAB_CONVERTED_DATA       = IT_MM01
       EXCEPTIONS
         CONVERSION_FAILED          = 1
         OTHERS                     = 2
    What is the exact format for the to send the Excel File.
    My requirement is the Excel file contains the several fields , that should be stored as a records in the internal table
    My problem is when i send the data in the excel file as one column, i'm getting all the data in the first column of the Internal Table.
    If i send the data in the excel file as a record it is not filling the internal table.
    what is the problem??/
    if the Excel files contain multiple records is it able to convert the data into internal table records.
    Regards,
    Adi.

    **Internal Table to hold the records in the text file
    Hello Adi,
    Put the fields in excel in the same format in which u want in ur internal table(here record)
    U can refer the following code.
    data: begin of record occurs 0,
          General Data
    data element: BUKRS
            bukrs_001(004), " Company Code
    data element: EKORG
            ekorg_002(004), " Purchase Orgn
    data element: KTOKK
            ktokk_003(004), " Account Group
        end of record.
    Internal Table
    data:it_excel like table of alsmex_tabline with header line.
    **SELECTION-SCREEN**
    selection-screen begin of  block blk.
    parameters: p_file like rlgrap-filename default 'c:\vendor_creation.xls'
    selection-screen end of block blk.
    A T   S E L E C T I O N - S C R E E N   O U T P U T
    ***************START*********************** F4 Help for field p_file
    at selection-screen on value-request for p_file.
    call function 'KD_GET_FILENAME_ON_F4'
    exporting
       program_name        = syst-repid
       dynpro_number       = syst-dynnr
      FIELD_NAME          = ' '
      STATIC              = ' '
      MASK                = ' '
      changing
        file_name           = p_file
    EXCEPTIONS
      MASK_TOO_LONG       = 1
      OTHERS              = 2
    if sy-subrc <>  0.
    message e006(zhnc).
    endif.
    S T A R T - O F - S E L E C T I O N
    start-of-selection.
    data : vf_index type i.
    data : vf_start_col type i value '1',      "start column
             vf_start_row type i value '4',    "start row
             vf_end_col   type i value '200',  "maximum column
             vf_end_row   type i value '2500', "maximum row
             p_text(20).                       "stores error messages
    */ Work Area
    data: wa_intern like it_excel.
    */ Field symbol
    field-symbols : <fs>.
    *********Fn Module to convert the excel file data into internal table
    call function 'ALSM_EXCEL_TO_INTERNAL_TABLE'
      exporting
        filename                      =  'c:\vendor_creation.xls'
        i_begin_col                   =  vf_start_col
        i_begin_row                   =  vf_start_row
        i_end_col                     =  vf_end_col
        i_end_row                     =  vf_end_row
      tables
        intern                        = it_excel
    exceptions
       inconsistent_parameters       = 1
       upload_ole                    = 2
       others                        = 3.
    if sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    endif.
      if it_excel[] is initial.
        p_text = 'No Data Uploaded'.
      else.
      sort it_excel by row col.
          loop at it_excel.
          move : it_excel-col to vf_index.
          assign component vf_index of structure record to <fs>.
          move : it_excel-value to <fs>.
          at end of row.
            append record.
            clear record.
          endat.
          endloop.
      endif.
    In case of any problem u  can revert back.
    Aastha

  • Uploading word doc into Internal Table

    Hi,
    Could you please let me know how to upload <b>A WORD DOC</b> into an Internal Table.
    The function WS_Upload is to upload a text file with extension DAT and not to upload .DOC.
    Please let me know the possibilities.
    Thanks
    Arun

    Hi Y Arun
    You may have to go for OLE, please check the link below:
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/technologies/an easy reference for ole automation.article
    Regards
    Ashish Jain

  • Large line to internal tables from  tab delimited file

    Dear All
    I am trying to upload the large file of tab delimited data into a SAP internal table. I am basically stuck with the fact that there are multiple lines and multiple columns in tab delimited file. There are around 300 columns which are tab delimited and separated
    For e.g  (* indicates tab)
    1material*****************1**9888**********5**********34*********3*********346************************-->upto 5000 columns
    1material*****************1**99338************4***********************************6************7************-->upto 5000 columns
    1material*****************1**22888********************5*********7*********************6*****7**************-->upto 5000 columns
    1material*****************1**44844************************5***5*********************************************-->upto 5000 columns
    1material***********34****1**54*******33********33*****33**************************************************-->upto 5000 columns
    1material*****************1**99888*****************************************************************************-->upto 5000 columns
    below upto 500 rows or more
    I want to read this file into a columner internal table.
    I am trying several ways . I have file on APP server. However Line breaks after 1024 characters or comes on another line.
    Currently I am not able to load it in single line of internal table. The structure of file is dynamic .. not static
    Amol

    Hi Amolsonaikar,
    you may try like this:
    TYPES:
      begin of line,
        t_field type table of string,
      end of line,
      t_line type table of line.
    DATA:
      lt_line  type t_line,
      lv_line type string,
      lt_field type table of string.
    open dataset 'XYZ' for input in text mode encoding default.
    while sy-subrc = 0.
      read dataset into lv_line.
      split lv_line at '|' into lt_field.
      append lt_field to lt_line.
    endwhile.
    Regards,
    Clemens

  • Is a database table required for temporary interfaces with flat file data set source ?

    Folks,  this is the situation I have in ODI 11.1.1.7
    I have a temporary interface (yellow), called MJ_TEMP_INT,  that pulls data from TWO data sets in the source into a temporary target (TEMP_TARG). The catch is one data set pulls from a from a table whereas the other data set pulls from a flat file.  A union is done on the data sets.
    I then create another interface, called MJ_INT, that uses the MJ_TEMP_INT as a source and the target is a real db. table called "REAL_TARGET"
    Two questions:
    When I execute my second interface  (MJ_INT), I get a message "ORA-00942: table or view does not exist" because it is looking for a real db table TEMP_TARG. Why must I have one ? because I am pulling from a flat file ?
    On my second interface (MJ_INT) when I look at the property sheet of my source interface MJ_TEMP_INT (yellow), the checkbox next to "Use temporary interface as Derived table" is DISABLED.  Why ? Is is also because my temporary interface is pulling from a flat file ?
    I have attached a file that shows a screen shot of my ODI studio.
    By the way,  IF my temporary interface source has only one data set pulling from a db. table into a temporary target table, say called MJ_TEMP2_TARG,  and then when I use this temporary interface as a source to another other real db. target table (REAL2_TARGET),  THEN, every thing works.  ODI does not require me to have a real db. table MJ_TEMP2_TARG and the checkbox for "Use temporary interface as Derived table" is NOT DISABLED and my REAL2_TARGET table gets populated.
    Thank you in advance.
    M. Jamal.

    Thanks SH. I thought so. 
    Though I understand the reason to materialize the file in a staging area, but that almost defeats the purpose of having a temporary interface in this case if we have to save the data in a permanent db. table first.  I assume the db. table sticks around and is not automatically dropped once the interface executing ends.  If the db. table sticks around then I also must truncate it first before executing the temporary interface each time. Right ?

  • Can we cleanse and transform data at flat file or external table level?

    Hi,
    I have some data that I want to cleanse and transform. I don't want to cleanse it after i populate the external table, I want to get done with it at flat file level or while populating the external table. Can we cleanse and transform data at flat file or external table level through Oracle or OWB 11.2? Is it possible to run a conditional load (i.e. having a where clause or if-else-then) for an external table? Can we call oracle functions for an external table at the time of creation?
    Thanks in advance.
    Regards,
    Ann.

    Hi Oleg,
    Thanks a lot for the clarification. :)
    So is there a way that I can clease the data within the text file through Oracle or OWB? I have datatype mismatches in the data and most of my data is getting rejected because of that. The way I can think of, for solving this problem, is to create the external table with all fields with datatype varchar and then cleansing the data. But it doesn't seem very effecient plus it will get very complicated because I have almost 80-90 fields.
    Any help?
    Thanks and regards,
    Ann.

  • SSIS - Exporting Data into flat files from Oracle Table as batchwise process

    Hi All,
    Thanks in advance.
    I have a Large Table in Oracle Database with some 3 Lakhs record. I need to fetch the 10,000 records for every iteration and export it into the flat file. This process should occur recursively until the table becomes empty.
    Hence, For every iteration on flat file to be generated with 10,000 records.
    Please help how to proceed further in SSIS.
    Thanks
    Pyarajan.S

    Yes, it always helps if your question doesn't specify the actual requirements...
    Use the FOR loop container to control the iterations of the data flow. For each run you read 10,000 rows from the table and dump them in a flat file. Either move the flat file, or use an expression on the flat file connection manager to give them dynamic
    file names.
    30 million rows is also not a problem by the way, it just takes a bit longer.
    MCSE SQL Server 2012 - Please mark posts as answered where appropriate.

  • Sy-tabix for internal table in smartform

    Hi friends,
    How to capture the sy-tabix value for the entries in an internal table which has been looped into the loop of table node of a smartform?? I need to print something immedaitely after the end of the table
    For every record the value of sy-tabix is showing 1 !!
    Advance Thanks
    Aadarsh

    Hi Aadarsh,
    Give ur sy-tabix at the end of the loop.
    loop at itab.
    //table node populations.
    endloop.
    give a seperate loop for this.
    loop at itab.
    sy-tabix.
    endloop
    get the total no and print it after the table.
    If u r using do loop then give sy-index.
    Hope tihs helps u,
    Regards,
    Nagarajan.
    Message was edited by: Nagarajan Kumarappan

  • Regarding Exporting and Importing internal table

    Hello Experts,
    I have two programs:
    1) Main program: It create batch jobs through open_job,submit and close job.Giving sub program as SUBMIT.
    I am using Export IT to memory id 'MID' to export internal table data to sap memory in the subprogram.
    The data will be processed in the subprogram and exporting data to sap memory.I need this data in the main program(And using import to get the data,but it is not working).
    Importing IT1 from memory id 'MID' to import the table data in the main program after completing the job(SUBMIT SUBPROGRAM AND RETURN).
    Importing is not getting data to internal table.
    Can you please suggest something to solve this issue.
    Thank you.
    Regards,
    Anand.

    Hi,
    This is the code i am using.
    DO g_f_packets TIMES.
    * Start Immediately
           IF NOT p_imm IS INITIAL .
             g_flg_start = 'X'.
           ENDIF.
           g_f_jobname = 'KZDO_INHERIT'.
           g_f_jobno = g_f_jobno + '001'.
           CONCATENATE g_f_jobname g_f_strtdate g_f_jobno INTO g_f_jobname
                                                  SEPARATED BY '_'.
           CONDENSE g_f_jobname NO-GAPS.
           p_psize1 = p_psize1 + p_psize.
           p_psize2 = p_psize1 - p_psize + 1.
           IF p_psize2 IS INITIAL.
             p_psize2  = 1.
           ENDIF.
           g_f_spname = 'MID'.
           g_f_spid = g_f_spid + '001'.
           CONDENSE g_f_spid NO-GAPS.
           CONCATENATE g_f_spname  g_f_spid INTO g_f_spname.
           CONDENSE g_f_spname NO-GAPS.
    * ... (1) Job creating...
           CALL FUNCTION 'JOB_OPEN'
             EXPORTING
               jobname          = g_f_jobname
             IMPORTING
               jobcount         = g_f_jobcount
             EXCEPTIONS
               cant_create_job  = 1
               invalid_job_data = 2
               jobname_missing  = 3
               OTHERS           = 4.
           IF sy-subrc <> 0.
             MESSAGE e469(9j) WITH g_f_jobname.
           ENDIF.
    * (2)Report start under job name
           SUBMIT (g_c_prog_kzdo)
                  WITH p_lgreg EQ p_lgreg
                  WITH s_grvsy IN s_grvsy
                  WITH s_prvsy IN s_prvsy
                  WITH s_prdat IN s_prdat
                  WITH s_datab IN s_datab
                  WITH p1      EQ p1
                  WITH p3      EQ p3
                  WITH p4      EQ p4
                  WITH p_mailid EQ g_f_mailid
                  WITH p_psize EQ p_psize
                  WITH p_psize1 EQ p_psize1
                  WITH p_psize2 EQ p_psize2
                  WITH spid     EQ g_f_spid
                  TO SAP-SPOOL WITHOUT SPOOL DYNPRO
                  VIA JOB g_f_jobname NUMBER g_f_jobcount AND RETURN.
    *(3)Job closed when starts Immediately
           IF NOT p_imm IS INITIAL.
             IF sy-index LE g_f_nojob.
               CALL FUNCTION 'JOB_CLOSE'
                 EXPORTING
                   jobcount             = g_f_jobcount
                   jobname              = g_f_jobname
                   strtimmed            = g_flg_start
                 EXCEPTIONS
                   cant_start_immediate = 1
                   invalid_startdate    = 2
                   jobname_missing      = 3
                   job_close_failed     = 4
                   job_nosteps          = 5
                   job_notex            = 6
                   lock_failed          = 7
                   OTHERS               = 8.
               gs_jobsts-jobcount = g_f_jobcount.
               gs_jobsts-jobname  = g_f_jobname.
               gs_jobsts-spname   = g_f_spname.
               APPEND gs_jobsts to gt_jobsts.
             ELSEIF sy-index GT g_f_nojob.
               CLEAR g_f_flg.
               DO.                         " Wiating untill any job completion
                 LOOP AT gt_jobsts into gs_jobsts.
                   CLEAR g_f_status.
                   CALL FUNCTION 'BP_JOB_STATUS_GET'
                     EXPORTING
                       JOBCOUNT                         = gs_jobsts-jobcount
                       JOBNAME                          = gs_jobsts-jobname
                    IMPORTING
                       STATUS                           = g_f_status
    *            HAS_CHILD                        =
    *          EXCEPTIONS
    *            JOB_DOESNT_EXIST                 = 1
    *            UNKNOWN_ERROR                    = 2
    *            PARENT_CHILD_INCONSISTENCY       = 3
    *            OTHERS                           = 4
                   g_f_mid = gs_jobsts-spname.
                   IF g_f_status = 'F'.
                     IMPORT gt_final FROM MEMORY ID g_f_mid .
                     FREE MEMORY ID gs_jobsts-spname.
                     APPEND LINES OF gt_final to gt_final1.
                     REFRESH gt_prlist.
                     CALL FUNCTION 'JOB_CLOSE'
                       EXPORTING
                         jobcount             = g_f_jobcount
                         jobname              = g_f_jobname
                         strtimmed            = g_flg_start
                       EXCEPTIONS
                         cant_start_immediate = 1
                         invalid_startdate    = 2
                         jobname_missing      = 3
                         job_close_failed     = 4
                         job_nosteps          = 5
                         job_notex            = 6
                         lock_failed          = 7
                         OTHERS               = 8.
                     IF sy-subrc = 0.
                       g_f_flg = 'X'.
                       gs_jobsts1-jobcount = g_f_jobcount.
                       gs_jobsts1-jobname  = g_f_jobname.
                       gs_jobsts1-spname   = g_f_spname.
                       APPEND gs_jobsts1 TO gt_jobsts.
                       DELETE TABLE gt_jobsts FROM gs_jobsts.
                       EXIT.
                     ENDIF.
                   ENDIF.
                 ENDLOOP.
                 IF g_f_flg = 'X'.
                   CLEAR g_f_flg.
                   EXIT.
                 ENDIF.
               ENDDO.
             ENDIF.
           ENDIF.
           IF sy-subrc <> 0.
             MESSAGE e539(scpr) WITH g_f_jobname.
           ENDIF.
           COMMIT WORK .
         ENDDO.

Maybe you are looking for