Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
m_aravindan
Active Participant

Step1:

        Go to SO10 Tcode .

                                        Give a text name   as shown below.

Step2 :

Click on Create .the screen will look like this.

Step3: write Some text as Required.

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.

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

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

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 thead-tdname 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_data-value.

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

  CALL FUNCTION 'READ_TEXT'

    EXPORTING
      client   = sy-mandt
      id       = lc_txtid
      language = sy-langu
      name     =iv_textname
      object   =lc_txtobj

   TABLES
      lines    = lt_table.

  LOOP AT lt_table INTO ls_table.
    lv_string = ls_table-tdline.
    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 ..

Hope it is useful..

Regards
Aravindan

   

2 Comments
Labels in this area