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: 

module pool program

ranjna_sharma
Explorer
0 Kudos

Hi,

i am developing a new infotype by T.C : pm01 i.e module pool program for HR module . i am creating a field and developed search help for it . now I want that whenever a user select that field content from F4 , its description comes automatically. plz tell me the correct way to do it .

field1 field1 Description

drodown box (f4)

1 ACCEPTED SOLUTION

GirieshM
Active Contributor
0 Kudos

1st step is:

choose screen 2000 for the program using t-code se80.

at the end of the coding enter the below code:

process ON VALUE-REQUEST.

FIELD screen field name module f4_zsearchhelp.

after typing the code double click on f4_zsearch help.

it ll ask for includes, Choose as main program.

then enter the below code after choosing:

DATA : t_dynpro_value TYPE TABLE OF dynpread,

v_field_value LIKE LINE OF t_dynpro_value,

lt_fields TYPE TABLE OF dfies,

t_return_str TYPE TABLE OF ddshretval,

w_return_str TYPE ddshretval,

v_text TYPE char25.

DATA: t_ty_prov_id TYPE STANDARD TABLE OF ty_prov_id,

w_ty_prov_id TYPE ty_prov_id.

CLEAR: t_ty_prov_id[], w_ty_prov_id, t_return_str[], w_return_str.

enter the select query from the description table to get the description for the particular code.

in this i had mentioned with an example that i m getting description for massg :

p9001-massg ll have the value and v_text ll have the description.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

  • DDIC_STRUCTURE = 'TY_TAB'

retfield = 'MASSG'------>returning field

  • PVALKEY = ' '

dynpprog = sy-repid

dynpnr = sy-dynnr

dynprofield = 'P9001-ZMASSG'----


> pass the screen field name

  • STEPL = 0

  • WINDOW_TITLE =

  • VALUE = ' '

value_org = 'S'

  • MULTIPLE_CHOICE = ' '

  • DISPLAY = ''

  • CALLBACK_PROGRAM = ' '

  • CALLBACK_FORM = ' '

  • MARK_TAB =

  • IMPORTING

  • USER_RESET =

TABLES

value_tab = t_ty_prov_id

  • field_tab = lt_fields

return_tab = t_return_str

  • DYNPFLD_MAPPING =

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.

READ TABLE t_return_str INTO w_return_str WITH KEY retfield = 'P9001-ZMASSG'.

IF sy-subrc IS INITIAL.

READ TABLE t_ty_prov_id INTO w_ty_prov_id WITH KEY zmassg_desc = w_return_str-fieldval.

IF sy-subrc eq 0.

  • DATA: et_desc(20) TYPE c.

  • et_desc = w_ty_agrtx-v_gtext.

*

  • MODIFY SCREEN.

CLEAR : v_field_value,t_dynpro_value[].

v_field_value-fieldname = 'P9001-ZMASSG'.

v_field_value-fieldvalue = w_ty_prov_id-action_resn.

APPEND v_field_value TO t_dynpro_value .

CLEAR : v_field_value.

v_field_value-fieldname = 'V_TEXT'.

v_field_value-fieldvalue = w_ty_prov_id-zmassg_desc.

APPEND v_field_value TO t_dynpro_value .

CLEAR : v_field_value.

ENDIF .

ENDIF.

CALL FUNCTION 'DYNP_VALUES_UPDATE'

EXPORTING

dyname = sy-cprog

dynumb = sy-dynnr

TABLES

dynpfields = t_dynpro_value

EXCEPTIONS

invalid_abapworkarea = 1

invalid_dynprofield = 2

invalid_dynproname = 3

invalid_dynpronummer = 4

invalid_request = 5

no_fielddescription = 6

undefind_error = 7

OTHERS = 8.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

you can add the v_text in layput .

hope it ll satisfy your requirement.

10 REPLIES 10

former_member305388
Active Contributor
0 Kudos

