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: 

Search Helps returning multiple values

Former Member
0 Kudos

Hi,

can any one tell how to fill the fields from search help to the screen fields

say suppose I have made a fields "CODE" and attached search help having values : "CODE", "Name", "Department" and when I click F4 for search help popup with all the values and I select one of them (say : 1002, BOB, IT) then CODE field on the screen is populated with "1002" . But the problem is how to display other two fields " Name" , "Department" on the screen from the above selected search help.

please suggest how to incorporate the above senario

thanks

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Bobby,

chk the FM dynp_values_update.

Also have a look at the code:

report zabc.

parameters: p_bukrs type t001-bukrs,

p_butxt type t001-butxt,

p_ort01 type t001-ort01,

p_land1 type t001-land1.

data: dynfields type table of dynpread with header line.

data: return type table of ddshretval with header line.

at selection-screen on value-request for p_bukrs.

call function 'F4IF_FIELD_VALUE_REQUEST'

exporting

tabname = 'T001'

fieldname = 'BUKRS'

dynpprog = sy-cprog

dynpnr = sy-dynnr

dynprofield = 'P_BUKRS'

tables

return_tab = return

exceptions

field_not_found = 1

no_help_for_field = 2

inconsistent_help = 3

no_values_found = 4

others = 5.

break-point.

refresh dynfields.

read table return with key fieldname = 'P_BUKRS'.

  • Add it back to the dynpro.

dynfields-fieldname = return-retfield.

dynfields-fieldvalue = return-fieldval.

append dynfields.

  • Get the company code from db and add to dynpro

data: xt001 type t001.

clear xt001.

select single * into xt001

from t001

where bukrs = return-fieldval.

dynfields-fieldname = 'P_BUTXT'.

dynfields-fieldvalue = xt001-butxt.

append dynfields.

dynfields-fieldname = 'P_ORT01'.

dynfields-fieldvalue = xt001-ort01.

append dynfields.

dynfields-fieldname = 'P_LAND1'.

dynfields-fieldvalue = xt001-land1.

append dynfields.

  • Update the dynpro values.

call function 'DYNP_VALUES_UPDATE'

exporting

dyname = sy-cprog

dynumb = sy-dynnr

tables

dynpfields = dynfields

exceptions

others = 8.

start-of-selection.

REgards,

keerthi

4 REPLIES 4

Former Member
0 Kudos

Check this sample code

TYPES: BEGIN OF t_code,

katalogart TYPE qpct-katalogart,

codegruppe TYPE qpct-codegruppe,

code TYPE qpct-code,

version TYPE qpct-version,

kurztext TYPE qpct-kurztext,

END OF t_code.

DATA : i_code TYPE TABLE OF t_code.

SELECT katalogart codegruppe
         code       version
         kurztext FROM qpct
                  INTO TABLE i_code
                  WHERE katalogart EQ '3'
                    AND codegruppe IN r_cdgrp
                    AND sprache EQ sy-langu.

  IF sy-subrc EQ 0.

    CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
       EXPORTING
*     DDIC_STRUCTURE         = ' '
         retfield               = 'CODE'
         dynpprog               = sy-repid
         dynpnr                 = sy-dynnr
         dynprofield            = 'S_VCODE'
         value_org              = 'S'
       TABLES
         value_tab              = i_code[]
*      return_tab             =
       EXCEPTIONS
         parameter_error        = 1
         no_values_found        = 2
         OTHERS                 = 3
               .
    IF sy-subrc <> 0.
*   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*           WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.

  ENDIF.

Former Member
0 Kudos

Hi Bobby,

chk the FM dynp_values_update.

Also have a look at the code:

report zabc.

parameters: p_bukrs type t001-bukrs,

p_butxt type t001-butxt,

p_ort01 type t001-ort01,

p_land1 type t001-land1.

data: dynfields type table of dynpread with header line.

data: return type table of ddshretval with header line.

at selection-screen on value-request for p_bukrs.

call function 'F4IF_FIELD_VALUE_REQUEST'

exporting

tabname = 'T001'

fieldname = 'BUKRS'

dynpprog = sy-cprog

dynpnr = sy-dynnr

dynprofield = 'P_BUKRS'

tables

return_tab = return

exceptions

field_not_found = 1

no_help_for_field = 2

inconsistent_help = 3

no_values_found = 4

others = 5.

break-point.

refresh dynfields.

read table return with key fieldname = 'P_BUKRS'.

  • Add it back to the dynpro.

dynfields-fieldname = return-retfield.

dynfields-fieldvalue = return-fieldval.

append dynfields.

  • Get the company code from db and add to dynpro

data: xt001 type t001.

clear xt001.

select single * into xt001

from t001

where bukrs = return-fieldval.

dynfields-fieldname = 'P_BUTXT'.

dynfields-fieldvalue = xt001-butxt.

append dynfields.

dynfields-fieldname = 'P_ORT01'.

dynfields-fieldvalue = xt001-ort01.

append dynfields.

dynfields-fieldname = 'P_LAND1'.

dynfields-fieldvalue = xt001-land1.

append dynfields.

  • Update the dynpro values.

call function 'DYNP_VALUES_UPDATE'

exporting

dyname = sy-cprog

dynumb = sy-dynnr

tables

dynpfields = dynfields

exceptions

others = 8.

start-of-selection.

REgards,

keerthi

Former Member
0 Kudos

I'm trying to get multiple values return also, could you tell me what did you do to resolve this?

here is my code to return only ONE value.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

RETFIELD = 'ZTBLPIF-PROJECTNUMBER'

DYNPROFIELD = 'ZTBLPIF-PROJECTID'

DYNPPROG = SY-CPROG

DYNPNR = SY-DYNNR

VALUE_ORG = 'S'

TABLES

VALUE_TAB = HELP_ITEM.

0 Kudos

simply using FM 'F4IF_FIELD_VALUE_REQUEST', put vallue into 'dynpfld_mapping' with value_tab's fieldname and Dyn fieldnames. IF value_tab has more than one key columns, using return-fieldval is not enough condition for Select from dbtab.