3.21.2010

SAP ABAP File Processing | Downloading Directly to Microsoft Excel Workbook | Sheet

TABLES: USR03,DD02L.
DATA: ZX030L LIKE X030L.
DATA BEGIN OF ZDFIES OCCURS 0.
INCLUDE STRUCTURE DFIES.
DATA END OF ZDFIES.
DATA: BEGIN OF FLDITAB OCCURS 0,
FLDNAME(11) TYPE C,
END OF FLDITAB.

DATA ITABUSR03 LIKE USR03 OCCURS 0 WITH HEADER LINE.
DATA TNAME LIKE DD02L-TABNAME.
SELECT * FROM USR03 INTO TABLE ITABUSR03.
TNAME = 'USR03'.
PERFORM GETFIELEDS.
PERFORM SHOW123.

FORM GETFIELEDS.

CALL FUNCTION 'GET_FIELDTAB'
EXPORTING
LANGU = SY-LANGU
ONLY = SPACE
TABNAME = TNAME
WITHTEXT = 'X' IMPORTING
HEADER = ZX030L
TABLES
FIELDTAB = ZDFIES
EXCEPTIONS
INTERNAL_ERROR = 01
NO_TEXTS_FOUND = 02
TABLE_HAS_NO_FIELDS = 03
TABLE_NOT_ACTIV = 04.
CASE SY-SUBRC.
WHEN 0.
LOOP AT ZDFIES.
FLDITAB-FLDNAME = ZDFIES-FIELDNAME.
APPEND FLDITAB.
ENDLOOP.
WHEN OTHERS.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
with SY-SUBRC.
ENDCASE.

ENDFORM.

FORM SHOW123.

CALL FUNCTION 'EXCEL_OLE_STANDARD_DAT'
EXPORTING
FILE_NAME = 'C:\USR03.XLS'
DATA_SHEET_NAME = 'USER LIST'
TABLES
DATA_TAB = ITABUSR03
FIELDNAMES = FLDITAB
EXCEPTIONS
FILE_NOT_EXIST = 1
FILENAME_EXPECTED = 2
COMMUNICATION_ERROR = 3
OLE_OBJECT_METHOD_ERROR = 4
OLE_OBJECT_PROPERTY_ERROR = 5
INVALID_FILENAME = 6
INVALID_PIVOT_FIELDS = 7
DOWNLOAD_PROBLEM = 8
OTHERS = 9.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

ENDFORM.
read more...

What is the difference between SY-UCOMM and OK_CODE in Dialog Program? | SAP ABAP Programming

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...

2.28.2010

Capacity Planning in PS module | Calendar like in MS Projects

With Pool Capacity we can generally define capacity for a group of expertise in a given Work Center. Meaning that if I have 10 peoples working at 40 hours a week each, my total capacity on a weekly basis is 400 hours.

If the demands from activities in my various projects using that Work Center exceeds the 400 hours then I'll be under capacity and Gantt's in Planning Board will show in red !!!!!

However if I decide to go for Individual Capacity planning using HR module; then from what I read the individuals already defined in HR as employee number; will be tied to the Work Center and automatically taken and represented in Gantt's chart individually.

The link is to tie them as employee number to the Work Center in HR.

My question is; likewise in MS Projects; where we can define availability via the calendar; we can grey out days when an individual is on vacation or not available.

And that will reflect in the overall availability...

In PS is there a way to get an ''equivalent'' calendar !!!!

I did not see anything in PS itself to lock individual's dates !!!!!

Would this be in HR ???

Mainly when I want to reserve vacation time ahead for indivial labour resources..!!!!

I am not an expert in this area but I know a bit about it (I made it in a customer, but at the end I had to undo it). Actually I cannot work with networks so all I have it is my memory.

The pool capacity works as you say, but it seems that you are using the capacity availabality feature. I understood that if you use that, the system only checks if there is capacity avalibale, but not makes a capacity "commitment", it means, other networks can plan that capacity as own (this is made in the "levelling" section). At last, I only used the first feature so only had a look on the second.

