2 Replies Latest reply: Jan 24, 2009 7:31 AM by Faisal Altaf RSS

F4 Search Help in ABAP

Zahin H
Currently Being Moderated

Hello Experts,

 

I have a parameter which takes a personnel number. I want to implement a F4 help for this parameter. It should retrieve personnel number based on employee full name from table PA0001.

 

When F4 help box is showed up, user would enter name and my ABAP code should populate parameter for personnel number.

 

How can I achieve this ?

 

Thank you very much.

  • Re: F4 Search Help in ABAP
    Avinash Kodarapu
    Currently Being Moderated

    HI,

     

    Try Collective srch hlp  PREM you have the search tab Last Name and First Name init.

     

     

    select-options: s_pernr for p0001-pernr matchcode object prem
                    no intervals.

     

  • Re: F4 Search Help in ABAP
    Faisal Altaf
    Currently Being Moderated

    Hi, Zahin

     

    Test the following code it will solve out your problem,

     

    REPORT zfsl_test_search_help NO STANDARD PAGE HEADING.
     
    TABLES: pa0001.
    SELECT-OPTIONS: ppernr for pa0001-pernr.
     
    DATA: i_return TYPE ddshretval OCCURS 0 WITH HEADER LINE,
          c TYPE c VALUE 'S'.
     
    * Search Help for Ppernr-low
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR ppernr-low.
     
      TYPES: BEGIN OF t_pernr,
        pernr LIKE pa0001-pernr,
        ename LIKE pa0001-ename,
      END OF t_pernr.
     
      DATA: it_pa0001 TYPE STANDARD TABLE OF t_pernr WITH HEADER LINE.
     
      SELECT pernr ename from pa0001
        INTO CORRESPONDING FIELDS OF TABLE it_pa0001
        where pa0001~endda = '99991231' .
    *    WHERE zsdo~kunnr IN sokunnr.
     
      DELETE it_pa0001 WHERE pernr = '00000000'.
      SORT it_pa0001 BY pernr.
     
      CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
        EXPORTING
          retfield    = 'PERNR'
          dynpprog    = sy-repid
          dynpnr      = sy-dynnr
          dynprofield = 'PERNR'
          value_org   = c
        TABLES
          value_tab   = it_pa0001
          return_tab  = i_return.
     
    * Search Help for Ppernr-High
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR ppernr-high.
     
      TYPES: BEGIN OF t_pernr,
        pernr LIKE pa0001-pernr,
        ename LIKE pa0001-ename,
      END OF t_pernr.
     
      DATA: it_pa0001 TYPE STANDARD TABLE OF t_pernr WITH HEADER LINE.
     
      SELECT pernr ename from pa0001
        INTO CORRESPONDING FIELDS OF TABLE it_pa0001
        where pa0001~endda = '99991231' .
    *    WHERE zsdo~kunnr IN sokunnr.
     
      DELETE it_pa0001 WHERE pernr = '00000000'.
      SORT it_pa0001 BY pernr.
     
      CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
        EXPORTING
          retfield    = 'PERNR'
          dynpprog    = sy-repid
          dynpnr      = sy-dynnr
          dynprofield = 'PERNR'
          value_org   = c
        TABLES
          value_tab   = it_pa0001
          return_tab  = i_return.

     

    Please Reply if need more help or any Issue.

     

    Kind Regards,

    Faisal

Actions