ECC to S4HANA On SAP Query dump 对应程序不存在 ;created from SQ01

Introduction

Hello Everyone, It’s my second blog post, On SAP Query dump created from SQ01 after ECC to S4HANA upgrade. I got up with a solution for the same.

Overview

The system displays the below error when you Run the Query report created from SQ01 after migration from ECC to S4HANA.

 

 

 

SQ01将query重新生成下可以解决问题,如果因为系统迁移已经不知道对应的query是哪个了,用如下方法

Please follow the below Step to overcome the above error.

  • Copy the program under Short Text

i.e. In my case, I got the error in program  AQL4SYSTQV00002QINSP_TYPE.

  • Enter Tcode SE37
  • Enter Function Module – RSAQ_DECODE_REPORT_NAME
    • Then press F8 (Execute)

Now on the below screen

  • Paste the copied program under REPORTNAME
  • Press F8 (Execute)

You will get some of the results according to your REPORTNAME

Copy the USERGROUP & QUERY

  • Now, Execute Tcode SE38
  • Enter Program SAP_QUERY_CALL

Press F8 (Execute)

Paste the USERGROUP & QUERY

Press F8 (Execute) and This will Open up your Query the same as before.

Also, the is a shortcut for the same. But I’m not sure that it would always work or not but here is another way.

Suppose you get the program as AQL4SYSTQV000002RTGDATA

————————————————————————————————————————————-

Thanks for going through the detailed document. Do revert back if you have more queries or feedbacks/ inputs so that I can update the document.

And here is the link to my first blog post on Simulating BAPI.

https://blogs.sap.com/2019/07/29/bapi-simulation-finding-bapi/

 

为了解决程序不存在的问题,但是又不想一个一个处理,所以写了如下程序去批量处理

*&---------------------------------------------------------------------*
*& Report ZQUERY_SUBMIT
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT zquery_submit.

TABLES:aqgqcat.

TYPES: BEGIN OF ty_reportname,
        reportname  TYPE  aqadef-pgname,
        usergroup   TYPE  aqs_bgname,
        query       TYPE  aqs_quname,
        msg         TYPE  bapi_msg,
        tcode       TYPE  tstc-tcode,
        delflag     TYPE  c,
       END OF ty_reportname,
       td_reportname TYPE TABLE OF ty_reportname.
DATA: lt_reportname  TYPE td_reportname .

SELECT-OPTIONS : s_num FOR aqgqcat-num,
                 s_qnum FOR aqgqcat-qnum.

PARAMETERS:R_R1 RADIOBUTTON GROUP R TYPE C,
           R_R2 RADIOBUTTON GROUP R TYPE C.
*&---------------------------------------------------------------------*
*& Form FRM_GET_QUERY
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& -->  p1        text
*& <--  p2        text
*&---------------------------------------------------------------------*


  SELECT *
    INTO TABLE @DATA(gt_aqgqcat)
    FROM aqgqcat
   WHERE ( num LIKE 'Y%' OR num LIKE 'Z%' )
     AND num  IN @s_num
     AND qnum IN @s_qnum.

PERFORM frm_get_program CHANGING lt_reportname.
PERFORM frm_check_exsit CHANGING lt_reportname.
PERFORM frm_create_program USING lt_reportname.
*&---------------------------------------------------------------------*
*& Form FRM_GET_PROGRAM
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& -->  p1        text
*& <--  p2        text
*&---------------------------------------------------------------------*
FORM frm_get_program CHANGING lt_reportname TYPE td_reportname.

 DATA:la_reportname TYPE ty_reportname.

 LOOP AT gt_aqgqcat INTO DATA(wa_aqgqcat).

    CALL FUNCTION 'RSAQ_REPORT_NAME'
      EXPORTING
        workspace     = 'X'
        usergroup     = wa_aqgqcat-num
        query         = wa_aqgqcat-qnum
     IMPORTING
       reportname     = la_reportname-reportname.
   la_reportname-usergroup = wa_aqgqcat-num.
   la_reportname-query     = wa_aqgqcat-qnum.
   APPEND la_reportname TO lt_reportname.

  ENDLOOP.

