Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Simple Tree Problem

Former Member
0 Likes
682

Hi all.

I read the table 'dd03l' to get all fields of one Table.

The result are 63 Fields.

The select:

  SELECT fieldname FROM dd03l INTO ls_fields-fieldname
      WHERE tabname  = gf_database
        AND as4local = 'A'
        AND as4vers  = 0
        AND position < 59
        AND datatype <> 'CLNT'.
    APPEND ls_fields TO lt_fields.
  ENDSELECT.

Ok, now i want to make a simple Tree with this fieldnames, like this:

Tablename
 - Field1
 - Field2
 - Field3

and so on...

No Problem?But i get a Dump, when i dont set this Argument ' AND position < 59'.

When i write position < 60, the result is a Dump. When i omit this Argument, i get a Dump. Because the Table, which i want to get all fields, have more then 59 Fields.

Why???

Here my Tree Coding:


  node-node_key = 'Root'.                                   
  CLEAR node-relatkey.      
  CLEAR node-relatship. 
  node-hidden = ' '.    
  node-disabled = ' '. 
  node-isfolder = 'X'.    
  CLEAR node-n_image.   
  CLEAR node-exp_image.
  CLEAR node-expander.  
  node-text = gf_database.
  APPEND node TO node_table.

  CLEAR gf_zaehler.
  CLEAR lf_fullzaehl.


  LOOP AT lt_fields INTO ls_fields.

    IF gf_zaehler EQ 10 OR gf_zaehler EQ 0.
      lf_fullzaehl = lf_fullzaehl + gf_zaehler.
      lf_zahltxt = lf_fullzaehl.
      CONCATENATE 'von' lf_zahltxt
             INTO lf_nodekeytxt
        SEPARATED BY space.

      CLEAR node.
      node-node_key = lf_nodekeytxt.                        
      node-relatkey = 'Root'.
      node-relatship = cl_gui_list_tree=>relat_last_child.
      node-isfolder = 'X'.
      node-text = lf_nodekeytxt.
      APPEND node TO node_table.

      CLEAR gf_zaehler.
    ENDIF.


    CLEAR node.
    node-node_key = ls_fields-fieldname.                    
    node-relatkey = lf_nodekeytxt.
    node-relatship = cl_gui_simple_tree=>relat_last_child.
    node-hidden = ' '.
    node-disabled = ' '.
    node-isfolder = ' '.
    CLEAR node-n_image.
    CLEAR node-exp_image.
    node-expander = ' '.
    node-text = ls_fields-fieldname.
    APPEND node TO node_table.

    gf_zaehler = gf_zaehler + 1.

  ENDLOOP.

  CALL METHOD g_tree->add_nodes
    EXPORTING
      table_structure_name           = 'MTREESNODE'
      node_table                     = node_table
    EXCEPTIONS
      failed                         = 1
      error_in_node_table            = 2
      dp_error                       = 3
      table_structure_name_not_found = 4
      OTHERS                         = 5.
  IF sy-subrc <> 0.
    MESSAGE a999.
  ENDIF.

What can i do???

Thx 4 help.

Sincerely yours

Markus

4 REPLIES 4
Read only

uwe_schieferstein
Active Contributor
0 Likes
545

Hello Markus

I understand neither the reason for the dump nor your SELECT statement. If you want to read metadata of tables then you should use function module <b>DDIF_FIELDINFO_GET</b> (set IMPORTING parameter ALL_TYPES = 'X').

Alternatively, you could use function module <b>LVC_FIELDCATALOG_MERGE</b>. By default this function module does not return the client field (I_CLIENT_NEVER_DISPLAY = 'X').

Regards

Uwe

Read only

0 Likes
545

Hello Uwe,

maybe its not the finest way, but the SELECT statement works fine. I get all fieldnames.

I have a second Report, a little bit different from the one i spoken in my first posting. There i get the Tree with all Fields, and i used the same SELECT statement. But the tree dosent looks fine, because all 'fieldnames' are root childs....

i can post it tomorrow. but i mean the select is not the problem.

Regards

Markus

Read only

Former Member
0 Likes
545

Today i want to post the second program, but now this one dont work.

Here the code:

Today i cant use 3 of the result-fieldnames. This coding runs in a dump.

FORM build_node_and_item_table.

  DATA:
        ls_fields          TYPE                   rsdsfields,
        lt_fields          TYPE STANDARD TABLE OF rsdsfields,

        lf_nodekeytxt(12)  TYPE c,

        lf_zaehler         TYPE int4,
        lf_zahltxt(3)      TYPE c,
        lf_fullzaehl       TYPE int4,
        lf_feldname(20)    TYPE c.




  ls_fields-tablename = gf_database.

  SELECT fieldname FROM dd03l INTO ls_fields-fieldname
      WHERE tabname  = gf_database
        AND as4local = 'A'
        AND as4vers  = 0
        AND position < 3
        AND datatype <> 'CLNT'.
    APPEND ls_fields TO lt_fields.
  ENDSELECT.


  nodekey = 1.



