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 Search Help

Former Member
0 Likes
808

Hi Gurus,

In am facing a big prob...

In my selection screen i have 2 input fields,

say, field1 and field2.. Both field1 and field2 has F4 Search helps..My requirement is, if i select field1 from F4 Search field2 also shud populate based on the selection of field1.

Say when i selected field1 search help values populated are

field1 field2

a 1

b 2

a 5

a 6 etc......

Now if i select a - 5 using field1 search help...field2 has to be populated with 5 along with field1 ....

So after selecting 'a' fields shud look like this...

field1 - a

field2 - 5

Any way in which i can acheive this...

Full rewards for appropriate answers...

Regards,

ABAPer 007

5 REPLIES 5
Read only

Former Member
0 Likes
773

Hi,

check the export parameters of ur search help.

if u check both the export parameters of ur serach help, when u click on the first field ,the second field also placed in the screen.

Thanks,

S.Gangi reddy.

Read only

0 Likes
773

Hi,

You need to use At selections screen output event.

Under this you need to code for pupolating your own search help depending on certain values from first field.

There is one FM for this.... you need to check for it.... do F4help* and you should get that FM.

Or you might also find some similar codes here on SDN itself

search by F4 help for custom fields.

Hope it helps.

Regards,

Siddhesh S.Tawate

Read only

Former Member
0 Likes
773

Hi,

see this example

u need to use the function module DYNP_VALUES_UPDATE.


TYPES:
   BEGIN OF t_t001w,
     werks       TYPE t001w-werks,
     name1       TYPE t001w-name1,
   END OF t_t001w,
   t_return_tab  TYPE ddshretval.
DATA:
    w_t001w      TYPE t_t001w,
    w_return_tab TYPE t_return_tab.
DATA:
    i_t001w      TYPE STANDARD TABLE OF t_t001w,
    i_return_tab TYPE STANDARD TABLE OF t_return_tab.
*&---------------------------------------------------------------------*
"SELECTION-SCREEN
*&---------------------------------------------------------------------*

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.
PARAMETERS :p_werks TYPE t001w-werks,
            p_name1 TYPE t001w-name1.
SELECTION-SCREEN END OF BLOCK b1.

*&---------------------------------------------------------------------*
" AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_werks
*&---------------------------------------------------------------------*
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_werks.
  PERFORM f4_help_for_palant.

*&---------------------------------------------------------------------*
*&      Form  f4_help_for_palant
*&---------------------------------------------------------------------*
FORM f4_help_for_palant.

  DATA:
      w_dynpfields TYPE dynpread,
      i_dynpfields LIKE STANDARD TABLE OF dynpread.

  IF i_t001w[] IS INITIAL.
    SELECT werks name1
    FROM t001w
    INTO TABLE i_t001w.
  ENDIF.

  CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
    EXPORTING
*   DDIC_STRUCTURE         = ' '
    retfield               = 'WERKS'
*   PVALKEY                = ' '
    dynpprog               = sy-repid
    dynpnr                 = sy-dynnr
    dynprofield            = 'P_WERKS'
*   STEPL                  = 0
*   WINDOW_TITLE           =
*   VALUE                  = ' '
   value_org              = 'S'
*   MULTIPLE_CHOICE        = ' '
*   DISPLAY                = ' '
*   CALLBACK_PROGRAM       = ' '
*   CALLBACK_FORM          = ' '
*   MARK_TAB               =
* IMPORTING
*   USER_RESET             =
    TABLES
      value_tab              = i_t001w
*   FIELD_TAB              =
    return_tab             = i_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.
  READ TABLE i_return_tab INTO w_return_tab INDEX 1.
  p_werks = w_return_tab-fieldval.
  READ TABLE i_t001w INTO w_t001w WITH KEY werks = p_werks.
  IF sy-subrc = 0.

    w_dynpfields-fieldname    = 'P_NAME1'.
    w_dynpfields-fieldvalue   = w_t001w-name1.
    APPEND w_dynpfields TO i_dynpfields.
    CLEAR w_dynpfields.

    CALL FUNCTION 'DYNP_VALUES_UPDATE'
      EXPORTING
        dyname               = sy-repid
        dynumb               = sy-dynnr
      TABLES
        dynpfields           = i_dynpfields
      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.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.


  ENDIF.


ENDFORM.                    " f4_help_for_palant

rgds,

bharat.

Read only

0 Likes
773

Hi,

See my requirement is different i think from ur code..which is using DYNP_VALUES_UPDATE not work here...Yes i have to use this definitely to update the second field..but for this i have to get the corresponding data in 2nd field..i will xplain it

Bharat / Velangini,

Ur sample code is different from my requirement...in ur code F4 Help is for plant code and u have to fill plant name accordingly....so this is an easy job since for a plant code thr will be only one plant name..just like one phone no will only belong to one particular person so identification is easy....please correct me if i am wrong...

but my requirement is

one material say M1 can belong to say 7 plants..if user selects from f4

M1 and 3rd plant i shud get tht coresponding plant also...i am using this FM

'F4IF_INT_TABLE_VALUE_REQUEST' here as tables parameter i am passing both material and plant...but since export parameter only has material info like DYNNR, Field name etc..in RETURN_TAB i am only getting M1 from it...

Also,,,

Hi Gangi reddy,

I think u r refering to table level search help rite....table level we can set the export and import parameters for the fields...wherein u select one material and plant for material search help values will automatically populate rite..But sorry i cant go as of now table level...i know tht will work out..but i need know any FM is thr wherein we can get both from one.....

Rewards will be done for appropriate answers.....

Regards,

ABAPer 007

Read only

Former Member
0 Likes
773

Hi,

Check the below code.

PARAMETERS: P_MNR TYPE FCMNR,

P_LTX TYPE FCLTX.

DATA: BEGIN OF ITAB OCCURS 0,

MNR TYPE FCMNR,

LTX TYPE FCLTX,

END OF ITAB.

DATA: DYNFIELDS TYPE DYNPREAD OCCURS 0 WITH HEADER LINE.

DATA: RETURN TYPE TABLE OF DDSHRETVAL WITH HEADER LINE.

INITIALIZATION.

SELECT MNR LTX INTO TABLE ITAB

FROM T247 where spras = 'E'.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_MNR.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

RETFIELD = 'MNR'

DYNPPROG = SY-CPROG

DYNPNR = SY-DYNNR

DYNPROFIELD = 'P_MNR'

VALUE_ORG = 'S'

TABLES

VALUE_TAB = ITAB

RETURN_TAB = 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.

REFRESH DYNFIELDS.

READ TABLE RETURN WITH KEY FIELDNAME = 'P_MNR'.

  • Add it back to the dynpro.

DYNFIELDS-FIELDNAME = RETURN-RETFIELD.

DYNFIELDS-FIELDVALUE = RETURN-FIELDVAL.

APPEND DYNFIELDS.

  • Get the company code from db and add to dynpro

DATA: XT247 TYPE T247.

CLEAR XT247.

SELECT SINGLE * INTO XT247

FROM T247

WHERE MNR = RETURN-FIELDVAL and spras = 'E'.

DYNFIELDS-FIELDNAME = 'P_LTX'.

DYNFIELDS-FIELDVALUE = XT247-LTX.

APPEND DYNFIELDS.

  • Update the dynpro values.

CALL FUNCTION 'DYNP_VALUES_UPDATE'

EXPORTING

DYNAME = SY-CPROG

DYNUMB = SY-DYNNR

TABLES

DYNPFIELDS = DYNFIELDS

EXCEPTIONS

OTHERS = 8.