Skip to Content
author's profile photo Former Member
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 a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on 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 a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 25, 2008 at 07:35 PM

    Use this FM MC_POPUP_TO_MARK_FIELDS

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on 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 a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.