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

Selection Screen F4 help

Former Member
0 Likes
428

Hi

I am designiing the Selection Screen.Based on the fst value of the selection screen my secound in put help should be seen.

I am using the following code

AT SELECTION-SCREEN ON VALUE-REQUEST FOR pa_sno.

SELECT num

sno FROM zsd_tab_cr_panel

INTO TABLE it_panel

WHERE num = pa_num.

IF sy-subrc EQ 0.

DELETE ADJACENT DUPLICATES FROM it_panel .

ENDIF.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = 'SNO'

dynpprog = sy-repid

dynpnr = '1000'

dynprofield = 'PA_SNO'

window_title = 'TEST'

VALUE_ORG = 'S'

TABLES

value_tab = it_panel

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.

after entering pa_num value in selection screen when i press f4 for second field is going initial hence my above code is not owrking.

please suggest me wat to do

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
400

Hai..

I tried the same thing with FM 'F4IF_INT_TABLE_VALUE_REQUEST'.

It is working well. Iam pating working code here. Hope It may to solve Ur problem.


*&-------To Provyde F4 Help

 DATA : BEGIN OF IT_HELP OCCURS 1,
             VBELN TYPE VBRK-VBELN,
             KUNAG TYPE VBRK-KUNAG,
            END OF IT_HELP.

DATA : IT_DYNP TYPE STANDARD TABLE OF DYNPREAD WITH HEADER LINE.
DATA : V_CUST TYPE KNA1-KUNNR.

SELECTION-SCREEN : BEGIN OF BLOCK B1.
 PARAMETERS : P_CUST LIKE VBRK-KUNAG,
              P_SORD LIKE VBRK-VBELN.
SELECTION-SCREEN : END OF BLOCK B1.

*&------- AT SELECTION SCREEN
*&---------------------------------------------------------------------*
*& parameter P_CUST Value is not assigning directly in this case,
*  so we need to read that value using FM 'DYNP_VALUES_READ'
*&---------------------------------------------------------------------*

AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_SORD.

  IT_DYNP-FIELDNAME = 'P_CUST'.
  APPEND IT_DYNP.

CALL FUNCTION 'DYNP_VALUES_READ'
    EXPORTING
      DYNAME                               = SY-CPROG
      DYNUMB                               = SY-DYNNR
    TABLES
      DYNPFIELDS                           = IT_DYNP.

 IF SY-SUBRC = 0.
   READ TABLE IT_DYNP WITH KEY FIELDNAME = 'P_CUST'.
    IF SY-SUBRC = 0.
     V_CUST = IT_DYNP-FIELDVALUE.
    ENDIF.
 ENDIF.

*&------- To display Salesorders based on Customer

*-------
  CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
    EXPORTING
      INPUT         = V_CUST
    IMPORTING
      OUTPUT        = V_CUST.
*-------

SELECT VBELN
       KUNAG FROM VBRK INTO TABLE IT_HELP
                       WHERE KUNAG = V_CUST.

*&---------------------------------------------------------------------*
*& 'F4IF_INT_TABLE_VALUE_REQUEST' This FM is to display requested values
*   as a table on selection screen for selection
*&---------------------------------------------------------------------*

  CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
    EXPORTING
      RETFIELD               = 'VBELN'
      DYNPPROG               = SY-CPROG
      DYNPNR                 = SY-DYNNR
      DYNPROFIELD            = 'P_SORD'
      VALUE_ORG              = 'S'
    TABLES
      VALUE_TAB              = IT_HELP.

Code Formatted by: Alvaro Tejada Galindo on Dec 26, 2008 10:21 AM

3 REPLIES 3
Read only

Former Member
0 Likes
400

In VALUE-REQUEST event we can't get the screen values, to get the screen values first we have to use

DATA: zdynpread LIKE  dynpread OCCURS 0 WITH HEADER LINE.
  MOVE 'PA_NUM' TO zdynpread-fieldname.
  APPEND zdynpread.

  CALL FUNCTION 'DYNP_VALUES_READ'
       EXPORTING
            dyname     = dyname
            dynumb     = '1000'
       TABLES
            dynpfields = zdynpread.


