Registration

Dear SAP Community Member,
In order to fully benefit from what the SAP Community has to offer, please register at:
http://scn.sap.com
Thank you,
The SAP Community team.
Skip to end of metadata
Go to start of metadata


Link to Content's target Space :

 
http://wiki.sdn.sap.com/wiki/display/stage/How+to+correct+transport+failure+for+Infoobjects+caused+due+to+special+characters+in+the+Master+Data

Applies to:

SAP BI 7.00, Support Pack SAPKW70022 and above, SAP BI 7.01, Support Pack SAPKW70105 and above. For more information, visit the Business Intelligence home page.

Summary

This document helps to correct the transport failure for an Infoobject being used as an Infoprovider, caused

due to Special Characters present in the Master Data for that Infoobject in the Target System. The solution

 
outlines a measure to remove these Special Characters from the P table of Master Data by creating an

executable program based on the concept of dynamic table creation from the input value and comparing

each row of the table against the Allowed Character Set.

Author(s):  Sarang Bhalerao

   
Company:     Accenture Services Private Ltd
Created on:  22 March 2011
Author(s) Bio


Sarang is a Certified SAP BI 7.0 Consultant in Accenture Services Private Ltd, India.
His expertise includes SAP BI and ABAP developments.

 
                       
 
                       

Table of Contents

Introduction

It is a common scenario to have Special Characters uploaded from R/3 systems in the Master data on BW side. If you are not using data cleansing techniques in BW, these special characters will keep on piling up and the Infoobject will be full of garbage data. Due to business requirements you sometimes need to do changes to this Infoobject (add or activate Navigational Attributes) in the development system and transport it to the next box in the landscape.

However, the transport fails to activate the Infoobject in the target system because of special characters present in the master data for that Infoobject and eventually the Infoobject gets deactivated and becomes unusable.

Business Scenario

Let us take an example of an Infoobject present across the BW landscape. Due to business requirement

you had to change the Infoobject and transport it to the target system. However the transport fails with

error as shown below –


  

Note: One of the options is to completely delete the Master Data for the said Infoobject, however this should not be done, as the Infoobject may be used in several DSO’s, Cubes, Infosets etc. and deleting the Master data will affect the generated SID’s and especially when it is a live production system.

Step by Step Solution

The solution outlines a measure to remove these Special Characters from the Master Data table by creating an executable program based on the concept of dynamic table creation from the input value and comparing each row of the table against the Allowed Character Set.

1)     Creating a Class and defining method to compare the data against the

        Allowed Character Set.

Create a Z class in SE24 and define a Method.

                                                                                                                                                                                                                                                      

The source code is as shown below --
method Z_RM_SPLCHAR.
DATA: l_d_len LIKE sy-index.
DATA: l_d_offst LIKE sy-index.
DATA: CharAll(240) TYPE C.

CharAll =
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzß0123456789"§$%&/()=?

