Saturday, November 03, 2007

SAP R/3 : Payroll Detail and Field Symbol

Very similar to a past report which I had done and requires it to display dynamic numbers of column and it occurs to me maybe I should just put a template here and share it with everyone who are using it. The report which I had just completed displayed list of employees with all of their basic pay, allowance, deductions and employer contribution from left to right.

Thus, any employee at one point might not have the same number of wagetypes [allowance/deductions] with hers or his peers. So the list that displaying those wage types will need to be very flexible when its display an employee and spreading their wagetypes to right of the report. Here goes the coding that I used to display it dynamically.

Assumingly your field for wagetypes in a structure looks like below:

DATA : BEGIN OF ta_wage,
pernr like pernr-pernr,
col001(010) type c,
col002(010) type c,
col003(010) type c,
col004(010) type c,
...
col050(010) type c,
DATA : END OF ta_wage.

As you see the above data structure has 50 columns. Each of this columns will hold a number of wagetypes [allowance/deductions] for an employee. So it should be dynamically to recognize a column that is occupied and to append it with the next employee's wagetype. Otherwise, it will use the next column.

Thus the coding to recognize the degree of each column that spread from left to right is as follows.

DATA : tp_ind(003) TYPE n.
CONSTANTS : cn_col(011) TYPE c VALUE 'TA_WAGE-COL'.
FIELD SYMBOLS : TYPE any.

LOOP ta_wagetype.
DO VARYING tp_value FROM ta_wage-col001 NEXT ta_wage-col002.
IF tp_ind = 50.
exit.
ENDIF.

CONCATENATE cn_col tp_ind INTO tp_dyncol.
ASSIGN (tp_dyncol) TO tp_value.

[add your logic here]

ADD 1 TO tp_ind.
ENDDO.
ENDLOOP.

Notice that i had declared an index variable to hold the count of item; a constant to assign to a field symbol to capture the column dynamically; and the field symbol to move contents fluidly (in my terms not SAP official explanation).

After that i perform a DO VARYING in the INTERNAL TABLE ta_wagetype so that for each employee, I can scroll the columns dynamically to the right and get the content. As I go to the right of each column's content I can actually assign a new value, shift left or shift right and determine which is the last column that it last stop.

is sky the limit... do varying and field symbol...

Thursday, October 18, 2007

SAP R/3 : Transaction Codes

I have gathered a few important transaction codes along the way in my projects and it had helped me a lot. Here are the following and I hope it will help you like it had helped me in the past, the present and the future:

SE43 - Menu Customization
SE93 - Transaction Code Maintenance
SE16N - Enjoy Screen version of SE16 for data viewing
SCC1 - Transport Copy
SE18 - Class and Methods templates for creation and maintenance
SE19 - Class and Methods maintenance
PA03 - Payroll Run - Release
FS00 - GL master data maintenance (create, change, delete, display)
FK03 - Display vendor master data
FK01 - Create vendor master data
FK02 - Change vendor master data
F-02 - FI posting
S_ALR_87012086 - to be confirmed
PC00_M99_DKON - GL account and wage type display (payroll)
PE01 - Schema maintenance
PA40 - HR maintenance
RSTXSCRP - SAPScript Export/Import


is sky the limit... transaction codes

Wednesday, October 17, 2007

SAP R/3 : FI Posting 1 (Conversation)

Lately, I had a conversation with a good friend of mine who had several years of FI consulting experience and below is what I found out from him:
Wilstroth: Hi, Therry I need your help in FI… I need to know a few things...
Therry: okay shoot

Wilstroth: When user says update vendor GL, say, 323XXX, it means I go to F-02 to do a posting key 40… then 50 right?
Therry: First, what kind of transaction they want to post?

Wilstroth: The transaction is regarding to payroll
Wilstroth: DR vendor
Wilstroth: CR bank

Therry: can you tell me the description of GL 323XXX?
Wilstroth: It’s reimbursement.

Therry: I assumed the vendor is the employee, correct?
Wilstroth: yes, you are right!

