2018年7月5日 星期四

Get program name of SAP Query

  CALL FUNCTION 'RSAQ_GENERATE_PROGRAM'           
    EXPORTING
      i_workspace          'G'             "Global area
      i_query              p_query         "Query name
      i_usergroup          'ZGROUP'        "User group
    IMPORTING
      o_report_name        p_prog          "Program name
*     O_STRUCTURE_NAME     =
    EXCEPTIONS
      no_query             1
      no_infoset           2
      query_locked         3
      generation_cancelled 4
      generation_error     5
      OTHERS               6.
  IF sy-subrc <> 0.                            "If Global area not found program
    CALL FUNCTION 'RSAQ_GENERATE_PROGRAM'
      EXPORTING
        i_workspace          ''               "Local area
        i_query              p_query
        i_usergroup          'ZGROUP'
      IMPORTING
        o_report_name        p_prog
*       O_STRUCTURE_NAME     =
      EXCEPTIONS
        no_query             1
        no_infoset           2
        query_locked         3
        generation_cancelled 4
        generation_error     5
        OTHERS               6.
  ENDIF.

沒有留言:

張貼留言