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

Search help with Two fields

former_member720692
Discoverer
0 Likes
3,458

hi all,

i want to create a search help(F4) for material based on two fields.

1. MAKT-MAKTX (40 characters)

2. MARA-NORMT (20 characters)

Please advice how to achieve this.

Thanks in advance

9 REPLIES 9
Read only

naveen_inuganti2
Active Contributor
0 Likes
2,097

Hi.,

If it is in screen level...

You need to declare the internal table which should be pass into F4IF-- Function module with your two fields

--Naveen Inuganti.

Read only

Former Member
0 Likes
2,097

if there are 2parameters in selection screen. For e.g. matnr and werks.

then to create a search help(F4) for material based on two fields:

AT SELECTION-SCREEN ON VALUE-REQUEST FOR werks.

select the werks based on plant in internal.table 
use f.m

F4IF_INT_TABLE_VALUE_REQUEST.
and pass the i.tab here in 

tables
value_t = i.tab

Or

Follow the psudo code below.

Note: it_matnr has only single field MATNR.

***--- Return table to handle selected field in F4 help ---***

data: it_return like ddshretval occurs 0 with header line.
 
parameters: p_matnr type marc-matnr,
                  p_werks type marc-werks.
 
at selection-screen on value-request for p_repnam.
 
  select matnr
         from marc
         into table it_matnr
         where werks eq p_werks.
 
  call function 'F4IF_INT_TABLE_VALUE_REQUEST'
    exporting
      retfield         = 'OBJ_NAME'
      dynpprog         = sy-cprog
      dynpnr           = sy-dynnr
      value_org        = 'S'
      callback_program = sy-cprog
    tables
      value_tab        = it_matnr
      return_tab       = it_return
    exceptions
      parameter_error  = 1
      no_values_found  = 2.
 
  if sy-subrc eq 0.
    loop at it_return.
      clear p_repnam.
      p_repnam = it_return-fieldval.
    endloop.
 
  endif.

regards

rahul

Read only

Former Member
0 Likes
2,097

Hi,

To create search help for a field based on other fields follow this link,

http://www.sapdevelopment.co.uk/dictionary/shelp/shelphome.htm

If u have any doubt let me know.

Read only

Former Member
0 Likes
2,097

Hi,

In which field u want to have search help.

If my understanding of ur problem is right then the following code will help u.


constants: c_s type c value 'S',
           c_e type c value 'E',
           c_n type c value 'N',
           c_x type c value 'X',
           c_01 type i value '1',
           c_ass_name(10) type c value 'MATNRS',
           c_ass_sg_main type c value '*',
           c_a type c value 'A'.

selection-screen begin of block input with frame title text-000.
select-options:  it_matnr for wa_output-matnr no intervals.
parameters:      p_werks type marc-werks,
                 p_plgscn type tcx0l-plscn.
selection-screen end of block input .

initialization.

*  Initializing select-options variables

  gv_w_opt_list-name = c_a.
  gv_w_opt_list-options-eq = c_x.
  append gv_w_opt_list to gv_w_res-opt_list_tab.
  gv_w_ass-kind = c_a.
  gv_w_ass-name = c_ass_name.
  gv_w_ass-op_main = c_a.
  gv_w_ass-sg_main = c_ass_sg_main.
  append gv_w_ass to gv_w_res-ass_tab.

* It allows to restrict intervals for select-options in selection screen

  call function 'SELECT_OPTIONS_RESTRICT'
    exporting
      program                = sy-repid
      restriction            = gv_w_res
    exceptions
      too_late               = 1
      repeated               = 2
      selopt_without_options = 3
      selopt_without_signs   = 4
      invalid_sign           = 5
      empty_option_list      = 6
      invalid_kind           = 7
      repeated_kind_a        = 8
      others                 = 9.

  if sy-subrc <> 0.
    message id sy-msgid type sy-msgty number sy-msgno
           with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  endif.

Thanks.

Read only

Former Member
0 Likes
2,097

hi you create a search help in se11 ..

as zsearch,.

here you write

in selection method ===name of your table used for input.

in parameter

there are two type parameters

import and export

in import you take fields which are used for selection

and in export you take the field to display input.

Read only

former_member720692
Discoverer
0 Likes
2,097

Hi all,

thanx for quick reply.

I'm creating a search help for MM01/MM02/MM03.

MAKTX belongs to table MAKT and NORMT belongs to MARA, and i've to concatenate these fields for the same search help.

PLease help me in this regard and please suggest me the HELP EXIT, in which i can code for the further requirments.

Read only

0 Likes
2,097

You can create a search help using SE11 and assign the same in program.


goto se11 - give ZHELP as search help - create.

selection method - mara
dialog type - display values immediately

add these fields

parameter lpos rpos
MATNR 1 1
MAKTX  2 2
NORMT 3  3

also check imp ,exp parameters for these and activate.

now in your program use this.

select-options: matnr for mara-matnr matchcode object ZHELP.

Read only

0 Likes
2,097

hi if you want to take data from two table then create a view for that..

nad use this view in your selection method

Read only

0 Likes
2,097

I got it to work by reading the dynpro values with FM DYNP_VALUES_READ. see the example in the following llink