cancel
Showing results for 
Search instead for 
Did you mean: 

FM to convert XString to String

Former Member
0 Kudos

I am developing an simple application to upload an excel file and display its contents in a table in Solution manager using Web dynpro.

But 'HR_KR_XSTRING_TO_STRING' is not avaiable in DS1.

Can you help me find a replacement for this function module.

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 char200,

fs_table TYPE str_itab,

l_xstring TYPE char200,

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 ).

Thanks in advance

Akshatha

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

I was browsing through the other forums and i found the answer for this thread.

Pls refer the following thread

i saved the file as tab delimited file and it worked.

Thanks

Akshatha

Former Member
0 Kudos

When i use this i get the following error:

A character set conversion is not possible.

Pls help.

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

It is not appropriate to ask general ABAP questions such as this in the Web Dynpro ABAP Forum. As your punishment I will help with your question.

In this sample buffer is the XSTRING, text_buffer is the string. You have to supply an encoding to tell the system what codepage/unicode type the XSTRING is.

data: convin  type ref to cl_abap_conv_in_ce,
      call method cl_abap_conv_in_ce=>create
        exporting
           encoding    = encoding
           input       = buffer
        receiving
          conv        = convin.

      call method convin->read
        importing
          data = text_buffer.

Former Member
0 Kudos

hi,

Try using CRM_IC_XML_XSTRING2STRING this FM.

Regards,

Runal

Former Member
0 Kudos

This FM gives output in xml format.That does not serve my purpose