Monday, July 24, 2017

How to read data in XML form via ABAP?

In one of my blog posts about Intermediate result of APD process a question was raised via comments. User asked where is ABAP code used in APD processes stored. Of course I replied back with the table name (RSANT_PROCESS) where the code can be found. Then the user replied back with another comment saying that field XML of that table is not completely readable as only first 131 characters is visible.

What can be visible in the XML field if the table if it is browsed via t-code like SE11 is something like:

This is really not complete ABAP code I mean not complete content of the field. The thing is that the database fields in xml format needs to be read differently.  It needs to decoded to human readable format. For this we can employ few SAP standard function modules. These are following ones:

SCMS_STRING_TO_XSTRING – converts texts (XML) to binary format, delivered within SAP SCMS (Content Management Service)

SMUM_XML_PARSE - parsing XML document into a table structure, delivered within User Management of SAP Markets (it was SAP initiative around year 2000 which later merged with SAP Portals).

Here complete example on how to read ABAP code for particular APD process in SAP BW system:


DATA: ls_rsant_process TYPE rsant_process,
      lv_xml           TYPE string,
      ls_xml_xstr      TYPE xstring,
      lt_result_xml    TYPE STANDARD TABLE OF smum_xmltb,
      ls_result_xml    TYPE smum_xmltb,
      lt_ret           TYPE STANDARD TABLE OF bapiret2,
      lo_alv           TYPE REF TO cl_salv_table,
      lo_col           TYPE REF TO cl_salv_columns_table,
      lo_fun           TYPE REF TO cl_salv_functions_list.

PARAMETERS: p_apd TYPE rsan_process OBLIGATORY.

SELECT SINGLE * FROM rsant_process INTO ls_rsant_process WHERE objvers = 'A' AND process = p_apd.
lv_xml = ls_rsant_process-xml.

CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
    EXPORTING
      text           = lv_xml
      mimetype       = 'text/xml'
   IMPORTING
     buffer         = ls_xml_xstr
   EXCEPTIONS
     failed         = 1
     others         = 2.

CALL FUNCTION 'SMUM_XML_PARSE'
  EXPORTING
    xml_input       = ls_xml_xstr
  TABLES
    xml_table       = lt_result_xml
    return          = lt_ret.

CALL METHOD cl_salv_table=>factory
  IMPORTING r_salv_table = lo_alv
  CHANGING t_table = lt_result_xml.

lo_col = lo_alv->get_columns( ).
lo_col->set_optimize( ) .
lo_fun = lo_alv->get_functions( ).
lo_fun->set_all( ).
CALL METHOD lo_alv->display.


Source code available at: github.com/softy12/ZMM_READ_XML_DATA

Tuesday, July 18, 2017

Scheduling Process Chains via copying its jobs

In my other blog post I mentioned how to schedule Process Chains with restrictions. This basically covers scenarios that things like SAP Factory calendar is used to base the scheduling on. Also this is about scenarios when the job shall not be executed on e.g. weekends-workdays etc.

Similarly there might be requirements on how to schedule the PC several times a day but there is no periodicity of these runs. Had it been the case periodicity is there than just a settings within job’s Start Time dialog box (like every minute/hour/day/…) can be leveraged -> see mu screenshot in here. These settings can be found under Periodic Values button in that pop-up window.

However as the periodicity is not given what can be done to schedule the job? Actually there is a possibility to just schedule one job for any given specific time and once there is a job scheduled via copying the job we replicate other schedules for the same PC for different start times that we need to have the PC running. This can be achieved via t-code SM37. There in its menu called Job there is an item Repeat scheduling available.

Once the job is copied just a start condition needs to be changed in the SM37 and that it!


Monday, July 17, 2017

How to check what is your SAP system type?

SAP system type is an function of the system in the SAP system group from the point of view of the Transport Organizer.

What is the SAP system type or sometimes referred as SAP system class can be revealed from parameters of SAP system. These parameters itself are normally set via system profile parameters function (t-codes RZ10 / RZ11).

1. transport/systemtype defines if the system belongs from a transport point-of-view to the world of SAP development systems (param value = SAP) or if it is a customer system (value = "CUSTOMER" and it is default value). The parameter is set during installation of the system. The parameter affects the transport behavior of the system (e.g. range of transport request numbers) on the correction system (working in the SAP namespace SSCR, etc.), and on upgrade behavior (keyword modifications).

2. auth/sap_test_system parameter indicates that the SAP system is special test system.  If so value of the param is set to ON.

3. auth/fa_test_system parameter indicates that the SAP system is type of test system marked as final assembly system. If so value is set to ON.
If any of these parameters are present in the SAP system it means that the system is based on ABAP Stack.


