Child pages
  • Updating invalid variable references in Queries
Skip to end of metadata
Go to start of metadata

Purpose

Variables can be filled by other variables, which is called filled by replacment path.  The query however must also contain the variable that it is refering to. 

Overview

The only variables that can contain a reference to another variable are replacement path variables, any other references are inconsistant and should be removed. This is explained in the KBA.  To find and correct these I have created the below report.

Using the report

Execute the report in SE38 and you will be presented with the screen below.

When you run the report it will display the problem variables.

 
If you want to update the variables, then run the report again and choose update.

Code

*&---------------------------------------------------------------------------------*
*& Report  ZBK_UPD_REFUID_VAR - -Brian Keenan Jan2012-----------*

*&----------------------------------------------------------------------------------*
REPORT  ZBK_UPD_REFUID_VAR.

DATA: wa_rszglobv TYPE rszglobv,
      gt_rszglobv TYPE TABLE OF RSZGLOBV,
      g_s_globv   TYPE TABLE OF RSZGLOBV.

SELECTION-SCREEN BEGIN OF BLOCK para WITH FRAME TITLE text-001.
  PARAMETERS: Check  RADIOBUTTON GROUP sel DEFAULT 'X',
              Update RADIOBUTTON GROUP sel.
SELECTION-SCREEN END OF BLOCK para.

START-OF-SELECTION.

*  select all variables that are filled by authorization and not optional
*  These should be changed as a user with 0BI_ALL will never get filled
*  The system will then throw and error.

SELECT * FROM RSZGLOBV INTO TABLE gt_rszglobv
WHERE VPROCTP <> '1' AND REFERENCE_UID <> '' AND OBJVERS = 'A'.

IF sy-subrc <> 0.
  MESSAGE 'No data found' TYPE 'I'.
  EXIT.
ENDIF.

LOOP AT gt_rszglobv into wa_rszglobv.
    IF update = 'X'.
        wa_rszglobv-REFERENCE_UID = ''.
        wa_rszglobv-REFERENCE_ACTION = 0.

        UPDATE rszglobv FROM wa_rszglobv.
        WRITE: / wa_rszglobv-vnam,
        'The invalid REFERENCE_UID has been removed'.
    ELSE.
        WRITE: / wa_rszglobv-vnam,
        'The variable contains an invalid refernence to a variable not in this query'.
    ENDIF.
ENDLOOP.

Related Content

Related Documents

Related Notes

  • No labels