\´`*+~;:_,.-><|@'''.

*You can also check in RSKC for the allowed characters in your BW system.

l_d_len = strlen( INPUT ).

IF NOT INPUT CO CharAll.

DO l_d_len TIMES.   “Check for each character against allowed character set.

l_d_offst = sy-index - 1.

IF NOT INPUT+l_d_offst(1) CO CharAll.

INPUT+l_d_offst(1) = ''.    “Replace special character with space
ENDIF.

ENDDO.
OUTPUT = INPUT.
ENDIF.
OUTPUT = INPUT.
endmethod.

 2) Call this method in a program as shown below -

TABLES: DD03L,  " Table Fields
        DD02L.  " SAP Tables
type-pools : abap.
field-symbols: <fs_tab> type standard table ,
               <fs_wa> type ANY.

data: dy_table type ref to data,
dy_line type ref to data,
xfc type lvc_s_fcat,
ifc type lvc_t_fcat.
DATA : ZRMSP TYPE REF TO ZRMSPLCHAR,
            RESULT TYPE STRING,
            l_tabix like sy-tabix,
            lw_line type sy-linct.

Create object ZRMSP.  “Object for the class

selection-screen begin of block TABLE
                          with frame title TEXT-002.
selection-screen : begin of line.
selection-screen : comment 1(14) TEXT-TAB.
selection-screen : position 20.
parameters: P_TABLE like dd03l-TABNAME OBLIGATORY.
selection-screen : end of line.

selection-screen end of block TABLE.
***********************************************************************************
AT SELECTION-SCREEN.

SELECT SINGLE * FROM dd02l WHERE tabname = P_TABLE
AND as4local = 'A'
AND as4vers = '0000'.
IF sy-subrc NE 0.
*Input is not an active Table in the Dictionary
MESSAGE e402(mo) WITH P_TABLE.
ELSEIF dd02l-tabclass = 'INTTAB'.
*Input is a structure, not a table
MESSAGE e403(mo) WITH P_TABLE.
ENDIF.
************************************************************************************
start-of-selection.
perform get_struct.          "Get the dynamic structure from the Input
perform create_dyn_itab.     "Create a dynamic internal table
perform get_data.            "Populate data in the dynamic table
perform clear_spchar.        "Clear string off special characters

*********************************************************************************
form get_struct.
data : idetails type abap_compdescr_tab,
xdetails type abap_compdescr.
data : ref_tab_descrp type ref to cl_abap_structdescr.
* Get the table structure from the Input.
ref_tab_descrp ?= cl_abap_typedescr=>describe_by_name( P_TABLE ).
idetails[] = ref_tab_descrp->components[].
loop at idetails into xdetails.
clear xfc.
xfc-fieldname = xdetails-name .
xfc-datatype = xdetails-type_kind.
xfc-inttype = xdetails-type_kind.
xfc-intlen = xdetails-length.
xfc-decimals = xdetails-decimals.
append xfc to ifc.
endloop.
endform.

*************************************************************************************
form create_dyn_itab.
* Create dynamic internal table and assign to Field Symbol
call method cl_alv_table_create=>create_dynamic_table
exporting
it_fieldcatalog = ifc
importing
ep_table = dy_table.
assign dy_table->* to <fs_tab>.
* Create dynamic work area and assign to Field Symbol
create data dy_line like line of <fs_tab>.
assign dy_line->* to <fs_wa>.
endform.

***************************************************************************************
form get_data.
* Get Data from table.
select * into table <fs_tab>
from (p_table).

endform.

***************************************************************************************
form clear_spchar.
*Get the Total Number of Records in the Table

DESCRIBE TABLE <fs_tab> lines lw_line.
WRITE :/ 'TOTAL NUMBER OF',lw_line,'RECORDS WILL BE PROCESSED'.

loop at <fs_tab> into <fs_wa>.
l_tabix = sy-tabix.
*Remove Special Chars
CALL METHOD ZRMSP-> Z_RM_SPLCHAR                         
  EXPORTING
    input  = <fs_wa>
  IMPORTING
    output = RESULT.

IF SY-SUBRC = 0.

IF RESULT = <fs_wa>.
WRITE :/ 'NO SPECIAL CHARACTERS FOUND IN THE ROW'.
ELSE.
WRITE :/ 'SPECIAL CHARACTERS REMOVED FROM THE ROW'.
Endif.
Endif.
MODIFY <fs_tab> FROM RESULT INDEX l_tabix.
endloop.
*Update the table with the changes
UPDATE (P_TABLE) FROM TABLE <fs_tab>.                        
COMMIT WORK.
endform.

Execute this program in the target system to clean up the Special Characters and then import your infoobject again.

Related Content

Please include at least three references to SDN documents or web pages.

http://wiki.sdn.sap.com/wiki/display/Snippets/dynamic+table+creation

SAP Community Network Wiki - Code Gallery - Dynamic Internal Table

SAP NOTE 1354610

Useful Information

Short quick summary to catch the reader's attention and of course the search engine