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

With a structure find a table

Former Member
0 Likes
3,463

Hello ,

i want to know how can i find a table when i know the structure ?

i type in se16 MEPO1235 and i get this message* where as in the technical information it is written table name : MEPO1235

( MEPO1235 is a structure, not a table )*

Thank you for your help

1 ACCEPTED SOLUTION
Read only

kiran_k8
Active Contributor
0 Likes
3,099

Mehdi,

Activate the trace in ST05

Run your tcode

Deactivate the trace in ST05

Display the trace.

Trace will be displaying the list of all the tables that are used in a tcode

K.Kiran.

9 REPLIES 9
Read only

iftah_peretz
Active Contributor
0 Likes
3,099

You simply can't.

This is a structure. If you come from a different programming language it is like an array.

Take a look at table EKET it contains most of the data you need.

Read only

0 Likes
3,099

okay so with structure i cant get the table. Maybe with a transaction i can get the table behind ?

(im trying to make a report so i go on transactions where i can find interesting field for my report )

Thank you in advance

Read only

0 Likes
3,099

Take a look at table EKET it contains most of the data you need.

Go to se16n and put it there and search with the relevant data you need. Furthermore, take a look here:

http://help.sap.com/saphelp_sm32/helpdata/en/8d/bc383fe58d5900e10000000a114084/content.htm

Another way is to use this function:

call function 'BAPI_PO_GETDETAIL'

  exporting

    purchaseorder                    = p_ebeln

  •   ITEMS                            = 'X'
  •   ACCOUNT_ASSIGNMENT               = ' '
  •   SCHEDULES                        = ' '
  •   HISTORY                          = ' '
  •   ITEM_TEXTS                       = ' '
  •   HEADER_TEXTS                     = ' '
  •   SERVICES                         = ' '
  •   CONFIRMATIONS                    = ' '
  •   SERVICE_TEXTS                    = ' '
  •   EXTENSIONS                       = ' '
  • IMPORTING
  •   PO_HEADER                        =
  •   PO_ADDRESS                       =

tables

  •   PO_HEADER_TEXTS                  =

   po_items                         = po_items

  •   PO_ITEM_ACCOUNT_ASSIGNMENT       =
  •   PO_ITEM_SCHEDULES                =
  •   PO_ITEM_CONFIRMATIONS            =
  •   PO_ITEM_TEXTS                    =
  •   PO_ITEM_HISTORY                  =
  •   PO_ITEM_HISTORY_TOTALS           =
  •   PO_ITEM_LIMITS                   =
  •   PO_ITEM_CONTRACT_LIMITS          =
  •   PO_ITEM_SERVICES                 =
  •   PO_ITEM_SRV_ACCASS_VALUES        =
  •   RETURN                           =
  •   PO_SERVICES_TEXTS                =
  •   EXTENSIONOUT                     =

          .

 

check sy-subrc  = 0.

 

loop at po_items.

  write:/ po_items.

endloop.

Read only

Former Member
0 Likes
3,099

Hi.

What you can do is to check where is used a component type of the structure on any table. Double clic on the component type and then clic on the icon where-used list and select tables.

It could help to find out the correct table.

Regards

Miguel

Read only

former_member209120
Active Contributor
0 Likes
3,099

Hi Mehdi,

If want to find tables used for  a particular tcode,

Run tcode System->Status, copy program name and run the below program and give program name as input and you will get the tables used in that program.

*ALV type pools declarations
TYPE-POOLS : slis.

*Internal table and work area declarations for dd02l and dd02t
DATA :  it_dd02l TYPE STANDARD TABLE OF dd02l,
         wa_dd02l TYPE dd02l,
         it_dd02t TYPE STANDARD TABLE OF dd02t,
         wa_dd02t TYPE dd02t.

*DATA DECLARATIONS FOR PROGRAM NAMES
DATA : progname LIKE sy-repid.

data : prognames(60) type c.

*Structure for output
TYPES : BEGIN OF ty_output,
        tabname LIKE dd02l-tabname,
        tabclass(20) TYPE c,
        contflag(80) TYPE c,
        text LIKE dd02t-ddtext,
        END OF ty_output.

*Internal table and work area declarations for output

DATA : it_output TYPE STANDARD TABLE OF ty_output,
         wa_output TYPE ty_output.

*Structure for table names

TYPES : BEGIN OF ty_names,
         name LIKE dd02l-tabname,
         END OF ty_names.

*Internal table and work area declarations for table names
DATA : it_names TYPE STANDARD TABLE OF ty_names.

*data declarations for ALV
DATA: it_layout TYPE slis_layout_alv,
       wa_fieldcat TYPE slis_fieldcat_alv,
       it_fieldcat TYPE slis_t_fieldcat_alv.

