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
866

PARAMETER : cntlarea LIKE CSKS-KOKRS OBLIGATORY.

my requirement is this : when the user click on F4, all the CSKS-KOKRS values should be displayed.

for this i used the following code:

SELECT KOKRS FROM CSKS INTO TABLE ITAB.

AT Selection-screen on value-request for cntlarea.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = 'KOKRS'

DYNPPROG = sy-repid

DYNPNR = sy-dynnr

DYNPROFIELD = 'CNTRLAREA'

WINDOW_TITLE = 'SELECT'

tables

value_tab = ITAB

The o/p is : No values found.

Please help me out.

1 ACCEPTED SOLUTION
Read only

Lakshmant1
Active Contributor
0 Likes
823

Hi Chirsty,

Please check the following,

Check for the internal table declaration, as in the select statement you are fetching KOKRS only. Instead use corresponding fields or declare ITAB with only 1 field.

Also in the the FM pass VALUE_ORG = 'S'.

PARAMETER : cntlarea LIKE CSKS-KOKRS OBLIGATORY.

AT Selection-screen on value-request for cntlarea.

SELECT KOKRS FROM CSKS INTO corresponding fields of TABLE ITAB.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = 'KOKRS'

DYNPPROG = sy-repid

DYNPNR = sy-dynnr

DYNPROFIELD = 'CNTRLAREA'

WINDOW_TITLE = 'SELECT'

VALUE_ORG = 'S'

tables

value_tab = ITAB.

Thanks

Lakshman

Edited by: Lakshman Tandra on May 20, 2008 3:30 PM

8 REPLIES 8
Read only

Former Member
0 Likes
823

Hi,

Try with this code

&----


*& Report YF4 *

*& *

&----


*& *

*& *

&----


REPORT yf4 .

TABLES:VBAK.

PARAMETERS:P_VBELN TYPE VBELN_VA,P_VKORG TYPE VKORG.

SELECT-OPTIONS:P_KUNNR FOR VBAK-KUNNR.

*PARAMETERS:P_KUNNR TYPE KUNNR.

TYPES: BEGIN OF ty_VBAK,

VBELN TYPE VBELN_VA,

VKORG TYPE VKORG,

KUNNR TYPE KUNNR,

END OF TY_VBAK.

DATA: T_VBAK TYPE TABLE OF TY_VBAK INITIAL SIZE 0.

DATA: BEGIN OF T_KUNNR OCCURS 0,

KUNNR TYPE KUNNR,

END OF T_KUNNR.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_VBELN.

PERFORM SUB_F4_VBELN.

FORM SUB_F4_VBELN.

select vbeln VKORG KUNNR from vbak into table t_vbak up to 20 rows.

*SELECT KUNNR FROM VBAK INTO TABLE T_KUNNR UP TO 20 ROWS.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

  • DDIC_STRUCTURE = ' '

retfield = 'VBELN'

  • PVALKEY = ' '

DYNPPROG = SY-REPID

DYNPNR = SY-DYNNR "'1000'

DYNPROFIELD = 'P_VBELN'

  • STEPL = 0

  • WINDOW_TITLE =

  • VALUE = ' '

VALUE_ORG = 'S'

  • MULTIPLE_CHOICE = ' '

  • DISPLAY = ' '

  • CALLBACK_PROGRAM = ' '

  • CALLBACK_FORM = ' '

  • MARK_TAB =

  • IMPORTING

  • USER_RESET =

tables

value_tab = T_VBAK

  • FIELD_TAB =

  • RETURN_TAB =

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

ENDFORM.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_VKORG.

PERFORM SUB_F4_VKORG.

FORM SUB_F4_VKORG.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

  • DDIC_STRUCTURE = ' '

retfield = 'VKORG'

  • PVALKEY = ' '

DYNPPROG = SY-REPID

DYNPNR = SY-DYNNR "'1000'

DYNPROFIELD = 'P_VKORG'

  • STEPL = 0

  • WINDOW_TITLE =

  • VALUE = ' '

VALUE_ORG = 'S'

  • MULTIPLE_CHOICE = ' '

  • DISPLAY = ' '

  • CALLBACK_PROGRAM = ' '

  • CALLBACK_FORM = ' '

  • MARK_TAB =

  • IMPORTING

  • USER_RESET =

tables

value_tab = T_VBAK

  • FIELD_TAB =

  • RETURN_TAB =

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

ENDFORM.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_KUNNR-LOW.

PERFORM SUB_F4_KUNNR.

FORM SUB_F4_KUNNR.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

  • DDIC_STRUCTURE = ' '

retfield = 'KUNNR'

  • PVALKEY = ' '

DYNPPROG = SY-REPID

DYNPNR = SY-DYNNR "'1000'

