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: 

How to get two fields help using on f4 help

Former Member
0 Kudos

Hello gurus,

I am using  F4IF_INT_TABLE_VALUE_REQUEST FM in POV for f4 help of a field  and my requirement is to get another field information automatically with the first field. So for one f4 on field A need to get information of field B also , its like its description.

I am trying to fillup two fields in Field mapping table  and used it in FM . But i can only populate one field the description i cant get it..

Code:

Internal table populated with two fields.

W_FMAP-FLDNAME = 'BUKRS'.

   W_FMAP-DYFLDNAME = 'T_TAB-BUKRS'.

   APPEND W_FMAP TO T_FMAP.

   W_FMAP-FLDNAME = 'BUTXT'.

   W_FMAP-DYFLDNAME = 'T_TAB-BUTXT'.

   APPEND W_FMAP TO T_FMAP.


CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

     EXPORTING

*     DDIC_STRUCTURE         = 'T001'

       retfield               = 'BUKRS'

      DYNPPROG               = SY-REPID

      DYNPNR                 = '0001'

      DYNPROFIELD            = 'T_TAB-BUKRS'

     tables

       value_tab              = T_T001

      DYNPFLD_MAPPING        = T_FMAP

Please friends is ther anything to add in this..

11 REPLIES 11

former_member226419
Contributor
0 Kudos

Hi,

Refer be low code.

    SELECT matnr FROM mara INTO TABLE lt_makt UP TO 200 ROWS.

    CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

      EXPORTING

*     DDIC_STRUCTURE         = ' '

        retfield               =  'MATNR'

       value_org               = 'S'

      TABLES

        value_tab              = lt_makt

*      field_tab               = lt_return

      return_tab               = lt_return.

    p_matnr = lt_return-fieldval.

    DATA wa_makt TYPE makt.

    DATA  : lt_dynpread TYPE STANDARD TABLE OF dynpread,

            ls_dynpread TYPE dynpread.

* Get the value for desc.

  CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

    EXPORTING

      input  = p_matnr

    IMPORTING

      output = p_matnr.

  SELECT SINGLEFROM makt INTO wa_makt WHERE matnr = p_matnr AND spras = sy-langu.

*   IF p_matnr = 10000.

  p_maktx = wa_makt-maktx.

*     p_maktx = 'ABC'.

*   ENDIF.

*Update it in field.

    ls_dynpread-fieldname  = 'P_MAKTX'..

    ls_dynpread-fieldvalue =  p_maktx. "wa_makt-maktx.

    APPEND ls_dynpread TO lt_dynpread.

    CALL FUNCTION 'DYNP_VALUES_UPDATE'

      EXPORTING

        dyname               = sy-cprog     " prog id

        dynumb               = sy-dynnr     " screen no

      TABLES

        dynpfields           = lt_dynpread

      EXCEPTIONS

        invalid_abapworkarea = 1

        invalid_dynprofield  = 2

        invalid_dynproname   = 3

        invalid_dynpronummer = 4

        invalid_request      = 5

        no_fielddescription  = 6

        undefind_error       = 7

        OTHERS               = 8.

BR

Sumeet

former_member226419
Contributor
0 Kudos

Hi,

You just need to call FM 'DYNP_VALUES_UPDATE' after your code.

BR

Sumeet

0 Kudos

TYPES : BEGIN OF TY_T001,

         BUKRS TYPE BUKRS,

         BUTXT TYPE BUTXT,

         ORT01 TYPE ORT01,

         LAND1 TYPE LAND1,

         END OF TY_T001.

  DATA : T_T001 TYPE TABLE OF TY_T001 INITIAL SIZE 0,

         W_T001 TYPE TY_T001,

         T_T001_1 TYPE TABLE OF TY_T001 INITIAL SIZE 0,

         W_T001_1 TYPE TY_T001,

         T_FMAP TYPE TABLE OF DSELC ,

         W_FMAP TYPE DSELC,

         T_RETURN TYPE TABLE OF DDSHRETVAL,

         W_RETURN TYPE DDSHRETVAL,

         T_DYNPREAD TYPE TABLE OF DYNPREAD,

         W_DYNPREAD TYPE DYNPREAD.

   SELECT BUKRS

          BUTXT

          ORT01

          LAND1

          INTO TABLE T_T001

          FROM T001.

   IF SY-SUBRC <> 0.

     WRITE : 'NO DATA FOR HELP'.

   ENDIF.

   W_FMAP-FLDNAME = 'BUKRS'.

   W_FMAP-DYFLDNAME = 'ZEXP_CTR-BUKRS'.

   APPEND W_FMAP TO T_FMAP.

   W_FMAP-FLDNAME = 'BUTXT'.

   W_FMAP-DYFLDNAME = 'ZEXP_CTR-BUTXT'.

   APPEND W_FMAP TO T_FMAP.

   CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

     EXPORTING

*     DDIC_STRUCTURE         = 'T001'

       retfield               = 'BUKRS'

