Thursday, November 28, 2013

Unified SAP Developer License

This week SAP announced unified SAP Developer License. It is much expected initiative from many developers. This is license which will be used for most of ABAP and Java downloads available on SCN’s Download Center and SAP cloud offerings for developers. I guess that none of us lazy ABAP developer will ever read it fully. Bu what is most important to is and I quote from Juergen Schmerder blog:

Yes, that does mean you are free to share your ABAP projects on Github!) and it is free of charge and not limited in time.

So thank you SAP to make us – ABAP developers happy!


You can find full license terms here.

Monday, November 11, 2013

How to read other’s program data

When it comes to enhancing SAP functionality we usually talks about user exists, BAdIs and enhancement points. Their main purpose is to extent SAP standard functionality. As particular customer needs may differ from what is offered by standard enhancements are needed to fulfill that particular need. Therefore SAP ABAP programmers are very well known of them.

What does it take to implement the enhancement? Basically you need to find a point in standard code where you plug-in your part of enhancement code. It is not an easy to do so and it takes a lot of
debugging. What is even tricky you may get into the situation where you exactly know where to put the code but you do not have all the input information in order to produce desired output information. This is often case as input parameters of standard function modules or forms may be very limited. So some information that is needed may not be at the right place. But case can be that data is there sitting in memory just it is not part of interface of that standard functionality. Therefore you need to explore what are global data of that program module which were loaded in memory. This can be done using ABAP field symbols. Field symbol enables you to access the place in memory. It is placeholder or symbolic name for other field. It doesn't physically store the data for the field, it just points to its contents. It can point to any data object. Prerequisite is that the field symbol needs to be declared first before is assigned to the data object.

Field symbol has following declaration syntax:
FIELD-SYMBOLS <fs> [typing].

Here’s syntax for assigning Field symbol to the data object:
ASSIGN dobj TO <fs>.

Once we do not need Field symbol we can cancel assignment by following statement:
UNASSIGN <fs>.

Now let’s go back to original topic of how we can read global data from other programs. In order to read it you need to know what the ABAP program is where data object is used. Also it is necessary to make sure that a data object in that ABAP program has a value. Once we know that we prepare variable in format:

(PRG)DOBJ

Where PRG is the name of an ABAP program and DOBJ is the name of a global data object of this program. Let see in following short ABAP fragment of code:

