Tuesday, July 16, 2013
Previously we worked on how to display data, how to handle check box on Table and discussed on table events SORTING and FILTERING.

The following article gives you step by step procedure to create and handle radio buttons on Table row.

  •  Create Web Dynpro Component(ZOVH_RADBUT_ON_TABROW) with Window and View(Automatically View is embedded into Window).

  •  Go to COMPONENTCONTROLLER context and create one IT0001 with cardinality 0-n.
    • Get PERNR and ENAME from PA0001 structure as shown in the picture


  •  Click on IT0001 and take out Dictionary structure PA0001. 
  • Add attributes YES, NO, AMENDMENT, KIV and SELECTEDKEY with type STRING.
  •  Go to view->Context->Map Component controller context node IT0001 to View context.(Drag IT0001 and drop at viwe context)
  •  Go to view-> Layout. 
    • Change ROOTUIELEMENTCONTAINER layout to MatrixLayout.
    •  Insert Table UI element and Bind context node to table UI element.


  •  While binding change Cell element to RadioButton for YES, NO, AMENDMENT and KIV and continue
    •  Table appears this way.
    •  Click on radio button in table cell  and set keyToSelect = 'a' and bind selectedKey with RADBUT_TAB_V.IT0001.SELECTEDKEY as shown in the picture. Continue same thing to NO, AMENDMENT and KIV.



    • Insert Button with text 'Update' and change layout to MatrixHeadLayout 
    • Copy existing table ui element and right click on Root Ui element and use Insert copied element menu and change layout to MatrixHeadLayout.
  •  Go to Methods->Double click on WDDOMODIFYVIEW.
    •  Method code
    • METHOD WDDOMODIFYVIEW .
        CASE FIRST_TIME.
          WHEN ABAP_TRUE.
            DATA LO_ND_IT0001 TYPE REF TO IF_WD_CONTEXT_NODE.
            DATA LT_IT0001 TYPE WD_THIS->ELEMENTS_IT0001.
            DATA LS_IT0001 TYPE WD_THIS->ELEMENT_IT0001.
      
            " navigate from  to  via lead selection
            LO_ND_IT0001 = WD_CONTEXT->GET_CHILD_NODE( NAME = WD_THIS->WDCTX_IT0001 ).
            SELECT *
              FROM PA0001
              INTO CORRESPONDING FIELDS OF TABLE LT_IT0001 UP TO 20 ROWS.
            LOOP AT LT_IT0001 INTO LS_IT0001.
              LS_IT0001-SELECTEDKEY = 'd'.
              MODIFY LT_IT0001 FROM LS_IT0001 INDEX SY-TABIX.
            ENDLOOP.
            LO_ND_IT0001->BIND_TABLE( NEW_ITEMS = LT_IT0001 ).
        ENDCASE.
      ENDMETHOD.
      
  • Activate Web Dynpro Component. 
  • Create Web Dynpro Application. 
  • Run Web dynpro Application
  • Application output. Select different radio buttons for different columns and click on Update button. 

0 comments:

Post a Comment

Your useful comments, suggestions are appreciated.Your comments are moderated.

Followers

Contact Form

Name

Email *

Message *

Web Dynpro ABAP Book

An SAP Consultant

Follow US


Want to Contribute ?

If you are interested in writing about the new stuff you learn everyday while working, please write to the.sap.consultants@gmail.com.

Click on Contribution for more details.