Therry: Okay, can you go to TCODE FS00?
Therry: Then type that GL 323XXX…
Therry: Check that GL with your specific company code…
Therry: Choose TAB "Control Data"…
Therry: Choose the Display icon first…
Therry: Then only choose “Control Data”…
Therry: Is there any field called "Recon. Account For Acct Type"?
Wilstroth: Yes, there is…

Therry: Are they referring to Vendor?
Wilstroth : Yes, they are!

Therry: You can post directly to 323XXX with posting key 40…
Therry: And 50 for the bank account (credit)…
Wilstroth: ic... ic...
Therry: Ok now... find the vendor master data first.
Wilstroth: ok...

Wilstroth: How do I search for the vendor master data?
Therry: The TCODE is FK03.

Wilstroth: From the list given by user, the vendor (employee) GL is 11000XXX.

Therry Mully: Type this TCODE S_ALR_87012086.
Therry Mully: and type the company code
Therry Mully: choose DYNAMIC SELECTIONS button
Therry Mully: on the right find reconciliation acct…
Therry Mully: then fill it with 11000XXX… and execute it (F8)
Therry Mully: you will see all vendors under that 11000XXX GL account
Therry Mully: Okay, now about the posting…
Therry Mully: usually it began with this journal entries:
Therry Mully: Dr. (40) Expense
Therry Mully: Cr. (31) Payable (Employee vendor)
Therry Mully: then it will be cleared with these journal entries:
Therry Mully: Dr. (25) Payable (Employee vendor)
Therry Mully: Cr. (50) Bank
Wilstroth: Okay... Now I see the picture!

Therry: you cannot use posting key 40 or 50 for vendor since you cannot post directly to 11000XXX!
Therry: 11000XXX is reconciliation account I assume, under this account you have employee vendor accounts and you only can post into the sub ledger or vendor accounts
Wilstroth: Yes, you are right!
Therry: please check 11000232 account again with tcode FS00, the one previously I taught you
Wilstroth: ok... hold on
Therry: check whether it is reconciliation account or not

Wilstroth: but its not existing
Therry: hah?


wilstroth: yeah i am at QAS
Therry: then let the user know


wilstroth: so there will do it right?
Therry: if they use the same concept i told u for salary...


Therry: then they should have payable account and employee vendor under it
wilstroth: ... ok let me go check further... thanks man...
Therry: welcome...


wilstroth: because i am doing update part on DR(25) and CR(50)... i will be using posting key 25 and posting key 50 right?
Therry: yes


wilstroth: that is the only part i am doing... journal entries... will be done by user
Therry: but you need the first journal entries before you do 25-50 posting
Therry: otherwise, the payable account will have OPEN status


wilstroth: ok.. i take note of that
is sky the limit... a conversation with FI consultant

Wednesday, October 10, 2007

SAP R/3 : GUI_UPLOAD with # as SPACE...

There are many times when we need to upload a text file into an internal table we are not aware that the SPACE among the line of strings in the text file is represented as '#'. When we unknowingly get a row of items and started to split it, using SPLIT syntax with the normal '#' symbol, into the columns of your internal table then we get garbage or unreadable contents in the internal table.


That is because the space is not recognized during upload by GUI_UPLOAD function module. The SPACE among the strings of line items will be replace by '#'. However, this hash or '#' is not your average character '#' but it is an ASCII character of value 09. Thus it showed as '#' in your strings of line items.

Therefore, you will need to do something in your coding so you can SPLIT your string of items properly with the '#'. So, you have to declare a variable with X and value of 09 at the begining of your code. Then only you can use it in your SPLIT syntax. For example, the code below.

Data : tp_hash TYPE x VALUE '09'.
Data : tp_result1(15) TYPE c.
Data : tp_result2(15) TYPE c.

Assuming variable tp_file-item contains 'WILLIAM#WILSTROTH' and obtained via GUI_UPLOAD.

SPLIT tp_file-item AT tp_hash INTO tp_result1 tp_result2.

Write : / tp_result1, tp_result2.