DYNPROFIELD = 'P_KUNNR'

  • STEPL = 0

  • WINDOW_TITLE =

  • VALUE = ' '

VALUE_ORG = 'S'

  • MULTIPLE_CHOICE = ' '

  • DISPLAY = ' '

  • CALLBACK_PROGRAM = ' '

  • CALLBACK_FORM = ' '

  • MARK_TAB =

  • IMPORTING

  • USER_RESET =

tables

value_tab = T_VBAK

  • FIELD_TAB =

  • RETURN_TAB =

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

ENDFORM.

Read only

Former Member
0 Likes
823

This should help



AT Selection-screen on value-request for cntlarea.

clear: itab, itab[].

SELECT KOKRS FROM CSKS INTO TABLE ITAB.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'KOKRS'
DYNPPROG = sy-repid
DYNPNR = sy-dynnr
DYNPROFIELD = 'CNTRLAREA'
WINDOW_TITLE = 'SELECT'
tables
value_tab = ITAB

Read only

Former Member
0 Likes
823

Hi,

YOu just need this code:

PARAMETER : cntlarea LIKE CSKS-KOKRS OBLIGATORY.

OR

PARAMETER : cntlarea LIKE TKA01-KOKRS OBLIGATORY.

Cheers.

...Reward if useful.

Read only

Former Member
0 Likes
823

Hi,

Make sure that the transparent table CSKS has entries in it so that ITAB filled after you select from the table.

However KOKRS being a standard data ditionary field you dont need to call that function or do any sort of extra coding as you will get the f4 help automatically.

regards,

Advait.

Read only

Lakshmant1
Active Contributor
0 Likes
824

Hi Chirsty,

Please check the following,

Check for the internal table declaration, as in the select statement you are fetching KOKRS only. Instead use corresponding fields or declare ITAB with only 1 field.

Also in the the FM pass VALUE_ORG = 'S'.

PARAMETER : cntlarea LIKE CSKS-KOKRS OBLIGATORY.

AT Selection-screen on value-request for cntlarea.

SELECT KOKRS FROM CSKS INTO corresponding fields of TABLE ITAB.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = 'KOKRS'

DYNPPROG = sy-repid

DYNPNR = sy-dynnr

DYNPROFIELD = 'CNTRLAREA'

WINDOW_TITLE = 'SELECT'

VALUE_ORG = 'S'

tables

value_tab = ITAB.

Thanks

Lakshman

Edited by: Lakshman Tandra on May 20, 2008 3:30 PM

Read only

0 Likes
823

hi Lakshman,

i tried again. my itab declarartion is this:

data : begin of itab occurs 0,

cntlarea LIKE CSKS-KOKRS,

end of itab.

which event i have to use to trigger F4 help on cntlarea.

Read only

0 Likes
823

Hi

Do in this way.

DATA : BEGIN OF itab OCCURS 0,
cntlarea LIKE csks-kokrs,
END OF itab.

PARAMETER : cntlarea LIKE csks-kokrs OBLIGATORY.

INITIALIZATION.

  SELECT kokrs FROM csks INTO TABLE itab.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR cntlarea.

  CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
    EXPORTING
      retfield     = 'CNTLAREA'
      dynpprog     = sy-repid
      dynpnr       = sy-dynnr
      value_org    = 'S'
      dynprofield  = 'CNTLAREA'
      window_title = 'SELECT'
    TABLES
      value_tab    = itab.

Read only

Former Member
0 Likes
823

Hi I think below lines of code will help youu2026

FORM sapfz_01_gi_kunnr_f4 .

SORT gi_kunnr.

DELETE ADJACENT DUPLICATES FROM gi_kunnr.

DELETE gi_kunnr WHERE kunnr = space.

  • Fetching the corresponding Description for the Customer.

SELECT kunnr

name1

ort01

FROM kna1

INTO TABLE gi_kunnr_f4

FOR ALL ENTRIES IN gi_kunnr

WHERE kunnr = gi_kunnr-kunnr

AND spras = sy-langu.

IF NOT gi_kunnr_f4 IS INITIAL.

SORT gi_kunnr_f4.

DELETE ADJACENT DUPLICATES FROM gi_kunnr_f4.

DELETE gi_kunnr_f4 WHERE kunnr = space.

  • Call the below function module to "F4 help - returning the value

  • to be displayed"

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = gc_kunnr

dynpprog = sy-cprog

dynpnr = sy-dynnr

dynprofield = gc_dynpro_kunnr

value_org = gc_s

TABLES

value_tab = gi_kunnr_f4.

ENDIF. " IF NOT gi_kunnr_f4 IS INITIAL.

ENDFORM. " sapfz_01_gi_kunnr_f4