****************************** SELECTION SCREEN ************************

PARAMETERS : program LIKE sy-repid.

****************************** INITIALIZATION **********************

INITIALIZATION.

****************************** START OF SELECTION **********************

START-OF-SELECTION.

*Select to check if the program exists
select single name from trdir into prognames where name = program.

*If Program does not exist message is thrown
   IF sy-subrc <> 0.

     MESSAGE 'PROGRAM DOES NOT EXIST' TYPE 'I'.

     EXIT.

   ENDIF.

*Calling FM to get the tables associated with the program
progname = program.

   CALL FUNCTION 'GET_TABLES'
     EXPORTING
       progname   = progname
     TABLES
       tables_tab = it_names.

*Check if there are tables in the internal tabel
   IF it_names IS INITIAL.

   MESSAGE 'DATA DOES NOT EXIST' TYPE 'I'.

     EXIT.

   ELSE.

*Subroutine to get the table details
     PERFORM TABLES_IN_PROGRAM.

   ENDIF.

*output display
   PERFORM alv_output.

*&---------------------------------------------------------------------*
*& Form TABLES_IN_PROGRAM
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*

FORM TABLES_IN_PROGRAM.

*To fetch Tables and their features
   IF it_names[] IS NOT INITIAL.

     SELECT tabname tabclass contflag FROM dd02l
     INTO CORRESPONDING FIELDS OF TABLE it_dd02l
     FOR ALL ENTRIES IN it_names
     WHERE tabname EQ it_names-name.

   ENDIF.

*To fetch the texts for the table
   IF it_dd02l[] IS NOT INITIAL.

     SELECT tabname ddtext FROM dd02t INTO CORRESPONDING FIELDS OF TABLE it_dd02t
     FOR ALL ENTRIES IN it_dd02l WHERE tabname EQ it_dd02l-tabname AND ddlanguage = 'E'.

   ENDIF.

*If no data is selected throw message
   IF sy-subrc <> 0.

    MESSAGE 'DATA DOES NOT EXIST' TYPE 'I'.

     EXIT.

   ENDIF.

*Appending values to the output table
   LOOP AT it_dd02l INTO wa_dd02l.

     wa_output-tabname = wa_dd02l-tabname.
     wa_output-tabclass = wa_dd02l-tabclass.
     wa_output-contflag = wa_dd02l-contflag.

     READ TABLE it_dd02t INTO wa_dd02t WITH KEY tabname = wa_dd02l-tabname.

     wa_output-text = wa_dd02t-ddtext.

     APPEND wa_output TO it_output.
     CLEAR wa_output.

   ENDLOOP.

*modifying the values in the output table for texts
   LOOP AT it_output INTO wa_output.

     AT NEW tabname.
       READ TABLE it_dd02l INTO wa_dd02l WITH KEY tabname = wa_output-tabname.

       CASE wa_dd02l-contflag.
         WHEN 'A'.
           wa_output-contflag = 'Application table (master and transaction data)'.
         WHEN 'C'.
           wa_output-contflag = 'Customizing table, maintenance only by cust., not SAP import '.
         WHEN 'L'.
           wa_output-contflag = 'Table for storing temporary data, delivered empty'.
         WHEN 'G'.
           wa_output-contflag = 'Customizing table, protected against SAP Upd., only INS all'.
         WHEN 'E'.
           wa_output-contflag = 'Control table, SAP and customer have separate key areas '.
         WHEN 'S'.
           wa_output-contflag = 'System table, maint. only by SAP, change = modification'.
         WHEN 'W'.
           wa_output-contflag = 'System table, contents transportable via separate TR objects '.
         WHEN ' '.
           wa_output-contflag = 'Delivery class not available '.

       ENDCASE.

       CASE wa_dd02l-tabclass.
         WHEN 'TRANSP'.
           wa_output-tabclass = 'Transparent table'.
         WHEN 'INTTAB'.
           wa_output-tabclass = 'Structure'.
         WHEN 'CLUSTER'.
           wa_output-tabclass = 'Cluster table'.
         WHEN 'POOL'.
           wa_output-tabclass = 'Pooled table'.
         WHEN 'VIEW'.
           wa_output-tabclass = 'General view structure '.
         WHEN 'APPEND'.
           wa_output-tabclass = 'Append structure'.

       ENDCASE.

       MODIFY it_output FROM wa_output TRANSPORTING contflag
                                                    tabclass
                                                    WHERE tabname EQ wa_output-tabname.
       CLEAR : wa_output , wa_dd02l.

     ENDAT.
   ENDLOOP.

ENDFORM. " TABLES_IN_PROGRAM

