7.19.2010

"SY-UCOMM and OK_CODE in Dialog Program | SAP ABAP Programming

What is the difference between SY-UCOMM and OK_CODE in Dialog Program?

sy-ucomm is for doing the functions what the user wishes to do at that particular event. You use it in menus and other place . this mainly in using

ok_code is generally used in screen as of I have used.  You will define the function in the screen. and you can use it in the main program.

ok_code acts just as a temporary variable that stores the value of sy-ucomm.


When user interacts with the screen elements, the function code that you have assigned is filled in the sy-ucomm field which is turn gets reflected in OK_CODE.

In your ABAP programs, you should work with the OK_CODE field instead of SY-UCOMM. There are two reasons for this: Firstly, the ABAP program has full control over fields declared within it, and secondly, you should never change the value of an ABAP system field. However, you should also always initialize the OK_CODE field in an ABAP program for the following reason:

In the same way that the OK_CODE field in the ABAP program and the system field SY-UCOMM receive the contents of the corresponding screen fields in the PAI event, their contents are also assigned to the OK_CODE screen field and system field SYST-UCOMM in the PBO event. Therefore, you must clear the OK_CODE field in the ABAP program to ensure that the function code of a screen is not already filled in the PBO event with an unwanted value. This is particularly important when the next PAI event can be triggered with an empty function code (for example, using ENTER). Empty function codes do not affect SY-UCOMM or the OK_CODE field, and consequently, the old field contents are transported.
   
read more...

Asset Master Data Upload | SAP FICO | Financial Modules | The Financial Statement Closing Tcodes | LSMW

1. If the change of the field can be put into an algorithm (e.g., enter XYZ as a super number for all assets in class 1234), you can use a mass change rule. You first define the mass change rule in the same way as you would define an asset substitution (IF something, THEN something else), then you go into the mass change transaction, select the right assets, the proper change rule ... and hit Execute.

2. Very often, it is easier to prepare the data in Excel and use transaction AS02 for the upload. Here, I can recommend transaction LSMW - you simulate (and record) the AS02 transaction on one fixed asset master, then follow all the steps proposed by the system (define fixed values, variables, etc.) and finally upload the Excel (.csv). System will automatically generate a batch input for all assets. It may take some time for you if you do it for the first time, but it is the best way if you would otherwise need to define complex algorithms.

So - use option 1 if you have a simple algorithm for many assets, and option 2 if "each case is different" or if you feel more comfortable in Excel than ABAP. Option 2 is simple, but of course takes some time to generate the upload and then run the batch sessions (while option 1 changes everything instantly in a matter of seconds).

Here are the details:

I. To use mass change:

1. First, define a mass change rule in transaction OA02 (Accounting - Financial accounting - Fixed assets - Environment - Mass change rule). For each company code, you can define one rule (or a sequence of them). However, all of them will always be executed at the same time. Therefore, if you need to define different rules for different assets, you will have to do this repeatedly. Technically, this is done in the same way as AA substititution.

2. Once the rule is defined, you need to select assets for mass change. Go to transaction AR01 (Accounting - Financial accounting - Fixed assets - Environment - Worklist - Generate). Enter selection criteria like on any standard AA report, and run Execute. I cannot simulate this now on my system (we do not have AA), but it should ask what you want to do (mass change, mass retirement, etc.) and ask for a name of the worklist (write anything - e.g., Super number change). The system will show you a list of selected assets in a report format. Check it and make sure that it is correct. You may add or remove single assets from this (now cannot tell you how, but it is possible). If you are happy with the list, save it.

3. The last step is execution of the change. Go to transaction AR31 (same path as above), execute the report and if you are happy with the list (same as in step 2), press Save. System will show you a log of change (what went through, which errors occured). You are done.

II. LSMW
LSMW is a transaction, which will let you mass upload almost any other transaction (FB01, FD01, AS91, etc.). You do it in the following way:
1. Enter into transaction LSMW (no menu path), possibly in a development / test system
2. First, define a project, subproject and object (relatively formal task).
3. On the horizontal menu, go to Goto -> Recordings. Click on "Create recording".
4. Enter the name and description of recording (freely definable).
5. I cannot simulate this now in my system, but SAP will ask you about transaction code (AS02) and will take you into the AS02 transaction. In this step, do the change manually. Make sure you "touch" (change / write something) in all fields which you want to update.
6. Once you are done, save the recording and return on the start page of LSMW. Click "Execute".
7. You will see a list of tasks. Do them one by one. They should be relatively simple (and I cannot help you with them). Important is step 3 (maintain source fields) - here you define the columns of your excel (csv) file in the particular order. In step 5 (field mapping and conversion rule), you assign file columns to SAP fields (note that you will see only those fields which you "touched" during recording). You need to go through all the steps. In the end, you get (and run) a batch session.
8. If you did this in a development system, transport the LSMW object (menu Extras - Export project, Extras - Import project). You have to do it via file, not via standard transports of configuration (it is perhaps more simple).

