Data upload from xls to internal table

Suppose I have data in the form of a matrix and I need to upload the data into the database after validation. The excel sheet is of the format:
Emp Empdept E1     E2     E3     E4     E5     E6     E7     E8     E9     
E1     MEC     0     2     3     4     5     6     6     5     7
E2     ELE     4     0     5     5     6     2     2     1     3
E3     ELE     4     4     0     6     1     4     7     8     9
E4     ECE     2     2     4     0     6     7     5     9     4
E5     CHE     7     8     9     5     0     5     6     1     3
E6     ELE     8     9     10     12     11     0     5     6     4     
E7     MEC     4     5     4     6     7     6     0     5     7
E8     MEC     9     4     7     5     2     2     8     0     1
E9      ELE     1     5     2     4     2     6     4     6     0
The first column is the employee number
The second column is the employee department and
The matrix indicates the time taken by emplyee1 to be trained to handle position of employee E2 is 2 months (map using row of E1 and column of E2).
Similarly E9 to E8 is 6 months.
I have to get the above data into an internal table of the format
Emp_from     Emp_to     Duration
E1          E1          0     
E1          E2          2
E1          E3          3     
E1          E4          4          
E1          E5          5     
E1          E6          6
E1          E7          6
E1          E8          5     
E1          E9          7
E2             E1          4
E2          E2          0     
E2          E3          5
can someone help me in building the logic for this
regards,
seenu

HI refer this program
in this
excel to internal table and then application server
*& Report  ZSD_EXCEL_INT_APP
REPORT  ZSD_EXCEL_INT_APP.
parameter: file_nm type localfile.
types : begin of it_tab1,
        f1(20),
        f2(40),
        f3(20),
       end of it_tab1.
data : it_tab type table of ALSMEX_TABLINE with header line,
       file type rlgrap-filename.
data : it_tab2 type it_tab1 occurs 1,
       wa_tab2 type it_tab1,
       w_message(100)  TYPE c.
at selection-screen on value-request for file_nm.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
  PROGRAM_NAME        = SYST-REPID
  DYNPRO_NUMBER       = SYST-DYNNR
  FIELD_NAME          = ' '
   STATIC              = 'X'
  MASK                = ' '
  CHANGING
   file_name           = file_nm
EXCEPTIONS
   MASK_TOO_LONG       = 1
   OTHERS              = 2
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
start-of-selection.
refresh it_tab2[].clear wa_tab2.
file = file_nm.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
  EXPORTING
    filename                      = file
    i_begin_col                   = '1'
    i_begin_row                   =  '1'
    i_end_col                     = '10'
    i_end_row                     = '35'
  tables
    intern                        = it_tab
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.
loop at it_tab.
  case it_tab-col.
   when '002'.
    wa_tab2-f1 = it_tab-value.
   when '004'.
    wa_tab2-f2 = it_tab-value.
  when '008'.
    wa_tab2-f3 = it_tab-value.
endcase.
at end of row.
  append wa_tab2 to it_tab2.
clear wa_tab2.
  endat.
endloop.
data : p_file TYPE  rlgrap-filename value 'TEST3.txt'.
OPEN DATASET p_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
*--- Display error messages if any.
  IF sy-subrc NE 0.
    MESSAGE e001(zsd_mes).
    EXIT.
  ELSE.
*---Data is downloaded to the application server file path
    LOOP AT it_tab2 INTO wa_tab2.
      TRANSFER wa_tab2 TO p_file.
    ENDLOOP.
  ENDIF.
*--Close the Application server file (Mandatory).
  CLOSE DATASET p_file.
loop at it_tab2 into wa_tab2.
  write : / wa_tab2-f1,wa_tab2-f2,wa_tab2-f3.
endloop.

