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 for field on selection-screen

former_member189596
Active Participant
0 Kudos

Hi all,

I have requirement to create search for fields which are on seelction-screen.

i have fallowing fields on selection-screen.

Company Number,

Currency

Decimal places .

First i need to create F4 help for Company numer.( it has only five field values)

Then Based on Company Number, i need to keep default curreny there.

Based i need to keep decimal points for that on selection-screen .

Is there any point to know sample code for this.

Thanks in advance,

Regards,

Bhaskar

3 REPLIES 3

Former Member
0 Kudos

Hi,

Try like this,

tables kna1.

data: begin of t_values occurs 2,

value like kna1-begru,

end of t_values,

t_return like ddshretval occurs 0 with header line.

select-options s_begru for kna1-begru.

at selection-screen on value-request for s_begru-low.

refresh t_values.

t_values = 'PAR*'.

append t_values.

t_values = 'UGG'.

append t_values.

call function 'F4IF_INT_TABLE_VALUE_REQUEST'

exporting

retfield = 'BEGRU'

value_org = 'S'

tables

value_tab = t_values

return_tab = t_return

exceptions

parameter_error = 1

no_values_found = 2

others = 3.

if sy-subrc = 0.

read table t_return index 1.

s_begru-low = t_return-fieldval.

endif.

Rewards points if helpful.

Regards,

Srinivas Ch

Former Member
0 Kudos

Hope below code can give you some idea:


parameters: p_ccode type bukrs,
            p_cur   type waers,
            p_dec   type i.

at selection-screen output.

   if not p_ccode is initial.
      select single waers into p_cur from t001
             where bukrs = p_ccode.
*** Similarly for Decimals
   else.
      clear: p_cur, p_dec.
   endif.

Kind Regards

Eswar

former_member200338
Active Contributor
0 Kudos

Hi,

Check the below code. You need to create a form and pass the form name in callback_form parameter.

data: lt_retval type standard table of ddshretval,

ls_retval like ddshretval,

lt_dynmap type standard table of dselc,

ls_dynmap type dselc,

dynp_values type standard table of dynpread ,

wa_dynp_values type dynpread,

lt_values type table of seahlpres,

lt_fields type table of dfies,

ls_field type dfies,

ls_return type ddshretval.

clear ls_field.

ls_field-fieldname = 'SKILLS'.

ls_field-intlen = 15.

ls_field-leng = 15.

ls_field-outputlen = 15.

ls_field-scrtext_m = 'SKILLS AVALIABLE'.

append ls_field to lt_fields.

clear ls_field.

ls_field-fieldname = 'DESCRIPTION'.

ls_field-intlen = 25.

ls_field-leng = 25.

ls_field-outputlen = 25.

ls_field-scrtext_m = 'DESCRIPTION'.

append ls_field to lt_fields.

perform fill_values using 'C' 'C programming'.

perform fill_values using 'C+' 'C+ Programming'.

perform fill_values using 'ABAP' 'ABAP Language'.

perform fill_values using 'JAVA' 'JAVA programming'.

perform fill_values using 'SAP SCRIPT' 'Working with SAP Scripts'.

perform fill_values using 'SMART FORMS' 'Smart forms'.

call function 'F4IF_INT_TABLE_VALUE_REQUEST'

exporting

retfield = 'SKILLS'

dynpprog = sy-repid

callback_program = sy-repid

callback_form = 'F4_CALLBACK_FORM'

tables

value_tab = gt_values

field_tab = lt_fields

return_tab = lt_retval

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.

sort lt_retval by fieldname descending .

read table lt_retval into ls_retval index 1.

if sy-subrc eq 0 .

move ls_retval-fieldval to p_skill2.

read table lt_retval into ls_retval index 2.

if sy-subrc eq 0.

move ls_retval-fieldval to p_title.

endif.

endif.

refresh dynp_values.

wa_dynp_values-fieldname = 'P_TITLE'.

wa_dynp_values-fieldvalue = p_title.

append wa_dynp_values to dynp_values.

call function 'DYNP_VALUES_UPDATE'

exporting

dyname = sy-repid

dynumb = '0100'

tables

dynpfields = dynp_values

exceptions

others = 04.

&----


*& Form F4_callback_form

&----


  • To get the TDLNR field value from search help

----


form f4_callback_form

tables record_tab structure seahlpres

changing shlp type shlp_descr

callcontrol like ddshf4ctrl.

data: interface like line of shlp-interface.

interface-shlpfield = 'DESCRIPTION'.

interface-valfield = '~'.

interface-f4field = 'X' .

append interface to shlp-interface[] .

endform. " F4_callback_form

Reward points if useful,

Regards,

Niyaz

Edited by: Niyaz Ahamed on Jan 8, 2008 2:13 PM