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

Former Member
0 Likes
1,027

I have an internal table which has three fields. for example,

Table name | filed | Value

vbap | matkl | 62

mara | matnr | 1000000023

kna1 | kvgr2 | 04

I want to find out the description of the value filed. Means what is mean by 62 for material group( matkl). IS there any function module for this? or any easy way to find out? please help me

1 ACCEPTED SOLUTION
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
967

Use FM DDIF_FIELDINFO_GET.

report zrich_0001.

data: idfies type table of dfies with header line.


clear idfies. refresh idfies.
call function 'DDIF_FIELDINFO_GET'
     exporting
          tabname   = 'VBAP'
          fieldname = 'MATKL'
     tables
          dfies_tab = idfies.
read table idfies index 1.
if sy-subrc = 0.
  write:/ idfies-fieldtext.
endif.

Regards,

Rich Heilman

11 REPLIES 11
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
968

Use FM DDIF_FIELDINFO_GET.

report zrich_0001.

data: idfies type table of dfies with header line.


clear idfies. refresh idfies.
call function 'DDIF_FIELDINFO_GET'
     exporting
          tabname   = 'VBAP'
          fieldname = 'MATKL'
     tables
          dfies_tab = idfies.
read table idfies index 1.
if sy-subrc = 0.
  write:/ idfies-fieldtext.
endif.

Regards,

Rich Heilman

Read only

0 Likes
967

This function module gives me what is VBAP-MATKL, But I need what is 62 for MATKL

Read only

0 Likes
967

Oh, I see. Well in that case, I think I agree with Ravi. You will need to code this yourself. You can find the values of the material groups from table T023T.

Regards,

Rich Heilman

Read only

0 Likes
967

for me it is not only vbap and matkl it may be any table and any filed.

Read only

0 Likes
967

For a given material group, you can get the description from <b>T023T</b>.

Regards,

Ravi

Note : Please mark all the helpful answers

Read only

0 Likes
967

Maybe you can use some of this code to find the text table that you need to read, then maybe read it dynamically. Not all text tables are set up with the same fields, this would be a problem.




report zrich_0001.


data: xchecktable type dd08v-tabname .
data: xtexttable type dd08v-tabname.
data: idfies type table of dfies with header line.

parameters: p_tab type  ddobjname,
            p_fld type  dfies-fieldname.

call function 'DDIF_FIELDINFO_GET'
     exporting
          tabname   = p_tab
          fieldname = p_fld
     tables
          dfies_tab = idfies.
read table idfies index 1.
if sy-subrc = 0.
  xchecktable = idfies-checktable.
endif.


call function 'DDUT_TEXTTABLE_GET'
     exporting
          tabname   = xchecktable
     importing
          texttable = xtexttable.



write:/ p_tab,
      / p_fld.
write:/ xchecktable.
write:/ xtexttable.


Regards,

Rich Heilman

Read only

0 Likes
967

There are some functions modules to get material group descriptions (like T023T_SINGLE_READ, /SAPNEA/SMAPI_MAT_GRP_GETLIST, and others), but a SELECT SINGLE from T023T seems to be the easiest and fastest approach.

Read only

0 Likes
967

Thank you very much. This will help me a lot

Read only

Former Member
0 Likes
967

I don't think there is any standard function module to get the description of the material group, you just need to get that from the master table of the material group (Text table for material group).

Regards,

Ravi

Note : Please mark all the helpful answers

Read only

Former Member
0 Likes
967

Check this thread out

Check FM DDIF_FIELDINFO_GET

Read only

Former Member
0 Likes
967

Hi,

*Validation for Material Group - MATKL

SELECT SINGLE matkl INTO lws_matkl FROM t023

WHERE matkl = '193891'.

IF sy-subrc <> 0.

ENDIF.

Regards,

Prakash.