I do not know how to plan people from HR module but:
- In CMP9 you can assign people to networks in basis to its Work Center in individual days (but it is very boring for the user).
- In the activity tag "Personal Assignment" you can assign people to an activity. This uses the HR information (working start time, absences, substitutions...). But this is not a capacity check or plan (at the end, I used that information to make a customer-specific report).
- The function "HR_PERSON_READ_WORK_SCHEDULE" can be used to know the exact avilabilty of a person (it will show you working hours, if that day is holiday, if there is a planned absence or substitution... everything). But you need to report previously that data to the system. (if you use it, take a look to the HR_PERSON_INIT_WORK_SCHEDULE too).
- The working factory calendar of the activity it is used to plan the capacity ==> maybe you would need to make a calendar for each employee (too much work I think).

Note that in MS project when you "gray" days is for all the activities, to make that in PS you should make a factory calendar with those days as no working days. I have talking to "gray" those days for each activity.

Sorry if this is not very clear (it has taken me an hour with several interrupts).

I very much agree with Guillermo, and I would suggest to go for his ideea. In my opinion using personal capacity planing in PS-HR is very inflexible and deficitary.

However, the link PS-HR you are asking for,

1. In work center (Transsaction: change work center) you will have to assign the persons from HR, you will have to be carefull as in the transaction there are 2 methods/buttons to assign persons to a work center. now I cannot tell you by heart which one is effectively linking the HR with PS, as only one works, you will have to try both of them (swich to capacity view and you'll see one button sth. "Link to HR" and then the other option is in the menu bar)

2. In HR - you will have to work with your HR colleagues maybe, should be maintained some HR Infotypes: Transaction PA61,
Infotype 0007 - planned working time (e.g. 8 hr. a day)
Infotype 0005 - vacation
Infotype 2001, type pf Infotype 0100 - absences

For the infotype 0007 - you will have alreadythe Arbeitszeitplanregel "rule to plan the working time", if I translate correct from german, which will set the calender for you. This is made with another HR transaction for the HR calender ....this calender(e.g. factory calender) has to be then generated/activated for every month (separate transaction). I do not remember all the transactions codes now, but is pretty much intuitiv, as the system will give you the steps while maintaining the Infotypes.

3. Then you plan the persons in the Activities for a determined period of time. In CMP9 you'll see the availability with the standard working hours (8Hr/day, as set in HR in calender) and the absences (as planed in HR in infotypes) with empty cells (Nota Bene: these cells have in transactions CMP2 and CMP3 a change modus, are not grey or inactive !!!!!) You can change the planing then with the transactions CMP2 or CMP3, one is from project, the other from workcenter point of view . If you make changes in CMP2 or 3 you will not see the changes in Project builder for example. With CMP9 you can only view the personals planing for a workcenter, a project...

I remember there is another transaction to see the personal availability somewhere in the Infosystem> PS>capacity. You'll have to look for it and generate it from Mandant 000.
read more...

Sequence Of Operations To Get EVA | SAP Project System

In my project system I want project progress analysis on the basis of only time proportionality.  Cost will not be consider for progress andtheir are different units used like m, m3, km & hr for work  in internal & external activities, so is it possible to do such setting on the basis of confirmation in customisation?

Yes it is possible do through activity confirmation.  It all depends on EV basis, their you need to set time proportionality.

You need to perform sequence of operations to get EVA. for time prop. you need to maintain scheduling, activity confirmation etc.


Define default meas method as Time prop for objects in customising.

You need to do customization settings for EVA for progress version, statistical key figures, value catagories, progress cost element etc.

You can go the following customizing steps... this will help you to configure as per your needs. This is not as per your need, as only you can understand what all the customizations you need to do........

1. Create Progress Version 101 with exclusive use 'Progress Analysis'. I have selected Plan & Actual check boxes.
2. Settings for Progress Version-
a) Plan version - '0'
b) EV basis - Cost plan (active project, annual values)
c) POC weighting - Cost plan (active project, annual values)
d) Planning type - Basic dates
e) Early / Late - earliest possible
f) Both reference boxes selected

3. SKFs- I created three SKFs 10 (Non-Aggregated POC), 20 (Aggregated POC) and 30 (POC for RA) with unit of measure '%' and selected the Key value category 'Total values'.

4. I need to assign these SKFs to different value categories. I created three value category 10, 20 & 30 with selection 'SKF with total values' and unit of measure '%'. Then I assigned SKF 10 to VC 10, SKF 20 to VC 20, SKF 30 to VC 30