Thus, it now shows:

William Wilstroth


is sky the limit... split with ASCII 09... not #...

Thursday, July 19, 2007

SAP ECC6.0 : GEN - RSTXSCRP

There is a need when you had created a SAPScript in one server and you need to move that SAPScript to another server. Or, you wanted to download the SAPScript and later upload it back to another server. Maybe, you wanted to copy one SAPScript from one to another server. The solution to this is this transaction code : RSTXSCRP. This program is called the 'SAPScript Export to Dataset OR Import from Dataset'.

It allows you to capture the following SAPScript items:
1. Form
2. Style
3. Standard Text
4. Device Type

Thus, this program is very handy when you need to do a copy from one server to another server.

is sky the limit... RSTXSCRP

Wednesday, May 30, 2007

SAP ECC6.0 : Payroll - DELIMIT

This is i must put credit to Hisyam who shared this knowledge with me on how to delimit a record in a table. Needless to say, one of my original requirement needs this feature so we go straight to the procedure:

1. I assume that you have created a master table
2. I also assume that you had made the table maintainable.
3. Go to table generator maintenance.
4. click "generate time dependent" button.
5. Click "maintenance object" then "Generate".

There you are, your table can be maintain...

is sky the limit... delimit your record

Tuesday, May 29, 2007

SAP ECC6.0 : Payroll - SAPMail Function Module

Sometimes you might want to include an email alert to users when they run their program. Recently, I was asked to provide an email alert if one of the records failed to process when run overnight. Thus in the morning, they can get feedback and proceed with their next course of action. So the very nice function module which you can use is below:

FM : SO_NEW_DOCUMENT_SEND_API1

To use this function module, fill up the following parameter:
1. DOCUMENT_DATA : obj_name, obj_descr
2. OBJECT_HEADER : line.
3. OBJECT_CONTENT : line.
4. RECEIVERS : line. (SAP Users)

Then you are ready to send. Check your email in your SAP Business Workplace at the main menu or you can use TCODE : SBWP.

is sky the limit... you've got mail...

SAP ECC6.0 : TAX - EC Form Enhancement

Annually, Malaysians working either in private or public sector will received a tax form from their employers. Those working in the private sector will get the EA Form. Others in the public sector will get the EC Form. EC Form describes how much one earns and gets remunerated (benefits) as well as how much of one earnings gets deducted. Thus the calculation of taxable of one employee. Therefore EC/EA Form denotes all of this in one year.

EC Form which i had to modify to fill up some blank spaces which was not filled up by SAP standard program took me nearly a week or more. I had to go through the standard program and see how the SAPScript (EC Form) and the standard program goes together to process payroll information. Nevertheless, I had to enhance one include file and pump the data into the SAPScript EC Form.


Although SAP did provide 2 BADI for developers to enhance those forms but it only work on certain way and i find it hard to fullfil my functional request thus forcing me to activate enhancement on the standard program itself. This solved one issue over another. Perhaps I would like to meet people who have experience similar situation in modifying or enhancing the EC Form.

So here goes the famous BADI offered by SAP:
1. HRPAYMY_ECFORM - calculation for BIK (Benefit In Kind). This generally displays a lump sum of benefit in kind into the section B (Manfaat Barangan). Unfortunately, my request was to display the breakdown list of all the benefits to one person.

2. HRPAYMY_EAFORM - process to fill up EA Form header only.

Now for those who had not gone through the EC Form or just started to modify it, my adviced is to really go over the program thoroughly because SAP did provide us a EC/EA Form Breakdown List. You need not to modify it.

Yet, that does not solve my problem because the EC Form still does not display the total amount of earnings, benefit and tax deductible. Thus I have to enhance the standard program.

That took me another few days to trace so i can find the best logical and reasonable point to make the enhancement. As you see, enhancement does not allow you to modify the standard program but you may add your coding at the top or bottom of a standard function without modify the mid section part. If you get my point, enhancement only allows addition of custom code at the top and bottom of the standard code. That is where i have to think where is the best part. Not to mention, that customized code should not affect other process too. It should be safe. So far my enhancement has not yield any justifiable complain that will lead to taking off the code. God knows if that happens!

