Skip to Content
avatar image
Former Member

Popup function module to select some fields on popup screen

Hello Gurus,

I want a popup during my program execution. This popup should show the list of fields that I want and a check box in front of those fields. If I select those fields and click ok, then they should be selected and passed tp program as soon as funcion module finsihes execution.

Thanks.

Regards,

Rajesh.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    avatar image
    Former Member
    Sep 25, 2008 at 07:53 PM

    Try this.

    TABLES: t001.
    DATA: t_fields  LIKE  mcs01 OCCURS 0 WITH HEADER LINE,
          t_marked_fields LIKE  mcs01 OCCURS 0 WITH HEADER LINE.
    
    SELECT * FROM t001 UP TO 5 ROWS.
      t_fields-tabname    = 'T001'.
      t_fields-fieldname  = t001-bukrs.
      t_fields-scrtext_l  = t001-butxt.
      APPEND t_fields.
    ENDSELECT.
    
    
    
    CALL FUNCTION 'MC_POPUP_TO_MARK_FIELDS'
      EXPORTING
        i_object_name_plural   = 'Test'
        i_object_name_singular = 'Test'
      TABLES
        t_fields               = t_fields
        t_marked_fields        = t_marked_fields
      EXCEPTIONS
        unvalid_text_length    = 1
        OTHERS                 = 2.
    IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    
    LOOP AT t_marked_fields.
      WRITE:/  t_marked_fields-scrtext_l.
    ENDLOOP.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 25, 2008 at 07:35 PM

    Use this FM MC_POPUP_TO_MARK_FIELDS

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 25, 2008 at 07:41 PM

    U can use FM REUSE_ALV_POPUP_TO_SELECT

    Sample code:

    Report ztests. 
    
    TYPE-POOLS SLIS. 
    
    DATA: BEGIN OF itab OCCURS 0,
            BUKRS LIKE T001-BUKRS,
            BUTXT LIKE T001-BUTXT,
          END   OF itab. 
    
    PARAMETERS: P_BUKRS TYPE BUKRS. 
    
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_BUKRS. 
    
      PERFORM F4_FOR_BUKRS.
    *&---------------------------------------------------------------------*
    *&      Form  F4_FOR_BUKRS
    *----------------------------------------------------------------------*
    FORM F4_FOR_BUKRS. 
    
      DATA: IT_FIELDCAT TYPE  SLIS_T_FIELDCAT_ALV WITH HEADER LINE,
            ES_SELFIELD TYPE  SLIS_SELFIELD. 
    
    * Get data
      SELECT BUKRS
             BUTXT
             FROM T001
             INTO TABLE itab
             up to 10 rows .
    * Get field
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
           EXPORTING
                I_PROGRAM_NAME     = SY-REPID
                I_INTERNAL_TABNAME = 'ITAB'
           CHANGING
                CT_FIELDCAT        = IT_FIELDCAT[]. 
    
      LOOP AT IT_FIELDCAT.
        IT_FIELDCAT-KEY = SPACE.
        IF IT_FIELDCAT-FIELDNAME = 'BUTXT'.
          IT_FIELDCAT-EMPHASIZE  = 'C710'.
        ENDIF.
        IF IT_FIELDCAT-FIELDNAME = 'BUKRS'.
          IT_FIELDCAT-EMPHASIZE  = 'C610'.
        ENDIF. 
    
        MODIFY IT_FIELDCAT.
      ENDLOOP. 
    
      CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'
        EXPORTING
     I_TITLE                       = 'THIS IS FOR F4 IN COLOR'
          I_TABNAME                     = 'ITAB'
          IT_FIELDCAT                   = IT_FIELDCAT[]
        IMPORTING
          ES_SELFIELD                   = ES_SELFIELD
        TABLES
          T_OUTTAB                      = ITAB . 
    
    ENDFORM.                    " F4_FOR_BUKRS
    
    

    Add comment
    10|10000 characters needed characters exceeded