*     PVALKEY                = ' '

      DYNPPROG               = SY-REPID

      DYNPNR                 = '0001'

      DYNPROFIELD            = 'ZEXP_CTR-BUKRS'

*     STEPL                  = 0

*     WINDOW_TITLE           =

*     VALUE                  = ' '

      VALUE_ORG              = 'S'

*     MULTIPLE_CHOICE        = ' '

*     DISPLAY                = ' '

*     CALLBACK_PROGRAM       = SY-CPROG

*     CALLBACK_FORM          = 'CALLBACK_F4'

*     CALLBACK_METHOD        =

*     MARK_TAB               =

*   IMPORTING

*     USER_RESET             =

     tables

       value_tab              = T_T001

*     FIELD_TAB              =

*      RETURN_TAB             = T_RETURN

*     DYNPFLD_MAPPING        = T_FMAP

    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.

   W_DYNPREAD-FIELDNAME = 'BUKRS'.

   W_DYNPREAD-FIELDVALUE = 'ZEXP_CTR-BUKRS'.

   APPEND W_DYNPREAD TO T_DYNPREAD.

   W_DYNPREAD-FIELDNAME = 'BUTXT'.

   W_DYNPREAD-FIELDVALUE = 'ZEXP_CTR-BUTXT'.

   APPEND W_DYNPREAD TO T_DYNPREAD.

CALL FUNCTION 'DYNP_VALUES_UPDATE'

   EXPORTING

     dyname                     = SY-CPROG

     dynumb                     = SY-DYNNR

   TABLES

     dynpfields                 = T_DYNPREAD

  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.

* Implement suitable error handling here

ENDIF.

------------------------------------------------------

This is my code .... i have problem... please check it bro..

0 Kudos

Hi,

I got your problem. In the above code  you will get value of bukrs in return_tab which you are selecting t_return-fieldval and based on that fetch value of butxt form the table and pass the same in FM 'DYNP_VALUES_UPDATE'. as I did in my code which I have provided to you.

I hope you got me.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

     EXPORTING

*     DDIC_STRUCTURE         = 'T001'

       retfield               = 'BUKRS'

*     PVALKEY                = ' '

      DYNPPROG               = SY-REPID

      DYNPNR                 = '0001'

      DYNPROFIELD            = 'ZEXP_CTR-BUKRS'

*     STEPL                  = 0

*     WINDOW_TITLE           =

*     VALUE                  = ' '

      VALUE_ORG              = 'S'

*     MULTIPLE_CHOICE        = ' '

*     DISPLAY                = ' '

*     CALLBACK_PROGRAM       = SY-CPROG

*     CALLBACK_FORM          = 'CALLBACK_F4'

*     CALLBACK_METHOD        =

*     MARK_TAB               =

*   IMPORTING

*     USER_RESET             =

     tables

       value_tab              = T_T001

*     FIELD_TAB              =

   RETURN_TAB             = T_RETURN

*     DYNPFLD_MAPPING        = T_FMAP

    EXCEPTIONS

      PARAMETER_ERROR        = 1

      NO_VALUES_FOUND        = 2

      OTHERS                 = 3

Former Member
0 Kudos

Hi,

Please use the following  code. Use your own table name. You are missing t_ft TYPE TABLE OF dfies, in your program.


TABLES zapt_cust.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE Text-000.
SELECT-OPTIONS p_num for zapt_cust-CUSTNUM.

PARAMETERS : p_nam TYPE zde_cusname,

             p_email TYPE zde_email.

SELECTION-SCREEN END OF BLOCK b1.



TYPES : BEGIN OF ty_sh,

        number TYPE zde_custnum,

        name TYPE zde_cusname,

        email TYPE zde_email,

        END OF ty_sh.



DATA  : t_dd TYPE TABLE OF dselc,

        t_ft TYPE TABLE OF dfies,

        x_dd TYPE dselc,

        x_ft TYPE dfies.



DATA : t_sh TYPE TABLE OF ty_sh,

       t_sh1 TYPE TABLE OF zapt_cust,

       x_sh TYPE ty_sh.



DATA lv_stepl         TYPE          sy-stepl ,

        t_screen_values  TYPE TABLE OF dynpread ,

        x_screen_values  TYPE          dynpread,

        RETURN       TYPE   DDSHRETVAL.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_num-low.

If t_sh1 IS INITIAL.

  SELECT *

  INTO TABLE t_sh1

  FROM zapt_cust.



  REFRESH t_dd.

  x_dd-fldname = 'CUSTNAME'.

  x_dd-dyfldname = 'P_NUM-HIGH'.

  APPEND x_dd To t_dd.

  CLEAR x_dd.



  x_dd-fldname = 'CUSTNAME'.

  x_dd-dyfldname = 'P_NAM'.

  APPEND x_dd To t_dd.

  CLEAR x_dd.



  x_dd-fldname = 'EMAIL'.

  x_dd-dyfldname = 'P_EMAIL'.

  APPEND x_dd to t_dd.

  CLEAR x_dd.



  REFRESH t_ft.

  x_ft-tabname = 'ZAPT_CUST'.

  x_ft-fieldname = 'CUSTNUM'.

  APPEND x_ft to t_ft.



  x_ft-tabname = 'ZAPT_CUST'.

  x_ft-fieldname = 'CUSTNAME'.

  APPEND x_ft to t_ft.



  x_ft-tabname = 'ZAPT_CUST'.

  x_ft-fieldname = 'EMAIL'.

  APPEND x_ft to t_ft.