Note : RPCTEAL0 is the original version given by SAP. RPCTEAL0_01 in this context is the new version given to the customer by SAP after a report was make to correct a certain mistake in the past.
So, in order to enhance the EC Form, there is this INCLUDE file named RCPTEAL3_01 that you can enhance to fullfil the request as above mentioned. RPCTEAL3_01 is an include file that do all the calculation process and also assigning of data to SAPScript. That is where you can modify it. In the process, the following are what i have done:

1. Enhancing subroutine FUELLEN : FUELLEN is a subroutine that will pass data to the SAPScript. This portion i put control to certain feature of the SAPScript to only display a specific format of PERNR(PNALT).

2. Changing PERNR to display a concatenated version PERNR(PNALT) and pass it to FUELLEN.

3. Changing DEPT to hold WERK/TEXT and KOSTL/TEXT and pass it to FUELLEN. Currently the DEPT field in SAPScript is left empty even though SAP did provided logic to determine it.

4. Calculation of earnings and benefits from internal table IT_BLTAB and pass it to EC Form Breakdown List.

For points 1 to 4, enhanced subroutine Fill_HD_TAB to cater the changes.

For points 1, enhanced subroutine FUELLEN to cater the changes.

SAPScript involves:
1. HR_MY_TAXECLM05Y - EC Form
2. HR_MY_TAXEABL007 - EC BreakDown List

IMPORTANT: You will need to open up your SAPScript EC Form to see what fields are displaying your value as you do your enhancement.

is sky the limit... EC Form the best enhancement ever done so far....

Thursday, May 17, 2007

SAP ECC6.0 : Payroll - Steps to create schema functions

Just like previous assignment in this entry, an additional 6 more functions to be added to the Payroll Driver Malaysia to validate existence:
- IT0003 (Payroll Status)
- IT0009 (Bank Details)
- IT0185 (Personnel IDs)
- IT0196 (EPF)
- IT0000 (BackDated Pay)
- IT0198 (Check if record exist)


When you need to create or add functions to payroll driver of a certain country, you will need to know three things and there are:

- PE01 - Schema Directory

Schema directory allows you to include steps, constraints and functions to be group together (its like maintaining a group of belonging functions or steps). In a schema, it can have subschemas, processess and instructions. Schema directory must be created if you are customizing a new functions for standard payroll driver. PE01 does not only cater for payroll but time management too.

Steps to create a schema structure:

Step 1: Enter a name e.g. ZTSW

Figure 1.0 : PE01 Main Screen

Step 2: Click create to get into the schema attributes. (Note : Choose country grouping accordingly to which payroll is being used. E.g. 14 is for Malaysia because this example is using Malaysian payroll).

Figure 1.1 : Schema attributes.

Step 3: Choose program class either payroll or time management.

Figure 1.3 : Program class selection

Step 4 : Save and exit. (Note : For the time being we go to PE04 to create functions before we come back to link both of them up)

- PE04 - Maintain Functions and Directories

PE04 allows you to create functions/operations for either payroll or time management. This functions will be saved and enabled in the following program and link to the schema directory above. Thus completing your setting up of additional schemas to your payroll program.

Steps to create function(s) in schema functions

Step 1: create a new name e.g. zsub1.

Figure 2.0 : Create a function

Step 2: Click create to go into characteristics of function payroll. Provide description and country assignment should be according to which country payroll are being run by the client.

Figure 2.1 : Choosing country assignment and description.

Step 3 : Click Save. (Note : Ensure your country assignment is selected correctly.)

- PCBURZMY0

After performing the above steps, you can start to insert functions into include program (PCBURZMY0) of main program (RPCALCL0). Additional functions of payroll schema/driver are added to PCBURZMY0. RPCALCL0 will go through each of the functions in PCBURZMY0 when payroll administrator runs payroll.

is sky the limit... payroll driver... how-to

Friday, April 27, 2007