As alternative to t-codes RZ10 / RZ11 function module TR_SYS_PARAMS can be used to check of what is value of transport/systemtype among other technical information like System Change Option, SID, Change Option for Client-Dependent Customizing Objects, Change Option for Repository Objects in Logon Client, Client Role, Recording Client for Switch BC Sets.

Sunday, July 16, 2017

What is TLOGO in SAP BW terms?

I mentioned the TLOGO term in my previous post. I just add short explanation of what it means. The TLOGO just represents different BW object types. TLOGO most likely refers to Transportable Object Type. To dig deeper to that, there are always two logical transport objects that represents the BW objects. There are the objects:

·        customer

·        delivery TLOGO object

The BW writes the TLOGO object as per the system settings to the transport request when transporting the particular object.

For more details see domain RSTLOGO in data dictionary.

The different TLOGOs can be also spotted in t-code RSA1 in Metadata Repository.

As of version BW 74 there are following different BW object types present:


CTRT   Currency Translation Type
UOMT  Quantity Conversion Type
AREA   InfoArea
APCO  Application
ROUT  Routine
RSFO  BW Formula
IOBJ    InfoObject
IOBC   InfoObject Catalog
ODSO  DataStore Object (classic)
ADSO  DataStore Object (advanced)
CUBE   InfoCube
AGGR  Aggregate
HYBR   HybridProvider
LPOA   Semantically Partitioned Object
ISET    InfoSet
COPR  Local CompositeProvider
ODPE  Operational Data Provider (ESH-Based)
FBPA   Open ODS View
MPRO  MultiProvider
HCPR   CompositeProvider
ALVL   Aggregation Level
DAPA  Data Archiving Process
ISTD   3.x InfoSource
ISCS   Communication Structure
TRCS   InfoSource
UPDR  Update Rules
LSYS   Source System
ISFS   3.x DataSource
RSDS  DataSource
INSP   Inspection Plan
ISMP   Transfer Rules
ISTS   Transfer Structure
DEST   Open Hub Destination
ELEM   Query Element
HAAP   SAP HANA Analysis Process
TRFN   Transformation
ISIP    InfoPackage
ISIG    InfoPackage Group
RASE   Reporting Agent Setting
RAPA   Reporting Agent Scheduling Package
RRCA  RRI InfoCube Receiver
RRQA  RRI Query Receiver
XLWB  Workbook
SPOK  InfoSpoke
EVEN   Event Processing Chain
DDAS  Data Access Service
RSPT   Process Chain Starter
RSPI   Interrupt Process
WWPA Web Design Time Parameter Metadata
WWIB  Web Design Time Item Metadata
QVIW  Query View
EREL   Enterprise Report: Reusable Element
ERPT   Enterprise Report
ITEM   Web Item (Format SAP BW 3.x)
BITM   BEx Web Item
TMPL   Web Template (Format SAP BW 3.x)
BTMP  BEx Web Template
KPDF   KPI Definition
KPCE   KPI Catalog Entry
BRSE   Broadcast Setting
ANMO  Mining Model
ANSO  Model Source
DMMO Data Model (currently not used)
ANPR  Analysis Process
ACGR  Role
CRWB  Crystal Report
AQBG  InfoSet Query User Group
AQSG  InfoSet
AQQU  InfoSet Query
DTPA   Data Transfer Process
PLST   Planning Function Type
PLSE   Planning Function
PLSQ   Planning Sequence
THEM  Theme
PLCR   Characteristic Relationships
THJT   Key Date of Type Derivation
DMOD Data Flow
RSPV   Process Variants
RSPC   Process Chain
PLDS   Data Slices
ENHO  Enhancement/Append
ASOB  Analytics Security Object (BI Analysis Authorization)
RRUL   Remodeling Rule
RDAC  Configuration for Real-Time Data Acqusition
APPS   Appplication Set (BPC - Transport)
BIXP   Conversion Object
XCLS   Xcelsius Dashboard
AAOE  Analysis Office Excel Workbook
AAOP  Analysis Office PowerPoint
TRPR   Operational Data Provider
AZAP   Analysis Application
ENVM  BPC Unified Environment
MODL  BPC Model
TEAM  BPC Team
WKSP  BPC Workspace
BBPF   BPC BPF
BDAP  BPC Data Access Profile
AZEX   Design Studio Extension
AINX   Local Provider
AABC  AVA Global Setting
AADT  AVA Global Setting
AAPP   Model
AAPS   Environment
ABPC   Business Unit
ABPF   BPF
ABRU  Business Rule
ACGA  Configuration
ACGP  Configuration
ACGS  BPC System Configuration
ACLB   Library
ACTR   Control
ADAF  Data Access Profile
ADEE   BPC Deletion Enttiy
ADEI   Deletion Item
ADEL   BPC Deletion
ADIM   Dimension
ADMC  Data Manager Data File
ADMD  Data Manager File Folder
ADMF  Data Manager File
ADML  Data Manager Package Link
ADMP  Data Manager Package
ADTG  Drill Through
AFLD   File Folder
AFLE   Files
AFLG   Business Unit
AFLC   Category
AJUT   Journal Template
AKPI   AVA KPI Setting
AMBR  Dimension member
AMPF  ToBeDeleted
ARTP   Templates
ASPD  Script Folder
ASPF   Script File
ASPR   Script Logic
ATEM  Team
ATPF   Task Profile

