Tuesday, 29 November 2011

How Currency works in SAP

When you look at the SAP Tables it will have the currency fields with 2 decimal places only. Though lot of currencies has only 2 decimal places as per the ISO Standards, there are also some currencies which Differs from the concept of 2 Decimal places, for example: Japanese Yen Does not have a concept of Decimal places, and most of the currencies from the middle Ease are having 3 decimal place, so how these currencies will be handled?

Also SAP gives us the option of defining our own currencies as per our Requirement.

Well, The answer for hoe the currencies with different Decimal notations lies in the Shifting mechanism.

For Example you have the currency JPY, which does not have any Decimal notation, this will be stored in the table after Shifting the Decimal point to left for 2 times,
For Example, the amount 1234 in JPY will be stored in the Database table as 12.34, and when displaying in the screens the Formatting will adjust such that it display the JPY amount without any decimal places.

This concept of shifting the decimal places based on the Currency key gives us the flexibility to define the currency without making any changes in the Database.

Sunday, 9 October 2011

My Experience with ABAP

Here I would like to post one of my experience with SAP ABAP,

This happened in one of the Implementation project project where I have worked.
After all the unit testing done in the Development we have moved the custom developments in to the testing system and started our testing there.

One of the program which was developed by a Junior Abaper started giving an unexpected Error message.

Its actually a report program. It hardly uses some error messages and the funny part here is that we Can't able to find out from where the error is coming and the particular error message is no where user in the program.

After doing some investigation I got little suspicious with the message statement that was written in the program, the junior Abaper has given the message statement without mentioning the message class and message number.



As he haven't mentioned the message class and the message number, the system taken the default message class 00 and the message number 001 and used the same to display the error message. As in the testing system the default message class and the message numbers are different, you have got a unexpected error message.

The default message class will usually have all '&' symbols to facilitate the message without the message class and the message numbers, but in some cases, the default message class might look different.

So as a Best practice, always use the recommended syntax/Standards for any statement that you are writing in the code.

Things to Remember while Programming in SAP ABAP – Part 1


In Any programming language a good program should take care of following 5 aspects
  • Flexible
  • Robust
  • Extensible
  • Easy to understand
  • Easy to maintain

There are some aspects that can be brought in ABAP(Though they will fall under any of the above mentioned categories) which will serve the full value to the purpose.
They are:

1)      Modularize your Code :
 While Developing the code don’t write the pages of code without using the modularization techniques, this will give good chance of reusing the redundant code, helps you to have clarity on the code and will helps your buddies to understand the code Easily.
The best way to use modularization Is to use performs.       

2)      Use the Standard function modules
Use the standard function modules in as far as possible in the Code, Don’t try to write the logic blindly, The logic that you have developed might not work when deployed in the different system as you might only code for the current configuration settings. For example. Currency conversion settings will be different for each currencies, Standard currency conversion function modules will be the best and easiest way to use

3)      Avoid Hard coding
Always don’t do any hard coding in the program, especially if there are any configuration items, try to fetch the configuration values from the table and use the same. Don’t ever do any hard-coding in the program. If there is no other go, use Constants instead of hard coding directly in the program.
One more technique is to create a custom table and store all the values for Hard coding in them and use them in the program. If there are any changes in those values, you just need to change the items in the table and you don’t need to change the program.

4)      Document you code
Use Comments and provide some documentation in the program, this will be usefull to the guys who will maintain the code in the future.

5)      Use Coding Standards
In most of the ABAP Development projects there will be coding standards defined, always don’t deviate from the coding standards already defined. This will be useful for the other members in the team to understand you code.
  
6)      Think about Performance of the system
Always consider the performance aspects while developing the ABAP code. Think about the size of the tables that you are going to access in the program. Try to avoid nested loops, nested Selects in the program. Try to use Binary Search in your program wherever applicable

 7)      Understand the target landscape for which you are developing the code.
One of the main thing that you should be careful while developing any code is to make sure that the code that you are developing fits your target landscape, you can deliver a better value only by having a good understanding of your target landscapes. If it is a large transformational project, then make sure that you a frequent discussion with the enterprise architect.

To Be Continued …..

ABAP - An Introduction

ABAP is one of the many application-specific fourth-generation languages (4GLs) first developed in the 1980s. It was originally the report language for SAP R/2, a platform that enabled large corporations to build mainframe business applications for materials management and financial and management accounting.
ABAP used to be an abbreviation of Allgemeiner Berichtsaufbereitungsprozessor, the German meaning of "generic report preparation processor" , but was later renamed to Advanced Business Application Programming. ABAP was one of the first languages to include the concept of Logical Databases (LDBs), which provides a high level of abstraction from the basic database level(s).
The ABAP programming language was originally used by developers to develop the SAP R/3 platform. It was also intended to be used by SAP customers to enhance SAP applications – customers can develop custom reports and interfaces with ABAP programming. 
ABAP  has been consistently optimized for business programming. With the introduction of the R/3 System in the nineties, the ABAP language - now in its fourth generation - became the basis of the entire system, in which all applications and large parts of Basis (as it was referred to at the time) were implemented. In the late nineties ABAP was extended to become a fully featured object-oriented language, and the extension was named ABAP Objects.

ABAP remains the language for creating programs for the client-server R/3 system, which SAP first released in 1992. As computer hardware evolved through the 1990s, more and more of SAP's applications and systems were written in ABAP. By 2001, all but the most basic functions were written in ABAP. In 1999, SAP released an object-oriented extension to ABAP called ABAP Objects, along with R/3 release 4.6.
SAP's current development platform NetWeaver supports both ABAP and Java.


ABAP TRIAL VERSION

You do not have access to an ABAP System?  Then download your own, with the SAP NetWeaver 7.02 ABAP Trial Version. 
These parts of the ABAP Intro Weblogs guide you through download and installation process of the ABAP Trial Version and advise you how to start the ABAP Application Server to get it ready for your first  ABAP development trials.