Endif.



CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

  EXPORTING

*   DDIC_STRUCTURE         = 'TY_SH'

    retfield               = 'CUSTNUM'

*   PVALKEY                = ' '

   DYNPPROG               = sy-repid

   DYNPNR                 = sy-dynnr

   DYNPROFIELD            = 'P_NUM'

*   STEPL                  = 0

*   WINDOW_TITLE           =

*   VALUE                  = ' '

   VALUE_ORG              = 'S'

*   MULTIPLE_CHOICE        = 'X'

*   DISPLAY                = ' '

*   CALLBACK_PROGRAM       = ' '

*   CALLBACK_FORM          = ' '

*   CALLBACK_METHOD        =

*   MARK_TAB               =

* IMPORTING

*   USER_RESET             =

  tables

    value_tab              = t_sh1

   FIELD_TAB              = t_ft

*   RETURN_TAB             = return

   DYNPFLD_MAPPING        = t_dd

EXCEPTIONS

   PARAMETER_ERROR        = 1

   NO_VALUES_FOUND        = 2

   OTHERS                 = 3

          .

IF sy-subrc <> 0.

* Implement suitable error handling here

ENDIF.

p_num-high = return + 20.


START-OF-SELECTION.

WRITE 'Hello'.

Regards

thanga_prakash
Active Contributor
0 Kudos

Hello,

As i understand you want to get the description of the field in the popup F4 screen along with the value.

Is my understanding correct ?

Regards,

Thanga

0 Kudos

Yeah bro, it is not a selection screen its a TMG.. and first column F4 help for BUKRS automatically next column BUTXT should be filled up. Above code is i am using. I am using Process on value request.

0 Kudos

Hello Bro,

You can find the texts in table T001T. Based on the data in T_T001 select the texts and pass it to another internal table with structure Company code and dependent texts.

Then pass this final internal table to the F4 help function module.

I am checking this and will get back to you if it works.

Regards,

Thanga

0 Kudos

Hi

I would suggest you in this case please dont do any coding. Kindly create a maintainence view using your custom table(without company code text field) and T001-BUTXT field. It has many advantages.

  1. company code text is already stored in some table we dont need to store it in your table
  2. Seconldy if tommorow company code text changes your custom table will have old text.

If you create view then all the above problems will not happen plus no custom coding

Nabheet

Former Member
0 Kudos

Hi.

   TYPES : BEGIN OF STRU,

   VBELN TYPE VBAK-VBELN,

   ERDAT TYPE VBAK-ERDAT,

   END OF STRU.

   DATA : ITAB TYPE TABLE OF STRU WITH HEADER LINE.

   SELECT VBELN ERDAT

     FROM VBAK

     INTO TABLE ITAB UP TO 10 ROWS.

     CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

       EXPORTING

*       DDIC_STRUCTURE         = ' '

         retfield               = 'VBELN'

*       PVALKEY                = ' '

         DYNPPROG               =   SY-REPID

         DYNPNR                 '1000'

         DYNPROFIELD            'VBELN'

         VALUE_ORG              = 'S'

       tables

         value_tab              = ITAB[].

Regards

RV Karthikeyan.

thanga_prakash
Active Contributor
0 Kudos

You can directly use the description table for selection of values and pass it to the F4 function module like below.


TABLES : MARA.

DATA: BEGIN OF IT_MAKT OCCURS 0,

MATNR LIKE MARA-MATNR,

MAKTX LIKE MAKT-MAKTX,

END OF IT_MAKT.

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

PARAMETERS: p_matnr LIKE mara-matnr.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_matnr.

  SELECT MATNR

         MAKTX

    FROM MAKT

    INTO TABLE IT_MAKT UP TO 10 ROWS.

  SORT IT_MAKT BY MATNR.

  DELETE ADJACENT DUPLICATES FROM IT_MAKT COMPARING MATNR.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

    EXPORTING

      RETFIELD       = 'MATNR'

      DYNPPROG       = SY-REPID

      DYNPNR         = '1000'

      DYNPROFIELD    = 'P_MATNR'

      VALUE_ORG      = 'S'

    TABLES

      VALUE_TAB      = IT_MAKT

      RETURN_TAB     = IT_RETURN

    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.

Here I have used MAKT (Material description field) for the data fetching and passed it to F4 help.

In your case instead of T001, use T001T to retrieve the company code and description and pass it to F4.

Regards,

Thanga