Hi Ranjna,

Lemme reiterate your query. You have a new field for which u want F4 help to be provided. And for this, you have already created a search help too. Now, you want not only the value of the field but also the description beside that. Right?

Did you create search help in that way? In searc help itself u can have both value of that field and even description. Then if u want this F4 help to be provided wherever u use the field, then attach this search help to the dataelement that u have created for this field.

Hope this helps.

0 Kudos

Hi,

I have created search help for field1 n when i press f4 it is showing me field content n description also .

the first field is populated but i want that field1 decription is also populated whenever user select field1 content from f4.

i.e

field1 field1 description

f4 help polpulated when press f4

t.v television.

plz tell how to populate field1 description based on field1 selection (f4).

0 Kudos

You will have to write a PAI module which will read the data from value table(used for F4 help) and display it in the text field adjacent to your input field.

Regards,

Rupesh

0 Kudos

Hi,

If you are using the FM : F4IF_INT_TABLE_VALUE_REQUEST and you have 2 fields in the internal table

***F4 HELP

data: begin of gt_display OCCURS 0,

FIELD(10),

FIELDTXT(20),

end of gt_display.

*fill in gt_display ...

*call

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = 'FIELDTXT' " <- return parameter should be the description field

dynpprog = c_program

dynprofield = 'FIELD'

dynpnr = sy-dynnr

WINDOW_TITLE = 'Report Variable'

value_org = 'S'

tables

value_tab = gt_display <---

EXCEPTIONS

PARAMETER_ERROR = 1

NO_VALUES_FOUND = 2

OTHERS = 3

Regards,

Srini.

0 Kudos

Hi Ranjna,

For this, u must write a select query for sure. If your is dialog program, then u can actually give the screenfield name as table1-desc1 directly. And once u enter some value into field1, based on this field1 value, u should fetch entry from table.

SELECT SINGLE * FROM table1 WHERE fild1 = value1.

Now, as ur screen field name is table1-desc1, this will automatically filled in.

Hope this clears.

former_member184578
Active Contributor
0 Kudos

Hi.,

Are u using drop down., !! if so assign function for for that list box, and in PAI., check that is selected and based on that populate description field.

If u are using input field with attached search help., in the search help u can do that., check Function Module: F4IF_INT_TABLE_VALUE_REQUEST

hope this helps u.,

Thanks & Regards

Kiran

Former Member
0 Kudos

Hi,

Please check the standard search help CV01 , and tcode CV01N.

GirieshM
Active Contributor
0 Kudos

1st step is:

choose screen 2000 for the program using t-code se80.

at the end of the coding enter the below code:

process ON VALUE-REQUEST.

FIELD screen field name module f4_zsearchhelp.

after typing the code double click on f4_zsearch help.

it ll ask for includes, Choose as main program.

then enter the below code after choosing:

DATA : t_dynpro_value TYPE TABLE OF dynpread,

v_field_value LIKE LINE OF t_dynpro_value,

lt_fields TYPE TABLE OF dfies,

t_return_str TYPE TABLE OF ddshretval,

w_return_str TYPE ddshretval,

v_text TYPE char25.

DATA: t_ty_prov_id TYPE STANDARD TABLE OF ty_prov_id,

w_ty_prov_id TYPE ty_prov_id.

CLEAR: t_ty_prov_id[], w_ty_prov_id, t_return_str[], w_return_str.

enter the select query from the description table to get the description for the particular code.

in this i had mentioned with an example that i m getting description for massg :

p9001-massg ll have the value and v_text ll have the description.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

  • DDIC_STRUCTURE = 'TY_TAB'

retfield = 'MASSG'------>returning field

  • PVALKEY = ' '

dynpprog = sy-repid

dynpnr = sy-dynnr

dynprofield = 'P9001-ZMASSG'----


> pass the screen field name

  • STEPL = 0

  • WINDOW_TITLE =

  • VALUE = ' '