AWSS  Workstatus

Different versions and statuses of BW objects

While working with BW objects one may encounter with different versions and statuses they may have.

Version of BW object (domain OBJVERS) is used to differentiate last active version and the modified version. E.g. if some settings within the BW object has changed from X to Z then before the object is activated then value of X is presented within record having OBJVERS 'A' and the value of Z will be in the 'M' record of the BW object. Once the object is activated then Z will be present in 'A' version.

To track changes within the BW object following customizing can be enabled: SPRO –>SAP Reference IMG –>SAP Net Weaver –>Business Warehouse –>General Settings –> Create Historical TLOGO Versions Automatically. Enabling this; the system may store historical versions of the specific BW object type (so called TLOGO – domain RSTLOGO) in case whether is created before the object of the relevant type is exported, imported or activated. The historical version enables you to monitor changes made to an object over time. Historical version can be generated in event of:

- Automatic version creation of export

- Automatic version creation after import

- Automatic version creation before activation

 

Objects versions of rest of BW objects (e.g. cubes, variables, etc) as defined in domain RSOBJVERS:

A        Active

M        Revised

N        New

D        Content

H        Historic

T        Transport

R        Retrofit (for some object types like BW transformations)

 

Object version for BI Metadata Search as domain RSOSOBJVERS:

A        Active

D        Content

 

Object versions of query elements - Usually query elements might be presented in the database tables in several objects versions:

A - Active version used by the BEx Query Designer and OLAP

B - Backup version represents 3.x definition in 7.x system

D - Delivery version. The objects created and delivered as SAP Business Content

M - Modifiable version. Used in transport. Query elements are imported into a target system in 'M' object version.

S - A backup object version created by the report SAP_GLOBV_CHECK.

 

Status of BW object describes whether the object is currently active or not. If it is active the value in is set to 'ACT', otherwise it will be 'INA'. The same value will be present in the 'A' and 'M' records for this field.

Object Status of BW object (DTP, LPO, TRFN, OpenHub, etc.) as per domain RSOBJSTAT:

ACT    Active, executable

INA     Inactive, not executable

OFF     Switched off

PRO    Productive

 

More information:

SDN wiki on Query Elements

Thursday, July 13, 2017

DLG_VARIABLE error while running BEx report in SAP Portal

While running BEx BE report in SAP portal environment I came across below error:


          Error in rendering root for dialog “DLG_VARIABLE”


The report runs fine while running it outside the portal in BEx Analyzer, Analysis for MS Office or via t-code RSRT. There are below SAP Notes available that fix this issue. However these SAP Notes are only relevant for SAP BW 7.5 SP06 version.

2465736 - Error: Error in rendering root for dialog “DLG_VARIABLE”
2357717 - Cannot convert field VALUE_NUMBER of type DECF34 to double

As in my case BW version was 7.4 so the Notes are not applicable. Root cause within one of BEx variables type of user exit used in the query which populated wrong value. 

Wednesday, July 12, 2017

How to prepare for start /stop of SAP BW system

A quiet while ago I posted blog about BW specific report RS_SYSTEM_SHUTDOWN to be used to shut down and start up BW processes. Actually I think SAP Basis people will agree that a topic of starting/stopping of BW system is bit more complex.

For restarting of the BW system SAP recommends to perform so called soft shutdown (sometimes called graceful shutdown). This means that while shutdown is triggered it waits for transactions to be completed instead just hard shutdown. The some waiting times can be configured via profile parameters to assign them specific time out. See more about these parameters here.

Here are points to consider from the BW system perspective while the soft shutdown is going on.

- Process chain related processes/jobs

- Real time data acquisition daemons (RDS) jobs

In case of PCs I there are these active it just continue to run during the wait time that was given in report RS_SYSTEM_SHUTDOWN on its selection screen. No new background processes (like process chains) are started by scheduler. If there are some of the PCs waiting for execution they will be executed after the restart.

In case of RDS jobs during the soft shutdown are terminated but without stopping the daemons or closing open requests. Successor jobs for the RDS are scheduled using immediate start.