*&---------------------------------------------------------------------*
*&      Form  ALV_OUTPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM alv_output.

*Fieldcatalogue
   PERFORM build_fieldcat.

*Layout
   PERFORM build_layout.
*Display
   PERFORM alv_display.

ENDFORM.                    "ALV_OUTPUT

*&---------------------------------------------------------------------*
*&      Form  build_fieldcat
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*Field catalogue
FORM build_fieldcat.

   CLEAR wa_fieldcat.
   wa_fieldcat-row_pos   = '1'.
   wa_fieldcat-col_pos   = '1'.
   wa_fieldcat-fieldname = 'TABNAME'.
   wa_fieldcat-tabname   = 'IT_OUTPUT'.
   wa_fieldcat-seltext_m = 'TABLENAME'.
   APPEND wa_fieldcat TO it_fieldcat.

   CLEAR wa_fieldcat.
   wa_fieldcat-row_pos   = '1'.
   wa_fieldcat-col_pos   = '2'.
   wa_fieldcat-fieldname = 'TABCLASS'.
   wa_fieldcat-tabname   = 'IT_OUTPUT'.
   wa_fieldcat-seltext_m = 'CATEGORY'.
   APPEND wa_fieldcat TO it_fieldcat.

   CLEAR wa_fieldcat.
   wa_fieldcat-row_pos   = '1'.
   wa_fieldcat-col_pos   = '3'.
   wa_fieldcat-fieldname = 'TEXT'.
   wa_fieldcat-tabname   = 'IT_OUTPUT'.
   wa_fieldcat-seltext_m = 'DESCRIPTION'.
   APPEND wa_fieldcat TO it_fieldcat.

   CLEAR wa_fieldcat.
   wa_fieldcat-row_pos   = '1'.
   wa_fieldcat-col_pos   = '4'.
   wa_fieldcat-fieldname = 'CONTFLAG'.
   wa_fieldcat-tabname   = 'IT_OUTPUT'.
   wa_fieldcat-seltext_m = 'Delivery Class'.
   APPEND wa_fieldcat TO it_fieldcat.

ENDFORM.                     "build_fieldcat

*&---------------------------------------------------------------------*
*&      Form  build_layout
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*Layout
FORM build_layout.

   it_layout-zebra = 'X'.
   it_layout-colwidth_optimize = 'X'.

ENDFORM.                     "build_layout

*&---------------------------------------------------------------------*
*&      Form  alv_display
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*ALV output
FORM alv_display.

   CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
     EXPORTING
       i_callback_program       = sy-repid
       i_callback_html_top_of_page  = 'HTML_TOP_OF_PAGE'
       it_fieldcat              = it_fieldcat
       is_layout                = it_layout
     TABLES
       t_outtab                 = it_output.

ENDFORM.                    "alv_display

*-----------------------------------------------------------------*
*       FORM html_top_of_page                                     *
*-----------------------------------------------------------------*
FORM HTML_TOP_OF_PAGE USING top TYPE REF TO cl_dd_document.

   data tstring type SDYDO_TEXT_ELEMENT.

   tstring = program.

   CALL METHOD top->add_text EXPORTING text = 'Tables used in the program'
                                       sap_style = 'heading' .
   CALL METHOD top->add_text EXPORTING text = tstring
                                       sap_style = 'Heading' .

ENDFORM.


Read only

kiran_k8
Active Contributor
0 Likes
3,100

Mehdi,

Activate the trace in ST05

Run your tcode

Deactivate the trace in ST05

Display the trace.

Trace will be displaying the list of all the tables that are used in a tcode

K.Kiran.

Read only

former_member196490
Active Participant
0 Likes
3,099

Hi,

It is not directly possible to find the table name from the structure.

You can use the data element of the fields from of the structure and do a where used list to get the table names.

Mostly to retrieve data of the SAP standard Tcodes BAPI & FM are already available so these can be used to get the details.

You can also use the transaction ST05 to see the tables that are being used in the Tcode.

Another way to find the table is bu debugging. do a /h before getting to the screen from which you require the details. use the Menu to put a breakpoint at the statement 'SELECT'. The debugger will now stop at each select an dtable could be identified.

Read only

Former Member
0 Likes
3,099

i have tried what you all told me but it is a bit difficul tbecause i m a very new with abap.

Does anyone has a tutorial which show me how to find with st05 or with other ways

Thank you

Read only

0 Likes
3,099

Hello Mehdi,

This link is one of the best I've seen on how to find tables:

http://it.toolbox.com/wiki/index.php/Find_where_the_data_is_stored_in_SAP

You can also use the debugger create a watch-point to fire only when your field has changed, so you can discover the process that fills the structure.

There are several solutions to this problem, they just need a little time devoting to them

Stuart.