cancel
Showing results for 
Search instead for 
Did you mean: 

Web Dynpro ABAP dynamic programming - UI elements in Grid layout

venkat_o
Active Contributor
0 Kudos

Hi,

I am new to dynamic programming in web dynpro abap. I have the following layout and I want to develop with dynamic programming.

1. Root UI element layout = Matrix layout

2. Group element layout = Grid layout. Column count 2.

Could you guide me on how to achieve the above layout using web dynpro abap dynamic programming ?

Regards

Venkat.O

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

Hi Venket,

May be this article will help you out.

Dynamic UI Genration

Thanks & Regards,

~Raj

venkat_o
Active Contributor
0 Kudos

Hi Raj,

Could you see my reply and suggest me on how to insert UI elements into Transparent container which has grid layout.?

Regards

Venkat

JerryWang
Advisor
Advisor
0 Kudos

Hi Venkat,

in my blog http://scn.sap.com/community/web-dynpro-abap/blog/2013/12/13/step-by-step-to-create-ui-elements-and-...

there is step by step how to create ui element in the runtime.

Best regards,

Jerry

venkat_o
Active Contributor
0 Kudos

Thank you guys for your helpful links. I started to design for the above output. I managed to get GROUP container in the output.

Code - 01.

METHOD WDDOMODIFYVIEW.
  CASE FIRST_TIME.
    WHEN ABAP_TRUE.
      DATA  LR_ROOT_CONTAINER   TYPE REF TO CL_WD_UIELEMENT_CONTAINER.
      DATA  LR_TRANSP_CONTAINER TYPE REF TO CL_WD_TRANSPARENT_CONTAINER.
      DATA  LR_GROUP            TYPE REF TO CL_WD_GROUP.
      DATA  LR_CAPTION          TYPE REF TO CL_WD_CAPTION.
      DATA  LR_INPUT_FIELD      TYPE REF TO CL_WD_INPUT_FIELD.
      DATA  LR_LABEL            TYPE REF TO CL_WD_LABEL.
      "Layouts
      DATA  LR_FLOW_DATA        TYPE REF TO CL_WD_FLOW_DATA.
      DATA  LR_GRID_DATA        TYPE REF TO CL_WD_GRID_DATA.
      DATA  LR_MATRIX_DATA      TYPE REF TO CL_WD_MATRIX_DATA.
      DATA  LR_MATRIX_HEAD_DATA TYPE REF TO CL_WD_MATRIX_HEAD_DATA.
      DATA  LR_GRID_LAYOUT      TYPE REF TO CL_WD_GRID_LAYOUT.
      "Variables
      DATA LV_READ_ONLY         TYPE WDY_BOOLEAN.
      DATA LV_TEXT              TYPE WDY_MD_TRANSLATABLE_TEXT.

      "Get a pointer to the RootUIElementContainer
      LR_ROOT_CONTAINER ?= VIEW->GET_ROOT_ELEMENT( ).
      CL_WD_MATRIX_LAYOUT=>NEW_MATRIX_LAYOUT( CONTAINER = LR_ROOT_CONTAINER ).
      "Create GROUP UI element
      CALL METHOD CL_WD_GROUP=>NEW_GROUP
        EXPORTING
          ID      = 'GRP_4_PMGMT_SKILLS'
          DESIGN  = CL_WD_GROUP=>E_DESIGN-SECONDARYCOLOR
          WIDTH   = '100%'
        RECEIVING
          CONTROL = LR_GROUP.
      "Create Caption
      CALL METHOD CL_WD_CAPTION=>NEW_CAPTION
        EXPORTING
          ID      = 'CAPTION'
          TEXT    = 'Project Management Skills'
        RECEIVING
          CONTROL = LR_CAPTION.
      "Set caption to GROUP header
      CALL METHOD LR_GROUP->SET_HEADER
        EXPORTING
          THE_HEADER = LR_CAPTION.
      "Set the layout of the GROUP UI element
      CL_WD_MATRIX_LAYOUT=>NEW_MATRIX_LAYOUT( CONTAINER = LR_GROUP ).
      CL_WD_MATRIX_HEAD_DATA=>NEW_MATRIX_HEAD_DATA( ELEMENT = LR_GROUP ).
      "Add Group to ROOT element
      LR_ROOT_CONTAINER->ADD_CHILD( LR_GROUP ).
    WHEN OTHERS.
  ENDCASE.

ENDMETHOD.

Points from above code.

  • ROOTUIELEMENTCONTAINER layout is set to Matrix Layout
  • Added GROUP UI element which is container element.GROUP layout is set to Matrix layout.
  • Added this GROUP as child to ROOT Container .

Output for the above code is

Next requirement

  • Want to add Transparent Container inside GROUP container and layout for Transparent Container should be Grid Layout.
  • As I want Grid layout for transparent container, Column count should be 2.
  • Output should be in the following way.

Expecting input on how to keep input fields in transparent container which is child of Group container which is child of ROOT element.

Regards

Venkat.O

former_member82178
Active Participant
0 Kudos
former_member219762
Contributor
0 Kudos

Hi,

The layout of the container and the layout data of the embedded UI element must always match. So it is not possible to create

Root UI element layout = Matrix layout

Group element layout = Grid layout. Column count 2.

Regards,

Sreenivas

Former Member
0 Kudos

Hi Venkat,

Please do some readings on this link: http://help.sap.com/saphelp_nw74/helpdata/en/11/ba74412cba127de10000000a155106/content.htm

I haven't tried out but I guess we can make use method SET_LAYOUT of interface CL_WD_UIELEMENT_CONTAINER, with parameter as an instance of CL_WD_LAYOUT

E.g.

  data: lr_matrix_layout  type ref to cl_wd_matrix_layout.

  lr_matrix_layout = cl_wd_matrix_layout=>new_matrix_layout(

                        container              = cr_root_container

                        stretched_horizontally = abap_false

                        stretched_vertically   = abap_false ).

  cr_root_container->set_layout( lr_matrix_layout ).

Please let me know if it works. Hope it helps. Cheers!