Application Development 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: 

how to get the value range values of domain on alv grid using components of LVC_S_FCAT

pashasapcha
Participant
0 Kudos
1,178

I have created report program using OOPS abap from scratch to get the sap user list by using 2 tables USSR02 and USER_ADDR.

For the field USR02-UFLAG, in the table the values are maintained as 0,32,64 which are numeric. But the domain

value range the description for these values are maintained.

I am using LVC_T_FCAT for field catalog. I want to get the description from the domain value range of field UFLAG,

rather than just numbers on the ALV grid.

LVC_T_FCAT is of structure LVC_S_FCAT.

Is there any way I can achieve this using any of the components in LVC_S_FCAT ?

7 REPLIES 7

thkolz
Contributor
1,071

Good morning,

I'm afraid you need to create an additional column like UFLAG_DESCR and fill the descriptions there with the help of e.g. FM GET_DOMAIN_VALUES.

Best regards,
Thorsten.

0 Kudos
1,071

I have tried it. I have created lt_final1 wthout status description.

lt_final = lt_final1 + uflag_des.

now I am looping the lt_final1 into ls_final1.

I am passing all the values of lt_final1 into ls_final. so only one field ls_final_uflag-des is empty.

I am now using the FM 'DD_DOMVALUES_GET' and getting the domain values into internal table idd07v.

Now I want to read this internal table idd07v into idd07v_wa with key DOMVALUE_L = ls_final-uflag. "DOMVALUE_L is one field of idd07v.

Here ls_final1 and ls_final work areas both are having values inside loop. but values are not getting moved from idd07v into idd07v_wa (work area).

Here, read table is not working to move the DDTEXT description into ls_final-uflag_des.

1,071

UFLAG is an integer value.
You need to convert it to DOMVALUE_L first:

TYPES:
BEGIN OF ty_data,
uflag TYPE xuuflag,
uflag_descr TYPE c LENGTH 60,
END OF ty_data.

TYPES tt_data TYPE STANDARD TABLE OF ty_data WITH DEFAULT KEY.

DATA:
t_data TYPE tt_data,
t_dd07v_tab TYPE dd07v_tab.

t_data = VALUE tt_data( ( uflag = 0 ) ( uflag = 128 ) ( uflag = 64 ) ).

* Needs to be called only once
CALL FUNCTION 'DD_DOMVALUES_GET'
EXPORTING domname = 'XUUFLAG'
text = abap_true
TABLES dd07v_tab = t_dd07v_tab
EXCEPTIONS wrong_textflag = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.

LOOP AT t_data ASSIGNING FIELD-SYMBOL(<fs_data>).
* Convert value to CHAR 10
DATA(v_value) = condense( CONV domvalue_l( <fs_data>-uflag ) ).

IF line_exists( t_dd07v_tab[ domvalue_l = v_value ] ).
<fs_data>-uflag_descr = t_dd07v_tab[ domvalue_l = v_value ]-ddtext.
ENDIF.

ENDLOOP.

cl_demo_output=>display( t_data ).

Sandra_Rossi
Active Contributor
0 Kudos
1,071

Just to say, this is a little bit more official solution:

Method GET_DDIC_FIXED_VALUES of CL_ABAP_ELEMDESCR.

pashasapcha concerning "is not working" (concerning "move the DDTEXT description into ls_final-uflag_des"), what do you mean? (what do you get, what do you expect + provide the context so that we can understand)

0 Kudos
1,071

I have tried the way Kolz mentioned and it worked. Let me make you clear . "is not working" , basically what I am doing is I am running a loop and inside the loop I am trying to read the internal table (idd07v) which we are getting from the 'DD_DOMVALUES_GET'.

idd07v contains field DOMVALUE_L . I have to read this internal table into workarea with the Domvalue_l and then I have to copy the DDTEXT into final workarea for alv display.

The result should be as follows

If there is any other way of achieving it , please let me know.

The overall requirement is that the user should know his employess login details and status which we are achieving using 2 tables USSR02 and USER_ADDR. Lock description field is not there, User will not understand the numbers, so we are fetching the domain values and getting it displayed on the grid.
Let me know if you need any more details. or we can leave it as the issue is resolved.

Sandra_Rossi
Active Contributor
0 Kudos
1,071

pashasapcha Sorry, I still don't get what "is not working" (it's what you said before Thorsten posted a final comment), I think you did not answer, you just repeated what you want to achieve. But as you now say that it's resolved, no need for you to clarify what WAS not working.

0 Kudos
1,071

"If there is any other way of achieving it , please let me know."

As I wrote at the beginning, there's no other way to achieve this.