Make sure you test it first in development or quality system!

Fiscal Year Variant

Assuming that you are newly implemention with go live date of Sept 1st 2006 and Fiscal year January - December, what will be the best way?
Would it be better to define a Shortened Fiscal year for Sept-Dec 2006 and then regular Fiscal years OR Define a full Fiscal year for the entire 2006 and future FYs

Normally, the best way is to keep it simple and leave the first year "normal" (12 + 4 months starting January). You convert old data as of August 31 (unless the client requests opening balance as of December 31, 2005 and then monthly movements - I have experienced both options) and then start normal bookings in month 9 on September 1.

We never tried shortened fiscal year in this context and it is surely not needed here. It just adds complexity.

If we create the normal Jan-Dec Fiscal Year for 2006 also, how will we handle the assets when we go live in Oct 2006? Do we load the book value at that time or we load the book value for January 2006 and depreciate in the system for January to September

The ordinary way is to load fixed assets which exist on September 30 (if you go live with AA module on October 1) with trans. AS91.
- First, you need to set in configuration that the last closed fiscal year for legacy data upload is 31.12.2005 and the last period for depreciation will be 9/2006. (Do it in IMG: Financial accounting - Asset accounting - Asset data transfer - Parameters for data transfer - Date specifications)

Within trans. AS91, you enter the following values:
- acquisition value and accummulated depreciation as of 01 January 2006
- all asset movements (acquisitions, retirements, but not ordinary depreciations) between January 1 and September 30 with their respective dates
- already posted depreciation in 2006 until September 30

Then you enter GL movements per month (either you temporarily change the asset reconciliation accounts for direct booking with trans. OAMK, then book with FB01 and finally reset with OAK5, or you book there directly with trans. OASV). This way, your asset accounts (acquisition value and accummulated depreciation) are the same as asset module as of September 30.

You can also let the system recalculate the depreciation from the beginning of the year, but then you may end up with a different value as of September 30 than your legacy system calculated. So, I would not recommend it unless there is no reliable source data. 
read more...

Process Fixed Asset Depreciation | Forecast | Financial Modules | FICO SAP

Every asset transaction immediately causes a change of the forecasted depreciation. However, it does not immediately cause an update of the depreciation and value adjustment accounts for the balance sheet and profit and loss statements. The planned depreciation is posted to the general ledger when you run the periodic depreciation posting run. This posting run uses a batch input session to post the planned depreciation for each posting level for each individual asset as a lump sum amount.

The calculation and scheduling of depreciation, interest and revaluation are automatically controlled by keys in the system, or you can control them manually using a special posting transaction. In both cases, planned depreciation from Asset Accounting must be periodically posted to the corresponding asset and expense accounts of the general ledger. You carry out this posting using a batch input session. In addition to the various depreciation types, interest and revaluation, this batch input session also posts the allocation and writing off of special reserves.

When the system posts depreciation, it creates collective documents. It does not create separate documents for each asset.

Depreciation Posting Run is done via transaction code 'AFAB'.

The program creates batch input sessions for posting depreciation and interest to the G/L accounts in Financial Accounting and/or to Controlling.

Fields Description :-

Company code  : Your Company Code

Fiscal Year   : Your fiscal year

Posting period : Your depreciation period

Reason for posting run (choose one)

Planned posting run  : X (default)

List assets : (tick if you want to see the detail)

Test run : (tick if you run in test mode else untick for production run)

Main asset number : (you can specify certain asset number if you click repeat run or test run)

Note :
Click the execute button if this is a test run.
Click the menu bar -> Program -> Execute in background if this is a production run.

You should get this message :
Background job was scheduled for program RABUCH00 and print out the output.

Release and Process the Batch Input Session in transaction code 'SM35'.

Process Session RABUCH00
X - Display errors only
Additional functions
X - Dynpro standard size

Click the Process button

If there is error, the system will pop up the error message.

Correct the error and recreate the session in transaction 'AFBD'.
read more...