*-- Node with key 'Root'
  CLEAR node.
  node-node_key  = 'Root'.
  node-hidden    = ' '.
  node-disabled  = ' '.
  node-isfolder  = 'X'.
  APPEND node TO node_table.

*-- Item to key 'Root'
  CLEAR item.
  item-node_key  = 'Root'.
  item-item_name = '1'.
  item-class     = cl_gui_list_tree=>item_class_text.
  item-alignment = cl_gui_list_tree=>align_auto.
  item-font      = cl_gui_list_tree=>item_font_prop.
  item-text      = gf_database.
  APPEND item TO item_table.


  CLEAR lf_zaehler.
  CLEAR lf_fullzaehl.


  LOOP AT lt_fields INTO ls_fields.

    lf_feldname = ls_fields-fieldname.

    IF lf_zaehler EQ 10 OR lf_zaehler EQ 0.
*-- Verzeichnis "von XX" erstellen
      lf_fullzaehl = lf_fullzaehl + lf_zaehler.
      lf_zahltxt = lf_fullzaehl.
      CONCATENATE 'von' lf_zahltxt
       INTO lf_nodekeytxt
  SEPARATED BY space.

      CLEAR node.
      ADD 1 TO nodekey.
      node-node_key   = lf_nodekeytxt.
      nodekeyx        = nodekey.
      node-relatkey   = 'Root'.
      node-relatship  = cl_gui_list_tree=>relat_last_child.
      node-dragdropid = handle_drop.
      node-hidden     = ' '.
      node-disabled   = ' '.
      node-isfolder   = 'X'.
      APPEND node TO node_table.

*-- Item zum Verzeichnis
      CLEAR item.
      item-node_key  = node-node_key.
      item-item_name = nodekeyx.
      item-class     = cl_gui_list_tree=>item_class_text.
      item-alignment = cl_gui_list_tree=>align_auto.
      item-font      = cl_gui_list_tree=>item_font_prop.
      item-text      = lf_nodekeytxt.
      APPEND item TO item_table.

      CLEAR lf_zaehler.
    ENDIF.


*-- Nun die Felder anhängen und dem jeweiligen Verzeichnis zuordnen
    CLEAR node.
*    ADD 1 TO nodekey.
    node-node_key   = lf_feldname.
    node-relatkey   = nodekeyx.
    node-relatship  = cl_gui_list_tree=>relat_last_child.
    node-dragdropid = handle_drag.
    node-hidden     = ' '.
    node-disabled   = ' '.
    node-isfolder   = ' '.
    APPEND node TO node_table.

*-- Item "Land"
    CLEAR item.
    item-node_key  = node-node_key.
    item-item_name = '1'.
    item-style     = cl_gui_list_tree=>style_intensified.
    item-class     = cl_gui_list_tree=>item_class_text.
    item-alignment = cl_gui_list_tree=>align_auto.
    item-font      = cl_gui_list_tree=>item_font_fixed.
    item-text      = lf_feldname.
    APPEND item TO item_table.

    lf_zaehler = lf_zaehler + 1.

  ENDLOOP.

ENDFORM.                    "build_node_and_item_table

and the Dump:

Runtime errors         MESSAGE_TYPE_X                                    
       Occurred on     20.04.2007 at   09:12:54                                                                                
The current application triggered a termination with a short dump.                                                                                
What happened?                                                                                
The current application program detected a situation which really        
should not occur. Therefore, a termination with a short dump was         
triggered on purpose by the key word MESSAGE (type X).                                                                                
What can you do?                                                                                
Print out the error message (using the "Print" function)                 
and make a note of the actions and input that caused the                 
error.                                                                                
To resolve the problem, contact your SAP system administrator.           
You can use transaction ST22 (ABAP Dump Analysis) to view and administer 
 termination messages, especially those beyond their normal deletion     
date.                                                                                
Error analysis                                                                                
Short text of error message:                                             
Control Framework : Error processing control                                                                                
Technical information about the message:                                 
 Diagnosis                                                               
     An error occurred when the system tried to process the commands     
     from the Automation Queue on the presentation server.               
     There are several possible reasons for this:                        
     - The installation of the SAP GUI on the presentation server is     
     faulty or obsolete.                                                 
     - There is an error in the application program                      
     - There is an error in the SAPGUI or an integrated control  
.
.
.
.
       

What is the problem???

I´m helpless ....

Regards

Markus

Read only

0 Likes
545

I found one mistake in the second coding.

*-- Nun die Felder anhängen und dem jeweiligen Verzeichnis zuordnen
    CLEAR node.
*    ADD 1 TO nodekey.
    node-node_key   = lf_feldname.
    node-relatkey   = lf_nodekeytxt.
    node-relatship  = cl_gui_list_tree=>relat_last_child.
    node-dragdropid = handle_drag.
    node-hidden     = ' '.
    node-disabled   = ' '.
    node-isfolder   = ' '.
    APPEND node TO node_table.

Wrong relatkey.

And i found the point, when the Dump activated.

At the moment when the Method "cl_gui_cfw=>flush" is triggered.

Can anyone help?

Thanks.

Message was edited by:

Markus Wendel