cancel
Showing results for 
Search instead for 
Did you mean: 

Get the values into a table from a dynamic node

Former Member
0 Kudos

Hi Experts,

I am not able to get the values into the table from a dynamic node. I searched a lot but couldn't find any solution.

I am doing this way:

*accessing the data from attribute for table content
lt_restab = wd_this->GT_DYN_TBL.
**--assign reference of internal table to field symbols.
   ASSIGN  lt_restab->* TO  <lt_dyn_tbl>.
   refresh <lt_dyn_tbl>.

lv_dyn_node_name = 'NODE_DYN_FORM_TAB'.
lo_nd_dyn_node = wd_context->get_child_node( name = lv_dyn_node_name ).
lo_nd_dyn_node->get_static_attributes_table( IMPORTING table = <lt_dyn_tbl> ).


It is throwing dump:

Error Text

OBJECT_NOT_STRUCTURED

Invalid operand type for the MOVE-CORRESPONDING statement.

Because im using filed catalog to build dynamic structure(GT_DYN_TBL). It is adding line as first field. but my node doesnot have that.

please help me find right solution.

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Thanks All for replying. I found the solution. The Culprit was the Dynamic node itself .

CALL METHOD lo_rootnode_info->add_new_child_node
                EXPORTING
*      static_element_type =
                  name                         = lv_dyn_node_name
                  is_mandatory                 = abap_false
                  is_mandatory_selection       = abap_false
                  is_multiple                  = abap_true
                  is_multiple_selection        = abap_true
                  is_singleton                 = abap_false
                  is_initialize_lead_selection = abap_true
                  STATIC_ELEMENT_RTTI          = lo_str
*                 is_static                    = abap_true
                  attributes                   = lt_attribute
                RECEIVING
                  child_node_info              = lo_node_info.


I was not passing, static_element_rtti. While debugging I find out, it was expecting 
it .



Regards

Monazza

Former Member
0 Kudos

hi:monazza


I have similar problems which I have created a dynamic node which name  as 'NEW_CODE' and displayed in alv.I created an eventhandler method for the event ON_CLICK of the ALV  and how to get static attributes from dynamic node in the method of   on_click

thanks

Answers (2)

Answers (2)

Former Member
0 Kudos

hi fatima,

i am not understand the requirement completely.

are u trying to use dynamic fieldcatlog in alv?

if yes observe this code once.

TYPE-POOLS : SLIS.
  *&---------------------------------------------------------------------*
*&  ALV Function Declarations
*&---------------------------------------------------------------------*
* Field Catalog Declarations
        T_FCAT TYPE SLIS_T_FIELDCAT_ALV,
        W_FCAT TYPE SLIS_FIELDCAT_ALV,

* Layout Declarations
        W_LAYO TYPE SLIS_LAYOUT_ALV.

*&---------------------------------------------------------------------*
*&  Global Variable Declarations
*&---------------------------------------------------------------------*

DATA : G_DATE TYPE SPMON,
        G_VAR(2) TYPE N ,
        G_MTEXT TYPE STRING,
        G_MONTH TYPE CHAR2,
        G_YEAR TYPE CHAR4,
        G_MONTH1 TYPE CHAR2,
        G_YEAR1 TYPE CHAR4,
        G_YEARD TYPE CHAR2,
        G_MOND TYPE CHAR2.

*&---------------------------------------------------------------------*
*&  Selection-Screen Declarations
*&---------------------------------------------------------------------*
SELECT-OPTIONS : S_DATE FOR G_DATE.

*&---------------------------------------------------------------------*
*&  Initialization Declarations
*&---------------------------------------------------------------------*
INITIALIZATION.
* Clearing Work areas
   CLEAR : W_LAYO,
           W_FCAT.

* Refreshing Internal Tables
   REFRESH : T_FCAT.