There are also other tools that can be used in case soft shutdown is not an option. For (let's call it) “hard” shutdown there is an ABAP report BTCTRNS1 (no new jobs are started during the shutdown) for “hard” restart report BTCTRNS2 (jobs are scheduled back after the restart and are started as well.

More information:

Tuesday, July 11, 2017

De-scheduling of BEx Broadcast

I recently needed to de-schedule one BEx broadcast I just realized that I forgot how to do it :-) Thus I’m writing this short blog post for my and perhaps others future reference.

As mostly all the settings of BEx broadcaster are done in web environment of JAVA stack -obviously also scheduling / de-schedule happens there. To start it one may go to t-code RSRD_ADMIN - Broadcasting Administration -> Settings and search here for particular broadcast you want to maintain. Once it is found just hit EDIT button and that action will start web environment of broadcaster.


Here there is a hyper link called “Overview of Scheduled Settings” available:

There one needs to specify again the same settings as in the t-code. Once it is found here and displayed there is a button called “Delete Selected Schedules” available and there you go..
For more information about many other features of the BEx broadcaster environment refer to: How to Edit or Delete a Scheduled BW Report

Other post on the BEx broadcaster:

Friday, July 7, 2017

Delete data load requests from Open Hub

Loads to Open Hubs (OH) are pretty much automated. This is meant in a way that there is normally not needed any manual user interaction. However in case load has failed and it needs to be deleted there are not many options left.
One of the options is to just see DTP associated with the OH. There is icon on tollbar called on "Last Request". This gets to data load request maintenance screen. By manipulating the request status via "Where-used List" button we can influence the load e.g. to delete it via setting it to failed status - red.

Another option is to run FM RSB_API_OHS_REQUEST_SETSTATUS. This FM set the status of the OH in load monitor. As input parameters an request ID, desired status (R   = Red; G = Green; N = New; O = Data Request) and finally message – text that will be shown in monitor. All 3 params are mandatory. Once the FM runs the OH request is set to the desired request status.

Thursday, July 6, 2017

Hierarchy data export - job terminated in source system error

I encounter below issue while exporting hierarchy data from InfoObject to other systems. I had enabled my IO with settings “Characteristics is Export DS” available on Master Data/Texts tab of the IO maintenance screen. This means that characteristic is used as export data source. So its attributes, texts, and hierarchies of the IO can be extracted into other BW systems via Data Mart Interface.


Afterwards I created export DS via doing right click on the IO and choosing menu Additional Functions -> Create Export DataSource. Notice that the export DS for hierarchy are still working in 3.x version fashion. Also the version of such a DS is always only modified and the DS is self is Emulated. Same settings you can observe in t-code RSDS.



I replicated DS in my target system. Once I tried to load the data via InfoPackage there was a following error:

Job terminated in source system -> Request set to red.

There was an ABAP dump associated with the cancelled job. It was saying about termination in ABAP report SAPLRSSG, runtime error was type of SYNTAX_ERROR and error description was like follows:

The current ABAP program "SAPLRSSG" had to be terminated because it has come across a statement that unfortunately cannot be executed.
In include "GP00733D5CMRY7YE3D93SUE852V", in line 34 of program
 "GP00733D5CMRY7YE3D93SUE852", the following syntax errors have occurred:
Field "/BIC/C5DU8_IOname is unknown. It is neither in one of the specified tables nor defined by a "DATA" statement.

It was obvious that data element as described wasn’t present in the system and it even wasn’t supposed to be in there.


Actually issue was within method for loading of data. This information for particular DS is stored in table ROOSGEN - Generated Objects for OLTP Source. In my case it was set to T that means transactional RFC but once I corrected it into I (Idoc) my upload worked.



There are few forum posts about this issue in SDN like here and here but solution is not provided within the posts. I hope this blog will be useful for people who face same issue.

Wednesday, July 5, 2017

Handling KF behavior in Expert Routine in case of DSO as target

I came across following issue while dealing with expert routine. There was a DSO object as target of TRFN.  Key figures within the TRFN were updated but they weren’t aggregated. Basically values of KFs from last row that was processed were updated into the DSO but not values form previously processed records. So at the end the KFs were not summed up – no aggregation took place and what was going on was that there was just a move operation executed.

After checking with SAP documentation I realized that that this behavior is as designed:
“If the target of the transformation is a DataStore object, key figures are updated by default with the aggregation behavior Overwrite (MOVE).”

If one wouldn’t need this behavior then it must be overcome in custom coding within the expert routine. Data in result package must be collected instead just appended. Below is example of how to do it.

TYPE: t_ty_t_TG_1 TYPE SORTED TABLE OF _ty_s_TG_1 WITH NON-UNIQUE DEFAULT KEY.

DATA: ls_record_no TYPE rsarecord VALUE 0,
lt_result_pack TYPE t_ty_t_TG_1,
ls_result_str TYPE _ty_s_TG_1.
.
.
.

COLLECT ls_result_str INTO lt_result_pack.