SAP ECC6.0 : Payroll - Integration for PA30

A BADI (HRPADOOINFTY) activated to execute an external program that will capture payroll infotypes into a customized table when user click the 'SAVE' button.

It will take 5 types of table
IT0008 - Basic Pay
IT0017 - Tabung Haji
IT0198 - Income Tax
IT0014 - Koperasi
IT0196 - EPF

All these data when user modified and click the SAVE button will be captured and sent to a customized table. Eventually this data saved in the customized table can be utilized by another program.

However, one should take note that doing so, especially in implementing this BADI (HRPADOOINFTY), must be careful that it will not affect the payroll run program. Otherwise, this BADI is useless and not helping at all.

is sky the limit... HRPADOOINFTY to save the 5 tables

SAP ECC6.0 : Payroll - DME Enhancement - New Layout...

Last month, i was required to modify DME (RFFOM100) standard program to add a new layout to the bank transfer file format.

DME is also known as international payment transfer

Although SAP provided a few standard file layout but as agreement between the client and its banks, the file was not supported by SAP. Thus a customized file layout was given to suit their needs.In order to modify this, there are a few requirements that you need to know:

1. In DME, under Output Control, Alternative Format must have the customized new file layout. In order to achieve that, go to OBF5 to add your customized file name. (Editor : Remember to set your ISO Code otherwise it won't go to your desired country specific customized alternative file format. Side Effect : it will make use of International MT100 if not set properly)

2. You will need to modify 3 function modules that will create the header file, item file and the trailer file. In order to do this, you can copy the following standard Malaysia file format (Malaysian Banking Berhad) and modified it. Thus, the standard are:
- DME_MY_HR_MBB_1(Header)
- DME_MY_HR_MBB_2(Item)
- DME_MY_HR_MBB_3(Trailer)

With this three standard function modules, you will copy and modified to become your custom file:
- ZDME_XXX_MT100_1(Header)
- ZDME_XXX_MT100_2(Item)
- ZDME_XXX_MT100_3(Trailer)

In each of this function module, please take note that certain lines you will need to retain and do some modifications so it could pass your parameters back to RFFOM100 (DME) program. The DME program will take this customized files and download accordingly to it.

3. Now, after you have modified your function module here comes the big question on how to link the alternative file format to your customized function module. Yes, you need to modify 3 more additional FMs. These FMs will tie your DME to your customized function module in step 2. Those FM are as follows:
- MT_MOD_MALAYSIA_1
- MT_MOD_MALAYSIA_2
- MT_MOD_MALAYSIA_3

In this three standard function modules, you do not need to copy and modified it. You just have to activate enhancement that is provided by ECC6.0. This feature is provided in ECC6.0 to make adjustment to standard programs easier. So to enhance the three function modules:

1. Open up enhancement feature by going to Function Module/Enhancement.
2. Go to Edit/Enhancement Operations/Show Implicit Enhancement Options
3. Then click on dotted lines indicating where enhancement is allowed on editor panel
4. Go to Edit/Enhancement Operations/Create Enhancement.

Now you can start to enhance the three standard function modules to call your customized function module to use your customized file format.

is sky the limit... DME (International Payment Transfer for Malaysia)

SAP ECC6.0 : Payroll – Payee Key for Alimony

In one of a payroll process when an employee or an entity that is identified to include in the payroll run, certain amount will be deducted or added to/from their gross pay. Thus, payee key in this context is the number that will determine a certain deduction to their gross pay.

The payment code here refers to employees, for example, who has alimony, child care, and so forth that needs to be pay by the person. Thus, this derive the Nafkah or dependent care payment.

The feature in this design:
1. The first two prefix dictates the key for personnel deduction. For example AL and followed by six running digits. (ALXXXXXX)
2. Creation of this requires particulars such as bank key, bank account, country, reference key (payee code), name, date begin, date end, and payment method (restricted to P or S).

If payment method is P then bank key and bank account fields
are not required. Else payment method is S thus the reversed.

3. Either able to modify or display after payee key is created.
4. Delimit the payee key. Delimit actually restricts certain validity of the payee key in this context.

Unlike delimiting a record in a table which creating a few record with similar key and different dates.

Tables that are affected by the process are T521B (payee key) and T521C (check table payee key)

This program is very much similar cheque number program but purpose is to maintain payee key.


More on how to DELIMIT record.


Is Sky The Limit... Payee Key

SAP ECC6.0 : Payroll - Cheque Number

This assignment requires a new infotype 9001 (Check Info) to store newly created cheque number(s). Each of this newly created cheque number is control by personnel area and is a running number too.

The cheque number is 6 digits in length.


In order to maintain cheque numbers, a dialog program is required to create, modify, display and delimit it by users manually. Currently, this program will be used by the conversion team to create cheque numbers by batch for testing. Other particulars that required by user is only the payee description.

This cheque will be use in the later stage when payroll department issue cheques to different personnel in personnel areas monthly.

Now, that you have a table that cater maintainence of cheque number, thus an infotype is required to support this information and tie to certain employee(s) when cheque numbers are allocated during payroll processing. This infotype will call PA9001.
I will explain more on infotype and infotype creation in the next entry.
In summary there are 3 portions to this development:
1. A customized table to hold cheque numbers
2. A program to maintain cheque numbers
3. An infotype to relate cheque numbers to payee.

is sky the limit... cheque numbers

SAP ECC6.0 : Payroll - Driver (Old wage type to new wage type)

This assignment requires a customized table and a payroll schema to maintain old wage type. A customized table containing existing bank key and bank name, begin date and end date, and the new wage type and text for replacement.

At PE04 (schema maintenance for payroll and time management) will be used to create a new payroll function to replace existing wage type to the new wage type based on the above content in customized table. Thus, a payroll driver will be created to maintain old wage type with new wage type.

Known tables or structure involved:
1. RT Table (Result Table) - holds all income/deduction wage types for a person

2. BT Table (Basic Pay Table) - holds all basic pay information (ie pay method, pers. area, etc)
3. V_T012 – House Banks - view of all banks alias with the company/org.

After payroll function has been defined, the new function will be added in PCBURZMY0. (this will require a developer key).

In this new function, certain logic is required to differentiate its outcome based on the payment method. If the payment method is bank transfer denoted by the 'T' then the payroll driver's schema must take into consideration of bank's information. However, on the denotion of 'C' meaning payment method is cheque thus, the bank's information is not required when replacing the wage type.


is sky the limit... payroll driver

SAP ECC6.0 : Payroll - Summarized Bank Report

In this second payroll program, it will display 3 types of report and there are the following:

Bank Cover Slip
Summary of Bank Credit Report
Summary of Employees Report

First, the bank cover slip will calculate the total number of amount payroll to be credited and the total number of employees to be credited. This is an overall calculated by the program when its process report 1 and report 2.

Second, the summary of employees report will display all the eligible employee for payroll. In this report, it will show the employee numbers (PNALT-PERNR), employee’s name, employee IC, employee bank account no and total amount paid. Each of this employee will be group according to a bank code. This bank code determine which bank will be credited.

Third, the summary of bank credit report, simply shows a list of bank and its total amount to be credited. The bank code, bank name and total amount are fields in the report.


is sky the limit... bank reports

SAP ECC6.0 : Payroll - Credit Control Statement

I had started my new project a month ago in one of the main government sector on payroll only. Yes, I will be revisiting HR’s Payroll module for another two months, possibly, might get extended according to the work’s urgency.

My first assignment was to come out with a payroll control statement that will display every employees income and benefit and deductions in a list. This control statement will be group accordingly to its WERKS-personnel area and ANSVH-work contract. This is due to large number of department (with 9XK employees) or states to manage its payroll. In this control statement, the payroll department will be able to validate all of its recipient correct amount of take home wage types and deductible wage types.

Apart from this, the technicality behind this program can be found in my previous entry on flexible spending account.

is sky the limit… payroll revisited for two months

Wednesday, March 21, 2007

SAP R/3 : Profit & Loss Report - Part 2

This profit and loss program has finally span to about one month and three weeks. Most of the time was spent in debugging and testing for additional requirements which were left out and accuracy in the reporting layout.

The very first amendment that took me quite some time after the first development was the reversal of FI documents (line items). FI modules in SAP allows reversal.
(Reversal meaning reversing a charge document in moments when there is a wrong charge or cancellation of order. This is my own definition and it could technically meant something else in a functional prospective as well as SAP's definition; so pardon me.)
All the six report in my program had to had the reversal mechanism following the standard SAP procedure so it took about one week and more. Apart from that the testing on the direct operating expenses took in the reversal and charge off too. So additional testing was required to ensure the accuracy of the report.

The second amendment came when the vendor reports related to cost codes being used in cost of sales report need to add an additional column. This amendment was a mistake not drawn in the layout but mention in the specification. So i was careless in this part; thus, a correction was immediately carried out in two days. So the vendors and its details are categorized accordingly to the cost code.

This project is a Project System (PS) and Account Receivables (AR), Account Payable (AP) combine reporting tool. Many late nights were carried out to complete this program. After all a 3000 line of codes really does worth my nights to make this program up and running smoothly. The best thing about this, the wholesome of AI logic taken in consideration when there is charge off, reversal, balance payment of direct operating expenses and most important, not to mention the ultra code that determine all mother of all problem, a certain cost code group that could take in other cost code groups only if it is not a VESSEL (This is another cost code group). This make the program a very challenging task and a lot of deployment of brain cells into activity.

Today, marks the last day of development for it has passed User Acceptance Test and will find myself less commit coming to maintain this PNL report. Unless, there are new requirements and another new challenging report that they are unable to report it out from SAP.

is sky the limit... profit a skill from this task and loss many sleepless nights!

Saturday, February 17, 2007

SAP R/3 : EN-QUEUE... Becareful when using it...

Three days ago, i was helping my colleague to troubleshoot his program. His program uses EN-QUEUE and DE-QUEUE functions to lock and unlock a transparent table that the program is using.

While I was troubleshooting, the application crashed indefinitely and it wouldn't budge. So i make the very wrong move by pressing, you know what, CTRL-ALT-DELETE. The all-mighty Microsoft GOD forbidden function to kill off crashed or stalled program. Why i would say it wrong or in fact you guys out there are shooting my brains off is because when an SAP or ABAP program is running, even though it may looked stalled, but behind it - IT IS STILL RUNNING...!

So i made the terrible mistake.

When i opened up the editor to edit the program, it was locked. So again, i went to SM12 to unlock the program. However, this doesn't really solve our problem. Why? Because, you have to remember that my friend is using EN-QUEUE and DE-QUEUE functions. It means, when your program has begun an EN-QUEUE function you must always DE-QUEUE it at the end immediately. Now, because i make the ever blunder CTRL-ALT-DEL before the ABAP program got the chance to DE-QUEUE it, the report will not execute properly in the next session.

So we were turning in cycles for at least one hour and looking for an answer until someone said, "Eh, you guys should check out SM51... maybe your process is still running" By GOLLY, it was still running and it was there. We delete the session and instantly everything came back to normal.

Lesson learnt :
1. Never use the almighty God Forbidden Microsoft invented CTRL-ALT-DEL to kill off your ABAP process. Think twice before doing it.
2. SM51 to maintain and monitor processes
3. SM12 to maintain and monitor locked programs or transactions.

is sky the limit... CTRL-ALT-DEL and EN-QUEUE vis DE-QUEUE...

Friday, February 09, 2007

SAP R/3 : Profit & Loss Report - Part 1

In about three weeks from now, i have been holed up in a cubicle with two FICO functional consultants doing PS (Project System) enhancement. A massive report combining six reports (Revenue, Cost of Sales, Vendor, Vendor & Invoices, Profit & Loss, and Profit & Loss by Work Package) were plan, scope, design and implemented. The implementation was put into my hands. I developed six reports in that following three weeks. This report was crucial as it is an important requirement by company to be able to view its PNL report.

Although SAP via PS module provides the standard report to view its own PNL report but they were unable to do so due to customization of their WBS element in PS. As a result, a customized PNL is required and i had to crash my mind to come out with it.

Revenue report
A revenue report that show all of its customer by means of first and second level of project definition. It is henceforth segmented into billed and unbilled category. Billed will have the known revenue items and changed order. Unbilled is the known revenue items as well as the changed order. This will be regarded as the revenue report.

Cost of Sales report
The cost of sales report is further categorized into 3 types of report, namely, the summary of cost of sales, vendor and vendor & invoice reports. Each has its own functionality.

- Summary Cost of Sales
Based on Cost Code Group, GL account number and the unknowns (items that are bought but not specific to which project) are group into the cost of sales. Not to mention, this include known invoices which are already identified to projects.

- Vendor and Vendor & Invoice
It will display all related vendors and its invoice the summary cost of sales.

Profit & Loss/Profit & Loss By WP
Combining the Revenue report and Summary Cost of Sales report, this will become the PNL.

is sky the limit.... PNL

SAP R/3 : Spool CONVERTING report to XLS file error...

A project costing report of my client recently had a problem downloading their report via spool into an excel file. The report was not align accordingly to the cells in the xls file. All records in the report were merge as one string and assign to a single cell at the first column in the xls file.

So we grouped together a few ABAP consultants and functional consultants to figure out what was the possible solution to enable the ABAP report to be downloaded into xls via spool correctly. So to say, we need to figure out how to make each column in the ABAP report correctly downloaded into each xls column as exactly as it is.

After several days of searching, the functional found an OSS notes, 78401, that describe our problem (symptom) and prescribed a solution. The solution was to provide the ABAP report to be optically identifiable by vertical lines so the spool knows what are the columns. Currently, the report in question was a classic ABAP report and no lines to indicate what were columns in the report. That makes sense. So an ABAP consultant was set to convert the classic report into an ALV report.

The result, it solves the problems. Now, the customer can happily download their report into xls format via the spool without any problem.

OSS NOTES : 78401.

is sky the limit... no vertical lines in report can make the spool blind.

Friday, January 12, 2007

SAP R/3 : Stock Status Program

Stock status versus budget is the latest program that i recently developed for a client. Much energy was strained to developed it. In the early stage, only two programs were required to combine to become one. So to say, after client viewing, it has now become a very large program with additional of another two programs.

This stock status program versus budget requires the following combination:
1. Outstanding Order
2. Stock Ageing
3. Production Manufacture
4. Delivery Manufacture

So this will become a total in aggregate to product types to display columns of Received Order, Oustanding Order, Stock Level more than 6 months, and the budget.

Although currently the program currently is still in testing stage. Hopefully by this Sunday, it should be ok for usage. I can't speak much of it now. I need to get myself organize on this and return to this post later.

is sky the limit.. a large program for one!

SAP R/3 : Stock Balance Report

I am now using SAP version 3.1 and the ABAP Editor is very crude. Its very different from the latest environment. Its totally different. Stock balance report was one of the report i maintained using this old system.

Added with a slow and unstable dial up connection, the maintenance was so troublesome and disheartening. Each testing and changes made will take half an hour or more. Ok, the report that i maintained today is a report that display a 5 line items.

1. The Opening balance
2. The Requirement
3. The Delivery/PO
4. The Balance
5. The Propose New PO

Each of this line item will display tonnage of stock that is used to monitor their stock level. The opening balance will show the leftover balance of stock including the safety stock. It will be calculated against the balance with item 2 and 3. The report will show the number of tonnage for 15 weeks in a row.

A few things were to take note when developing this report:
1. Less usage of SELECT... ENDSELECT to minimize burden to performance
2. More usage of FOR ALL ENTRIES IN and INNER JOIN.
3. Added and then removed GET_PRINT_PARAMETERS to control printing of blank pages.

is sky the limit... 3.1 is crude