READ TABLE zdynpread WITH KEY fieldname = 'PA_NUM'

then pass this value to further process

Regards

Sasi

Read only

Former Member
0 Likes
401

Hai..

I tried the same thing with FM 'F4IF_INT_TABLE_VALUE_REQUEST'.

It is working well. Iam pating working code here. Hope It may to solve Ur problem.


*&-------To Provyde F4 Help

 DATA : BEGIN OF IT_HELP OCCURS 1,
             VBELN TYPE VBRK-VBELN,
             KUNAG TYPE VBRK-KUNAG,
            END OF IT_HELP.

DATA : IT_DYNP TYPE STANDARD TABLE OF DYNPREAD WITH HEADER LINE.
DATA : V_CUST TYPE KNA1-KUNNR.

SELECTION-SCREEN : BEGIN OF BLOCK B1.
 PARAMETERS : P_CUST LIKE VBRK-KUNAG,
              P_SORD LIKE VBRK-VBELN.
SELECTION-SCREEN : END OF BLOCK B1.

*&------- AT SELECTION SCREEN
*&---------------------------------------------------------------------*
*& parameter P_CUST Value is not assigning directly in this case,
*  so we need to read that value using FM 'DYNP_VALUES_READ'
*&---------------------------------------------------------------------*

AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_SORD.

  IT_DYNP-FIELDNAME = 'P_CUST'.
  APPEND IT_DYNP.

CALL FUNCTION 'DYNP_VALUES_READ'
    EXPORTING
      DYNAME                               = SY-CPROG
      DYNUMB                               = SY-DYNNR
    TABLES
      DYNPFIELDS                           = IT_DYNP.

 IF SY-SUBRC = 0.
   READ TABLE IT_DYNP WITH KEY FIELDNAME = 'P_CUST'.
    IF SY-SUBRC = 0.
     V_CUST = IT_DYNP-FIELDVALUE.
    ENDIF.
 ENDIF.

*&------- To display Salesorders based on Customer

*-------
  CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
    EXPORTING
      INPUT         = V_CUST
    IMPORTING
      OUTPUT        = V_CUST.
*-------

SELECT VBELN
       KUNAG FROM VBRK INTO TABLE IT_HELP
                       WHERE KUNAG = V_CUST.

*&---------------------------------------------------------------------*
*& 'F4IF_INT_TABLE_VALUE_REQUEST' This FM is to display requested values
*   as a table on selection screen for selection
*&---------------------------------------------------------------------*

  CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
    EXPORTING
      RETFIELD               = 'VBELN'
      DYNPPROG               = SY-CPROG
      DYNPNR                 = SY-DYNNR
      DYNPROFIELD            = 'P_SORD'
      VALUE_ORG              = 'S'
    TABLES
      VALUE_TAB              = IT_HELP.

Code Formatted by: Alvaro Tejada Galindo on Dec 26, 2008 10:21 AM

Read only

Former Member
0 Likes
400

modified ur code ..

 
DATA : it_return LIKE ddshretval OCCURS 0 WITH HEADER LINE. "declare this
AT SELECTION-SCREEN ON VALUE-REQUEST FOR pa_sno.
IF NOT PA_NUM IS INITIAL." drop this and prevalidate this parameter
SELECT num
sno FROM zsd_tab_cr_panel
INTO TABLE it_panel
WHERE num = pa_num.
IF sy-subrc EQ 0.
DELETE ADJACENT DUPLICATES FROM it_panel .
ENDIF.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'SNO'
dynpprog = sy-repid
dynpnr = '1000'
dynprofield = 'PA_SNO'
window_title = 'TEST'
VALUE_ORG = 'S'

TABLES
value_tab = it_panel
return_tab = it_return  "new 
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.
pa_sno = it_return-fieldval. "screen field returned 

endif.

i hope u r getting the f4 values as desired when posting this thread ..

then this should return the val when u have selected the field ..just check and confirm