Skip to Content
author's profile photo Former Member
Former Member

Upload Excel File data to ALV GRID

Hello,

I am new in ABAP, and i am trying to upload an Excel file to ALV. I am using the function "GUI_UPLOAD" to get the data from the excel to the internal table, but the data is not passing to my itenral table, i dont know what i am doing wrong, and would appreciate any help you guys could give me. The Excel file i am trying to pass is a table of Assets from a company.

Thank you very much in advance

Regards

Miguel

  1. *&---------------------------------------------------------------------*
  2. *& Report ZOPEN_XLS
  3. *&
  4. *&---------------------------------------------------------------------*
  5. *&
  6. *&
  7. *&---------------------------------------------------------------------*
  8. INCLUDE ZOPEN_XLS_TOP . " global Data
  9. * INCLUDE ZOPEN_XLS_O01 . " PBO-Modules
  10. * INCLUDE ZOPEN_XLS_I01 . " PAI-Modules
  11. INCLUDE ZOPEN_XLS_F01 . " FORM-Routines
  12. *****************Defenição de parametro de seleção
  13. PARAMETERS P_FILE(1024) TYPE C.
  14. *****************Evento para ativar o matchcode
  15. AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
  16. *****************Metodo para exibir o popup de seleção de arquivos
  17. CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG
  18. CHANGING
  19. FILE_TABLE = IT_FILE
  20. RC = V_RC
  21. EXCEPTIONS
  22. FILE_OPEN_DIALOG_FAILED = 1
  23. CNTL_ERROR = 2
  24. ERROR_NO_GUI = 3
  25. NOT_SUPPORTED_BY_GUI = 4
  26. OTHERS = 5.
  27. IF SY-SUBRC <> 0.
  28. MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
  29. WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  30. ELSE.
  31. ******************Identifica o arquivo selecionado e joga para o parametro de seleção
  32. READ TABLE IT_FILE INTO WA_FILE INDEX 1.
  33. P_FILE = WA_FILE-FILENAME.
  34. ENDIF.
  35. LV_FILE = P_FILE.
  36. START-OF-SELECTION.
  37. PERFORM F_UPLOAD.
  38. END-OF-SELECTION.
  39. IF NOT IT_OUTDATA IS INITIAL.
  40. PERFORM F_FIELDCAT_ALV.
  41. PERFORM F_DISPLAY_ALV.
  42. ENDIF.
  43. /////////////////////////////////////////////////////////////////////////////////////////////////////
  44. *&---------------------------------------------------------------------*
  45. *& Include ZOPEN_XLS_TOP Report ZOPEN_XLS
  46. *&
  47. *&---------------------------------------------------------------------*
  48. REPORT ZOPEN_XLS.
  49. TYPE-POOLS : SLIS.
  50. DATA: IT_FILE TYPE FILETABLE,
  51. WA_FILE TYPE FILE_TABLE,
  52. V_RC TYPE I.
  53. TYPES : BEGIN OF TY_OUTDATA,
  54. BUKRS TYPE ANLA-BUKRS,
  55. ANLN1 TYPE ANLA-ANLN1,
  56. ANLN2 TYPE ANLA-ANLN2,
  57. ANLKL TYPE ANLA-ANLKL,
  58. TXT50 TYPE ANLA-TXT50,
  59. MENGE TYPE ANLA-MENGE,
  60. GSBER TYPE ANLZ-GSBER,
  61. KOSTL TYPE ANLZ-KOSTL,
  62. STORT TYPE ANLZ-STORT,
  63. END OF TY_OUTDATA.
  64. DATA : IT_OUTDATA TYPE TABLE OF TY_OUTDATA,
  65. WA_OUTDATA TYPE TY_OUTDATA,
  66. IT_FCAT TYPE SLIS_T_FIELDCAT_ALV,
  67. WA_FCAT TYPE SLIS_FIELDCAT_ALV.
  68. **********************Variáveis para o GUI UPLOAD
  69. DATA LV_FILE TYPE STRING.
  70. //////////////////////////////////////////////////////////////////////////////////////////////////////
  71. *&---------------------------------------------------------------------*
  72. *& Include ZOPEN_XLS_F01
  73. *&---------------------------------------------------------------------*
  74. *&---------------------------------------------------------------------*
  75. *& Form F_UPLOAD
  76. *&---------------------------------------------------------------------*
  77. * text
  78. *----------------------------------------------------------------------*
  79. * --> p1 text
  80. * <-- p2 text
  81. *----------------------------------------------------------------------*
  82. FORM F_UPLOAD .
  83. *Função para fazer o upload e passar para a tabela interna.
  84. *Neste caso o tipo ASC é para arquivos TXT e Excel.
  85. *O tipo BIN é para word e pdf.
  86. CALL FUNCTION 'GUI_UPLOAD'
  87. EXPORTING
  88. FILENAME = LV_FILE
  89. FILETYPE = 'ASC'
  90. * HAS_FIELD_SEPARATOR = ' '
  91. * HEADER_LENGTH = 0
  92. * READ_BY_LINE = 'X'
  93. * DAT_MODE = ' '
  94. * CODEPAGE = ' '
  95. * IGNORE_CERR = ABAP_TRUE
  96. * REPLACEMENT = '#'
  97. * CHECK_BOM = ' '
  98. * VIRUS_SCAN_PROFILE =
  99. * NO_AUTH_CHECK = ' '
  100. * IMPORTING
  101. * FILELENGTH =
  102. * HEADER =
  103. TABLES
  104. DATA_TAB = IT_OUTDATA
  105. EXCEPTIONS
  106. FILE_OPEN_ERROR = 1
  107. FILE_READ_ERROR = 2
  108. NO_BATCH = 3
  109. GUI_REFUSE_FILETRANSFER = 4
  110. INVALID_TYPE = 5
  111. NO_AUTHORITY = 6
  112. UNKNOWN_ERROR = 7
  113. BAD_DATA_FORMAT = 8
  114. HEADER_NOT_ALLOWED = 9
  115. SEPARATOR_NOT_ALLOWED = 10
  116. HEADER_TOO_LONG = 11
  117. UNKNOWN_DP_ERROR = 12
  118. ACCESS_DENIED = 13
  119. DP_OUT_OF_MEMORY = 14
  120. DISK_FULL = 15
  121. DP_TIMEOUT = 16
  122. OTHERS = 17.
  123. IF SY-SUBRC <> 0.
  124. * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
  125. * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  126. ENDIF.
  127. ENDFORM.
  128. *&---------------------------------------------------------------------*
  129. *& Form F_FIELDCAT_ALV
  130. *&---------------------------------------------------------------------*
  131. * text
  132. *----------------------------------------------------------------------*
  133. * --> p1 text
  134. * <-- p2 text
  135. *----------------------------------------------------------------------*
  136. FORM F_FIELDCAT_ALV .
  137. REFRESH : IT_FCAT.
  138. CLEAR : WA_FCAT.
  139. WA_FCAT-ROW_POS = '1'.
  140. WA_FCAT-COL_POS = '1'.
  141. WA_FCAT-FIELDNAME = 'BUKRS'.
  142. WA_FCAT-TABNAME = 'IT_OUTDATA'.
  143. WA_FCAT-SELTEXT_L = TEXT-001.
  144. APPEND WA_FCAT TO IT_FCAT.
  145. CLEAR : WA_FCAT.
  146. WA_FCAT-ROW_POS = '1'.
  147. WA_FCAT-COL_POS = '2'.
  148. WA_FCAT-FIELDNAME = 'ANLN1'.
  149. WA_FCAT-TABNAME = 'IT_OUTDATA'.
  150. WA_FCAT-SELTEXT_L = TEXT-002.
  151. APPEND WA_FCAT TO IT_FCAT.
  152. CLEAR : WA_FCAT.
  153. WA_FCAT-ROW_POS = '1'.
  154. WA_FCAT-COL_POS = '3'.
  155. WA_FCAT-FIELDNAME = 'ANLN2'.
  156. WA_FCAT-TABNAME = 'IT_OUTDATA'.
  157. WA_FCAT-SELTEXT_L = TEXT-003.
  158. APPEND WA_FCAT TO IT_FCAT.
  159. CLEAR : WA_FCAT.
  160. WA_FCAT-ROW_POS = '1'.
  161. WA_FCAT-COL_POS = '4'.
  162. WA_FCAT-FIELDNAME = 'ANLKL'.
  163. WA_FCAT-TABNAME = 'IT_OUTDATA'.
  164. WA_FCAT-SELTEXT_L = TEXT-004.
  165. APPEND WA_FCAT TO IT_FCAT.
  166. CLEAR : WA_FCAT.
  167. WA_FCAT-ROW_POS = '1'.
  168. WA_FCAT-COL_POS = '5'.
  169. WA_FCAT-FIELDNAME = 'TXT50'.
  170. WA_FCAT-TABNAME = 'IT_OUTDATA'.
  171. WA_FCAT-SELTEXT_L = TEXT-005.
  172. APPEND WA_FCAT TO IT_FCAT.
  173. CLEAR : WA_FCAT.
  174. WA_FCAT-ROW_POS = '1'.
  175. WA_FCAT-COL_POS = '6'.
  176. WA_FCAT-FIELDNAME = 'MENGE'.
  177. WA_FCAT-TABNAME = 'IT_OUTDATA'.
  178. WA_FCAT-SELTEXT_L = TEXT-006.
  179. APPEND WA_FCAT TO IT_FCAT.
  180. CLEAR : WA_FCAT.
  181. WA_FCAT-ROW_POS = '1'.
  182. WA_FCAT-COL_POS = '7'.
  183. WA_FCAT-FIELDNAME = 'GSBER'.
  184. WA_FCAT-TABNAME = 'IT_OUTDATA'.
  185. WA_FCAT-SELTEXT_L = TEXT-007.
  186. APPEND WA_FCAT TO IT_FCAT.
  187. CLEAR : WA_FCAT.
  188. WA_FCAT-ROW_POS = '1'.
  189. WA_FCAT-COL_POS = '8'.
  190. WA_FCAT-FIELDNAME = 'KOSTL'.
  191. WA_FCAT-TABNAME = 'IT_OUTDATA'.
  192. WA_FCAT-SELTEXT_L = TEXT-008.
  193. APPEND WA_FCAT TO IT_FCAT.
  194. CLEAR : WA_FCAT.
  195. WA_FCAT-ROW_POS = '1'.
  196. WA_FCAT-COL_POS = '9'.
  197. WA_FCAT-FIELDNAME = 'STORT'.
  198. WA_FCAT-TABNAME = 'IT_OUTDATA'.
  199. WA_FCAT-SELTEXT_L = TEXT-009.
  200. APPEND WA_FCAT TO IT_FCAT.
  201. CLEAR : WA_FCAT.
  202. ENDFORM.
  203. *&---------------------------------------------------------------------*
  204. *& Form F_DISPLAY_ALV
  205. *&---------------------------------------------------------------------*
  206. * text
  207. *----------------------------------------------------------------------*
  208. * --> p1 text
  209. * <-- p2 text
  210. *----------------------------------------------------------------------*
  211. FORM F_DISPLAY_ALV .
  212. CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
  213. EXPORTING
  214. * I_INTERFACE_CHECK = ' '
  215. * I_BYPASSING_BUFFER = ' '
  216. * I_BUFFER_ACTIVE = ' '
  217. I_CALLBACK_PROGRAM = SY-REPID
  218. * I_CALLBACK_PF_STATUS_SET = ' '
  219. * I_CALLBACK_USER_COMMAND = ' '
  220. * I_CALLBACK_TOP_OF_PAGE = ' '
  221. * I_CALLBACK_HTML_TOP_OF_PAGE = ' '
  222. * I_CALLBACK_HTML_END_OF_LIST = ' '
  223. * I_STRUCTURE_NAME =
  224. * I_BACKGROUND_ID = ' '
  225. * I_GRID_TITLE =
  226. * I_GRID_SETTINGS =
  227. * IS_LAYOUT =
  228. IT_FIELDCAT = IT_FCAT
  229. * IT_EXCLUDING =
  230. * IT_SPECIAL_GROUPS =
  231. * IT_SORT =
  232. * IT_FILTER =
  233. * IS_SEL_HIDE =
  234. * I_DEFAULT = 'X'
  235. I_SAVE = 'A'
  236. * IS_VARIANT =
  237. * IT_EVENTS =
  238. * IT_EVENT_EXIT =
  239. * IS_PRINT =
  240. * IS_REPREP_ID =
  241. * I_SCREEN_START_COLUMN = 0
  242. * I_SCREEN_START_LINE = 0
  243. * I_SCREEN_END_COLUMN = 0
  244. * I_SCREEN_END_LINE = 0
  245. * I_HTML_HEIGHT_TOP = 0
  246. * I_HTML_HEIGHT_END = 0
  247. * IT_ALV_GRAPHICS =
  248. * IT_HYPERLINK =
  249. * IT_ADD_FIELDCAT =
  250. * IT_EXCEPT_QINFO =
  251. * IR_SALV_FULLSCREEN_ADAPTER =
  252. * IMPORTING
  253. * E_EXIT_CAUSED_BY_CALLER =
  254. * ES_EXIT_CAUSED_BY_USER =
  255. TABLES
  256. T_OUTTAB = IT_OUTDATA
  257. EXCEPTIONS
  258. PROGRAM_ERROR = 1
  259. OTHERS = 2.
  260. IF SY-SUBRC <> 0.
  261. * Implement suitable error handling here
  262. ENDIF.
  263. ENDFORM.
