Skip to Content

Step1:

        Go to SO10 Tcode .

                                        Give a text name   as shown below.

/wp-content/uploads/2013/03/step1_199466.png

Step2 :

Click on Create .the screen will look like this.

/wp-content/uploads/2013/03/step2_199467.png

Step3: write Some text as Required.

/wp-content/uploads/2013/03/step3_199468.png

Click on save  and save the text.

Step 4: Now go to SE80 and create a webdynpro component .

            Then go to view , create a context node and a attribute of type string as shown below.

/wp-content/uploads/2013/03/step4_199472.png

Step5: Go to layout tab and create a Formatted text view.

/wp-content/uploads/2013/03/step5_199473.png

Step6:  Bind the attribute of the context to the formatted text view as shown below.

/wp-content/uploads/2013/03/step6_199474.png

/wp-content/uploads/2013/03/step7_199478.png

Step 7 : Now go to the init method of the view and write the following code .

        

        Here we will be using ‘READ_TEXT’ function module to read the text from SO10 and

       we will binding  the vaule to the  attribute which is binded to the formatted text view.

DATA:lt_table TYPE STANDARD TABLE OF tline,
     ls_table TYPE tline,
     iv_textname TYPE theadtdname VALUE ‘TEXT_FOR_WEBDYNPRO’, “Text name which we gave in SO10.
     lv_string TYPE string.

DATA: ex_lines TYPE string.

DATA lo_nd_data TYPE REF TO if_wd_context_node.
DATA lo_el_data TYPE REF TO if_wd_context_element.
DATA ls_data TYPE wd_this->element_data.
DATA lv_value TYPE wd_this->element_datavalue.

CONSTANTS: lc_txtid(4TYPE c VALUE ‘ST’,
           lc_txtobj(10) TYPE c VALUE ‘TEXT’.

  CALL FUNCTION ‘READ_TEXT’

    EXPORTING
      client   = symandt
      id       = lc_txtid
      language = sylangu
      name     =iv_textname
      object   =lc_txtobj

   TABLES
      lines    = lt_table.

  LOOP AT lt_table INTO ls_table.
    lv_string = ls_tabletdline.
    CONCATENATE ex_lines lv_string INTO ex_lines SEPARATED BY space.
  ENDLOOP.

* navigate from <CONTEXT> to<DATA> via lead selection

  lo_nd_data = wd_context->get_child_node( name = wd_this->wdctx_data ).

* get element via lead selection

  lo_el_data = lo_nd_data->get_element( ).

* set single attribute

  lo_el_data->set_attribute(

    name `VALUE`

    value = ex_lines  ).

Step 8 : Now create a web dynpro application and test it ..

/wp-content/uploads/2013/03/step9_199480.png

Hope it is useful..

Regards
Aravindan

   

To report this post you need to login first.

2 Comments

You must be Logged on to comment or reply to a post.

Leave a Reply