value_org = 'S'

  • MULTIPLE_CHOICE = ' '

  • DISPLAY = ''

  • CALLBACK_PROGRAM = ' '

  • CALLBACK_FORM = ' '

  • MARK_TAB =

  • IMPORTING

  • USER_RESET =

TABLES

value_tab = t_ty_prov_id

  • field_tab = lt_fields

return_tab = t_return_str

  • DYNPFLD_MAPPING =

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.

READ TABLE t_return_str INTO w_return_str WITH KEY retfield = 'P9001-ZMASSG'.

IF sy-subrc IS INITIAL.

READ TABLE t_ty_prov_id INTO w_ty_prov_id WITH KEY zmassg_desc = w_return_str-fieldval.

IF sy-subrc eq 0.

  • DATA: et_desc(20) TYPE c.

  • et_desc = w_ty_agrtx-v_gtext.

*

  • MODIFY SCREEN.

CLEAR : v_field_value,t_dynpro_value[].

v_field_value-fieldname = 'P9001-ZMASSG'.

v_field_value-fieldvalue = w_ty_prov_id-action_resn.

APPEND v_field_value TO t_dynpro_value .

CLEAR : v_field_value.

v_field_value-fieldname = 'V_TEXT'.

v_field_value-fieldvalue = w_ty_prov_id-zmassg_desc.

APPEND v_field_value TO t_dynpro_value .

CLEAR : v_field_value.

ENDIF .

ENDIF.

CALL FUNCTION 'DYNP_VALUES_UPDATE'

EXPORTING

dyname = sy-cprog

dynumb = sy-dynnr

TABLES

dynpfields = t_dynpro_value

EXCEPTIONS

invalid_abapworkarea = 1

invalid_dynprofield = 2

invalid_dynproname = 3

invalid_dynpronummer = 4

invalid_request = 5

no_fielddescription = 6

undefind_error = 7

OTHERS = 8.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

you can add the v_text in layput .

hope it ll satisfy your requirement.

AbhinavDagar
Explorer
0 Kudos

Hi,

Your query is very simple,

On the screen just add another field in which description will come from the search help.

eg,

Lets say a search help is there which returns the EMP number and Emp Name

so on yuor screen system has already created EMP No field when u created the infotype via PM01

no just go to teh screen and add one more field with the same name which is there in the Search Help and it will be filled with the description.

Regards

Abhinav Dagar

pawan_rai
Participant
0 Kudos

Hi RANJNA,

You can take reference of below code .It had same requirement to get particular po for posting date.

for eg if you enter today's date and you press enter than you get po for that date...

DATA : it_return1 LIKE ddshretval OCCURS 0 WITH HEADER LINE.

AT SELECTION-SCREEN.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_doc.

SELECT REFID FROM MMIM_PREDOC_ORG INTO corresponding fields of TABLE ITAB where datlo = P_DAT.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

  • DDIC_STRUCTURE = ' '

RETFIELD = 'REFID'

  • PVALKEY = ' '

DYNPPROG = ' '

DYNPNR = SY-DYNNR

DYNPROFIELD = 'P_DOC'

  • STEPL = 0

  • WINDOW_TITLE =

  • VALUE = ' '

VALUE_ORG = 'S'

  • MULTIPLE_CHOICE = ' '

  • DISPLAY = ''

  • CALLBACK_PROGRAM = ' '

  • CALLBACK_FORM = ' '

  • MARK_TAB =

  • IMPORTING

  • USER_RESET =

TABLES

VALUE_TAB = ITAB

  • FIELD_TAB =

RETURN_TAB = IT_RETURN1

  • DYNPFLD_MAPPING =

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.

IF SY-SUBRC = 0.

READ TABLE IT_RETURN1 INDEX 1.

p_doc = it_return1-fieldval.

refresh ITAB.

ENDIF.

Regards,

Pawan