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

Function module for read data of 20 Tables

Former Member
0 Likes
1,918

Hi Experts,

i am facing a problem to creating a Function Module.

Problem: i want to get the data from 20 Database tables standard.there is no relationship in between. Import Parameter is Field_id (Table field) based on this we want Result : Field_id, Field code, field Text.

Example: field id = MTART (METARIAL TYPE) TABLE T134T

MBRSH ( industry type ) TABLE : T137T

Result : MTART (metarial code) ,MTBEZ (metarial Text)

Can any body tell me how i can do this function module.

your answer will be very usefull.

Thanks .

Hi Experts,

i am facing a problem to creating a Function Module.

Problem: i want to get the data from 20 Database tables standard.there is no relationship in between. Import Parameter is Field_id (Table field) based on this we want Result : Field_id, Field code, field Text.

Example: field id = MTART (METARIAL TYPE) TABLE T134T

MBRSH ( industry type ) TABLE : T137T

Result : MTART (metarial code) ,MTBEZ (metarial Text)

Can any body tell me how i can do this function module.

your answer will be very usefull.

Thanks .

6 REPLIES 6
Read only

Former Member
0 Likes
972

Hi

You can build a FM to bring data from 20 tables. Question is how will you relate data from one table to another?

You cant just bring all data from these tables. There should be a valid relation between the tables and the data.

You can use optimized code to make your FM an effective one.

Regards

Raj

Read only

0 Likes
972

Hi Raj,

i give you example .in the tables there is no relationship between them.

only i want to select only three field from every table then display in to one table.

if you have any idea please suggest me.

Thanks

Read only

sukhbold_altanbat
Active Participant
0 Likes
972

Hi Rashmi,

Check these tables:

Domain: <b>DD01L & DD01T</b>

values for the domains <b>DD07L & DD07T</b>

Data elements : <b>DD04L & DD04T</b>

Table Fields: <b>DD03L & DD03T</b>

Foreign key fields: <b>DD05S</b>

Tables: <b>DD02L & DD02T</b>

Technical settings of tables <b>DD09L</b>

Texts on SQL tables <b>DD06T</b>

Pool, Cluster structures: <b>DD06L</b>

Relationship definitions : <b>DD08L & DD08T</b>

now, for your requirement do the followings:

1. se11 and try to see the content of table DD03L (table for table fields) provding the fieldID (MTART). so result will show all the tables which uses the given field.

2. now you can write your FM for the same.

it is just simple select statement from table DD03L where fieldID = MTART (example). also you can retreive the description text of same fieldID from DD03T proving the fieldID.

Hope it is useful.

Regards,

Sukhee

Read only

former_member194669
Active Contributor
0 Likes
972

Hi,

Check this code


REPORT ZTABLEFIELDNAME.

TABLES: DFIES,
        X030L.

DATA: BEGIN OF INTTAB OCCURS 100.
        INCLUDE STRUCTURE DFIES.
DATA: END OF INTTAB.

PARAMETERS: TABLENM TYPE DDOBJNAME       DEFAULT 'MSEG',
            FIELDNM TYPE DFIES-FIELDNAME DEFAULT 'MENGE'.

      call function 'DDIF_FIELDINFO_GET'
        exporting
          tabname              = TABLENM
          FIELDNAME            = FIELDNM
          LANGU                = SY-LANGU
*         LFIELDNAME           = ' '
*         ALL_TYPES            = ' '
*       IMPORTING
*         X030L_WA             = WATAB
*         DDOBJTYPE            =
*         DFIES_WA             =
*         LINES_DESCR          =
        TABLES
          DFIES_TAB            = INTTAB
*         FIXED_VALUES         =
        EXCEPTIONS
          NOT_FOUND            = 1
          INTERNAL_ERROR       = 2
          OTHERS               = 3.

      if sy-subrc <> 0.
         WRITE:/ 'Field name not found'.
      endif.

      LOOP AT INTTAB.
         WRITE:/ INTTAB-TABNAME, INTTAB-FIELDNAME, INTTAB-FIELDTEXT.
      ENDLOOP.

*** End of Program 

aRs

Read only

0 Likes
972

Hi, thanks for your reponse.

but i want to display the data from standard Table (T134) .

plese see my first Message.

Thanks.

Read only

sukhbold_altanbat
Active Participant
0 Likes
972

Hi Rashmi,

your requirement is not that clear. What i understood is your FM will import only one parameter which is the field name and will do something , finally will return 3 parameters.

I want to know whether those 20 standard tables are known or unknown.

And could you just explain the 3 outputs (Field_id, Field_code, Field_text) ?

actually what is Field_code?

from your first example it is difficult to know what are those.

Regards,

Sukhee