1

cl_gui_textedit問題の原因となる改行を含むコンポーネント内のファイルを表示したい。

次のコードを使用してコンポーネントを初期化しています

  DATA: lo_c_errorviewer TYPE REF TO cl_gui_custom_container.

  CREATE OBJECT lo_c_errorviewer
    EXPORTING
        container_name = 'C_ERROR_MSG'.

  CREATE OBJECT go_error_textedit
    EXPORTING parent = lo_c_errorviewer.

  go_error_textedit->set_toolbar_mode( 0 ).
  go_error_textedit->set_statusbar_mode( 0 ).

iXML パッケージで XML 処理を行った後、ファイルのバイナリ データは次のように利用できます。

types: begin of xml_line,
        data(256) type x,
       end of xml_line.

data:  xml_table type table of xml_line,
       xml_size  type i.

ostream = streamFactory->create_ostream_itable( xml_table ).
document->render( ostream = ostream  recursive = 'X' ).
xml_size = ostream->get_num_written_raw( ).

私が正しければ、これには改行が含まれているはずです。ostream オブジェクトでは、デフォルトで「プリティ プリンティング」がオンになっています。

参照を検索しましたが、情報を渡す唯一の方法は経由です

call method <c_textedit_control> - > set_text_as_stream

文字の「標準テーブル」が必要です。データを変換したり、コンポーネントに渡したりするにはどうすればよいですか?

4

1 に答える 1

1

XML ドキュメントをSTRINGすぐにレンダリングして、CL_GUI_TEXTEDITコントロールに送信できるようにすると簡単です。

data xmlstring type string.
data ostream type ref to if_ixml_ostream.
ostream = streamfactory->create_ostream_cstring( xmlstring ).
document->render( ostream = ostream recursive = 'X' ).
...
data textedit type ref to cl_gui_textedit.
create object textedit
  exporting
    parent = container.
textedit->set_textstream( xmlstring ).



バイナリ データにレンダリングする必要がある場合は、XSTRINGそのためにを使用することをお勧めします。

data xmlxstring type xstring.
data ostream type ref to if_ixml_ostream.
ostream = streamfactory->create_ostream_xstring( xmlxstring ).
document->render( ostream = ostream recursive = 'X' ).

CL_ABAP_CONV_IN_CE次に、SAP が提供するクラスを使用して、バイナリ データを文字列に変換できます。

data converter type ref to cl_abap_conv_in_ce.
converter = cl_abap_conv_in_ce=>create( input = xmlxstring ).
data xmlstring type string.
converter->read( importing data = xmlstring ).

コントロールに送信できるものCL_GUI_TEXTEDIT

data textedit type ref to cl_gui_textedit.
create object textedit
  exporting
    parent = container.
textedit->set_textstream( xmlstring ).



エンコーディングの問題が発生した場合は、レンダリングの前に ostream オブジェクトにエンコーディングを設定できます。また、コンバーター オブジェクトを作成するときにエンコーディングを指定できます。

于 2012-01-06T23:42:28.883 に答える