DATAlv_data(30TYPE c.
FIELD-SYMBOLS  <> TYPE ANY.

lv_data 
'(RSAWBN_START)L_AWB_VIEW_MODE'.
ASSIGN (lv_dataTO <>.

IF <fs> EQ 'M'.
  "RSA1 was started 
ELSEIF <fs> EQ 'A'.
  "RSMON was started 
ELSEIF <fs> EQ ''.  
  "RSAWB was started 
ENDIF.  

Now if the program PROG (in this case = RSAWBN_START) is loaded during execution of the statement ASSIGN in the same internal mode as the current program, the data object (RSAWBN_START)L_AWB_VIEW_MODE is searched for in this program, and the field symbol points to this data object after the object has been successfully assigned.

This example would help us in imaginary extension of TA RSA1 of BW system. With help of this code we could possible enhanced RSA1 depending in which mode it was started. By this we would recognize in which mode RSA1 was started and we would put code into all 3 IF/ELSEIF statement.

Used sources:

Sunday, November 10, 2013

Dirty read in ABAP

SAP systems are based on Relational Database Management System (RMDB) systems or simply said database systems. That’s basically the place where all the data of the systems is stored in. There is an isolation property defined in databases. It is about definition when changes to the database are visible to other simultaneous or concurrent operations. Just side note isolation is one of ACID (Atomicity, Consistency, Isolation and Durability) properties of the databases.

From particular database systems point of view the isolation topic falls under one of phenomenas. Particular database recognizes phenomena during processing of concurrent transactions. If situation in the database is unclear we call it the phenomena. There are following phenomenas defined in e.g. SAP MaxDB as it follows ANSI/ISO standard SQL 92:

  • Dirty Read
  • Non-Repeatable Read
  • Phantom
With respect to Dirty Read: there is a situation when A row is modified in the course of a transaction T1, and a transaction T2 reads this row before T1 has been concluded with the COMMIT statement. T1 then executes the rollback statement, i.e. T2 has read a row that never actually existed. So it is dirty because we are not sure if we getting real data by that read statement.

Basically ABAP programmer should always try to avoid the phenomenas when designed locking behavior of custom tables.

Used sources:

SAP innovation mission control centre

SAP has a new offering to support SAP implementation projects. It is so called innovation mission control centre. They use a kind of NASA or control center approach to help the projects. SAP support services experts (part of SAP Active Global Support (AGS)) are using best practices to check, integrate, consolidate, leverage and run SAP solution you implementing to maximize its value.

The control centre comprises of three levels:

Innovation Control Center (ICC) - at customer’s/project location
Operations Control Center (OCC) – at customer’s/project location
Mission Control Center (MCC) – remotely located at SAP facility

Each is designed to complement the other and provide high-level support throughout the various stages of an SAP-centric solution’s lifecycle.

Current locations of mission control centers are: two in China, U.S. center in Pennsylvania, Germany, Brazil, Ireland and Mexico.

Unfortunately (usually within the SAP) more detail about the service itself is not available. I couldn’t find even one single SAP Note about it. The only one very brief presence of term “control centre” is in note 1170668 - The role of SAP Solution Manager in Remote Service Delivery. But note basically says about some of AGS services. So I’m not really sure if services described in the note are actually mission control centre services.

Used sources:

Thursday, October 24, 2013

Reporting security issues to SAP

Security in today’s interconnected digital world is very important. There are many hacks, threats, attacks, viruses reported on daily basis. Every year hackers are using more sophisticated methods. As many other software vendors SAP is very much into the security aspects within its software. Basis team of every customer running SAP should regularly monitor security SAP Notes (see service.sap.com/securitynotes). SAP have patch day - Tuesday. It is every second Tuesday of month (so called SAP Security Patch Day).

But purpose of this blog post is intended to provide basic guideline to someone who may find security issue within SAP software and wants to report it to SAP.

So how to report a Security Issue to SAP? Basic advice is provided by SAP at following page:

Basically there are two options depending who you are:

1 SAP Customer:  In case you find out possible security issue report it to SAP via SMP as customer message at service.sap.com/message

2 Independed:  If realize possible security issue, please report it to SAP Product Security Response Team via email mailto:secure@sap.com using PGP for e-mail encryption.



If you are curious how many issues were discovered by independed researchers and who are those people look at following page: http://scn.sap.com/docs/DOC-8218 Page provides that statistics – a kind of hall of fame or acknowledgments to security researchers.

Wednesday, October 23, 2013

SAP BusinessObjects BI platform reference architecture

Recently I found on SDN very interesting content related to BO. It is set of 2 documents describing in brief capability of every SAP BusinessObjects tools.

First document is clickable map of all the tools. You can see the purpose and changes done into the tool within major versions or feature packs. The document comes in Adobe Flash form and it I clickable. In current version all tools from SAP BO BI platform 4.0 Feature Pack 3 are depicted. There is a horizontally split for all the tools:

Client / web / management / storage / processing / data


Second document is related to architecture of client apps / web / processing servers of SAP BO BI platform 4.1. Basically what you can get here is how BO tool is supported by major product and databases. Also you see what database connection / access is supported:


SDN is providing gateway pages to those documents as well. You can find it here.

TA to maintain Variables Screen for Variable Selection of BEx reports run in TA RSRT

Recently I found TA RSLWSPVARSCREEN in SAP NetWeaver BW based systems. I was wondering what purpose it has. At first sight it deals with variable screen of BEx reports. However this is limited to only variants which are used in TA RSRT. So basically if you have some custom functionality build on top of TA RSRT plus you have stored variants of BEx query used in TA RSRT you may use TA RSLWSPVARSCREEN to maintain/adjust variant.

And here’s how you maintain variant:


Selection screen of TA RSLWSPVARSCREEN loos like following:

Off course you can still use TA RSRT to the same.

TA as itself is liked to ABAP report RSL_UTIL_CALL_VARSCREEN. Currently there is only one SAP Note which mentions this TA:

1642127 - Workspace: Variable scrn for variable maintenance (back end)

Tuesday, October 8, 2013

“Last data update” in Analysis Office (AO)

As BusinessObjects Analysis Office (AO) is about to replace Bex in near future there are a lot of features that are being added to AO. One of the features that BEx web reporting has is “Last data update” in web reporting. Basically it shows the latest date and time of loads in all InfoProvider involved in Multiprovider on which particular report is based on. Similar functionality is offered in Analysis Office for MS Excel.


In version 1.3.9.2462 of AO this functionality is accessible from menu Info Field -> Last Delta Update or you can drg&drop it from Information tab of right side toolbar. Basically functionality is built into AO’s Excel add-in as macro and there are 2 functions available:

=SAPGetSourceInfo("DS_1", "LastDataUpdate")
=SAPGetSourceInfo("DS_1", "LastDataUpdateMaximum")
1st function returns the oldest load and 2nd one the newest load. First parameter is always the name of report (AO calls it DataSource) inserted into Excel’s worksheet.

My other posts on AO topic:


Monday, October 7, 2013

How to get rid of GP* reports

So called GP or Generated Programs are behind some BW functionalities like transformations or BW queries. Existence of obsolete GP reports in SAP BW systems may cause problems. Here I’ providing a one example. Imagine a case of transformations when business logic is coded in ABAP includes. If for some reason name of ABAP include changes e.g. because of change in ABAP naming convention a new ABAP include is included in GP. As transformations get reactivated and as it changes it GP* report name we have in system also old GP* where still old ABAP include is included. If we want to delete old ABAP include it is not possible as there is still an old GP* report where old include is included. So we are in in stalemate situation.

What are possibilities to get rid of obsolete GP* report?

1. Run report SAP_DROP_TMPTABLES. However this report has also downside. It will delete all GP* reports in the system. This will cause that almost everything (see 1139396 - Temporary database objects in BW 7.X, 449891 - Temporary database objects in BW 3.x) w/o taking into account whether or not they are still in your system. So you will be in need of regeneration of a lot of objects. Therefor usage of this report is no-go.

2. You can write small ABAP report which will delete obsolete GP*. As template you can use code below. You can have similar program in all the systems in your landscape. But at least put GP* name on selection screen to make this small program re-usable.
DATA: lv_rep TYPE REPID.
lv_rep = 'GP4TV9WHSM6L4CTUFESVKHU9AN8'.
DELETE REPORT lv_rep.
IF sy-subrc = 0.
  WRITE: / 'GP* deletion OK'.
ELSE.
  WRITE: / ' GP* deletion NOK'.
ENDIF.


What would be other options? Hmm… good question. Actually I raised this topic to SAP via tool called Idea Place. So far no progress on this topic. Apparently it was not promoted by enovty people L

Wednesday, October 2, 2013

Max no of records to see in PSA maintenance screen

Recently I needed to check large data set in PSA. I wanted to list all data records that arrived to PSA from source system. Source was getting me over 3 millions of records. On PSA maintenance selection screen there is a possibility to specify no of records that is supposed to be displayed. Even I had approx. 3 millions of records I was not able to get them all into PSA’s output screen.



I tried to debug the functionality which displays the data. I found out that within the code there is limit on no of records to be displayed:
MODULE user_command_0500 INPUT.
...
  
if g_record_max >= 2147483647.
    g_record_max 
2147483646.
  
endif.
...
The limit is 2,147,483,647. Even if I would exceed the number on the screen by entering higher no I would be getting following error:


To be honest I’m not sure why I was not able to pull out all the records. Finally I managed it differently as I went directly to corresponding PSA transparent table via SE11. So at the end it was not an issue; but I’m curious to know why I cannot see more (all) the records.
PS: no 2,147,483,647 is prime number and is one of only four known double Mersenne primes. It has strong significance in computing because it is the maximum value for a 32-bit signed integer (int).

My other posts on PSA topic:


Monday, September 30, 2013

SAPUI5


Earlier this year SAP came with their new UI technology called SAP UI5. Wait a moment don't they have other UI technologies? Right they do have. Let's do some check and list some of them:

SAPGUI, NetWeaver Business Client (NWBC), browser-based classic dynpros (HTMLB), Business Server Pages (BSP), webDynpro for Java and ABAP, SAP CRM web client, SRM web client, Interactive Forms by Adobe,…

So why new UI? We can look at SAPUI5 as SAP’s HTML5 controls library. SAP is using it as the standard User Interface Control library in all their future applications that need a “consumer grade” User Experience. From technical perspective UI5 is based on HTML/CSS/Javascript and built on open libraries such as jQuery. SAP basically took what was available in open source standards like JQuery, HTML5, JavaScript, CSS and only enhanced it where there was lack of enterprise functions. UI5 is optimized to consume REST/OData services as exposed by e.g. SAP HANA, SAP Netweaver Gateway, SAP HANA Cloud Gateway etc.

SAPUI5 is bundled with SAP NetWeaver Cloud (code name Neo or Project River) which is OnDemand offering or Platform-as-a-Service (PaaS).


UI5 get to know

- 28/01/2014 update -
SAPUI5 has twin buddy called OpenUI5 which is basically same thing just open source based.

SAP Screen Personas

SAP came few times with initiatives how to simplify and even reduce number of SAP screens and fields on the screens. There are options within different SAP products e.g. in customizing where particular screens/fields can be hidden if not used for that customer or SAP implementation. These initiatives are really important. SAP software is covering a lot of industry solutions basically we would hardly found some major industry which is not covered by SAP. Therefore all the screens are really very advanced supporting needs of different industries. Downside is that such as screens/fields are heavy containing a lot of features tied to wide functionalities.

Other initiative was GuiXT. Provided by 3rd party company (Synactive) it is a way how to  customize SAP GUI user interface enabling to narrow down no of screens/fields without touching coding (e.g. ABAP or dynpros). More details about GuiXT see here.

In 2012 SAP came with another possibility. It is called SAP Screen Personas. Basically it is aiming same goal. In contrast of GuiXt it is browser based tool for personalizing SAP Dynpro screens. Notice that Personas works on most of dynpro screen. However it doesn’t work on webdynpros based apps (e.g. app like SAP CRM web client or SAP SRM). It can run as far as you accessing SAP backend system via web browser. It is compatible with SAP NetWeaver Business Client (NWBC) as well as with old ITS. Personas are supported by Microsoft Silverlight (app framework for writing and running rich Internet applications; similar Adobe Flash) and HTML. Personas are part of SAP’s User Experience strategy – they enable improving of SAP screens. In lights of other new SAP initiative like SAP Fiori (which aims to renew widely used SAP user scenario) and SAP UI5 (UI to create new SAP apps) Personas are complementary. Again no programming is involved in Personas deployment.

Screen Personas are delivered as SAP NetWeaver software Component called PERSOS; means it is add-on which needs to be installed into your NetWeaver backend system. NW kernel 7.21 is required. You can customize SAP Personas via TA SPRO -> SAP Customizing Implementation Guide -> Cross Application Components -> SAP Screen Personas.

SAP Screen Personas, version history:
2013 July: Personas 2.0 and Personas 1.0 SP2
2013 April: Personas 1.0 Service Pack 1 (SP1)
2012 December: SAP Screen Personas 1.0

Coming back to GuiXT: As per note 1825312 (Maintenance strategy of GuiXT) GuiXT is still supported and there are currently no plans to remove it from SAP GUI installation.

SAP Personas Resources:
1826286 - FAQ/How-To Guide for SAP Screen Personas
1884539 - Considerations when using SAP Screen Personas
1776739 - Release strategy for the ABAP add-on PERSOS

Thursday, September 12, 2013

Retraction of data from BW to ECC CO-PA part II

Retraction of data from BW is not that easy topic. I found out that while working with it for some time. BW developer who develops the query which does the retraction needs also to customize the ECC part. And that the tricky part of that. As I mentioned already in my previous post Retraction of data from BW to ECC CO-PA customizing is done in TA KELC. You may face an issue in the test or production system later on. While everything seems to be okay from customizing point of view but query (or retraction) cannot be found in TA KELR – where you attempt to run retraction.

Issue is that you need to change RFC entries that are still pointing into BW system which was used in development of ECC system. By standard functionality ECC doesn’t convert RFC connections. But there is a note (540278 - Retractor: Changes to BW system after Customizing transport) which provide ABAP repot which can do the change of RFC connection name for you.

However there might be other issues. E.g. in TA KELR; even when you have proper RFC in all tables there is an error. You may want to check following views/tables:

V_TKEBWLT               BW-CO-PA Field Assignment: Initial Screen
          TKEBWLTN
          TKEBWLTNT
V_TKEBWLT2              BW-CO-PA Field Assignment: BW Query Operating Concern
          TKEBWLRTR3
V_TKEBWLE
          TKEBWLRTRE  BW-CO-PA Transfer: Assignment On BW System OpConc. Level

 But it doesn’t run. Instead of that following is the error:



No date set Message no. KE321
Diagnosis
No date has been set in the transferred field. date fields transferred:
PERIO (period/year):
BUDAT (posting date): 00.00.0000
GJAHR (fiscal year):
PERDE (period):
System Response
Record was stored in the error file.
Procedure
Enter either "PERIO" or "BUDAT" or a combination of "GJAHR/PERDE".
SYST: Period 000 not defined Message no. AF003
Diagnosis
No provision is made for period 000. It is outside of the period interval as specified by the number of the ordinary and special periods in fiscal year version K4.
Procedure
Check your entries. It is possible that there is a program error, if you have not entered the period yourself. In this case, inform your system administrator.

The issue is most likely caused running of your query with different operating concern as it was supposed to. You may use other op.concern before and once you didn't log out from ECC it still remembers last op.concern used. Therefore clear and set proper operating concern in TA KEBC. Then re-run KELR.


Happy retraction! J


Tuesday, August 27, 2013

What is SAP HANA Live?

SAP HANA Live (formerly SAP HANA Analytics Foundation or SHAF or SAP HANA ANALY) is solution for operational real-time reporting on HANA. HANA Live tries to bridge the gap of having operational reporting on top of OLTP system. Kind of to replace operational DWH as we know it. What you get once you install HANA LINE on top of SAP ECC/RRP is a suite of SQL views which spans across majority of ECC modules (FI, CO, MM, PP, SD, PS, CRM, GTS, AM and GRC). They are SAP delivered SAP HANA calculation views for real-time operational of following categories: different categories:

1. Query Views - for end users for their reporting needs
2. Re-use Views - for customers to have a kind of templates on which they can base their own query views
3. Private Views - cannot be changed, forms a kind of abstraction layer for the DB tables and help SAP to keep the re-use views valid even if a database table might change. For using the query views, customers have a variety of options as they can chose from actually any BI client that offers an SQL interface. Obviously, we recommend using SAP's own BI clients like Analysis for Office, Crystal Reports or the brand new Visual Intelligence.

Currently there are 2000+ HANA virtual data model views. So technically deployment of HANA Live involves:
1. Deployment of above mentioned SQL views into your HANA system
2. Setting up SAP Landscape Transformation Replication Server to replicate data from ECC to HANA
3. Using BI client (SAP BO (e.g. SAP BO Dashboards, SAP BO Explorer, SAP BO Analysis edition for Microsoft Office, SAP Crystal Reports Enterprise), or SAP Lumira).


In addition there are apps on top of HANA Live. Basically they are HANA apps with its own UI. E.g. “SAP Invoice and Goods Receipt Reconciliation”, “SAP Supply Chain Info Center”, “SAP Working Capital Analytics”.
Product was for 1st time released on December 2012. As of August 13th 2013 SAP HANA Live is in Generally Availability (GA).

HANA live has currently following components:
SAP HANA Live Tools
          SAP HANA Live Browser
          SAP HANA Live Authorization Assistant
SAP HANA Live for SAP CRM
SAP HANA Live for EHP4 for SAP ERP
SAP HANA Live for SAP solutions for GRC
SAP HANA Live for SAP GTS
SAP HANA Live for SAP SCM
SAP HANA Live for Policy Management

With now having HANA Live, is it another step (after HANA as itself) to get rid of BW? According SAP it is not. They advise to you both solutions for different purpose:

SAP HANA Live:
- Operational Reporting - can eliminate Operational Data Stores thus redundancy and latency
- Untransformed data (no business rules applied) – no persistence of transformations, original transaction data are used: no aggregates, no replication
- Possible replacement for SE16/SE16N, Report Designer ABAP reports, SAP query (SQVI – QuickViewer) and other native ERP Legacy reporting tools.

BW on HANA:
- Analytical Reporting
- Enterprise Data Warehousing capability (time dependent master data, hierarchies, etc.)
- Information Lifecyle Management - Retention of Data, archiving, near line storage
- Business Rules applied to the data before persisting them
- Enterprise Information (Data) Management - Harmonization and consolidation of data from multiple sources

For further information refer to following sources:
1778607 - SAP HANA Live for SAP Business Suite
1846294 - Rapid deployment of analytics with SAP HANA Live
help.sap.com/hba - SAP HANA Live for SAP Business Suite 1.0
saphana.com/docs/DOC-2923 - comprehensive source of resources on HANA Live

Saturday, July 20, 2013

ABAP: select count on an internal table?

I recently came across interesting fragment of ABAP code. Actually it was causing a problem means ABAP dump.

DATAit_tab    TYPE TABLE OF usr02,
      lt_tab2   
TYPE TABLE OF usr02,
      lv_count  
TYPE i,
      lv_tabnm  
TYPE string.

SELECT *
  
FROM usr02
  
INTO  TABLE it_tab.

lv_tabnm 
'it_tab'.

IF sy-dbcnt NE 0.
  
SELECT COUNT(*FROM (lv_tabnm)
    
INTO lv_count
    
WHERE bname 'DDIC'.
ENDIF.

Apparently developer never tested this piece of code. He or she just simply assumed that it is possible to supply internal table name into SELECT statement. In this case SELECT COUNT which was supposed to return no of lines in that internal table.

However SELECT COUNT on internal tables doesn't work. There are other possibilities how to count no of rows in internal table. You can only supply name of DDIC table into the text variable and SELECT COUNT will count no of rows in the database table.

If you do need to count no of rows in itab as whole w/o any WHERE condition there are following possibilities as far as I know:
  1. Very old fashioned way via LOOP statement. It is not very efficient since iterating over every row of table:

    LOOP AT it_tab TRANSPORTING NO FIELDS WHERE bname 'DDIC'.
      lv_count 
    lv_count + 1.
    ENDLOOP.

  1. Via DESCCRIBE TABLE statement, just you cannot specify any conditions:
DESCRIBE TABLE it_tab LINES lv_count.

  1. Via LINES function, again it is not possible to specify any conditions:
lv_count LINESit_tab ).

  1. Usage of system variable SY-TFILL which with ABAP statements DESCRIBE TABLE, LOOP AT, and READ TABLE is filled with the row number of the internal table.
DESCRIBE TABLE result_package.
IF sy-tfill > 0.

  1. One option to build efficient way how to count the rows with respect to some condition is following. By using DELETE statement we delete records that do not fulfill condition and then we use LINES function to count rows of table.
it_tab2 it_tab.
DELETE it_tab2 WHERE NOT bname 'DDIC'.
lv_count 
LINESit_tab2 ).

Conclusion is that you cannot use SELECT COUNT on internal tables. The statement like:

SELECT COUNT(*FROM (lv_tabnm)

Would only work has if lv_tabnm is text variable and contains the name of a database (DDIC) table. By this way SELECT COUNT is executed on this database table.

- update 09/11/2013 –
Usage no.4 was added. I just want to stress out the reason why to know no of the internal tables is important. To determine number of rows of internal tables is very often used in ABAP programs. Due to the ABAP serves to process business data of high volumes there is always counting of rows in internal tables.