cancel
Showing results for 
Search instead for 
Did you mean: 

file upload

Former Member
0 Kudos

I am new for webdynpro ABAP and I tried this code and getting Dump (character set conversion not possible). I am getting the dump in this location.

convt = cl_abap_conv_in_ce=>create( input = lv_file ).

convt->read( importing data = s_cont ).

i am giving my code here..



data:  s_cont type string,
        x_cont type xstring,
        convt type ref to cl_abap_conv_in_ce.
 
data:   input_string type string,
        fields  type string_table,
        fields2  type string_table,
        tbl_fields  type string_table,
        s_table type string_table,
        ls_table like line of s_table,
        ls like line of fields,
        lv_num_cols type i.
 
 TYPES:BEGIN OF x_final1,
      pspnr     TYPE prps-posid,
      matnr     TYPE mara-matnr,
      desc      TYPE prps-objnr,
      vbeln     TYPE vbap-vbeln,
      ebeln     TYPE ekpo-ebeln,
      END OF x_final1.
 
DATA:lt_data TYPE STANDARD TABLE OF x_final1,
     ls_data TYPE x_final1,
     lv_data TYPE string.
 
   field-symbols: <wa_table> like line of s_table.
 
   DATA lo_nd_file TYPE REF TO if_wd_context_node.
   DATA lo_el_file TYPE REF TO if_wd_context_element.
   DATA ls_file TYPE wd_this->element_file.
   DATA lv_file type xstring.
 
*  navigate from <CONTEXT> to <FILE> via lead selection
 
   lo_nd_file = wd_context->get_child_node( name = wd_this->wdctx_file ).
 
*  get element via lead selection
   lo_el_file = lo_nd_file->get_element(  ).
 
*  get single attribute
   lo_el_file->get_attribute(
     EXPORTING
       name =  `FILE`
     IMPORTING
       value = lv_file ).
 
 
 convt = cl_abap_conv_in_ce=>create( input = lv_file ).
  convt->read( importing data = s_cont ).
 
  "Column headers
  split s_cont at cl_abap_char_utilities=>cr_lf into table s_table.
  read table s_table into ls_table index 1.
 
  "Delete column header
  delete s_table index 1.
  split ls_table at cl_abap_char_utilities=>horizontal_tab into table fields.
 
  lv_num_cols = lines( fields ).
  refresh fields.
 
 
  loop at s_table assigning <wa_table>.
    split <wa_table> at cl_abap_char_utilities=>horizontal_tab into :
      ls_data-pspnr
      ls_data-matnr
      ls_data-desc
      ls_data-vbeln
      ls_data-ebeln  .
     append ls_data to lt_data.
     clear ls_data.
 
  endloop.
 

lv_file is containing data in bytes.and i am not able to get the original data in the s_table

Please help me.Thanks in advance.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Rajkumar,

In my case i am using a TabDelimeted file as input. I have an Excel with columns and data. Now from file->save as option i save this file as TEXT (Tab Delimeted) option. then this file is ready for upload.

If you are uploading excel , saving it as tab-delimeted should solve your problem.

Greetings

Prashant