Assets.jpg (231.7 kB)
Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

7 Answers

  • Best Answer
    Posted on Nov 17, 2015 at 07:32 AM

    Hi Miguel,

    To upload the data from Excel to SAP try the FM: ALSM_EXCEL_TO_INTERNAL_TABLE, instead of GUI_UPLOAD.

    Try this code:

    TYPE-POOLS : slis.

    DATA: wa_file TYPE file_table,

    v_rc TYPE i,

    it_file TYPE TABLE OF file_table,

    lv_file TYPE string.

    TYPES : BEGIN OF ty_outdata,

    bukrs TYPE anla-bukrs,

    anln1 TYPE anla-anln1,

    anln2 TYPE anla-anln2,

    anlkl TYPE anla-anlkl,

    txt50 TYPE anla-txt50,

    menge TYPE anla-menge,

    gsber TYPE anlz-gsber,

    kostl TYPE anlz-kostl,

    stort TYPE anlz-stort,

    END OF ty_outdata.

    DATA : it_outdata TYPE TABLE OF ty_outdata,

    wa_outdata TYPE ty_outdata,

    it_fcat TYPE slis_t_fieldcat_alv,

    wa_fcat TYPE slis_fieldcat_alv,

    gt_excel TYPE TABLE OF alsmex_tabline,

    wa_excel TYPE alsmex_tabline,

    gv_currentrow TYPE i.

    *****************Defenição de parametro de seleção

    PARAMETERS p_file TYPE rlgrap-filename.

    *****************Evento para ativar o matchcode

    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.

    *****************Metodo para exibir o popup de seleção de arquivos

    CALL METHOD cl_gui_frontend_services=>file_open_dialog

    CHANGING

    file_table = it_file

    rc = v_rc

    EXCEPTIONS

    file_open_dialog_failed = 1

    cntl_error = 2

    error_no_gui = 3

    not_supported_by_gui = 4

    OTHERS = 5.

    IF sy-subrc <> 0.

    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

    ELSE.

    ******************Identifica o arquivo selecionado e joga para o parametro de seleção

    READ TABLE it_file INTO wa_file INDEX 1.

    p_file = wa_file-filename.

    ENDIF.

    START-OF-SELECTION.

    PERFORM f_upload.

    IF NOT it_outdata IS INITIAL.

    PERFORM f_fieldcat_alv.

    PERFORM f_display_alv.

    ENDIF.

    *&---------------------------------------------------------------------*

    *& Form F_UPLOAD

    *&---------------------------------------------------------------------*

    FORM f_upload .

    CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'

    EXPORTING

    filename = p_file

    i_begin_col = '1'

    i_begin_row = '2' "If file is not having header then start with '1'

    i_end_col = '10'

    i_end_row = '30000'

    TABLES

    intern = gt_excel

    EXCEPTIONS

    inconsistent_parameters = 1

    upload_ole = 2

    OTHERS = 3.

    IF sy-subrc EQ 0.

    CLEAR wa_excel.

    READ TABLE gt_excel INTO wa_excel INDEX 1.

    IF sy-subrc IS INITIAL.

    CLEAR gv_currentrow.

    gv_currentrow = wa_excel-row.

    ENDIF.

    LOOP AT gt_excel INTO wa_excel.

    IF wa_excel-row NE gv_currentrow.

    APPEND wa_outdata TO it_outdata.

    CLEAR wa_outdata.

    gv_currentrow = wa_excel-row.

    ENDIF.

    CASE wa_excel-col.

    WHEN '0001'.

    wa_outdata-bukrs = wa_excel-value.

    WHEN '0002'.

    wa_outdata-anln1 = wa_excel-value.

    WHEN '0003'.

    wa_outdata-anln2 = wa_excel-value.

    WHEN '0004'.

    wa_outdata-anlkl = wa_excel-value.

    WHEN '0005'.

    wa_outdata-txt50 = wa_excel-value.

    WHEN '0006'.

    wa_outdata-menge = wa_excel-value.

    WHEN '0007'.

    wa_outdata-gsber = wa_excel-value.

    WHEN '0008'.

    wa_outdata-kostl = wa_excel-value.

    WHEN '0009'.

    wa_outdata-stort = wa_excel-value.

    ENDCASE.

    ENDLOOP.

    APPEND wa_outdata TO it_outdata.

    CLEAR wa_outdata.

    ENDIF.

    ENDFORM. "f_upload

    *&---------------------------------------------------------------------*

    *& Form F_FIELDCAT_ALV

    *&---------------------------------------------------------------------*

    FORM f_fieldcat_alv .

    REFRESH : it_fcat.

    CLEAR : wa_fcat.

    wa_fcat-row_pos = '1'.

    wa_fcat-col_pos = '1'.

    wa_fcat-fieldname = 'BUKRS'.

    wa_fcat-tabname = 'IT_OUTDATA'.

    wa_fcat-seltext_l = text-001.

    APPEND wa_fcat TO it_fcat.

    CLEAR : wa_fcat.

    wa_fcat-row_pos = '1'.

    wa_fcat-col_pos = '2'.

    wa_fcat-fieldname = 'ANLN1'.

    wa_fcat-tabname = 'IT_OUTDATA'.

    wa_fcat-seltext_l = text-002.

    APPEND wa_fcat TO it_fcat.

    CLEAR : wa_fcat.

    wa_fcat-row_pos = '1'.

    wa_fcat-col_pos = '3'.

    wa_fcat-fieldname = 'ANLN2'.

    wa_fcat-tabname = 'IT_OUTDATA'.

    wa_fcat-seltext_l = text-003.

    APPEND wa_fcat TO it_fcat.

    CLEAR : wa_fcat.

    wa_fcat-row_pos = '1'.

    wa_fcat-col_pos = '4'.

    wa_fcat-fieldname = 'ANLKL'.

    wa_fcat-tabname = 'IT_OUTDATA'.

    wa_fcat-seltext_l = text-004.

    APPEND wa_fcat TO it_fcat.

    CLEAR : wa_fcat.

    wa_fcat-row_pos = '1'.

    wa_fcat-col_pos = '5'.

    wa_fcat-fieldname = 'TXT50'.

    wa_fcat-tabname = 'IT_OUTDATA'.

    wa_fcat-seltext_l = text-005.

    APPEND wa_fcat TO it_fcat.

    CLEAR : wa_fcat.

    wa_fcat-row_pos = '1'.

    wa_fcat-col_pos = '6'.

    wa_fcat-fieldname = 'MENGE'.

    wa_fcat-tabname = 'IT_OUTDATA'.

    wa_fcat-seltext_l = text-006.

    APPEND wa_fcat TO it_fcat.

    CLEAR : wa_fcat.

    wa_fcat-row_pos = '1'.

    wa_fcat-col_pos = '7'.

    wa_fcat-fieldname = 'GSBER'.

    wa_fcat-tabname = 'IT_OUTDATA'.

    wa_fcat-seltext_l = text-007.

    APPEND wa_fcat TO it_fcat.

    CLEAR : wa_fcat.

    wa_fcat-row_pos = '1'.

    wa_fcat-col_pos = '8'.

    wa_fcat-fieldname = 'KOSTL'.

    wa_fcat-tabname = 'IT_OUTDATA'.

    wa_fcat-seltext_l = text-008.

    APPEND wa_fcat TO it_fcat.

    CLEAR : wa_fcat.

    wa_fcat-row_pos = '1'.

    wa_fcat-col_pos = '9'.

    wa_fcat-fieldname = 'STORT'.

    wa_fcat-tabname = 'IT_OUTDATA'.

    wa_fcat-seltext_l = text-009.

    APPEND wa_fcat TO it_fcat.

    CLEAR : wa_fcat.

    ENDFORM. "F_FIELDCAT_ALV

    *&---------------------------------------------------------------------*

    *& Form F_DISPLAY_ALV

    *&---------------------------------------------------------------------*

    FORM f_display_alv .

    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

    EXPORTING

    i_callback_program = sy-repid

    it_fieldcat = it_fcat

    i_save = 'A'

    TABLES

    t_outtab = it_outdata

    EXCEPTIONS

    program_error = 1

    OTHERS = 2.

    IF sy-subrc <> 0.

    * Implement suitable error handling here

    ENDIF.

    ENDFORM. "F_DISPLAY_ALV



    Hope it will help you.


    Regards,

    Manish Shankar.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 16, 2015 at 06:42 PM

    Try 'TEXT_CONVERT_XLS_TO_SAP'


    PARAMETERS: p_infile TYPE rlgrap-filename OBLIGATORY.

    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_infile.

    CALL FUNCTION 'F4_FILENAME'

    EXPORTING

    field_name = 'P_INFILE'

    IMPORTING

    file_name = p_infile.

    START-OF-SELECTION.

    ************************************************************************

    CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'

    EXPORTING

    * I_FIELD_SEPERATOR =

    * I_LINE_HEADER = 'X'

    i_tab_raw_data = it_raw " work table

    i_filename = p_infile

    TABLES

    i_tab_converted_data = it_outdata " excel data

    EXCEPTIONS

    conversion_failed = 1

    OTHERS = 2.

    .

    Add a comment
    10|10000 characters needed characters exceeded

    • Hi ,

      you can use other FM TEXT_CONVERT_XLS_TO_SAP

      CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'

      EXPORTING

      * I_FIELD_SEPERATOR =

      I_LINE_HEADER = 'X' << As in your case excel have a heading TO BY PASS THAT

      i_tab_raw_data = it_raw " work table

      i_filename = p_infile

      TABLES

      i_tab_converted_data = it_outdata " excel data

      EXCEPTIONS

      conversion_failed = 1

      OTHERS = 2.

  • Posted on Nov 16, 2015 at 04:47 PM

    Hi Miguel,

    Try this function module ALSM_EXCEL_TO_INTERNAL_TABLE.

    Regards

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 17, 2015 at 06:52 AM

    Hi Miguel,

    consider this is data you want to upload

    MATNR MATID DOCNO
    01 d01 d001
    02 d02 d002


    CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
    EXPORTING
    FILENAME = PATH
    I_BEGIN_COL = '1'
    I_BEGIN_ROW = '1'
    I_END_COL = '3'
    I_END_ROW = '256'
    TABLES
    INTERN = IT_data
    EXCEPTIONS
    INCONSISTENT_PARAMETERS = 1
    UPLOAD_OLE = 2
    OTHERS = 3.

    data in it_data table will be in this format

    Row Column Value
    1 1 01
    1 2 d01
    1 3 d001
    2 1 02
    2 2 d02
    2 3 d002

    Need to convert it to required format
    conversion:

    LOOP AT IT_data into is_data.
    CASE IT_data-COL.
    WHEN '0001'.
    is_upload-matnr = is_data-VALUE.
    WHEN '0002'.
    is_upload-matid = is_data-VALUE.
    WHEN '0003'.
    is_upload-docno = is_data-VALUE.
    ENDCASE.
    append is_upload to it_upload.
    clear is_upload.
    endloop.

    It_upload contains your final data.

    Regards.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Nov 17, 2015 at 09:15 AM

    Hi Miguel,

    i want to share something, long back i try to upload excel to sap and i failed , latter i found that the excel fill is not MS-excel , that is generated from kignsoft Excel,

    So check excel is Microsoft Excel Or not , May be it is difficult to believe , have a look and try it in MS excel,

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 17, 2015 at 11:10 AM

    Conseguiu resolver Miguel?

    Se quiser tratar em português por favor, mande se ainda não deu certo.

    Boa sorte.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 17, 2015 at 11:50 AM

    Thank you to everyone, that helped me, its working. This community is the best!

    Regards

    Miguel Barão

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.