5. I assigned measurement method as default value:
a) WBS (Plan) - Cost Proportional
b) WBS (Actual) - Cost Proportional
c) Internal Activity (Plan) - Cost Proportional
d) Internal Activity (Actual) - Degree of Processing
c) Exernal activity(Plan) - Cost Proportional
d) Exernal Activity (Actual) - Degree of Processing

6. I made progress cost element '6511100' (Secondary cost element) with Cost element category as 61.

7. I maintain a value catagory 6511100 with Cost radio button selected.
And assigned the progress cost element to the value catagory. i.e Cost element 6511100 to value catagory 6511100.

8. I maintain the assignment of cost element group. ie. I assigned progress cost elemnt to cost element group with default radio button selected. In the cost element group, I have selected certain cost elements which we regularly used (cost elements for project materials, project manhours, project contracts, spares etc)

Run CJEN first then CNE1 and CNE5.
read more...

SAP Logistics : PS Substitutions

Project Substitutions

We have configured Partner funcitons to used at PD and WBS element level. We want to enter the 'customer number' as partner at the PD level and then want to copy it automatically in all the WBS elements under the project.

Is it possible to do such a thing? We are unable to use substitutions coz Partner fields do not occur in the substitution fields.

This is reasonably easy to achieve with substitution exit, where you can retrieve data from any logically linked objects and use these as substitution source data. This is described in note 440186, chapter 4.

However, with this technique you can only maintain the fields of PRPS,  e.g. user fields USR*.

If your intention is to substitute corresponding Partner role in each level of WBS, I think that will not be possible with this technique directly.

You should additionally check if there is a user exit at partner maintenance to complete the scenario.

Normally you can use user exit RGGBS00 to insert a user specific into subsititution.

But in your case, it's a little complex, because the partner is in another table (not in PRPS). however you can try to insert your own field into table GB01 and regenerate with program RGUGBR00 (note 42615). 
read more...

2.09.2010

Object Orientation | Its Uses

What is Object Orientation?

In the past, information systems used to be defined primarily by their functionality: data and functions were kept separate and linked together by means of input and output relations.

The object-oriented approach, however, focuses on objects that represent abstract or concrete things of the real world. These objects are first defined by their character and their properties which are represented by their internal structure and their attributes (data). The behaviour of these objects is described by methods (functionality).

Objects form a capsule which combines the character to the respective behaviour. Objects should enable programmers to map a real problem and its proposed software solution on a one-to-one basis. Typical objects in a business environment are, for example, ‘Customer’, ‘Order’, or ‘Invoice’. From Release 3.1 onwards, the Business Object Repository (BOR) of SAP Web Applicaton Server ABAP has contained examples of such objects. The BOR object model will be integrated into ABAP Objects in the next Release by migrating the BOR object types to the ABAP class library. A comprehensive introduction to object orientation as a whole would go far beyond the limits of this introduction to ABAP Objects. This documentation introduces a selection of terms that are used universally in object orientation and also occur in ABAP Objects. In subsequent sections, it goes on to discuss in more detail how these terms are used in ABAP Objects. The end of this section contains a list of further reading, with a selection of titles about object orientation.

Objects

Objects are instances of classes. They contain data and provides services. The data forms the attributes of the object. The services are known as methods (also known as operations or functions). Typically, methods operate on private data (the attributes, or state of the object), which is only visible to the methods of the object. Thus the attributes of an object cannot be changed directly by the user, but only by the methods of the object. This guarantees the internal consistency of the object.
Classes

Classes describe objects. From a technical point of view, objects are runtime instances of a class. In theory, you can create any number of objects based on a single class. Each instance (object) of a class has a unique identity and its own set of values for its attributes.

Object References

In a program, you identify and address objects using unique object references. Object references allow you to access the attributes and methods of an object. In object-oriented programming, objects usually have the following properties:
Encapsulation

Objects restrict the visibility of their resources (attributes and methods) to other users. Every object has an interface, which determines how other objects can interact with it. The implementation of the object is encapsulated, that is, invisible outside the object itself. Inheritance You can use an existing class to derive a new class. Derived classes inherit the data and methods of the superclass. However, they can overwrite existing methods, and also add new ones.
Polymorphism

Identical (identically-named) methods behave differently in different classes. In ABAP Objects, polymorphism is implemented by redefining methods during inheritance and by using constructs called interfaces.
Uses of Object Orientation