Similar Messages

  • How To UPLOAD a DATA (.DAT) fiel from PC to internal table and then split it into the data different columns

    Hi all,
    I am new to ABAP Development. I need to upload a .DAT file (the file doesn#t have any proper structure-- Please find the .DAT file in the attachment). After uploading the DATA (.DAT) fiel I need to split in into different columns. Refering the attached .DAT fiel the fields in bracets like:
    [Arbeitstag],  [Pecunia], [Mita], [Kunde], [Auftrag] and  [Position] are different fields that need to be arranged in columns in an internal table. this .DAT fiel which I want to upload and then SPLIT it into various fields will will treated as MASTER DATA table for further programming. The program that I had written is as below. Also please refer the attached .DAT table.
    Please if any one could help me. i searched a lot in different forums but couldn't find me  a solution. Also note that the attached fiel is in text (.txt) format here but in real situation the same fiel is in DATA (.DAT) format.
    *& Report  ZDEMO_ZEITERFASSUNG9
    REPORT  ZDEMO_ZEITERFASSUNG9.
    Types: Begin of ttab,
            Rec(1000) type c,
           End of ttab.
    DATA: itab  type table of ttab.
    DATA: wa_tab type ttab.
    DATA: file_str type string.
    Parameters: p_file type localfile.
    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              = 'X'
    *                                          MASK                = ' '
                                             CHANGING
                                               file_name           = p_file.
    *                                        EXCEPTIONS
    *                                          MASK_TOO_LONG       = 1
    *                                          OTHERS              = 2
    Start-of-Selection.
      file_str = P_file.
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          filename                      = '\\10.10.1.92\Volume_1\_projekte\Zeiterfassung-SAP\BUP_ZEIT.DAT'   " This the file  source address
          FILETYPE                      = 'DAT'
          HAS_FIELD_SEPARATOR           = ';'
    *     HEADER_LENGTH                 = 0
    *     READ_BY_LINE                  = 'X'
    *     DAT_MODE                      = ' '
    *     CODEPAGE                      = ' '
    *     IGNORE_CERR                   = ABAP_TRUE
    *     REPLACEMENT                   = '#'
    *     CHECK_BOM                     = ' '
    *     VIRUS_SCAN_PROFILE            =
    *     NO_AUTH_CHECK                 = ' '
    *   IMPORTING
    *     FILELENGTH                    =
    *     HEADER                        =
        tables
          data_tab                      = itab
       EXCEPTIONS
         FILE_OPEN_ERROR               = 1
         FILE_READ_ERROR               = 2
         NO_BATCH                      = 3
         GUI_REFUSE_FILETRANSFER       = 4
         INVALID_TYPE                  = 5
         NO_AUTHORITY                  = 6
         UNKNOWN_ERROR                 = 7
         BAD_DATA_FORMAT               = 8
         HEADER_NOT_ALLOWED            = 9
         SEPARATOR_NOT_ALLOWED         = 10
         HEADER_TOO_LONG               = 11
         UNKNOWN_DP_ERROR              = 12
         ACCESS_DENIED                 = 13
         DP_OUT_OF_MEMORY              = 14
         DISK_FULL                     = 15
         DP_TIMEOUT                    = 16
         OTHERS                        = 17
      IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      LOOP at itab into wa_tab.
            WRITE: / wa_tab.
      ENDLOOP.
    I will be grateful to all you experts for ur inputs
    regards
    Chandan Singh

    For every Auftrag, there are multiple Position entries.
    Rest of the blocks don't seems to have any relation.
    So you can check this code to see how internal table lt_str is built whose first 3 fields have data contained in Auftrag, and next 3 fields have Position data. The structure is flat, assuming that every Position record is related to preceding Auftrag.
    Try out this snippet.
    DATA lt_data TYPE TABLE OF string.
    DATA lv_data TYPE string.
    CALL METHOD cl_gui_frontend_services=>gui_upload
      EXPORTING
        filename = 'C:\temp\test.txt'
      CHANGING
        data_tab = lt_data
      EXCEPTIONS
        OTHERS   = 19.
    CHECK sy-subrc EQ 0.
    TYPES:
    BEGIN OF ty_str,
      a1 TYPE string,
      a2 TYPE string,
      a3 TYPE string,
      p1 TYPE string,
      p2 TYPE string,
      p3 TYPE string,
    END OF ty_str.
    DATA: lt_str TYPE TABLE OF ty_str,
          ls_str TYPE ty_str,
          lv_block TYPE string,
          lv_flag TYPE boolean.
    LOOP AT lt_data INTO lv_data.
      CASE lv_data.
        WHEN '[Version]' OR '[StdSatz]' OR '[Arbeitstag]' OR '[Pecunia]'
             OR '[Mita]' OR '[Kunde]' OR '[Auftrag]' OR '[Position]'.
          lv_block = lv_data.
          lv_flag = abap_false.
        WHEN OTHERS.
          lv_flag = abap_true.
      ENDCASE.
      CHECK lv_flag EQ abap_true.
      CASE lv_block.
        WHEN '[Auftrag]'.
          SPLIT lv_data AT ';' INTO ls_str-a1 ls_str-a2 ls_str-a3.
        WHEN '[Position]'.
          SPLIT lv_data AT ';' INTO ls_str-p1 ls_str-p2 ls_str-p3.
          APPEND ls_str TO lt_str.
      ENDCASE.
    ENDLOOP.

  • DATA UPLOAD into 5 Different Internal Tables !!!

    Hi ABAPers,
    I have data in 5 different TABS of an Excel Sheet.
    I have to UPLOAD this data in these different TABS to 5 different Internal tables.
    Can any one give me a solution to this ???

    take data from all internal tabels into final internal table.....and proceed in below way......
    fill ur inetnal table and call call the below form DOWNLOAD_TO_EXCEL, This Form is displaying an internal table it_outtab
    Move data from it_outtab to it_excel
    it_excel will contain all the charecter fields
    DATA : BEGIN OF IT_EXCEL OCCURS 0,
    FLD1(32),
    FLD2(32),
    FLD3(32),
    FLD4(32),
    FLD5(32),
    FLD6(32),
    FLD7(32),
    FLD8(32),
    FLD9(32),
    FLD10(32),
    FLD11(32),
    FLD12(32),
    FLD13(32),
    FLD14(32),
    FLD15(32),
    FLD16(32),
    FLD17(32),
    FLD18(32),
    FLD19(32),
    FLD20(32),
    FLD21(32),
    END OF IT_EXCEL.
    FORM DOWNLOAD_TO_EXCEL.
    PERFORM GET_FILE_NAME .
    CLEAR IT_EXCEL.
    REFRESH IT_EXCEL.
    IF NOT FNAME IS INITIAL .
    PERFORM POPULATE_HEADER_DETAIL.
    LOOP AT IT_OUTTAB.
    IT_EXCEL-FLD1 = IT_OUTTAB-BANFN.
    IT_EXCEL-FLD2 = IT_OUTTAB-BNFPO.
    IT_EXCEL-FLD3 = IT_OUTTAB-EBELN.
    IT_EXCEL-FLD4 = IT_OUTTAB-EBELP.
    IT_EXCEL-FLD5 = IT_OUTTAB-STYLE.
    IT_EXCEL-FLD6 = IT_OUTTAB-SKU.
    IT_EXCEL-FLD7 = IT_OUTTAB-LP_COLOR.
    IT_EXCEL-FLD8 = IT_OUTTAB-MAKTX.
    IT_EXCEL-FLD9 = IT_OUTTAB-CURR_PRICE.
    IF NOT IT_OUTTAB-VALID_FROM IS INITIAL.
    CONCATENATE IT_OUTTAB-VALID_FROM+4(2) '/'
    IT_OUTTAB-VALID_FROM+6(2) '/'
    IT_OUTTAB-VALID_FROM(4) INTO IT_EXCEL-FLD10.
    ENDIF.
    IF NOT IT_OUTTAB-VALID_TO IS INITIAL.
    CONCATENATE IT_OUTTAB-VALID_TO+4(2) '/'
    IT_OUTTAB-VALID_TO+6(2) '/'
    IT_OUTTAB-VALID_TO(4) INTO IT_EXCEL-FLD11.
    ENDIF.
    IT_EXCEL-FLD12 = IT_OUTTAB-FUT_PRICE.
    IT_EXCEL-FLD13 = IT_OUTTAB-FAC_PRICE.
    IF NOT IT_OUTTAB-FAC_VALID_FROM IS INITIAL.
    CONCATENATE IT_OUTTAB-FAC_VALID_FROM+4(2) '/'
    IT_OUTTAB-FAC_VALID_FROM+6(2) '/'
    IT_OUTTAB-FAC_VALID_FROM(4) INTO IT_EXCEL-FLD14.
    ENDIF.
    IF NOT IT_OUTTAB-FAC_VALID_TO IS INITIAL.
    CONCATENATE IT_OUTTAB-FAC_VALID_TO+4(2) '/'
    IT_OUTTAB-FAC_VALID_TO+6(2) '/'
    IT_OUTTAB-FAC_VALID_TO(4) INTO IT_EXCEL-FLD15.
    ENDIF.
    IT_EXCEL-FLD16 = IT_OUTTAB-JPN_PRICE.
    IT_EXCEL-FLD17 = IT_OUTTAB-EAN11_1.
    IT_EXCEL-FLD18 = IT_OUTTAB-EAN11_2.
    IT_EXCEL-FLD19 = IT_OUTTAB-HANG_TAG_STAT.
    IT_EXCEL-FLD20 = IT_OUTTAB-LABEL_STAT.
    IT_EXCEL-FLD21 = IT_OUTTAB-CJI_STAT.
    APPEND IT_EXCEL.
    CLEAR IT_EXCEL.
    ENDLOOP.
    CALL FUNCTION 'RH_START_EXCEL_WITH_DATA'
    EXPORTING
    CHECK_VERSION = ' '
    DATA_NAME = FNAME
    DATA_PATH_FLAG = ''
    DATA_TYPE = 'DAT'
    DATA_BIN_FILE_SIZE =
    MACRO_NAME = ' '
    MACRO_PATH_FLAG = 'E'
    FORCE_START = ' '
    WAIT = ''
    IMPORTING
    WINID =
    TABLES
    DATA_TAB = IT_EXCEL
    EXCEPTIONS
    NO_BATCH = 1
    EXCEL_NOT_INSTALLED = 2
    WRONG_VERSION = 3
    INTERNAL_ERROR = 4
    INVALID_TYPE = 5
    CANCELLED = 6
    DOWNLOAD_ERROR = 7
    OTHERS = 8
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ENDIF .
    ENDFORM. " DOWNLOAD_TO_EXCEL
    FORM GET_FILE_NAME.
    DATA: TMP_FILENAME LIKE RLGRAP-FILENAME,
    GLOBAL_FILEMASK_ALL(80),
    GLOBAL_FILEMASK_MASK(20), GLOBAL_FILEMASK_TEXT(20),
    GLOBAL_DOWNLOAD_PATH LIKE RLGRAP-FILENAME,
    DEF_PATH LIKE RLGRAP-FILENAME,
    FIELDLN TYPE I,
    MODE TYPE C,
    TMP_MASK LIKE GLOBAL_FILEMASK_ALL.
    FIELD-SYMBOLS: .
    IF GLOBAL_FILEMASK_MASK IS INITIAL.
    TMP_MASK = ',.,..'.
    ELSE.
    TMP_MASK = ','.
    WRITE GLOBAL_FILEMASK_TEXT TO TMP_MASK+1.
    WRITE ',' TO TMP_MASK+21.
    WRITE GLOBAL_FILEMASK_MASK TO TMP_MASK+22.
    WRITE '.' TO TMP_MASK+42.
    CONDENSE TMP_MASK NO-GAPS.
    ENDIF.
    IF NOT GLOBAL_FILEMASK_ALL IS INITIAL.
    TMP_MASK = GLOBAL_FILEMASK_ALL.
    ENDIF.
    FIELDLN = STRLEN( DEF_PATH ) - 1.
    ASSIGN DEF_PATH+FIELDLN(1) TO .
    ENDIF.
    CALL FUNCTION 'WS_FILENAME_GET'
    EXPORTING
    DEF_FILENAME = FNAME "rlgrap-filename
    DEF_PATH = DEF_PATH
    MASK = TMP_MASK
    MODE = MODE
    TITLE = ' '
    IMPORTING
    FILENAME = FNAME
    RC =
    EXCEPTIONS
    INV_WINSYS = 01
    NO_BATCH = 02
    SELECTION_CANCEL = 03
    SELECTION_ERROR = 04.
    IF SY-SUBRC = 0.
    FNAME = TMP_FILENAME.
    ELSE.
    ENDIF.
    ENDFORM. " GET_FILE_NAME
    FORM POPULATE_HEADER_DETAIL.
    IT_EXCEL-FLD8 = 'S U D H E E R'.
    APPEND IT_EXCEL.
    CLEAR IT_EXCEL.
    IT_EXCEL-FLD1 = 'Price Validation Report'.
    IT_EXCEL-FLD14 = 'Page'.
    APPEND IT_EXCEL.
    CLEAR IT_EXCEL.
    IT_EXCEL-FLD1 = 'Vendor Number/Name'.
    IT_EXCEL-FLD3 = 'Plan Month'.
    IT_EXCEL-FLD4 = 'Effective In-store-Date'.
    APPEND IT_EXCEL.
    CLEAR IT_EXCEL.
    IT_EXCEL-FLD1 = VENDOR_NAME.
    IT_EXCEL-FLD3 = P_BEDNR.
    IT_EXCEL-FLD4 = P_EFF_DT.
    APPEND IT_EXCEL.
    CLEAR IT_EXCEL.
    sudheer start
    APPEND IT_EXCEL.
    IT_EXCEL-FLD1 = 'PR'.
    IT_EXCEL-FLD2 = 'Line'.
    IT_EXCEL-FLD3 = 'PO'.
    IT_EXCEL-FLD4 = 'PO Line'.
    IT_EXCEL-FLD5 = 'Style'.
    IT_EXCEL-FLD6 = 'SKU'.
    IT_EXCEL-FLD7 = 'Long Color'.
    IT_EXCEL-FLD8 = 'Material Description'.
    IT_EXCEL-FLD9 = 'Current Price'.
    IT_EXCEL-FLD10 = 'validity'.
    IT_EXCEL-FLD11 = 'Period'.
    IT_EXCEL-FLD12 = 'Future Price'.
    IT_EXCEL-FLD13 = 'Factory Price'.
    IT_EXCEL-FLD14 = 'Validity'.
    IT_EXCEL-FLD15 = 'Period'.
    IT_EXCEL-FLD16 = 'Japan Price'.
    IT_EXCEL-FLD17 = 'First UPC'.
    IT_EXCEL-FLD18 = 'Factory UPC'.
    IT_EXCEL-FLD19 = 'Hang Tag Status'.
    IT_EXCEL-FLD20 = 'Label Status'.
    IT_EXCEL-FLD21 = 'CJI Label Status'.
    *sudheer end
    APPEND IT_EXCEL.
    CLEAR IT_EXCEL.
    ENDFORM. " POPULATE_HEADER_DETAIL
    Check these links for sample code :
    http://www.sapdevelopment.co.uk/ms/ms_excel.htm
    please check this example:
    FORM download.
    DATA: lh_file1 TYPE rlgrap-filename,
    lh_file2 TYPE rlgrap-filename,
    lh_file3 TYPE rlgrap-filename,
    lh_datda(1).
    CLEAR: lh_file1, lh_file2, lh_file3.
    Download neue Daten
    CONCATENATE xh_pfad 'Datafile materialmaster new ' sy-datum(4)
    sy-datum4(2) sy-datum6(2) sy-uzeit '.xls' INTO lh_file1.
    working area
    DATA: index TYPE i,
    lh_col TYPE i.
    FIELD-SYMBOLS: .
    SORT xt_bmm00 BY matnr.
    SORT xt_bmmh1 BY matnr.
    SORT xt_bmmh4 BY matnr.
    SORT xt_bmmh7 BY matnr.
    IF NOT xt_bmm00[] IS INITIAL.
    MOVE 'X' TO lh_datda.
    DO 4 TIMES.
    CASE sy-index.
    WHEN 1.
    CREATE OBJECT lh_excel 'EXCEL.APPLICATION' .
    SET PROPERTY OF lh_excel 'Visible' = 1 .
    GET PROPERTY OF lh_excel 'Workbooks' = lh_workbooks .
    GET PROPERTY OF lh_workbooks 'Application' = lh_application .
    SET PROPERTY OF lh_application 'SheetsInNewWorkbook' = 1 .
    CALL METHOD OF lh_workbooks 'Add' = lh_workbook .
    CALL METHOD OF lh_workbook 'Sheets' = lh_sheets .
    CALL METHOD OF lh_sheets 'Item' = lh_sheet
    EXPORTING #1 = sy-index .
    SET PROPERTY OF lh_sheet 'NAME' = 'BMMH7'.
    Überschrift erstellen
    CLEAR xt_ftab.
    REFRESH xt_ftab.
    CALL FUNCTION 'GET_FIELDTAB'
    EXPORTING
    langu = sy-langu
    tabname = '/SIE/TS_MM01S005'
    withtext = ' '
    only = 'T'
    TABLES
    fieldtab = xt_ftab
    EXCEPTIONS
    OTHERS = 1.
    CLEAR lh_col.
    LOOP AT xt_ftab.
    ADD 1 TO lh_col.
    PERFORM fill_cell
    USING 1 lh_col xt_ftab-fieldname lh_excel lh_cells.
    ENDLOOP.
    LOOP AT xt_bmmh7.
    index = sy-tabix + 1.
    DO 4 TIMES.
    ASSIGN COMPONENT sy-index OF STRUCTURE xt_bmmh7 TO  lh_excel lh_cells.
    ENDIF.
    ENDDO.
    ENDLOOP.
    WHEN 2.
    GET PROPERTY OF lh_workbook 'Sheets' = lh_sheets .
    CALL METHOD OF lh_sheets 'Add' = lh_newsheet .
    SET PROPERTY OF lh_newsheet 'Name' = 'BMMH4'.
    CALL METHOD OF lh_excel 'WorkSheets' = lh_activesheet
    EXPORTING #1 = 'BMMH4'.
    CALL METHOD OF lh_activesheet 'Activate' .
    Überschrift erstellen
    CLEAR xt_ftab.
    REFRESH xt_ftab.
    CALL FUNCTION 'GET_FIELDTAB'
    EXPORTING
    langu = sy-langu
    tabname = '/SIE/TS_MM01S004'
    withtext = ' '
    only = 'T'
    TABLES
    fieldtab = xt_ftab
    EXCEPTIONS
    OTHERS = 1.
    CLEAR lh_col.
    LOOP AT xt_ftab.
    ADD 1 TO lh_col.
    PERFORM fill_cell
    USING 1 lh_col xt_ftab-fieldname lh_excel lh_cells.
    ENDLOOP.
    LOOP AT xt_bmmh4.
    index = sy-tabix + 1.
    DO 4 TIMES.
    ASSIGN COMPONENT sy-index OF STRUCTURE xt_bmmh4 TO  lh_excel lh_cells.
    ENDIF.
    ENDDO.
    ENDLOOP.
    WHEN 3.
    GET PROPERTY OF lh_workbook 'Sheets' = lh_sheets .
    CALL METHOD OF lh_sheets 'Add' = lh_newsheet .
    SET PROPERTY OF lh_newsheet 'Name' = 'BMMH1'.
    CALL METHOD OF lh_excel 'WorkSheets' = lh_activesheet
    EXPORTING #1 = 'BMMH1'.
    CALL METHOD OF lh_activesheet 'Activate' .
    Überschrift erstellen
    CLEAR xt_ftab.
    REFRESH xt_ftab.
    CALL FUNCTION 'GET_FIELDTAB'
    EXPORTING
    langu = sy-langu
    tabname = '/SIE/TS_MM01S003'
    withtext = ' '
    only = 'T'
    TABLES
    fieldtab = xt_ftab
    EXCEPTIONS
    OTHERS = 1.
    CLEAR lh_col.
    LOOP AT xt_ftab.
    Die folgende Abfrage ist notwendig, weil der Namensraum ZZ...
    in der Struktur nicht erlaubt ist, aber im Excel-Sheet als
    Überschrift gebraucht wird.
    IF xt_ftab-fieldname = 'SPIRIDON'.
    MOVE 'ZZSSN' TO xt_ftab-fieldname.
    ENDIF.
    ADD 1 TO lh_col.
    PERFORM fill_cell
    USING 1 lh_col xt_ftab-fieldname lh_excel lh_cells.
    ENDLOOP.
    LOOP AT xt_bmmh1.
    index = sy-tabix + 1.
    DO 72 TIMES.
    ASSIGN COMPONENT sy-index OF STRUCTURE xt_bmmh1 TO  lh_excel lh_cells.
    ENDIF.
    ENDDO.
    ENDLOOP.
    WHEN 4.
    GET PROPERTY OF lh_workbook 'Sheets' = lh_sheets .
    CALL METHOD OF lh_sheets 'Add' = lh_newsheet .
    SET PROPERTY OF lh_newsheet 'Name' = 'BMM00'.
    CALL METHOD OF lh_excel 'WorkSheets' = lh_activesheet
    EXPORTING #1 = 'BMM00'.
    CALL METHOD OF lh_activesheet 'Activate' .
    Überschrift erstellen
    CLEAR xt_ftab.
    REFRESH xt_ftab.
    CALL FUNCTION 'GET_FIELDTAB'
    EXPORTING
    langu = sy-langu
    tabname = '/SIE/TS_MM01S002'
    withtext = ' '
    only = 'T'
    TABLES
    fieldtab = xt_ftab
    EXCEPTIONS
    OTHERS = 1.
    CLEAR lh_col.
    LOOP AT xt_ftab.
    ADD 1 TO lh_col.
    PERFORM fill_cell
    USING 1 lh_col xt_ftab-fieldname lh_excel lh_cells.
    ENDLOOP.
    LOOP AT xt_bmm00.
    index = sy-tabix + 1.
    DO 21 TIMES.
    ASSIGN COMPONENT sy-index OF STRUCTURE xt_bmm00 TO  lh_excel lh_cells.
    ENDIF.
    ENDDO.
    ENDLOOP.
    ENDCASE.
    ENDDO.
    CALL METHOD OF lh_workbook 'SAVEAS'
    EXPORTING #1 = lh_file1.
    CALL METHOD OF lh_excel 'QUIT'.
    FREE OBJECT: lh_cells, lh_sheet, lh_sheets, lh_application,
    lh_workbook, lh_workbooks, lh_excel,
    lh_chart, lh_activesheet.
    ENDIF.
    Download geänderter Materialstammdaten
    CONCATENATE xh_pfad 'Datafile materialmaster change ' sy-datum(4)
    sy-datum4(2) sy-datum6(2) sy-uzeit '.xls' INTO lh_file2.
    IF NOT xt_emmh1[] IS INITIAL.
    MOVE 'X' TO lh_datda.
    DO 2 TIMES.
    CALL METHOD OF lh_sheets 'Item' = lh_sheet
    EXPORTING #1 = sy-index .
    CASE sy-index.
    WHEN 1.
    CREATE OBJECT lh_excel 'EXCEL.APPLICATION' .
    SET PROPERTY OF lh_excel 'Visible' = 1 .
    GET PROPERTY OF lh_excel 'Workbooks' = lh_workbooks .
    GET PROPERTY OF lh_workbooks 'Application' = lh_application .
    SET PROPERTY OF lh_application 'SheetsInNewWorkbook' = 1 .
    CALL METHOD OF lh_workbooks 'Add' = lh_workbook .
    CALL METHOD OF lh_workbook 'Sheets' = lh_sheets .
    CALL METHOD OF lh_sheets 'Item' = lh_sheet
    EXPORTING #1 = sy-index .
    SET PROPERTY OF lh_sheet 'NAME' = 'BMMH7'.
    Überschrift erstellen
    CLEAR xt_ftab.
    REFRESH xt_ftab.
    CALL FUNCTION 'GET_FIELDTAB'
    EXPORTING
    langu = sy-langu
    tabname = '/SIE/TS_MM01S005'
    withtext = ' '
    only = 'T'
    TABLES
    fieldtab = xt_ftab
    EXCEPTIONS
    OTHERS = 1.
    CLEAR lh_col.
    LOOP AT xt_ftab.
    ADD 1 TO lh_col.
    PERFORM fill_cell
    USING 1 lh_col xt_ftab-fieldname lh_excel lh_cells.
    ENDLOOP.
    LOOP AT xt_emmh7.
    index = sy-tabix + 1.
    DO 4 TIMES.
    ASSIGN COMPONENT sy-index OF STRUCTURE xt_emmh7 TO  lh_excel lh_cells.
    ENDIF.
    ENDDO.
    ENDLOOP.
    WHEN 2.
    GET PROPERTY OF lh_workbook 'Sheets' = lh_sheets .
    CALL METHOD OF lh_sheets 'Add' = lh_newsheet .
    SET PROPERTY OF lh_newsheet 'Name' = 'BMMH1'.
    CALL METHOD OF lh_excel 'WorkSheets' = lh_activesheet
    EXPORTING #1 = 'BMMH1'.
    CALL METHOD OF lh_activesheet 'Activate' .
    Überschrift erstellen
    CLEAR xt_ftab.
    REFRESH xt_ftab.
    CALL FUNCTION 'GET_FIELDTAB'
    EXPORTING
    langu = sy-langu
    tabname = '/SIE/TS_MM01S003'
    withtext = ' '
    only = 'T'
    TABLES
    fieldtab = xt_ftab
    EXCEPTIONS
    OTHERS = 1.
    CLEAR lh_col.
    LOOP AT xt_ftab.
    Die folgende Abfrage ist notwendig, weil der Namensraum ZZ...
    in der Struktur nicht erlaubt ist, aber im Excel-Sheet als
    Überschrift gebraucht wird.
    IF xt_ftab-fieldname = 'SPIRIDON'.
    MOVE 'ZZSSN' TO xt_ftab-fieldname.
    ENDIF.
    ADD 1 TO lh_col.
    PERFORM fill_cell
    USING 1 lh_col xt_ftab-fieldname lh_excel lh_cells.
    ENDLOOP.
    LOOP AT xt_emmh1.
    index = sy-tabix + 1.
    DO 72 TIMES.
    ASSIGN COMPONENT sy-index OF STRUCTURE xt_emmh1 TO  lh_excel lh_cells.
    ENDIF.
    ENDDO.
    ENDLOOP.
    ENDCASE.
    ENDDO.
    CALL METHOD OF lh_workbook 'SAVEAS'
    EXPORTING #1 = lh_file2.
    CALL METHOD OF lh_excel 'QUIT'.
    FREE OBJECT: lh_cells, lh_sheet, lh_sheets, lh_application,
    lh_workbook, lh_workbooks, lh_excel,
    lh_chart, lh_activesheet.
    ENDIF.
    Download geänderter Texte
    CONCATENATE xh_pfad 'Datafile materialmaster change PO ' sy-datum(4)
    sy-datum4(2) sy-datum6(2) sy-uzeit '.xls' INTO lh_file3.
    IF NOT xt_tmmh7[] IS INITIAL.
    CLEAR: lh_cells, lh_sheet, lh_sheets, lh_application,
    lh_workbook, lh_workbooks, lh_excel,
    lh_chart, lh_activesheet.
    MOVE 'X' TO lh_datda.
    CREATE OBJECT lh_excel 'EXCEL.APPLICATION' .
    SET PROPERTY OF lh_excel 'Visible' = 1 .
    GET PROPERTY OF lh_excel 'Workbooks' = lh_workbooks .
    GET PROPERTY OF lh_workbooks 'Application' = lh_application .
    SET PROPERTY OF lh_application 'SheetsInNewWorkbook' = 1 .
    CALL METHOD OF lh_workbooks 'Add' = lh_workbook .
    CALL METHOD OF lh_workbook 'Sheets' = lh_sheets .
    CALL METHOD OF lh_sheets 'Item' = lh_sheet
    EXPORTING #1 = 1 .
    SET PROPERTY OF lh_sheet 'NAME' = 'BMMH7'.
    Überschrift erstellen
    CLEAR xt_ftab.
    REFRESH xt_ftab.
    CALL FUNCTION 'GET_FIELDTAB'
    EXPORTING
    langu = sy-langu
    tabname = '/SIE/TS_MM01S005'
    withtext = ' '
    only = 'T'
    TABLES
    fieldtab = xt_ftab
    EXCEPTIONS
    OTHERS = 1.
    CLEAR lh_col.
    LOOP AT xt_ftab.
    ADD 1 TO lh_col.
    PERFORM fill_cell
    USING 1 lh_col xt_ftab-fieldname lh_excel lh_cells.
    ENDLOOP.
    LOOP AT xt_tmmh7.
    index = sy-tabix + 1.
    DO 4 TIMES.
    ASSIGN COMPONENT sy-index OF STRUCTURE xt_tmmh7 TO  lh_excel lh_cells.
    ENDIF.
    ENDDO.
    ENDLOOP.
    CALL METHOD OF lh_workbook 'SAVEAS'
    EXPORTING #1 = lh_file3.
    CALL METHOD OF lh_excel 'QUIT'.
    FREE OBJECT: lh_cells, lh_sheet, lh_sheets, lh_application,
    lh_workbook, lh_workbooks, lh_excel,
    lh_chart, lh_activesheet.
    ENDIF.
    IF lh_datda NE 'X'.
    MESSAGE i016.
    ENDIF.
    ENDFORM. " download
    FORM fill_cell USING p_i
    value
    p_customer_cell1
    h_excel
    h_cells.
    CALL METHOD OF h_excel 'Cells' = h_cells EXPORTING #1 = p_i #2 = value.
    SET PROPERTY OF lh_cells 'Numberformat' = '@'.
    SET PROPERTY OF h_cells 'Value' = p_customer_cell1.
    ENDFORM. " fill_cell

  • In SRM How to upload data from Excel to Internal Table

    Hello Experts,
    As seen the Function Module 'ALSM_EXCEL_TO_INTERNAL_TABLE' does not exists in SRM.
    Is there any alternative to upload the data direct from excel to Internal table using any other FM. As seach did't get any relevant FM.
    Please advice..
    Thanks..

    did u try this
    TEXT_CONVERT_XLS_TO_SAP
    in this manner
    CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
        EXPORTING
          i_line_header              = 'X'
          i_tab_raw_data             = lt_raw
          i_filename                 = p_path
        TABLES
          i_tab_converted_data       = gt_output
        EXCEPTIONS
          conversion_failed          = 1
          OTHERS                     = 2.
    this FM works on DOI
    so
    SAP document about DOI:
    http://help.sap.com/saphelp_nw2004s/helpdata/EN/e9/0be775408e11d1893b0000e8323c4f/frameset.htm
    SAP Demo Program about DOI: SAPRDEMOEXCELINTEGRATION.
    the fm you mentioned works on OLE
    so you could refer,
    SAP document about OLE:
    http://help.sap.com/saphelp_46c/helpdata/EN/59/ae3c98488f11d189490000e829fbbd/frameset.htm
    Also you can refer this post
    Download of SRM Contracts in Excel - Unit of Measurement Missing
    Let me know if this works ..
    Regards
    Manthan.
    Edited by: Manthan_R on Feb 23, 2010 12:18 PM

  • Upload data from Excel to Internal table

    Hi,
    I am facing a peculiar problem in uploading the data in excel sheet to internal table.
    The excel file contains material number and product hierarchy number. The product hierarchy number for some material is downloaded as 5.73101E17 for the value 573100910115782000. Though I expand the sheet the display is the same 5.73101E17. When i upload the sheet using the f'n module "ALSM_EXCEL_TO_INTERNAL_TABLE" the value is taken as it is (5.73101E+17) into the internal table which is wrong. I tried to change the data type to type n. Then the value is uploaded as 5731011700000000.
    Please propose a solution to this without having to change the format of the column from general to "number without decimals"
    Regards,
    Sam

    HI
    see this example code which EXCEL TO INTERNAL TABLE AND THEN TO APPLICATION
    *& Report  ZSD_EXCEL_INT_APP
    REPORT  ZSD_EXCEL_INT_APP.
    parameter: file_nm type localfile.
    types : begin of it_tab1,
            f1(20),
            f2(40),
            f3(20),
           end of it_tab1.
    data : it_tab type table of ALSMEX_TABLINE with header line,
           file type rlgrap-filename.
    data : it_tab2 type it_tab1 occurs 1,
           wa_tab2 type it_tab1,
           w_message(100)  TYPE c.
    at selection-screen on value-request for file_nm.
    CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
    EXPORTING
      PROGRAM_NAME        = SYST-REPID
      DYNPRO_NUMBER       = SYST-DYNNR
      FIELD_NAME          = ' '
       STATIC              = 'X'
      MASK                = ' '
      CHANGING
       file_name           = file_nm
    EXCEPTIONS
       MASK_TOO_LONG       = 1
       OTHERS              = 2
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    start-of-selection.
    refresh it_tab2[].clear wa_tab2.
    file = file_nm.
    CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
      EXPORTING
        filename                      = file
        i_begin_col                   = '1'
        i_begin_row                   =  '1'
        i_end_col                     = '10'
        i_end_row                     = '35'
      tables
        intern                        = it_tab
    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.
    loop at it_tab.
      case it_tab-col.
       when '002'.
        wa_tab2-f1 = it_tab-value.
       when '004'.
        wa_tab2-f2 = it_tab-value.
      when '008'.
        wa_tab2-f3 = it_tab-value.
    endcase.
    at end of row.
      append wa_tab2 to it_tab2.
    clear wa_tab2.
      endat.
    endloop.
    data : p_file TYPE  rlgrap-filename value 'TEST3.txt'.
    OPEN DATASET p_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
    *--- Display error messages if any.
      IF sy-subrc NE 0.
        MESSAGE e001(zsd_mes).
        EXIT.
      ELSE.
    *---Data is downloaded to the application server file path
        LOOP AT it_tab2 INTO wa_tab2.
          TRANSFER wa_tab2 TO p_file.
        ENDLOOP.
      ENDIF.
    *--Close the Application server file (Mandatory).
      CLOSE DATASET p_file.
    loop at it_tab2 into wa_tab2.
      write : / wa_tab2-f1,wa_tab2-f2,wa_tab2-f3.
    endloop.

  • Upload data from Excel to Internal table in ECC

    Hello SDN,
    Here I am facing a problem for uploading the data from excel sheet to internal table in ECC6.0
    Main problem is we don't have any FM ALSM_EXCEL_TO_INTERNAL_TABLE.
    Please provide me the solution how to upload the data from excel to internal table through class. If possible please provide me the sample code so that it will be very helpful for me.
    Waitingfor your valuable response.
    Thanks & Regards,
    Kumar.

    Hi,
    you can use OLE to acces (not only) excel, but this will only work in dialog processing.
    regards,
    Hans

  • To upload data from excel to internal table

    hi
    in excel sheet it contains 4 tabs.to upload data from excel to internal table i have used this fm
    text_convert_xls_to_sap .but error wil comeing.that error in tables parameter.iternal table does not contain data.ple help me.(v 6.0) ple give me one example with coding

    Hello,
    Take a look on this: [ABAP - Upload data from Excel to Sap using OO|https://wiki.sdn.sap.com/wiki/x/xOw].
    Regards.

  • How to transfer data from a dynamic internal table

    Hi All
    I want to transfer data from a dynamic internal table<dyn_table>
    to a non dynamic internal table itab which should have the same structure as <dyn_table>.
    How can this be done?
    Regards,
    Harshit Rungta

    As stated earlier this can be done only through field symbols...
    You cannot create an non dynamic internal table with ANY structure...using DATA statement
    If the strucutre is defined well and good...you can create an non-dynamic internal table...
    If you do not know the structure then the internal table has to be dynamic...and to be generated using field symbols
    DATA: lv_ref TYPE REF TO data.
    FIELD-SYMBOLS: <fs_dyn_table> TYPE STANDARD TABLE.
    * You create a dynamic internal table...
    CREATE DATA lv_ref LIKE (your_dynamic_internal_table).
    ASSIGN lv_ref->* TO <fs_dyn_table>.
    Now...do the transfer.
    <fs_dyn_table> = "your_dynamic_internal_Table
    Hope it helps!

  • Data upload from excel into SAP

    Hi Gurus
    Could anyone please guide me how to upload excel data into SAP?
    I need to update existing Gross weight and Net weight data. Got new data in excel format.So need to upload excel file straight into SAP and update the data.
    Step by step procedure will be much appreciated.
    Rgds
    Utpal

    try with bdc .....
    below coding is move the data from excel to internal table ....
    TYPES: BEGIN OF s_ovro,
              VKORG LIKE V_TVSFK-VKORG,
              VTWEG LIKE V_TVSFK-VTWEG,
              SPART LIKE V_TVSFK-SPART,
              STGKU LIKE V_TVSFK-STGKU,
              STGAK LIKE V_TVSFK-STGAK,
              STAFO LIKE V_TVSFK-STAFO,
           END OF s_ovro.
    DATA: I_OVRO TYPE TABLE OF s_ovro,
          w_ovro type s_ovro.
    data : request(15) type c,
            i type c.
    DATA : IT_EXCEL TYPE STANDARD TABLE OF ALSMEX_TABLINE WITH HEADER LINE.
    FIELD-SYMBOLS: <FS1> TYPE ANY.
    include bdcrecx1.
    SELECTION-SCREEN BEGIN OF BLOCK DATA WITH FRAME.
    PARAMETERS: P_FILE TYPE  RLGRAP-FILENAME DEFAULT 'C:\Documents and Settings\itfactory\Desktop\sd1.xls' OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK DATA.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
      CALL FUNCTION 'F4_FILENAME'
        EXPORTING
          PROGRAM_NAME  = SYST-CPROG
          DYNPRO_NUMBER = SYST-DYNNR
          FIELD_NAME    = 'P_FILE'
        IMPORTING
          FILE_NAME     = P_FILE.
    start-of-selection.
    CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
        EXPORTING
          FILENAME                = P_FILE
          I_BEGIN_COL             = 1
          I_BEGIN_ROW             = 1
          I_END_COL               = 24
          I_END_ROW               = 60000
        TABLES
          INTERN                  = IT_EXCEL
        EXCEPTIONS
          INCONSISTENT_PARAMETERS = 1
          UPLOAD_OLE              = 2
          OTHERS                  = 3.
      LOOP AT IT_EXCEL.
        ASSIGN COMPONENT IT_EXCEL-COL OF STRUCTURE
        W_ovro TO <FS1>.
        <FS1> = IT_EXCEL-VALUE.
        AT END OF ROW.
         MOVE-CORRESPONDING: Wib TO Iib.
          APPEND w_ovro to I_ovro.
          CLEAR W_ovro.
        ENDAT.
      ENDLOOP.
    through bdc program update the data from internal table to bdc...

  • Problem converting data in XML file to internal table data

    Hi all,
    I have a requirement. I need to convert an XML file to internal table data and based on that data do Goods Receipt in SAP.
    With the help of this blog /people/r.eijpe/blog/2005/11/10/xml-dom-processing-in-abap-part-i--convert-an-abap-table-into-xml-file-using-sap-dom-approach
    I am able to convert the XML file to data in SAP. But this blog will display the output on screen as ELELEMNT = nodename VALUE= value of that node.
    But I donu2019t want in that way, I want to store all the data in XML file in an internal table so that I can make use of those values and do Goods Recipt in SAP.
    Can some one suggest how should I read the data in an internal table.
    Here is my code..what changes should I make?
    *& Report  z_xit_xml_check
      REPORT  z_xit_xml_check.
      TYPE-POOLS: ixml.
      TYPES: BEGIN OF t_xml_line,
              data(256) TYPE x,
            END OF t_xml_line.
      DATA: l_ixml            TYPE REF TO if_ixml,
            l_streamfactory   TYPE REF TO if_ixml_stream_factory,
            l_parser          TYPE REF TO if_ixml_parser,
            l_istream         TYPE REF TO if_ixml_istream,
            l_document        TYPE REF TO if_ixml_document,
            l_node            TYPE REF TO if_ixml_node,
            l_xmldata         TYPE string.
      DATA: l_elem            TYPE REF TO if_ixml_element,
            l_root_node       TYPE REF TO if_ixml_node,
            l_next_node       TYPE REF TO if_ixml_node,
            l_name            TYPE string,
            l_iterator        TYPE REF TO if_ixml_node_iterator.
      DATA: l_xml_table       TYPE TABLE OF t_xml_line,
            l_xml_line        TYPE t_xml_line,
            l_xml_table_size  TYPE i.
      DATA: l_filename        TYPE string.
      PARAMETERS: pa_file TYPE char1024 DEFAULT 'c:\temp\orders_dtd.xml'.
    Validation of XML file: Only DTD included in xml document is supported
      PARAMETERS: pa_val  TYPE char1 AS CHECKBOX.
      START-OF-SELECTION.
      Creating the main iXML factory
        l_ixml = cl_ixml=>create( ).
      Creating a stream factory
        l_streamfactory = l_ixml->create_stream_factory( ).
        PERFORM get_xml_table CHANGING l_xml_table_size l_xml_table.
      wrap the table containing the file into a stream
        l_istream = l_streamfactory->create_istream_itable( table = l_xml_table
                                                        size  = l_xml_table_size ).
      Creating a document
        l_document = l_ixml->create_document( ).
      Create a Parser
        l_parser = l_ixml->create_parser( stream_factory = l_streamfactory
                                          istream        = l_istream
                                          document       = l_document ).
      Validate a document
        IF pa_val EQ 'X'.
          l_parser->set_validating( mode = if_ixml_parser=>co_validate ).
        ENDIF.
      Parse the stream
        IF l_parser->parse( ) NE 0.
          IF l_parser->num_errors( ) NE 0.
            DATA: parseerror TYPE REF TO if_ixml_parse_error,
                  str        TYPE string,
                  i          TYPE i,
                  count      TYPE i,
                  index      TYPE i.
            count = l_parser->num_errors( ).
            WRITE: count, ' parse errors have occured:'.
            index = 0.
            WHILE index < count.
              parseerror = l_parser->get_error( index = index ).
              i = parseerror->get_line( ).
              WRITE: 'line: ', i.
              i = parseerror->get_column( ).
              WRITE: 'column: ', i.
              str = parseerror->get_reason( ).
              WRITE: str.
              index = index + 1.
            ENDWHILE.
          ENDIF.
        ENDIF.
      Process the document
        IF l_parser->is_dom_generating( ) EQ 'X'.
          PERFORM process_dom USING l_document.
        ENDIF.
    *&      Form  get_xml_table
      FORM get_xml_table CHANGING l_xml_table_size TYPE i
                                  l_xml_table      TYPE STANDARD TABLE.
      Local variable declaration
        DATA: l_len      TYPE i,
              l_len2     TYPE i,
              l_tab      TYPE tsfixml,
              l_content  TYPE string,
              l_str1     TYPE string,
              c_conv     TYPE REF TO cl_abap_conv_in_ce,
              l_itab     TYPE TABLE OF string.
        l_filename = pa_file.
      upload a file from the client's workstation
        CALL METHOD cl_gui_frontend_services=>gui_upload
          EXPORTING
            filename   = l_filename
            filetype   = 'BIN'
          IMPORTING
            filelength = l_xml_table_size
          CHANGING
            data_tab   = l_xml_table
          EXCEPTIONS
            OTHERS     = 19.
        IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                     WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
      Writing the XML document to the screen
        CLEAR l_str1.
        LOOP AT l_xml_table INTO l_xml_line.
          c_conv = cl_abap_conv_in_ce=>create( input = l_xml_line-data replacement = space  ).
          c_conv->read( IMPORTING data = l_content len = l_len ).
          CONCATENATE l_str1 l_content INTO l_str1.
        ENDLOOP.
        l_str1 = l_str1+0(l_xml_table_size).
        SPLIT l_str1 AT cl_abap_char_utilities=>cr_lf INTO TABLE l_itab.
        WRITE: /.
        WRITE: /' XML File'.
        WRITE: /.
        LOOP AT l_itab INTO l_str1.
          REPLACE ALL OCCURRENCES OF cl_abap_char_utilities=>horizontal_tab IN
            l_str1 WITH space.
          WRITE: / l_str1.
        ENDLOOP.
        WRITE: /.
      ENDFORM.                    "get_xml_table
    *&      Form  process_dom
      FORM process_dom USING document TYPE REF TO if_ixml_document.
        DATA: node      TYPE REF TO if_ixml_node,
              iterator  TYPE REF TO if_ixml_node_iterator,
              nodemap   TYPE REF TO if_ixml_named_node_map,
              attr      TYPE REF TO if_ixml_node,
              name      TYPE string,
              prefix    TYPE string,
              value     TYPE string,
              indent    TYPE i,
              count     TYPE i,
              index     TYPE i.
        node ?= document.
        CHECK NOT node IS INITIAL.
        ULINE.
        WRITE: /.
        WRITE: /' DOM-TREE'.
        WRITE: /.
        IF node IS INITIAL. EXIT. ENDIF.
      create a node iterator
        iterator  = node->create_iterator( ).
      get current node
        node = iterator->get_next( ).
      loop over all nodes
        WHILE NOT node IS INITIAL.
          indent = node->get_height( ) * 2.
          indent = indent + 20.
          CASE node->get_type( ).
            WHEN if_ixml_node=>co_node_element.
            element node
              name    = node->get_name( ).
              nodemap = node->get_attributes( ).
              WRITE: / 'ELEMENT  :'.
              WRITE: AT indent name COLOR COL_POSITIVE INVERSE.
              IF NOT nodemap IS INITIAL.
              attributes
                count = nodemap->get_length( ).
                DO count TIMES.
                  index  = sy-index - 1.
                  attr   = nodemap->get_item( index ).
                  name   = attr->get_name( ).
                  prefix = attr->get_namespace_prefix( ).
                  value  = attr->get_value( ).
                  WRITE: / 'ATTRIBUTE:'.
                  WRITE: AT indent name  COLOR COL_HEADING INVERSE, '=',
                                   value COLOR COL_TOTAL   INVERSE.
                ENDDO.
              ENDIF.
            WHEN if_ixml_node=>co_node_text OR
                 if_ixml_node=>co_node_cdata_section.
            text node
              value  = node->get_value( ).
              WRITE: / 'VALUE     :'.
              WRITE: AT indent value COLOR COL_GROUP INVERSE.
          ENDCASE.
        advance to next node
          node = iterator->get_next( ).
        ENDWHILE.
      ENDFORM.                    "process_dom
    Any help would be highly apperciated.
    regards,
    Jessica Sam

    Pavel Vera,
    With your example i tries doing the following .....
    I tried  to convert the data of XML file to internal table data. I am collecting the data in internal table to do goos recipt with that data.
    Please find my XML file, ABAP pgm and XSLT pgm . I donu2019t know what I am missing I am not getting any output. I donu2019t know what is wrong please help me with this
    Below is my XML file, My code and XSLT Program. In the below XML file I need to collect Vendor Number, Order Number, and Date tags which occur only once for one XML file.
    I also need to collect the following tags from <Shipmentdetail>
    <Shipmentdetail> has following child nodes and I need to collect them
    TrackingNumber
    Freight
    Weight
    ShipmentDate
    ShipmentMethod
    Need to collect to collect the following tags from <ProductInformation>
    <ProductInformation> has following child nodes and I need to collect them
        LineNumber
        SKUNumber
        OrderedQuantity
        ShippedQuantity
        UOM
    The <Shipmentdetail> and <ProductInformation> are child nodes of <OrderShipment>
    The <Shipmentdetail> occurs only ones but the <ProductInformation> can occur once or many times and will be dynamic and differs depening on the input file.
    My XML file is as follows
    <?xml version="1.0" encoding="iso-8859-1" ?>
    - <ShipmentHeader>
      <AccountID />
    - <OrderShipment>
          <VendorNumber>1000</VendorNumber>
          <OrderNumber>P00009238</OrderNumber>
          <OrderType>Stock</OrderType>
          <Company />
          <Division />
         <Department />
         <Date>20061120</Date>
         <CartonCount>2</CartonCount>
         <ShipAllProducts>No</ShipAllProducts>
    -             <ShipmentDetail>
                      <TrackingNumber>1ZR3W891PG47477811</TrackingNumber>
                      <Freight>000000010000</Freight>
                      <ShipmentDate>20061120</ShipmentDate>
                      <ShipmentMethod>UPS1PS</ShipmentMethod>
                 </ShipmentDetail>
    -            <ProductInformation>
                     <LineNumber>000000001</LineNumber>
                     <SKUNumber>110FR</SKUNumber>
                     <AdvSKUNumber>003 4518</AdvSKUNumber>
                     <SKUID />
                     <OrderedQuantity>00000001000000</OrderedQuantity>
                     <ShippedQuantity>00000001000000</ShippedQuantity>
                     <UOM>EA</UOM>
                     <Factor>1</Factor>
                </ProductInformation>
    -           <ProductInformation>
                    <LineNumber>000000002</LineNumber>
                    <SKUNumber>938EN</SKUNumber>
                    <AdvSKUNumber>001 7294</AdvSKUNumber>
                    <SKUID />
                    <OrderedQuantity>00000000450000</OrderedQuantity>
                    <ShippedQuantity>00000000450000</ShippedQuantity>
                    <UOM>EA</UOM>
                    <Factor>1</Factor>
                </ProductInformation>
    -           <CaseInformation>
                   <LineNumber>000000001</LineNumber>
                   <SKUNumber>110FR</SKUNumber>
                   <AdvSKUNumber>003 4518</AdvSKUNumber>
                   <SKUID />
                   <SSCCNumber>00000001668000002487</SSCCNumber>
                   <CaseQuantity>00000001000000</CaseQuantity>
                   <UOM>EA</UOM>
                   <Factor>1</Factor>
                 </CaseInformation>
                 <CaseInformation>
                   <LineNumber>000000001</LineNumber>
                   <SKUNumber>110FR</SKUNumber>
                   <AdvSKUNumber>003 4518</AdvSKUNumber>
                   <SKUID />
                   <SSCCNumber>00000001668000002487</SSCCNumber>
                   <CaseQuantity>00000001000000</CaseQuantity>
                   <UOM>EA</UOM>
                   <Factor>1</Factor>
                 </CaseInformation>
    -  </OrderShipment>
      </ShipmentHeader>
    My Program
    TYPE-POOLS abap.
    CONSTANTS gs_file TYPE string VALUE 'C:\temp\test.xml'.
    * This is the structure for the data from the XML file
    TYPES: BEGIN OF ts_shipment,
             VendorNumber(10)     TYPE n,
             OrderNumber(20)      TYPE n,
             OrderType(8)         TYPE c,
             Date(8)              TYPE c,
           END OF ts_shipment.
    TYPES: BEGIN OF ts_shipmentdetail,
             TrackingNumber(30)     TYPE n,
             Freight(12)            TYPE n,
             Weight(14)             TYPE n,
             ShipmentDate(8)        TYPE c,
             ShipmentMethod(8)      TYPE c,
             END OF ts_shipmentdetail.
    TYPES: BEGIN OF ts_productinformation,
             LineNumber(9)          TYPE n,
             SKUNumber(20)          TYPE c,
             OrderedQuantity(14)    TYPE n,
             ShippedQuantity(14)    TYPE n,
             UOM(4)                 TYPE c,
             END OF ts_productinformation.
    * Table for the XML content
    DATA: gt_itab       TYPE STANDARD TABLE OF char2048.
    * Table and work ares for the data from the XML file
    DATA: gt_shipment               TYPE STANDARD TABLE OF ts_shipment,
          gs_shipment               TYPE ts_shipment.
    DATA: gt_shipmentdetail         TYPE STANDARD TABLE OF ts_shipmentdetail,
          gs_shipmentdetail         TYPE ts_shipmentdetail.
    DATA: gt_productinformation     TYPE STANDARD TABLE OF ts_productinformation,
          gs_productinformation     TYPE ts_productinformation.
    * Result table that contains references
    * of the internal tables to be filled
    DATA: gt_result_xml TYPE abap_trans_resbind_tab,
          gs_result_xml TYPE abap_trans_resbind.
    * For error handling
    DATA: gs_rif_ex     TYPE REF TO cx_root,
          gs_var_text   TYPE string.
    * Get the XML file from your client
    CALL METHOD cl_gui_frontend_services=>gui_upload
      EXPORTING
        filename                = gs_file
      CHANGING
        data_tab                = gt_itab
      EXCEPTIONS
        file_open_error         = 1
        file_read_error         = 2
        no_batch                = 3
        gui_refuse_filetransfer = 4
        invalid_type            = 5
        no_authority            = 6
        unknown_error           = 7
        bad_data_format         = 8
        header_not_allowed      = 9
        separator_not_allowed   = 10
        header_too_long         = 11
        unknown_dp_error        = 12
        access_denied           = 13
        dp_out_of_memory        = 14
        disk_full               = 15
        dp_timeout              = 16
        not_supported_by_gui    = 17
        error_no_gui            = 18
        OTHERS                  = 19.
    IF sy-subrc <> 0.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    * Fill the result table with a reference to the data table.
    * Within the XSLT stylesheet, the data table can be accessed with
    * "ISHIPMENT".
    GET REFERENCE OF gt_shipment INTO gs_result_xml-value.
    gs_result_xml-name = 'ISHIPMENT'.
    APPEND gs_result_xml TO gt_result_xml.
    * Fill the result table with a reference to the data table.
    * Within the XSLT stylesheet, the data table can be accessed with
    * "ISHIPDET".
    GET REFERENCE OF gt_shipmentdetail INTO gs_result_xml-value.
    gs_result_xml-name = 'ISHIPDET'.
    APPEND gs_result_xml TO gt_result_xml.
    * Fill the result table with a reference to the data table.
    * Within the XSLT stylesheet, the data table can be accessed with
    * "IPRODDET".
    GET REFERENCE OF gt_productinformation  INTO gs_result_xml-value.
    gs_result_xml-name = 'IPRODDET'.
    APPEND gs_result_xml TO gt_result_xml.
    * Perform the XSLT stylesheet
    TRY.
        CALL TRANSFORMATION z_xml_to_abap3
        SOURCE XML gt_itab
        RESULT (gt_result_xml).
      CATCH cx_root INTO gs_rif_ex.
        gs_var_text = gs_rif_ex->get_text( ).
        MESSAGE gs_var_text TYPE 'E'.
    ENDTRY.
    * Writing the data from file for gt_shipment
    *Collecting the Shipping Data from the XML file to internal table gt_shipment
    *and writing the data to the screen
    LOOP AT gt_shipment INTO gs_shipment.
      WRITE: / 'VendorNumber:', gs_shipment-VendorNumber.
      WRITE: / 'OrderNumber :', gs_shipment-OrderNumber.
      WRITE: / 'OrderType  :', gs_shipment-OrderType.
      WRITE: / 'Date  :',      gs_shipment-Date.
      WRITE : /.
    ENDLOOP. "gt_shipment.
    LOOP AT gt_shipmentdetail INTO gs_shipmentdetail.
      WRITE: / 'TrackingNumber:',     gs_shipmentdetail-TrackingNumber.
      WRITE: / 'Freight :',           gs_shipmentdetail-Freight.
      WRITE: / 'Weight  :',           gs_shipmentdetail-Weight.
      WRITE: / 'ShipmentDate  :',     gs_shipmentdetail-ShipmentDate.
    * WRITE: / 'ShipmentMethod  :'    gs_shipmentdetail-ShipmentMethod
      WRITE : /.
    ENDLOOP. "gt_shipmentdetail.
    LOOP AT gt_productinformation INTO gs_productinformation.
      WRITE: / 'LineNumber:',         gs_productinformation-LineNumber.
      WRITE: / 'SKUNumber :',         gs_productinformation-SKUNumber.
      WRITE: / 'OrderedQuantity  :',  gs_productinformation-OrderedQuantity.
      WRITE: / 'ShippedQuantity  :',  gs_productinformation-ShippedQuantity.
      WRITE: / 'UOM  :',              gs_productinformation-UOM.
      WRITE : /.
    ENDLOOP. "gt_productinformation.
    XSLT Program
    <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
      <xsl:output encoding="iso-8859-1" indent="yes" method="xml" version="1.0"/>
      <xsl:strip-space elements="*"/>
      <xsl:template match="/">
        <asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
          <asx:values>
            <ISHIPMENT>
              <xsl:apply-templates select="//OrderShipment"/>
            </ISHIPMENT>
          </asx:values>
        </asx:abap>
      </xsl:template>
      <xsl:template match="OrderShipment">
        <item>
          <VENDORNUMBER>
            <xsl:value-of select="VendorNumber"/>
          </VENDORNUMBER>
          <ORDERNUMBER>
            <xsl:value-of select="OrderNumber"/>
          </ORDERNUMBER>
          <ORDERTYPE>
            <xsl:value-of select="OrderType"/>
          </ORDERTYPE>
          <DATE>
            <xsl:value-of select="Date"/>
          </DATE>
        </item>
      </xsl:template>
      <xsl:template match="/">
        <asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
          <asx:values>
            <ISHIPDET>
              <xsl:apply-templates select="//OrderShipment/ShipmentDetail"/>
            </ISHIPDET>
          </asx:values>
        </asx:abap>
      </xsl:template>
      <xsl:template match="ShipmentDetail">
        <item>
          <TRACKINGNUMBER>
            <xsl:value-of select="TrackingNumber"/>
          </TRACKINGNUMBER>
          <FREIGHT>
            <xsl:value-of select="Freight"/>
          </FREIGHT>
          <SHIPMENTDATE>
            <xsl:value-of select="ShipmentDate"/>
          </SHIPMENTDATE>
          <SHIPMENTMETHOD>
            <xsl:value-of select="ShipmentMethod"/>
          </SHIPMENTMETHOD>
        </item>
      </xsl:template>
    </xsl:transform> .
    Any help is highly appreciated. If anyone encountered this situation before please let me know where i am going wrong in my XSLT transformation.
    Any Help will be highly apppreciated. Thanks in advance
    Regards,
    Jessica   Sam

  • Uploading excel file into internal table with field length more than 255

    I am trying to upload the data from an excel file through function module 'TEXT_CONVERT_XLS_TO_SAP'.
    I have tested by changing the field type from string, and char2000.
    But it is accepting only 255 chars from the cell content.
    How to get the total content of the field if it is more than 255 char.

    hi,
      you can use any of the following procedures:
    For uploading data from excel to internal table refer standard report  RC1TCG3Z  in se38 :
                                               or
    You can use the FM 'ALSM_EXCEL_TO_INTERNAL_TABLE' itself. Please check if you have done it this way . But,  this FM can be a little time consuming if the excel has large data, so you can use the FM u2018GUI_UPLOADu2019.
    CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
            EXPORTING
              filename                = p_file1
              i_begin_col          = l_b1
              i_begin_row        = l_c1
             i_end_col               = l_b2
             i_end_row             = l_c2
           TABLES
              intern                  = lt_data
            EXCEPTIONS
             inconsistent_parameters = 1
            upload_ole              = 2
              OTHERS                  = 3.
          IF sy-subrc <> 0.
            MESSAGE e018 DISPLAY LIKE 'i'.
         ENDIF.
    *---Removing the first heading fields from the file.
          IF NOT lt_data[] IS INITIAL.
            LOOP AT lt_data INTO lwa_data WHERE row = '0001'.
              DELETE lt_data.
              CLEAR lwa_data.
            ENDLOOP.
    *---Inserting the data from file the internal table
            LOOP AT lt_data INTO lwa_data.
              CASE lwa_data-col.
                WHEN 1.
                  wa_file_wicopa-serial = lwa_data-value.
                WHEN 2.
                  wa_file_wicopa-blart = lwa_data-value.
                WHEN 3.
                  wa_file_wicopa-bldat = lwa_data-value.
                WHEN 4.
                  wa_file_wicopa-budat = lwa_data-value.
              ENDCASE.
              AT END OF row.
                APPEND wa_file_wicopa TO gt_file_wicopa.
                CLEAR wa_file_wicopa.
              ENDAT.
              CLEAR lwa_data.
            ENDLOOP.
          ENDIF.
        ENDIF.
                                                or
    DATA: it_test TYPE STANDARD TABLE OF alsmex_tabline WITH HEADER LINE.
    DATA :v_start_col TYPE i VALUE '1',
          v_start_row TYPE i VALUE '1',
          v_end_col TYPE i VALUE '256',
          v_end_row TYPE i VALUE '65536',
          v_text TYPE repti.
    * Funtion Module to upload values from excel to the Internal table
      CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
        EXPORTING
          filename                = p_file
          i_begin_col             = v_start_col
          i_begin_row             = v_start_row
          i_end_col               = v_end_col
          i_end_row               = v_end_row
        TABLES
          intern                  = it_test
        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.
                             Or
    You can use FM u201CTEXT_CONVERT_XLS_TO_SAPu201D.
    DATA : i_raw TYPE truxs_t_text_data.
    CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
        EXPORTING
          i_field_seperator          = 'X'
          i_tab_raw_data             = i_raw
          i_filename                 = p_path
        TABLES
          i_tab_converted_data       = itab
    EXCEPTIONS
       conversion_failed          = 1
       OTHERS                     = 2
    hope it will help u
    regards
    rahul

  • Uploading a file to internal table

    Hi experts,
    I have a peculiar problem with loading a file into internal table.
    While loading the file the first record(line) only is getting uploaded in to the internal table, although i hve many records(lines).
    what could be the problem.
    thnx very much,
    the code is something like this:
    data: begin of t_line occurs 0,   
             data(150) type c,           
          end of t_line.
    OPEN DATASET FILENAME FOR INPUT IN TEXT MODE.
    if sy-subrc = 0.
    perform process_file_contents.
    FORM PROCESS_FILE_CONTENTS.
      DO.                       
         read dataset filename into t_line.        
        IF SY-SUBRC NE 0.
          IF REC_READ < 1.
            MESSAGE E009(ZM) WITH 'No records in the file' FILENAME.
          ENDIF.
          EXIT.
        ELSE.
           ADD 1 TO REC_READ.
        ENDIF.
           append t_line.
    ENDDO.

    Hi sey ni,
    check if this sample code can be of some help to u.:
    TABLES: kna1.
    TYPES: BEGIN OF s_file,
             customer TYPE kna1-kunnr,
             name     TYPE kna1-name1,
             country  TYPE kna1-land1,
             region   TYPE kna1-regio,
             post_code TYPE kna1-pstlz,
             street    TYPE kna1-stras,
          END OF s_file.
    DATA: it_file TYPE s_file OCCURS 0 WITH HEADER LINE.
    *-- selection screen
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    PARAMETERS: p_file TYPE rlgrap-filename DEFAULT 'Customer_download.txt'
    OBLIGATORY.
    *SELECT-OPTIONS s_cust FOR kna1-kunnr.
    SELECTION-SCREEN END OF BLOCK b1.
    *-- start processing
    at selection-screen on value-request for p_file.
    perform file_help using p_file.
    START-OF-SELECTION.
    **-- Extract data from DB
    PERFORM extract_data.
    *-- Transfer data to file
      PERFORM file_transfer USING p_file.
    *-- write to o/p
    END-OF-SELECTION.
      LOOP AT it_file.
    WRITE:/ it_file-customer, it_file-name, it_file-country, it_file-region,
    it_file-post_code, it_file-street.
      ENDLOOP.
    *&      Form  extract_data
    FORM extract_data .
    SELECT kunnr
            name1
            land1
            regio
            pstlz
            stras
       APPENDING TABLE it_file
       FROM kna1
       WHERE kunnr IN s_cust.
    ENDFORM.                    " extract_data
    *&      Form  file_transfer
    FORM file_transfer  USING    p_p_file.
      DATA: l_message(30).
    *-- Open File for write
      OPEN DATASET p_p_file FOR INPUT IN TEXT MODE ENCODING DEFAULT MESSAGE
    l_message.
      IF sy-subrc NE 0.
        MESSAGE i002 WITH p_p_file.
      ENDIF.
    *-- Transfer data from FILE TO internal table
      DO.
        READ DATASET p_p_file  INTO it_file.
        IF sy-subrc = 0.
          APPEND it_file.
          CLEAR it_file.
        ELSE.
          EXIT.
        ENDIF.
      ENDDO.
    *-- Close file
      CLOSE DATASET p_p_file.
      endform.
    *&      Form  file_hepl
          text
         -->P_P_FILE  text
    form file_help  using    p_p_file.
    data:l_filepath type ibipparms-path.
    CALL FUNCTION 'F4_FILENAME'
                     EXPORTING
                       PROGRAM_NAME        = SYST-CPROG
                       DYNPRO_NUMBER       = SYST-DYNNR
                       FIELD_NAME          = ' '
                      IMPORTING
                        FILE_NAME           = l_filepath
    p_p_file = l_filepath .
    endform.                    " file_hepl
    regards,
    keerthi.

  • Logic for retreiving the values from a dynamic internal table

    Hi all,
    I have an issue with the logic to fetch data from a dynamic internal table into fields. let me give you guys an example the sy-tfill = 9 (subject to vary). I need to populate the fields.
    Regards,
    Sukumar

    Hi,
    this is for printing out the info in a dynamic table,
    it will work likewise to insert data.
    PARAMETERS:
      p_tabnam TYPE tabname DEFAULT 'DB_TABLE_NAME'.
    DATA:
      lv_dref TYPE REF TO data,
      ls_dd03l LIKE dd03l,
      lt_fieldname TYPE TABLE OF fieldname,
      ls_fieldname TYPE fieldname.
    FIELD-SYMBOLS:
      <fs> TYPE STANDARD TABLE,
      <wa_comp> TYPE fieldname,
      <wa_data> TYPE ANY,
      <wa_field> TYPE ANY.
    REFRESH lt_fieldname.
    SELECT * FROM dd03l INTO ls_dd03l
                       WHERE as4local = 'A'
                         AND as4vers  = '0000'
                         AND tabname  = p_tabnam
                       ORDER BY position.
      ls_fieldname = ls_dd03l-fieldname.
      APPEND ls_fieldname TO lt_fieldname.
    ENDSELECT.
    IF NOT ( lt_fieldname[] IS INITIAL ).
      CREATE DATA lv_dref TYPE TABLE OF (p_tabnam).
      ASSIGN lv_dref->* TO <fs>.
      SELECT * FROM (p_tabnam) INTO TABLE <fs>.
      WRITE:
        / 'CONTENTS OF TABLE', p_tabnam.
      LOOP AT <fs> ASSIGNING <wa_data>.
        SKIP.
        WRITE:
          / 'LINE', sy-tabix.
        ULINE.
        LOOP AT lt_fieldname ASSIGNING <wa_comp>.
          ASSIGN COMPONENT sy-tabix OF STRUCTURE <wa_data> TO <wa_field>.
          WRITE:
            / <wa_comp>, <wa_field>.
        ENDLOOP.
      ENDLOOP.
    ENDIF.
    grtz
    Koen

  • Upload excel file to internal table in web dynpro program

    Hi friend's
    In web dynpro program how to upload excel file into  internal table and finally data will be save Y table.

    hi,
    See the properties of File Upload UI element..
    Link: [http://help.sap.com/saphelp_nw70ehp1/helpdata/en/48/732f0510d83ff6e10000000a42189c/frameset.htm]
    Goto References -> User Interface Elements -> Integration Category -> File upload..
    After creating the 'FILE UPLOAD' element in a view.. Bind a datasource(a context attribute with STRING) with the data property..
    Double click on ONACTION_UPLOAD method. Write a code as given below.
    METHOD onactionon_upload .
    TYPES :   BEGIN OF str_itab,
           name(10) TYPE c,
           age(10) TYPE c,
           END OF str_itab.  DATA : t_table1 TYPE STANDARD TABLE OF str_itab,
             i_data TYPE STANDARD TABLE OF string,
             l_string TYPE string,
             fs_table TYPE str_itab,
             l_xstring TYPE xstring,
             fields TYPE string_table,
             lv_field TYPE string.
    DATA : t_table TYPE if_main=>elements_data_tab,
             data_table TYPE if_main=>elements_data_tab.
    * get single attribute 
    wd_context->get_attribute(  
    EXPORTING    
    name =  `DATASOURCE`  
    IMPORTING    
    value = l_xstring ).
      CALL FUNCTION 'HR_KR_XSTRING_TO_STRING'
        EXPORTING
          in_xstring = l_xstring
        IMPORTING
          out_string = l_string. 
    SPLIT l_string  AT cl_abap_char_utilities=>newline INTO TABLE i_data.
    * Bind With table Element.
    LOOP AT i_data INTO l_string.
        SPLIT l_string AT cl_abap_char_utilities=>horizontal_tab INTO TABLE fields.
       READ TABLE fields INTO lv_field INDEX 1.
        fs_table-name = lv_field.  
    READ TABLE fields INTO lv_field INDEX 2.
        fs_table-age = lv_field.   
    APPEND fs_table TO t_table1.     "Append to  the internal  table
      ENDLOOP.
    Edited by: Rameshkumar Raamasamy on Feb 9, 2010 9:39 AM

  • How to schedule Job for data uploading from source to BI

    Hi to all,
    How to schedule Job for data uploading from source to BI,
    Why we required and how we do it.
    As I am fresher in BI, I need to know from bottom.
    Regards
    Pavneet Rana

    Hi.
    You can create [process chain |http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/502b2998-1017-2d10-1c8a-a57a35d52bc8?quicklink=index&overridelayout=true]for data loading pocess and schedule start process to any time/date etc ...
    Regadrs.

Maybe you are looking for

  • Listener load on system

    Hi, Here is some basic info about hardware / software I am running Oracle on: Hardware: Sun-Fire-V490 OS: Solaris 10 Oracle: 10g (10.02.04 patch set applied) I have three Oracle instances (PRD, TEST, DEV). Each of these instances are completely indep

  • Solutions for Acrobat X annoyances?

    I just upgraded to Acrobat X and must say I am very disappointed in some of the new layout "features". 1. The fading toolbar window at the bottom of the screen - this has to be one of the dumbest ideas that the programmers came up with. On Acrobat 9

  • Lost apps after 4.0.1 update

    I synced my phone before installing the new update. My phone had an error while performing the update and I had to restore my phone. Now that it is restored and updated, I am missing a bunch of apps. There are a few that were free when I got them and

  • Mobile Backups on mac taking up 1/3 of disk space

    Hello, So I was just cleaning up my mac. I went to 'about this mac' under the apple on finder, and went to storage. It says that backups are taking up 145.16GB of disk space. What does it mean by backups? Can I get rid of them? I do have time machine

  • Music drops when streaming to airport express

    music drops when streaming to airport express