Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Upload Excel

Dear Experts,

I tried the example given in the saptechnical -> tutorials-> webdynpro abap -> Uploading excel file using WebDynpro for ABAP.

During the execution of the program, i specified the path and when i clicked on the button : it was going on running(processing) continously but did not display the contents of excel in the table yet.

can anyone pls tell me how to correct it.

Kind Regards

Sajid

Former Member
replied

Coding 2:

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,
         lo_nd_sflight TYPE REF TO if_wd_context_node,
         lo_el_sflight TYPE REF TO if_wd_context_element,
         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.
  ENDLOOP.

  lo_nd_sflight = wd_context->get_child_node( 'DATA_TAB' ).
  lo_nd_sflight->bind_table( t_table1 ).
endmethod.

0 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question