Below are some of the advantages of object-oriented programming: · Complex software systems become easier to understand, since object-oriented structuring provides a closer representation of reality than other programming techniques. · In a well-designed object-oriented system, it should be possible to implement changes at class level, without having to make alterations at other points in the system. This reduces the overall amount of maintenance required. · Through polymorphism and inheritance, object-oriented programming allows you to reuse individual components. · In an object-oriented system, the amount of work involved in revising and maintaining the system is reduced, since many problems can be detected and corrected in the design phase.
Achieving these goals requires:

· Object-oriented programming languages

Object-oriented programming techniques do not necessarily depend on object-oriented programming languages. However, the efficiency of object-oriented programming depends directly on how object-oriented language techniques are implemented in the system kernel.

· Object-oriented tools

Object-oriented tools allow you to create object-oriented programs in object-oriented languages. They allow you to model and store development objects and the relationships between them.

· Object-oriented modeling

The object-orientation modeling of a software system is the most important, most time-consuming, and most difficult requirement for attaining the above goals. Object-oriented design involves more than just object-oriented programming, and provides logical advantages that are independent of the actual implementation.
read more...

SAP Object and Properties | Polymorphism | Inheritance | Encapsulation

Object Introduction

ABAP Objects has appeared with the version 4.0. of R/3 and has never stopped maturing since that time. It has now reached a level that makes it a real object oriented programming language that is worth learning. So if you are ready to see what this great technology is about, take a big breath and go on reading.
What is ABAP Objects

ABAP Objects stands for Object oriented ABAP. Compared to the traditional ABAP programming language, ABAP Objects represents an extension of ABAP that provides the language with the tools to support the object oriented programming paradigm.



What is object oriented programming?

To anyone who doesn’t know what object oriented programming is, the object orientation terminology might sound like it is yet another fancy concept that doesn’t serve any real purpose nor provide any real added value just like too many other concepts in computer sciences. More recent than the traditional procedural programming model in which the source code is arranged in procedures to help achieve some level of modularity, the object oriented programming builds on the basics of the existing procedural programming model to propose a radically more sophisticated and comprehensive programming model.

This model lets the analyst-programmer implement complex systems made up of numerous objects linked together or not and control the interactions between these objects. This characteristic of the object programming language constitutes a definitive advantage other traditional programming techniques as it becomes much easier to solve complex problems. As you have already understood, the notion of Object is at the center of the model. It is voluntarily a very general notion as its aim is to describe anything that has properties and functions. In this sense, the terminology object is not yet abstract enough because it bears some idea of concreteness while an object in the sense of object oriented programming might very well represent abstract things. In fact the notion of Object could have been advantageously replaced with the notion of Concept as the programming model we are going to see is able to manipulate any kinds of concepts and to make actual representations of them.
The object oriented programming model has three major characteristics. It assumes support for:
1. Encapsulation
2. Inheritence
3. Polymorphism

We are going to see in more details what these terms mean but keep in mind that these characteristics of object programming represent only the minimum key features that any object oriented programming language must implement. The object oriented programming is not limited to these characteristics. Also we are going to see here what these terms mean in a rather abstract way. We will become more concrete in the next sections of this article when you will have a better understanding of the key concepts of object programming.
1. Encapsulation

Encapsulation is the ability that an object has to contain and restrict the access to its members. We will see later that objects members may be either properties (data) or methods (functions) of the objects. Encapsulation is a key concept of object programming that ensures the autonomy and integrity of the objects.
2. Inheritance

Inheritance is the ability of an object to inherit the properties and methods of an other object. We will come back to this later as you need to have a good understanding of what an object really is if you want to apprehend this concept. Keep in mind for the moment that inheritence is the ability offered to objects to inherit properties from other objects and to form hierarchies. This characteristic leads to the creation of families of objects (just like families exist for humans) with parent objects and child objects. In this configuration, it is clear that child objects inherit some characteristics from their parent object.
3. Polymorphism

This somewhat barbaric term designates the ability of objects to redefine properties inherited from their parents. In other words, a method of an object may have different implementations (behaviours or forms) depending on the object that implements it. This characteristic of the object oriented languages is an important asset to implement abstract concepts which often make sense only in specific contexts.
read more...