Z Program untuk Display Query

REPORT yquery no standard page heading.

SELECTION-SCREEN BEGIN OF BLOCK blok WITH FRAME TITLE text_001.
PARAMETERS : p_user TYPE rs38s-bgnum OBLIGATORY,
             p_query TYPE rs38r-qnum OBLIGATORY.
SELECTION-SCREEN END OF BLOCK blok.

start-of-selection.
  perform f_processing.

at selection-screen on value-request for p_user.
  perform f_get_help_user.

at selection-screen on value-request for p_query.
  perform f_get_help_query.

*&---------------------------------------------------------------------*
*&      Form  F_PROCESSING
*&---------------------------------------------------------------------*
FORM f_processing .
  DATA : ld_reportname  LIKE  aqadef-pgname.

  CHECK p_user ne '' AND p_query ne ''.

  ld_reportname = ''.
  CALL FUNCTION 'RSAQ_REPORT_NAME'
    EXPORTING
      workspace  = ''
      usergroup  = p_user
      query      = p_query
    IMPORTING
      reportname = ld_reportname.

  IF ld_reportname NE ''.
    CALL FUNCTION 'RSAQ_SUBMIT_QUERY_REPORT'
      EXPORTING
        queryreport       = ld_reportname
        variante          = ''
      EXCEPTIONS
        only_with_variant = 1
        variant_not_exist = 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.
  ENDIF.

ENDFORM.                    " F_PROCESSING

*&---------------------------------------------------------------------*
*&      Form  F_GET_HELP_QUERY
*&---------------------------------------------------------------------*
FORM f_get_help_query .
  DATA : ld_query LIKE  aqadef-quname,
         ld_bgruppe LIKE  aqadef-bgname,
         ld_pf3flag LIKE  aqadef-flag.

  IF p_user NE ''.
    CALL FUNCTION 'RSAQSQU_SELECT_QUERY'
      EXPORTING
        squ_workspace      = space
        squ_user_group_in  = p_user
        squ_complete       = space
        squ_tcode          = 'SQ01'
        squ_hflag          = 'H'
      IMPORTING
        squ_query_out      = ld_query
        squ_user_group_out = ld_bgruppe
        squ_rcode          = ld_pf3flag.

    p_query = ld_query.

  ENDIF.
ENDFORM.                    " F_GET_HELP_QUERY

*&---------------------------------------------------------------------*
*&      Form  F_GET_HELP_USER
*&---------------------------------------------------------------------*
FORM f_get_help_user .
  DATA : ld_usergroup LIKE  aqadef-bgname.
  CALL FUNCTION 'RSAQSUG_SELECT_USERGROUP'
    EXPORTING
      sug_workspace = space
      sug_superuser = 'X'
      sug_show_only = space
    IMPORTING
      sug_usergroup = ld_usergroup.
  p_user = ld_usergroup.
ENDFORM.                    " F_GET_HELP_USER
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s