ENDFORM.
*&---------------------------------------------------------------------*
*& Form FRM_CHECK_EXSIT
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& -->  p1        text
*& <--  p2        text
*&---------------------------------------------------------------------*
FORM frm_check_exsit CHANGING lt_reportname TYPE td_reportname.

  LOOP AT lt_reportname INTO DATA(ld_reportname).

    SELECT *
      INTO TABLE @DATA(lt_reposrc)
      FROM reposrc
      WHERE progname = @ld_reportname-reportname.
    IF sy-subrc = 0.
      ld_reportname-delflag = 'X'.
      MODIFY lt_reportname FROM ld_reportname.
    ENDIF.

  ENDLOOP.

  DELETE lt_reportname WHERE delflag = 'X'.

ENDFORM.
*&---------------------------------------------------------------------*
*& Form FRM_CREATE_PROGRAM
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& -->  p1        text
*& <--  p2        text
*&---------------------------------------------------------------------*
FORM frm_create_program CHANGING lt_reportname TYPE td_reportname.

*  SELECT TCODE  pgmna
*    INTO TABLE @DATA(lt_tstc)
*    FROM tstc
*    INNER JOIN vari ON vari~REPORT = tstc~pgmna
*    FOR ALL ENTRIES IN @lt_reportname
*    WHERE pgmna = @lt_reportname-reportname.
*
*  LOOP AT lt_tstc INTO DATA(LW_TSTC).
*
*  ENDLOOP.

  IF R_R1 = 'X' .

  ELSE.
    LOOP AT lt_reportname INTO DATA(lw_reportname).

*      CALL FUNCTION 'RSAQ_GENERATE_PROGRAM'
*        EXPORTING
*          i_workspace                = 'X'
*          i_query                    = lw_reportname-query
*          i_usergroup                = lw_reportname-usergroup
*    *   IMPORTING
*    *     O_REPORT_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.
*        lw_reportname-msg = '生成程序失败'.
*      ELSE.
*        lw_reportname-msg = '生成程序成功'.
*      ENDIF.

    ENDLOOP.
  ENDIF.
  PERFORM frm_display USING lt_reportname  .

ENDFORM.
*&---------------------------------------------------------------------*
*& Form FRM_DISPLAY
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& -->  p1        text
*& <--  p2        text
*&---------------------------------------------------------------------*
FORM frm_display USING lt_reportname TYPE td_reportname.
 DATA:
    lth_layout   TYPE lvc_s_layo,
    ltd_fieldcat TYPE lvc_t_fcat.

*---- Set fieldcat
  PERFORM f_set_it_fieldcat
      CHANGING ltd_fieldcat.

* Set Layout settings
  lth_layout-cwidth_opt  = 'X'.

  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
    EXPORTING
      i_buffer_active          = 'X'
      i_callback_program       = sy-cprog
      is_layout_lvc            = lth_layout
      it_fieldcat_lvc          = ltd_fieldcat
      i_default                = 'X'
    TABLES
      t_outtab                 = lt_reportname
    EXCEPTIONS
      program_error            = 1
      OTHERS                   = 2.
  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid
          TYPE 'S'
        NUMBER sy-msgno
          WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
       DISPLAY LIKE 'E'.
    LEAVE LIST-PROCESSING.
  ENDIF.
ENDFORM.

*&---------------------------------------------------------------------*
*&      Form  F_SET_IT_FIELDCAT2
*&---------------------------------------------------------------------*
*       Set fieldcat
*----------------------------------------------------------------------*
*      <--fc_td_fieldcat  fieldcat
*----------------------------------------------------------------------*
FORM f_set_it_fieldcat CHANGING fc_td_fieldcat TYPE lvc_t_fcat.

* Local variable define
  DATA lth_fieldcat TYPE lvc_s_fcat.

  DEFINE build_fieldcat.
    lth_fieldcat-fieldname = &1.
    lth_fieldcat-scrtext_s = &2.
    lth_fieldcat-scrtext_m = &2.
    lth_fieldcat-scrtext_l = &2.
    lth_fieldcat-col_opt   = 'A'.
    APPEND lth_fieldcat TO fc_td_fieldcat.
    CLEAR lth_fieldcat.
  END-OF-DEFINITION.

  build_fieldcat  'REPORTNAME'    '程序名'    .
  build_fieldcat 'USERGROUP'     'usergroup'   .
  build_fieldcat 'QUERY'     'query'   .
  build_fieldcat 'MSG'     'msg'   .

ENDFORM.

 

posted on 2020-06-30 15:20  TorranceZhao  阅读(569)  评论(0)    收藏  举报

导航