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

Typical issue with F4 Functionality on MPP

Former Member
0 Likes
1,014

I have two fields on the screen. I have provided the F4 Option to the first field.

EX: Fld1 = Customer Number - Provided the F4 Help.

Fld2 = Customer Name - When i chooose any number from F4 help, i should get the corresponding name on the 2nd field.

I have two fields on the screen. I have provided the F4 Option to the first field.

EX: Fld1 = Customer Number - Provided the F4 Help.

Fld2 = Customer Name - When i chooose any number from F4 help, i should get the corresponding name on the 2nd field.

6 REPLIES 6
Read only

Former Member
0 Likes
967

Hi,

Try this example.

When carrid is entered then for that carrid corresponding

connid's will be displayed when you press F4 on connid.

PARAMETERS :
  p_carrid  LIKE spfli-carrid,
  p_connid  LIKE spfli-connid.

DATA:
 w_conn TYPE dfies-fieldname,
 w_carr TYPE dfies-fieldname.

DATA:
  w_prog1  TYPE  sy-repid,
  w_dynp1  TYPE  sy-dynnr,
  w_prog LIKE d020s-prog,
  w_dynp LIKE d020s-dnum,
  w_tabix LIKE sy-tabix,
  w_carrid LIKE spfli-carrid,
  w_connid LIKE spfli-connid.


*---------------------------------------------------------------------*
*           Declaration Of  Internal Table t_emp                      *
*---------------------------------------------------------------------*
DATA:
  BEGIN OF t_flight OCCURS 0,
    carrid TYPE spfli-carrid,
    connid TYPE spfli-connid,
    fldate TYPE sflight-fldate,
 END OF  t_flight .

*---------------------------------------------------------------------*
*    Internal Table To Hold MARA Table Details                        *
*---------------------------------------------------------------------*
DATA:
  t_dynpro TYPE
  STANDARD TABLE
        OF dynpread
      WITH HEADER LINE.

*---------------------------------------------------------------------*
*    Field string to hold field_value                                 *
*---------------------------------------------------------------------*

DATA:
 field_value LIKE LINE OF t_dynpro.


*---------------------------------------------------------------------*
*    Internal Table To Hold MARA Table Details                        *
*---------------------------------------------------------------------*

DATA:
  t_return TYPE
  STANDARD TABLE
        OF ddshretval
      WITH HEADER LINE.

*---------------------------------------------------------------------*
*    Internal Table To Hold MARA Table Details                        *
*---------------------------------------------------------------------*
DATA:
   BEGIN OF itab_connid OCCURS 3,
     carrid TYPE s_carr_id,
     connid TYPE spfli-connid,
  END OF itab_connid.

*---------------------------------------------------------------------*
*    Internal Table To Hold MARA Table Details                        *
*---------------------------------------------------------------------*
DATA:
  BEGIN OF itab_carrid OCCURS 3,
    carrid TYPE spfli-carrid,
 END OF itab_carrid.

*---------------------------------------------------------------------*
*                START-OF-SELECTION  EVENT                            *
*---------------------------------------------------------------------*

START-OF-SELECTION.

   SELECT carrid
         connid
         fldate
    INTO TABLE t_flight
    FROM sflight
   WHERE carrid = p_carrid
     AND connid = p_connid.

  LOOP AT t_flight.
    WRITE :/  t_flight-carrid,
              t_flight-connid,
              t_flight-fldate.
  ENDLOOP.

*---------------------------------------------------------------------*
*               AT SELECTION-SCREEN OUTPUT                            *
*---------------------------------------------------------------------*
 AT SELECTION-SCREEN .

 READ TABLE itab_connid WITH KEY connid = w_conn.

    p_carrid = itab_connid-carrid.
    w_carr   = itab_connid-carrid.

 P_CARRID = W_CARR.
 P_CONNID = W_CONN.


*---------------------------------------------------------------------*
*       AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_carrid.            *
*---------------------------------------------------------------------*
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_carrid .
  PERFORM carrid_select.


*---------------------------------------------------------------------*
*      AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_CONNID              *
*---------------------------------------------------------------------*
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_connid .

  CLEAR p_carrid.
  CLEAR p_connid.
  CLEAR: field_value, t_dynpro.
  field_value-fieldname = 'P_CARRID'.
  APPEND field_value TO t_dynpro.
  field_value-fieldname = 'P_CONNID'.
  APPEND field_value TO t_dynpro.


  w_prog = sy-repid.
  w_dynp = sy-dynnr.

