Skip to Content
avatar image
Former Member

conactinating frst and last name

Hi All,

I have a requirement to provide F4 help for a Screen field called u2018owner nameu2019 This is a combination of u2018FIRST NAMEu2019 and u2018LAST NAMEu2019.

These are 2 separate fields in YFIFDLTY table.

But on clicking F4 help I need to display both the fields and when the user clicks on any entry then I need to concatenate the same and display in the screen field as a single name.

I am calling the function F4IF_INT_TABLE_VALUE_REQUEST.

This FM displays both the names, but when I select any one entry only one field i.e. u2018LAST NAMEu2019 is getting selected in the screen field.

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

3 Answers

  • Best Answer
    avatar image
    Former Member
    Oct 17, 2008 at 12:00 PM

    hi tarn,

    following steps can be used ;-

    Step 1. Create Elementary search help with search help exit.

    Step 2. FM for search help exit.

    Step 3. Create structure.

    Step 4. Assign Screen fields to that structure.

    hope this will solve ur problem

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 20, 2008 at 06:43 AM

    Hi Tarn,

    Please check the below code, hope these may solve your problem.

    DATA : BEGIN OF IT_KNA1 OCCURS 0,
              KUNNR LIKE KNA1-KUNNR,
              NAME1 LIKE KNA1-NAME1,
              NAME2 LIKE KNA1-NAME2,
              NAME3 TYPE CHAR80,
           END OF IT_KNA1.
    
    DATA : IT_RETURN LIKE DDSHRETVAL OCCURS 0 WITH HEADER LINE.
    
    PARAMETERS : P_OWNER TYPE CHAR80.
    
    
    
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_OWNER.
    
    
      SELECT KUNNR
             NAME1
             NAME2
             FROM KNA1 INTO TABLE IT_KNA1
             UP TO 20 ROWS.
    
      LOOP AT IT_KNA1.
        CONCATENATE IT_KNA1-NAME2 ',' IT_KNA1-NAME1 INTO IT_KNA1-NAME3.
        MODIFY IT_KNA1.
        CLEAR IT_KNA1.
      ENDLOOP.
      BREAK VGUMMALA.
    
      CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
        EXPORTING
          RETFIELD               = 'NAME3'
          DYNPPROG               = SY-REPID
          DYNPROFIELD            = 'P_OWNER'
    *    VALUE                  = ' '
          VALUE_ORG              = 'S'
    *    MULTIPLE_CHOICE        = ' '
    *    DISPLAY                = ' '
         CALLBACK_PROGRAM       = SY-REPID
    *    CALLBACK_FORM          = ' '
    *    MARK_TAB               =
    *  IMPORTING
    *    USER_RESET             =
        TABLES
          VALUE_TAB              = IT_KNA1[]
    *    FIELD_TAB              =
         RETURN_TAB             = IT_RETURN[]
    *    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 IT_RETURN INDEX 1.
      WRITE : IT_RETURN-FIELDVAL TO P_OWNER.
    

    or you can get the KUNNR value then select the frist name and lastname concatenate and pass the value to the P_OWNER

    do comment on it.

    regards

    Kumar M

    Edited by: mukesh kumar on Oct 20, 2008 8:46 AM

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 20, 2008 at 09:37 AM

    Hi,

    you are getting it in F4 ie. if you are getting the First and Last name in F4 but once user is selecting it then u r getting only the last name.....am i right?

    if yes, then 1st check your data declaration for the internal table you r using in Function Module for F4.

    It should have only one field of the same type as that of First name and Last name.

    Concatenate the First and Last Names into this field and you should get it.

    Add comment
    10|10000 characters needed characters exceeded