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: 

Possible Values List for Database Fields

Former Member
0 Kudos

Hi,

I have a requirement where on the selection screen, I give a Table(Infotype) name and Field name.

The report has to show the list of all Possible values for this particular field.

The Value List should be similar to the list available with F4 in SE16.

I could debug the FMs, "DD_SHLP_CALL_FROM_DYNP", "HELP_START" etc..

But, therez a lot of standard code.

I just wanted to check out if there is a simple method of doing this.

Please suggest.

Thanks,

Suryakiran D.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hello,

Even if u press F4 on stat2 field in SE16 of PA0000 and the table is blank then also u will get the values from T529U only. As u said u were debugging the program when F4 is pressed, if u just do it again and when u reach HELP_START line 56

if help_infos-call = 'T' or "Alle Arten von Prüftabellen

help_infos-call = 'M' or "Matchcode-Hilfe

help_infos-call = 'V'. "Festwerte (Domäne oder VALUES)

it takes T which is indicating check table.

Now if ur req is something other than accessing this check table I would suggest u write ur own code in AT selection-screen on value-request for stat1.

7 REPLIES 7

Former Member
0 Kudos

sample code is given below...the FM u have to use is F4IF_INT_TABLE_VALUE_REQUEST.. First select data using proper query into your internal table and then paass this internal table along with selection-screen field name to FM..

***************************************************

SELECT EXIDV FROM VEKP AS A

INNER JOIN VEPO AS B ON AVENUM EQ BVENUM

INTO TABLE IT_EXIDV

WHERE B~VBELN EQ L_VBELN.

DELETE ADJACENT DUPLICATES FROM IT_EXIDV.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

RETFIELD = 'EXIDV'

DYNPPROG = SY-REPID

DYNPNR = SY-DYNNR

DYNPROFIELD = 'EXIDV-LOW'

VALUE_ORG = 'S'

TABLES

VALUE_TAB = IT_EXIDV.

************************************************

if your selection-screen field is non Data-dictionary Field then logic of getting F4 help for it goes follwing.

************************************************

FORM get_input_help USING ret_val CHANGING s_status_value.

DATA: BEGIN OF itab_values OCCURS 0,

key TYPE tdhyphenat,

value TYPE tdobject,

END OF itab_values.

MOVE: 'a' TO itab_values-key,

'Drive' TO itab_values-value.

APPEND itab_values.

MOVE: 'b' TO itab_values-key,

'Stop' TO itab_values-value.

APPEND itab_values.

MOVE: 'c' TO itab_values-key,

'Accelarate' TO itab_values-value.

APPEND itab_values.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = ret_val

value_org = 'S'

TABLES

value_tab = itab_values

return_tab = itab_return.

IF sy-subrc = 0.

READ TABLE itab_return INDEX 1.

READ TABLE itab_values WITH KEY value = itab_return-fieldval.

s_status_value = itab_values-key.

ENDIF.

CLEAR itab_values.

REFRESH itab_values.

ENDFORM. " get_input_help

Message was edited by: kaushal malavia

Former Member
0 Kudos

Hello Suryakrian,

For ur report, if the field already has a search help available then u can code it as

select-options <sass> matchcode object <mobj>

if u don't have search help then u can code

at selection screen on value-request for <abc>.

former_member188685
Active Contributor
0 Kudos

Hi Surya kiran,

here is the sample code check it..

REPORT  ZTEST_DYNAMIC  no standard page heading                         .


parameters: tabl type DD03L-tabname,
            fld type dd03l-FIELDNAME.

data: begin of itab occurs 0,
       char(20),
      end of itab.

start-of-selection.

         select (fld)
              into table itab
              from (tabl).
              if sy-subrc = 0.

              endif.
end-of-selection.
write: tabl.
write:/ fld.
loop at itab.

write: / ITAB-char.

endloop.

Regards

vijay

0 Kudos

Sorry guys,

If I say, Table: PA0000, Field: STAT2, I get the List of Possible Values from the Check Table T529U.

Its not necessary that PA0000 has all the values of STAT2 in it.

Some Cases, I have to get the List of Possible values from the Value Table in the Domains.

Some cases, I have to get from the Search Helps.

Say, I have no entries in PA0000,

Even then, if I go to SE16 and do an F4 on Stat2 field, I get a list of Possible Values.

I want this list to be displayed on the report.

Please suggest.

Thanks,

Suryakiran D.

Former Member
0 Kudos

Hello,

Even if u press F4 on stat2 field in SE16 of PA0000 and the table is blank then also u will get the values from T529U only. As u said u were debugging the program when F4 is pressed, if u just do it again and when u reach HELP_START line 56

if help_infos-call = 'T' or "Alle Arten von Prüftabellen

help_infos-call = 'M' or "Matchcode-Hilfe

help_infos-call = 'V'. "Festwerte (Domäne oder VALUES)

it takes T which is indicating check table.

Now if ur req is something other than accessing this check table I would suggest u write ur own code in AT selection-screen on value-request for stat1.

0 Kudos

Hi,

Its not just STA2. The decision on the Source of Possible List is not fixed. It depends on the Field requested. And, HELP_START shows a dialog in between. I dont want a dialog, I just need a List of all the possible values, say in an internal table.

And, HELP_START is not working for P0181-ADID1. Please suggest what extra information to be passed.

Thanks,

Suryakiran D.

0 Kudos
REPORT  ZTEST_DYNAMIC  NO STANDARD PAGE HEADING                         .


PARAMETERS: TABL TYPE DD03L-TABNAME,
            FLD TYPE DD03L-FIELDNAME.

DATA: BEGIN OF ITAB OCCURS 0,
       CHAR(20),
      END OF ITAB.
DATA: CHECKTABLE LIKE DD03L-CHECKTABLE,
      DOMNAME LIKE DD03L-DOMNAME.

START-OF-SELECTION.
  SELECT SINGLE CHECKTABLE
               INTO CHECKTABLE
               FROM DD03L
               WHERE TABNAME = TABL
                AND FIELDNAME = FLD.
  IF SY-SUBRC <> 0.
    SELECT SINGLE DOMNAME
                  INTO DOMNAME
                 FROM DD03L
          WHERE TABNAME = TABL
                AND FIELDNAME = FLD.
    IF SY-SUBRC <> 0.
      SELECT (FLD)
           INTO TABLE ITAB
           FROM (TABL).
      IF SY-SUBRC = 0.

      ENDIF.
    ELSE.
      "get the check table value
      "select the data from check table
    ENDIF.
  ELSE.
    "call this FM get domain values DDUT_DOMVALUES_GET
  ENDIF.

END-OF-SELECTION.
"now based on data availability you show the data of checktable/domain fixed values/table