* To read the values entered at screen

  CALL FUNCTION 'DYNP_VALUES_READ'
    EXPORTING
      dyname             = w_prog
      dynumb             = w_dynp
      translate_to_upper = 'X'
    TABLES
      dynpfields         = t_dynpro.

  READ TABLE  t_dynpro INDEX 1 INTO field_value.

  w_carrid = field_value-fieldvalue.
  p_carrid = w_carrid.

  READ TABLE  t_dynpro INDEX 2 INTO field_value.
  w_connid = field_value-fieldvalue.
  p_connid = w_connid.



* If carrid is not initial

  IF p_carrid IS NOT INITIAL.

    w_prog1 = sy-repid.
    w_dynp1 = sy-dynnr.

    REFRESH itab_connid.

    SELECT carrid connid
                    FROM spfli
                    INTO CORRESPONDING FIELDS OF TABLE itab_connid
            WHERE carrid EQ w_carrid.

    CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
      EXPORTING
        retfield        = w_conn
        value_org       = 'S'
 
      TABLES
        value_tab       = itab_connid
        return_tab      = t_return
      EXCEPTIONS
        parameter_error = 1
        no_values_found = 2
        OTHERS          = 3.
    IF sy-subrc EQ 0.
*    READ TABLE T_RETURN INDEX SY-TABIX INTO p_connid.
    ENDIF.

    w_conn = t_return-fieldval.
    p_connid = w_conn.

*** If carrid is initial 
   ELSE.
 
    SELECT carrid
           connid
      INTO TABLE itab_connid
      FROM spfli.

    CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
      EXPORTING
        retfield        = w_conn
        value_org       = 'S'
      TABLES
        value_tab       = itab_connid
        return_tab      = t_return
      EXCEPTIONS
        parameter_error = 1
        no_values_found = 2
        OTHERS          = 3.
    IF sy-subrc EQ 0.

*    READ TABLE ITAB_CONNID INDEX SY-TABIX  .
    ENDIF.

    CLEAR p_connid.
    CLEAR p_carrid.

    w_conn = t_return-fieldval.
    p_connid =  w_conn.

    READ TABLE itab_connid WITH KEY connid = w_conn.

    p_carrid = itab_connid-carrid.
    w_carr = itab_connid-carrid.
    p_carrid = w_carr.

  ENDIF.


*&---------------------------------------------------------------------*
*&      Form  carrid_select
*&---------------------------------------------------------------------*
 
FORM carrid_select .
  SELECT carrid
                   FROM scarr
                   INTO CORRESPONDING FIELDS OF TABLE itab_carrid.

  CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
    EXPORTING
      retfield        = w_carr
      value_org       = 'S'
    TABLES
      value_tab       = itab_carrid
      return_tab      = t_return
    EXCEPTIONS
      parameter_error = 1
      no_values_found = 2
      OTHERS          = 3.
  IF sy-subrc EQ 0.
*    READ TABLE T_RETURN INDEX sy-tabix INTO p_carrid.
  ENDIF.

  w_carrid = t_return-fieldval.

  p_carrid = w_carrid.

ENDFORM.                    " CARRID_SELECT

Regards,

Rajitha.

Read only

0 Likes
966

Hi friends i want the functionality not in a report selection screen. i want that functionality in the Modulepool Program

Read only

0 Likes
966

hi,

try this.

you can create a collective search help for both the fields. and in the PAI you have to write a select query to display the second value.

reward points if helpful,

siri.

Read only

Former Member
0 Likes
966

hi,

you can try something like inside the AT SELECTION-SCREEN events select the value for field2 against field1.

like:

at selection-screen on field1.

***select...

if field1 = 'A'.

field2 = 'B'.

endif.

With luck,

Pritam.

Read only

Former Member
0 Likes
966

Hi manjunath,

In case of Report program we provide F4 help for a field using

AT SELECTION-SCREEN ON VALUE-REQUEST FOR <field-name>

In case of Module poole you can write the code in

' Process on Value-request' event .

It will work there also. Just write the code within

VALUE-REQUEST fro both the fields.

Regards,

Rajitha.

Edited by: Rajitha Muthineni on Jul 9, 2008 12:15 PM

Read only

Former Member
0 Likes
966

I Myself solved the issue.