*&---------------------------------------------------------------------*
*&  Start-of-Selection Declarations
*&---------------------------------------------------------------------*
START-OF-SELECTION.

   G_MONTH = S_DATE-LOW+4(2).
   G_YEAR  = S_DATE-LOW+0(6).

   G_MONTH1 = S_DATE-HIGH+4(2).
   G_YEAR1  = S_DATE-HIGH+0(6).

   G_YEARD = G_YEAR1 - G_YEAR.
   G_VAR = G_MONTH.

   IF G_YEARD >= 1.
     G_MOND = ( G_MONTH1 + ( 12 * G_YEARD ) ) - G_MONTH.
     ADD 1 TO G_MOND.
   ELSE.
     G_MOND = G_MONTH1 - G_MONTH.
     ADD 1 TO G_MOND.
   ENDIF.

   DO G_MOND TIMES.

     CASE G_VAR.
       WHEN '1'.
         G_MTEXT = 'January'.
         ADD 1 TO G_VAR.
         CONCATENATE G_MTEXT G_YEAR INTO W_FCAT-SELTEXT_M SEPARATED BY SPACE.
         APPEND W_FCAT TO T_FCAT.
         CLEAR W_FCAT.
       WHEN '2'.
         G_MTEXT = 'february'.
         ADD 1 TO G_VAR.
         CONCATENATE G_MTEXT G_YEAR INTO W_FCAT-SELTEXT_M SEPARATED BY SPACE.
         APPEND W_FCAT TO T_FCAT.
         CLEAR W_FCAT.
       WHEN '3'.
         G_MTEXT = 'March'.
         ADD 1 TO G_VAR.
         CONCATENATE G_MTEXT G_YEAR INTO W_FCAT-SELTEXT_M SEPARATED BY SPACE.
         APPEND W_FCAT TO T_FCAT.
         CLEAR W_FCAT.
       WHEN '4'.
         G_MTEXT = 'April'.
         ADD 1 TO G_VAR.
         CONCATENATE G_MTEXT G_YEAR INTO W_FCAT-SELTEXT_M SEPARATED BY SPACE.
         APPEND W_FCAT TO T_FCAT.
         CLEAR W_FCAT.
       WHEN '5'.
         G_MTEXT = 'May'.
         ADD 1 TO G_VAR.
         CONCATENATE G_MTEXT G_YEAR INTO W_FCAT-SELTEXT_M SEPARATED BY SPACE.
         APPEND W_FCAT TO T_FCAT.
         CLEAR W_FCAT.
       WHEN '6'.
         G_MTEXT = 'June'.
         ADD 1 TO G_VAR.
         CONCATENATE G_MTEXT G_YEAR INTO W_FCAT-SELTEXT_M SEPARATED BY SPACE.
         APPEND W_FCAT TO T_FCAT.
         CLEAR W_FCAT.
       WHEN '7'.
         G_MTEXT = 'July'.
         ADD 1 TO G_VAR.
         CONCATENATE G_MTEXT G_YEAR INTO W_FCAT-SELTEXT_M SEPARATED BY SPACE.
         APPEND W_FCAT TO T_FCAT.
         CLEAR W_FCAT.
       WHEN '8'.
         G_MTEXT = 'August'.
         ADD 1 TO G_VAR.
         CONCATENATE G_MTEXT G_YEAR INTO W_FCAT-SELTEXT_M SEPARATED BY SPACE.
         APPEND W_FCAT TO T_FCAT.
         CLEAR W_FCAT.
       WHEN '9'.
         G_MTEXT = 'September'.
         ADD 1 TO G_VAR.
         CONCATENATE G_MTEXT G_YEAR INTO W_FCAT-SELTEXT_M SEPARATED BY SPACE.
         APPEND W_FCAT TO T_FCAT.
         CLEAR W_FCAT.
       WHEN '10'.
         G_MTEXT = 'October'.
         ADD 1 TO G_VAR.
         CONCATENATE G_MTEXT G_YEAR INTO W_FCAT-SELTEXT_M SEPARATED BY SPACE.
         APPEND W_FCAT TO T_FCAT.
         CLEAR W_FCAT.
       WHEN '11'.
         G_MTEXT = 'November'.
         ADD 1 TO G_VAR.
         CONCATENATE G_MTEXT G_YEAR INTO W_FCAT-SELTEXT_M SEPARATED BY SPACE.
         APPEND W_FCAT TO T_FCAT.
         CLEAR W_FCAT.
       WHEN '12'.
         G_MTEXT = 'December'.
         G_VAR = 1.
         CONCATENATE G_MTEXT G_YEAR INTO W_FCAT-SELTEXT_M SEPARATED BY SPACE.
         APPEND W_FCAT TO T_FCAT.
         CLEAR W_FCAT.
         ADD 1 TO G_YEAR.
     ENDCASE.

   ENDDO.

* Populating the Layout Fields
   W_LAYO-ZEBRA = 'X'.
   W_LAYO-COLWIDTH_OPTIMIZE = 'X'.

* Calling the Function Module for Displaying the Report in ALV Format
   CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
     EXPORTING
       I_CALLBACK_PROGRAM = SY-CPROG
       IS_LAYOUT          = W_LAYO
       IT_FIELDCAT        = T_FCAT
     TABLES
       T_OUTTAB           = T_KNA1.


is code is used to design fieldcatlogs dynamically,

if u give 02-2013 to 05-2013 in sel screen

the o/p fieldcat is like feb13, mar13, apr13, may13.

and changes for different values of input


Thanks and regards,

Prasanth.


Former Member
0 Kudos

Thank you Prasanth ,

Really appreciated your help.

I am not using ALV. My node cardinality is 0.. n. So I want to read my dynamic node as table. For saving data at the back end. But is it throwing dump at this statement.

lo_nd_dyn_node->get_static_attributes_table( IMPORTING table = <lt_dyn_tbl> ).


Thanks

Monazza

nishantbansal91
Active Contributor
0 Kudos
Former Member
0 Kudos

Hi All,

May be my question is not clear.

My problem  is, I am not able to access the data in the dynamic node.As we read the normal static node as table operation, my goal is same for dynamic node.

But, it is throwing dump at lo_nd_dyn_node->get_static_attributes_table( IMPORTING table = <lt_dyn_tbl> ).


Since, i don't know what would be my table type, therefore I used field symbol of type standard table.


There is so much about creating dynamic node, but how do we access(read elements) of he dynamic node??? In my case my dynamic node is table.


Please, experts help me find the right solution.


Regards

Monazza

ramakrishnappa
Active Contributor
0 Kudos

Hi,

Please refer the below link

How to get data from a dynamic node in Webdynpro ABAP

Here there are 3 methods

  • GET_NODE_INFO( ) - Get node information from node name
  • GET_NODE_DATA_TYPE( ) - Get node data type & attribute list by using node reference ( if_wd_context_node )
  • GET_DATA( ) - Get data of any given node reference

Create the methods as it is, in your component and you can just pass the node name to retrieve the data.

Hope this resolves your issue.

Regards,

Rama

Former Member
0 Kudos

Thank you  Ramakrishnappa ,


I'll try your method and will give you update.