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

f4 help

Former Member
0 Likes
717

hi all,

I want to restrict the user to select the value from f4 help only instead of entering it manually.

is it possible. if yes, how

Thanks in advance

Veda

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
691

Hi

You can do it in Four ways.

1. You can take the reference of data element which has Search help assigned to it.

Code Below.

Parameters: p_lifnr type lifnr.

select-options: s_lofnr for lfa1-lifnr.

2. You can take reference type like below.

parameters: p_lifnr type lfa1-lifnr. or any field.

3. you can create Search help for that field through SE11 and assigned this to ur select options or parameters.

see code below.

PARAMETERS: p_zloc type zloctno MATCHCODE OBJECT zlocation,

here Zlocation is Search help object.

4. You can do it in Program itself.

data: int_fdoc type standard table of x_fdoc,

int_return type standard table of ddshretval.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_fdoc.

  • Select Field for F4 help.

SELECT <Filed> FROM <Table name> INTO TABLE<Internal table >WHERE <As per ur reqt comndition>

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = '<Fieldn ame>'

value_org = 'S'

TABLES

value_tab = int_fdoc

return_tab = int_return

EXCEPTIONS

parameter_error = 1

no_values_found = 2

OTHERS = 3.

IF sy-subrc = 0.

GET CURSOR FIELD ws_field.

READ TABLE int_return INTO wa_return INDEX 1.

IF sy-subrc = 0.

p_fdoc = wa_return-fieldval.

ENDIF.

CLEAR wa_fdoc.

ENDIF.

Hope This will help u lot.

<removed_by_moderator>

Regards,

Shyam

Edited by: Julius Bussche on Aug 21, 2008 10:34 AM

7 REPLIES 7
Read only

Former Member
0 Likes
691

Hi,

You can try like this,

Suppose if you want to provide F4 help for MATNR then

write AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_MATNR.

And provide F4 help values to that field.

within this event put one flag like W_FLAG = 1.

Initially W_FLAG =0. So when user enters his

own value in that field then the value of W_FLAG = 0.

If selects F4 help then value of W_FLAG becomes 1.

When user executes the report then check the value of W_FLAG .

If it is 0 then give a message. And also don't forget to make the field input disable after entering the value. So that he can't be able to change the value in that field again.

parameters:
  p_matnr like mara-matnr.
data: 
  w_flag type i.
  
AT SELECTION-SCREEN ON VALUE-REQUEST FOR
 
 P_MATNR.  
  W_FLAG = 1.

 CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
   .........

* check condition in at selection-screen event
AT SELECTION-SCREEN.
   if sy-ucomm eq 'ONLI'.
      if W_FLAG ne 1.
         message 'Please select from F4 help' type 'E'.
      endif.   
   else.
     PERFORM PRINT_OUTPUT.
    endif.
   
    

Regards,

Rajitha.

Read only

Former Member
0 Likes
691

SDH4

F4_ENTER_SELECTIONS

SF4E

F4_ENTER_FREE_SELECTIONS

Regards

Anbu

Read only

Subhankar
Active Contributor
0 Likes
691

Hi ...

Please check this... think it will solve your problem

PARAMETERS: p_matnr TYPE matnr.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_matnr .

Read only

Former Member
0 Likes
692

Hi

You can do it in Four ways.

1. You can take the reference of data element which has Search help assigned to it.

Code Below.

Parameters: p_lifnr type lifnr.

select-options: s_lofnr for lfa1-lifnr.

2. You can take reference type like below.

parameters: p_lifnr type lfa1-lifnr. or any field.

3. you can create Search help for that field through SE11 and assigned this to ur select options or parameters.

see code below.

PARAMETERS: p_zloc type zloctno MATCHCODE OBJECT zlocation,

here Zlocation is Search help object.

4. You can do it in Program itself.

data: int_fdoc type standard table of x_fdoc,

int_return type standard table of ddshretval.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_fdoc.

  • Select Field for F4 help.

SELECT <Filed> FROM <Table name> INTO TABLE<Internal table >WHERE <As per ur reqt comndition>

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = '<Fieldn ame>'

value_org = 'S'

TABLES

value_tab = int_fdoc

return_tab = int_return

EXCEPTIONS

parameter_error = 1

no_values_found = 2

OTHERS = 3.

IF sy-subrc = 0.

GET CURSOR FIELD ws_field.

READ TABLE int_return INTO wa_return INDEX 1.

IF sy-subrc = 0.

p_fdoc = wa_return-fieldval.

ENDIF.

CLEAR wa_fdoc.

ENDIF.

Hope This will help u lot.

<removed_by_moderator>

Regards,

Shyam

Edited by: Julius Bussche on Aug 21, 2008 10:34 AM

Read only

Former Member
0 Likes
691

you can make use of the "DISPLAY" parameter of the FM "F4IF_INT_TABLE_VALUE_REQUEST", pass the value for the "DISPLAY"

as "F"(Force Display) and disable(SCREEN-INPUT = 0) the input for the field using LOOP AT SCREEN in AT SELECTION-SCREEN OUTPUT event.

Read only

Former Member
0 Likes
691

Hi,

you can go through this sample program .

TABLES:ZACTESTTABLE.

DATA: BEGIN OF ITAB OCCURS 0,

NAME TYPE ZACTESTTABLE-NAME,

END OF ITAB.

DATA : IT_RETURN TYPE STANDARD TABLE OF DDSHRETVAL WITH HEADER LINE.

PARAMETERS : NAMEEMP LIKE ZACTESTTABLE-NAME.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR NAMEEMP.

SELECT NAME FROM ZACTESTTABLE INTO TABLE ITAB.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

  • DDIC_STRUCTURE = ' '

retfield = 'NAME'

  • PVALKEY = ' '

DYNPPROG = 'SY-REPID'

DYNPNR = '1000'

DYNPROFIELD = 'NAMEEMP'

  • 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_RETURN

  • 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 only

Former Member
0 Likes
691

Hi ,

In that case i suppose u need to make the screen filed in display mode .

if it is in input mode then he can enter any value of his choice sometimes wrong value also .. and that needs to be validated again in pai ..

So inorder to make the user to choose from a set of fields only then either u can have a list drop down which is advised if the entries are say less in number or make the field disabled but providing the f4 func'ty.

selecting the list entry and moving it to screen field ..

Br, vijay..