Powered By

Free XML Skins for Blogger

Powered by Blogger

Friday, August 8, 2008

Before customizing the Master Data in SAP Plant Maintenance and Customer Service

You must have defined the plant maintenance organizational structure in your system before you proceed with customizing.

This involves maintaining the planning plants and maintenance plants as organizational units.

A distinction is made in Plant Maintenance between planning plants and maintenance plants.

The Maintenance plant is a plant where you can manage technical objects and the work centers responsible for carrying out the work in a maintenance plant.

The planning plant is a plant where you define maintenance task lists, carry out materials planning on the basis of the BOMs in task lists and perform maintenance orders, manage and schedule maintenance plans, enter maintenance notifications and process maintenance orders for the associated maintenance plants.

The recommendation is that yo should always use planning plants when maintenance planning is to be carried out centrally in one plant for several plants. If each plant is independent from a maintenance point of view, each plant is then also a planning plant.

Please note that there are many areas that will overlap with the implementation of components 'MM' (Materials Management) and 'PP' (Production Planning) when you are customizing the system for Plant Maintenance.

If you discover settings that are not relevant to Plant Maintenance, you should only change or delete these after consultation with the appropriate project groups.

PM - Material Master Vs. Equipment Master

If maintenance activities are to be carried out for an equipment and at the same time if an identical replacement is to be
maintained for it in inventory then is it better to create it from the material master rather than from
PM -> Technical Objects -> Create -> Equipment.

What is the significance of maintaining Functional Location BOM.

I would do both create a material number for consistency and the replenishment of equipment in the future and also assign it a unique equipment master record number.

In the equipment master record (I believe PM DATA screen), there is a construction type field which is by default an IBAU material. Link the material number to the equipment master. If you want to get real slick, create the equipment master record with reference to the material number. This way the description (short text) of the equipment is automatically populated by the Construction Type (IBAU material) as well as populating the Construction Type field.

The Functional Location BOM further enhances the hierarchy of the equipment master BOM via Component lists. Lets say you have several equipment (large assemblies) BOM's made up of smaller components (material). You could then create several large assemblies in the material master which would be the equivalent to the equipment (large assemblies) which have BOM's of smaller components (material) . Next, create a Functional Location BOM made up of several of these larger assemblies (material) . This will provide you with a nice hierarchy when running List Edit Display (multi level).

This is a rather complex situation because if the equipment is an asset then the repair costs should reflect the asset value too in some cases. Also the replacing equipment has its own cost record and I think you want to know which equipment number has the most costs collected.

There are a few other ways to control this situations:

1. Creating a sub work order linked to the main work order with the repaired material. So this sub work order should
collect the repair cost. This has the advantage that the main work order cannot be closed unless the repair has been
closed. (or a disadvantage in some cases)

2. You can also use the serialization utility, meaning creating a material number and link it to the equipment and activate
this utility in the material master record. For every movement in MM , it will ask for the related serial number and
accordingly to the proper equipment. So if you send this to the vendor I think this is an advantage to see how much
time this particular equipment has been send out for repair.

But as I said before, the whole process can be very complex if you want to follow it up properly.

In SAP, On what basis we decide to create either material master record or Equipment master record.
And what is the basic difference between Material Master record and Equipment master record.

In SAP a material is a representation of an object that can be procured, produced, assembled, sold, and replaced (among a couple other things). A material can exist as a physical object as stock and it can also exist as a virtual representation of a structure or process. Usually materials are handled as groups of objects (like 100 fenders or a dozen cookies of batch A or 4 panels in restricted stock).

An equipment is a representation of a single physical object that is handled at a much more granular level than materials. An equipment is typically installed somewhere and can have extra information (like warranty or measurement data) and can have maintenance done on it. Usually it's the individualization and maintenance aspect that determines if an object is an equipment or a material (a single entity for which you want to track data like maintenance work, history, or costs).

An equipment can also be linked to a material by indicating that the equipment is made of the material (as a generalization - construction type) and/or indicating that the equipment is actually an instance of a material (material plus serial number in the serial data tab).

SAP PM Equipment FAQ

Q1: How do you distinguish, in a simple manner, between Equipment that is being charged and not charged for service?

A1: Define different equipment categories. Standard equipment reference categories for 'Internal Machines' and 'Customer Equipment' exist.

Q2: How do you distinguish between company and customer owned equipment? Equipment on land owned by the company and land leased by the company?

A2: Same as Q1. Explore combinations of equip. category and equipment types to achieve the design objective.

Q3: How do you define equipment/material loaned/leased to a customer?

A3: Read documentation on 'Structuring Technical Systems' in 'Plant Maintenance / Service management' modules. You need to define sales area (sales org/dist channel/division) for an equipment with equipment category being one for which the equipment reference category is 'Customer Equipment'.

Q4: How can we block service to a customer? It has to be done through the FL, since most of the Equipment belongs to the company and is loaned to the customer.

A4: Deactivate the FL. This allows no further creation of transaction data (service orders, etc.). However, the existing
orders can be processed and closed. The deactivation can be reversed at a later date.

Q5: Where is a Service Contract assigned to a piece of equipment?

A5: Service contract is assigned to a material. Material is assigned to the equipment in the equipment master. This functionality is not intended for managing equipment bought from vendors (where we are getting service rather than providing service).

Q6: Is purchasing information (Vendor, date of purchase, etc.) copied from MM to the equipment when it is being created?

A6: Not in the standard system. But it can be done with ABAP batch jobs.

Q7: When you maintain an assembly in a piece of equipment, is it possible to get maintenance history of the assembly? Do you have to create it as a piece of equipment?

A7: As maintenance orders are created for FL/equipment only, maintenance history can only be tracked at that level, not at assembly level. Assemblies are mere structuring devices to have spare parts linked to an equipment in a structured manner. However, in PM orders, you can mention the assembly along with the FL/Eq. Depending on your reporting needs, an
ABAPer could use the 'PM Assembly' field in PM orders.

Q8: What is the use of the field "Standing order"? What kind of order is it?

A8: Standing orders are used to carry out on-going maintenance jobs and settle them at month end rather than creating a fresh PM order every time. Using order hierarchies, you could attach sub-orders to the standing order and settle them to the standing order to provide you with more precise recording of maint costs at sub-order level as well as a budget monitoring at the standing order level.

Q9: Is it possible to accumulate maintenance history for an assembly (not part of an equipment) for which no equipment record exists?

A9: No. But, if the assembly is included in a FL BOM, then PM orders at the FL can be used to carry maint at assembly level (no equipment is required).

Show Equipments Characteristics in a List

SAP PM Question:

How can I show equipments characteristics in a list?
I need to list one characteristics of all equipaments.
How can I do this? How is the simple way to do this?

Try this.

Go to IH08

In CLASS on the selection screen, select the class desired.

In Valuation, select the Characteristic value desired.

Execute

This will list all Equipments of a particular class having a particular Characteristic value.

or

You may also try this.

Go to Object List (CL6B)

Mention the Class and Class Type.

Tick on "Select Characteristics" and "With assigned values"

Execute.

This takes you to another screen wherein all characteristics of the class selected on the first screen are listed.

Select the Characteristic you want and "Copy"

This lists all Equipments of a particular Class with a particular characteristic.

Component Allocation in Task List

Whenever I am attaching components in task list, item category is coming "L" i,e stockable by default & it is greyed out. I want to change it to non stockable.

In standard SAP in a task list the item cat is taken from the Material Master . That is the reason its greyed . To solve your issue you can create the BOM and have the non stock spare added as a BOM. In the task list you can select material from BOM.

Equipment BOM

Equipment Task List Component Tab

Scenario of Rotating Equipment

How to configure the scenario of rotating equipment , i.e a Sub assembly which can be used on line 1, line 2 and can also be kept in store . History of the equipment should move along with it to each line.

Create the item as an equipment (IE01) this will fit into your scenario. Then you can install and dismantle the equipment as it moves around functional locations.

My Scenario is to move as well as store the equipment in stores as an material but with its history.
A Equipment X is used in line 1, and removed and provided in line 2 and after some repairs kept in stores .from where it can be issued against W/O for line 3/1/2
I feel equipment serial number management can help , but don't know how to configure and use it .

Yes, you are right the serialisation process will help track where your equipment is and has been. You will need assistance for the MM people to have the serialisation activated in the material master (a special material type may have to be created).
It is hard to explain how it works but I will give you an indication of the process I used at a previous business.

They had Material types "ROTO" & REPA" which could be both serialised for Rotable equipment. The serial number used in the material master was the equipment number of the Rotable equipment.

  1. Work Order created to replace equipment X on line 1.
  2. Equipment Y book out of the store which changed the status to "AVLB"(the serial number must be added before the equipment can be issued).
  3. Equipment X physically replaced with equipment Y.
  4. Equipment X position changed to "DISM" to show it is not currently in that position.
  5. Equipment Y is installed to the Functional Location and the position is "INST" (including the correct date of installation).
  6. Equipment X is repaired using the same Work Order (total costing reasons).
  7. Equipment X is repaired and is ready to be booked back into the store.
  8. The Work Order is Technically completed. (this must be done before dismantling the equipment otherwise the link to the Functional location costing is lost A serialised equipment carries no costing detail in the master data because it gets it from the Functional Location it is installed on). Once TECOed the data is locked.
  9. Equipment X is dismantled from the Functional Location.
  10. Equipment X is booked into the store which changes the status to "ESTO"
  11. M3 Activity report detailing the repairs is created to equipment X.
I know it looks messy but the main thing is the planners have to manage it otherwise equipment will get lost or end up in the wrong location. Start small and expand don't implement until you understand how it works.

Attach a Drawing To Equipment Master Data

How to attach a drawing to equipment master data (IE01)?

By: Yasser

To attach a drawing to equipment, follow these steps in IE02 :-

Select this icon at bottom : Attach Drawing Icon

Attach Drawing - Change Equipment Organization

Then select Create - Create Attachment

Attach Drawing - Menu Path

Well done.

Plant Maintenance Reservations

When creating a material reservation or requisition via the PM order, the G/L account is defaulted by the automatic account assignment in the material master.

The default G/L can be changed for a material requisition on the purchasing data screen.

How / where do you change the default G/L for a reservation?

A manual update is not allowed to a reservation that has been created via a PM order.

Other companies are having the same problem.

Currently, the only way to do it is doing a manual goods issue, without using the reservation.

In this way you can, of course, change the default G/L account.

Deletion and control of materials Reservations (PM order)

How can we delete PM materials Reservations in the MM module?

Without using the PM order, can we limit the no. of days to permit the GOODS ISSUE of the PM materials Reservations.

As I'm sure you've found, SAP does not allow manual change to reservations created automatically (e.g.. by PM).

This is to ensure that all the work done by the planners is not simply ignored by the people in the stores. If they want a reservation to be canceled they should call the PM planners who can change the PM order.

You can usually limit the validity period of the reservation in configuration to, for example, 5 days of planned GI date.

In this case, if 5 days have gone by past the planned issue date the deletion flag is automatically set on the reservation. This applies to reservations created by PM.

The transaction in IMG for this is OMBN.

Note that when the PM order is set TECO that the reservations will automatically be deleted.

This is the normal way to control this.

PM - SM notifications

In 3.1f Notifications, there is option to create special Notification or Activity or Request.

The screen fields of Notification and request are different.

Request displays all Catalogs codes, Sales Organization, DC, Division, Maintenance Plant etc. whereas Notification does not ask for these details.

So in general which is preferred to use and why?

Assuming you have 15 regions which will create Notification for customer calls. So will Request help in doing analysis of outstanding, completed Notifications region-wise etc.

Let me put it this way;

What will I not get if I use Notification?

What will I not get if I use Request as default?

This is not from 3.0f client, it is from 4.5A but the concept is still the same.

There are 3 generic Notification types.

1. Reporting defects
2. Reporting previously carried out work
3. Requesting work.

In 4.5A these are called Problem Notification, Activity Report and Service Request.

They are all Notification "Types".

You can create your own types and mix and match the initial screens and defaulted catalog types, but these three are the ones from the menu path you quoted. Also, the initial screens and defaulted catalogs for these 3 types are also configurable.
If you don't use Notifications (in general) then you miss out on catalog reporting, breakdown reporting, downtime and most of the functionality in the SMIS.

Recommendation, use Notifications.

The type to use? That depends on the industry and your company's needs.

In SAP the order is the planning tool and the collector and distributor of costs.

SAP has created the functionality for Notification Tasks for the planning of work, but there is no cost planning or allocations.

Problem Notifications are just what they suggest. Reporting problems.

Depending upon the size of the job depends whether an order is created to plan the work and/or capture the costs.

Activity Reports are normally created to save the administration of an Order. i.e. No significant costs, but you wish to record some technical history after the event. They can also be created from a Preventive type maintenance Order (created automatically from a Maintenance Plan) for technical reporting.

Service request. Typically a Service is required, not a defect or problem.

Typical examples are upgrade or improvements.

Recommendation: Use which is right for you, but you can report across all the Notification types.

SAP PM (Service Management) Geographical Work Centres

-----Original Message-----
Subject: PM (Service Management) Geographical Work Centres
From: Mike Kennedy

Hi all,

My question relates to the creation of tasklists for a common planning plant (across the entire organization). These general tasklists also need to be common to the entire organization, however it would be desirable to have different Main Work Centers representing different geographical regions for the purposes of capacity analysis. Here lies the problem;

The task lists must have a work center assigned to each operation.

If a common work center is used in the task lists this defaults into the operation overview for the Scheduled orders when in fact it is desirable for this work center to be the same as the Main Work Center of the technical object that the work is being performed on ( which corresponds to it's geogrpahical location ).

We do not want to have to change the work centres on the order manually but alas, we require the work centre to represent the geographical region so that the impact of the order can be analysed in the capacity evaluation.

Any Suggestions?

Thanks in advance,

Mike K

-----Reply Message-----
Subject: Re: (Service Management) Geographical Work Centres
From: Barry Dickau

Mike,

Could you not group your tasklists by geographical locations which would mean duplicating the same tasklists but then each would have their own specific workcenters by location. Or create them as equipment or FL tasklists? I'm assuming your Plant structure is based on centralized planning, 1 Planning Plant to many Maint Plants?

-----Reply Message-----
Subject: Re: PM (Service Management) Geographical Work Centres
From: Siminski, Tom TM

Mike,

You may create General Task Lists to be used as reference and then create object related (functional location and/or equipment) task lists by copying the general list and changing work centre to "geographically correct" one.

Additional advantage may be that object specific task lists are easier to use when creating a work order. Extras -> Task list -> Object related, will give you list of all task lists for the object and only those.

Hope that is of some help.
Tom

-----End of Reply Message-----

SAP SM Revenue and Non Revenue Combination Orders

-----Original Message-----
Subject: SM Revenue and Non Revenue Combination Orders

My customer has a requirement to have a combination work order.
Which means they would use a non-revenue work order (material and labor
to be charged to the contract) and also have material and labor to be billed
to the customer all on the same order.

Example:

An SM01 order is created and 6 hrs of labor and $200.00 worth of
material was used. Out of the $200.00 worth of material that was used
$100.00 is to be billed to the customer and the remaining 6hrs of labor and
$100.00 worth of material is to be charged to the contract.

Has anyone encountered this situation and have found some resolution
other than creating to work orders for 1 notification.

Any help would be appreciated.

-----Reply Message-----
Subject: RE: SM Revenue and Non Revenue Combination Orders

I don't think you need to create 2 work orders but one way is to create
SM01 (non-revenue) order & define two settlement rules, one of them
would be the sales order using which you want to bill the customer.
Other one could be your absorbing cost center. You have mentioned
charging to the contract, I guess that should also be possible since it is
a different order type only.

Therefore your solution would be to define two settlement rules with
appropriate percentage to the sales orders.

-----Reply Message-----
Subject: RE: SM Revenue and Non Revenue Combination Orders

I forgot to mention in my earlier mail, In order to define the settlement
rule to the sales order or in other words sales order to be the receiver of
the costs, you will have to have proper item category in the sales order
item.

Regards

-----Reply Message-----
Subject: RE: SM Revenue and Non Revenue Combination Orders

This will not work for SM since you can only assign one settlement rule
to the order type. What might work is to change the percentage to each
cost center. However, the problem with this is that they need actual costs.

SM does not work exactly like PP,PM and SD.

Thanks for your input.

-----Reply Message-----
Subject: RE: SM Revenue and Non Revenue Combination Orders

I am not sure about , what do you mean by "assign one settlement rule
to the order type" but my intention was to give percentages to different
receivers in the settlement rule.

If you want to apportion actual costs only & not percentages, another
option is to try condition types in the sales order & use SM02 i.e.
revenue bearing order type. bill the amount which you want to the customer &
charge the balance to whatever account you want through a separate
condition type. Treat something like warranty.

My answer was/is from SM perspective & it has got nothing to do with
PM/PP or SD.

Hope that helps

-----Reply Message-----
Subject: RE: SM Revenue and Non Revenue Combination Orders

Thanks for the information. What I did not want to do is create two
orders, SM01 and SM02.

Please accept my applogies for sounding like I thought you were not
coming from a Service Management Perspective. I have had four or five answer
that related to PP,PM or SD.

-----Reply Message-----
Subject: RE: SM Revenue and Non Revenue Combination Orders

My answer was not to create two orders but still only one order SM02
but you will have to try out what I suggested.

If that also fails (I don't know yet), there is another solution which is
definitely not going to fail & even SAP will give you the same answer &
probably the only solution if none of other works.

SAP has provided user exit in resource related billing & if the procedure
of billing is somewhat different from all the other ways, activate this user
exit & do the billing & bookings the way you want.

Pls try out all the alternatives & do not say that development will not
work!! Believe me user exits are meant to make the system user
friendly,get some automation & IT IS NOT SYSTEM MODIFICATION.

Regards

-----End of Message-----

Open and Close Posting FICO Periods

Define the posting company code variant in SM30 - V_T010O

Assign the company code variant in SM30 - V_001_R

Maintain the open and close posting period with OB52.

You can control period by : -

1. G/L number range.

2. Company code.

3. Company code and G/L range.

SD Output/Email Sending a billing document by e-mail

First, your SAP system must be configure by the basis people in order for you to send an external mail.

Whether it can send pdf or other file format will depends on the Mail Server you are using.

The basis people must also maintain the conversion parameters so that SAP knows how to convert the billing documents to be send as a pdf file or other desired format specified by your company.

Finally, you have define the IMG in Maintain Output Determination for Billing Documents (Output type MAIL)

Output/Email SAP SD Customizing Picking Output

From Release 4.5A, the system does no longer display the actions for SD picking in the implementation guide.

If you want to use the picking list according to the "old" procedure, you can maintain the list as follows:

o Carry out Transaction V/38 to maintain the output types.

o Carry out Transaction OVLT to assign the picking list types to the
shipping points.

o Carry out Transaction V/53 to assign the picking lists to own
forms and programs.

SD Output/Email Program for Sales Order by Customer, Date, Sales

Sales Order by Organisation, Customer - To create the Sales Order by More no of Date's

User's can easily take the Report from this by selecting Different kinds like Customer Specific [And/Or] Sales Organisation Specific [And/Or] duration of date but Here Date is Mandatory Fields user must have to give date as a selection criteria

In Second level this report will interact with user where they can select date to see the full Details of Sales Order
Selection
- Sales Organisation
- Date
- Customer this will be usefull when Selecting the Checkbox
Standard Variants
- Output
- Sales Order

Example
Date SalesOrderNo Material Amount Currency
10.01.2007 8530 732 1000 INR

*&---------------------------------------------------------------------*
*& Report ZCHE_SALES_ORDER
*&--------Done by V.Chellavelu on 11.01.2007
--------------------------*

REPORT zche_sales_order .

****************************Declarations********************************
TABLES: vbkd,vepvg.",vbak,vbap,vbpa,vakpa, vapma.

DATA: BEGIN OF sal OCCURS 0,
ch TYPE checkbox,
vbeln LIKE vbak-vbeln, " sales document
netwr LIKE vbak-netwr, "Net Value of the SalesOrder
matnr LIKE vbap-matnr, "material no.
waerk LIKE vbak-waerk, "curr.
dat LIKE vbak-erdat, "date.
END OF sal.
DATA: newsal LIKE sal OCCURS 0 WITH HEADER LINE.

DATA: amount LIKE vbak-netwr, date2(15),date3(8),date4(1),
date5(2),date6(2).

DATA: lin LIKE sy-curow VALUE 1,"Screens, vertical cursor position at
"PAI available in SYST struc.
checkbox TYPE c ,
dat LIKE vbak-erdat.

*******************Selection**Screen**Design****************************
SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
PARAMETERS: vkorg LIKE vepvg-vkorg,
vtweg LIKE vepvg-vtweg,
spart LIKE vepvg-spart.
SELECT-OPTIONS date FOR vbkd-bstdk DEFAULT sy-datum TO sy-datum
OBLIGATORY.
SELECTION-SCREEN END OF BLOCK blk1.

SELECTION-SCREEN BEGIN OF BLOCK blk2 WITH FRAME TITLE text-002.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN POSITION 10.
PARAMETERS: chk1 AS CHECKBOX.
SELECTION-SCREEN POSITION 20.
PARAMETERS: kunnr1 LIKE vbpa-kunnr.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK blk2.

********************First**Level**Operation*****************************
IF chk1 <> 'X'.
IF vkorg <> ''.
PERFORM organisation.
ELSE.
PERFORM organisation_else.
ENDIF.

ELSE.
IF vkorg <> ''.
PERFORM cus_orga.
ELSE.
PERFORM cus_orga_else.
ENDIF.
ENDIF.


* Displaying the contents which is selected from table by
* -selection conditions
SORT sal BY dat.

LOOP AT sal.
ON CHANGE OF sal-dat.
* FORMAT HOTSPOT ON.
IF sy-tabix = 1.
WRITE: sy-vline, sal-ch AS CHECKBOX,sal-dat .
CLEAR amount.
ELSE.
WRITE:sy-vline, amount,/ sy-vline, sal-ch AS CHECKBOX,sal-dat.
CLEAR amount.
ENDIF.
ENDON.
amount = amount + sal-netwr.
AT LAST.
WRITE:sy-vline, amount.
ULINE.
SUM.
* FORMAT HOTSPOT OFF.
FORMAT COLOR = 3.
WRITE:/ ' Total Amount:', sal-netwr UNDER amount.
ENDAT.
ENDLOOP.

**********************Interaction with report**************************

SET PF-STATUS 'BANU'. " To create Application ToolBar for Display
Button
* To verify Double click on BANU

AT USER-COMMAND. " This will execute after pressing Display Button
CASE sy-ucomm.
WHEN 'DISP'.
free newsal.
DO.
READ LINE lin FIELD VALUE sal-ch INTO checkbox.
IF sy-subrc NE 0. EXIT. ENDIF.
IF checkbox = 'X'.
PERFORM datecon.
PERFORM process.
ENDIF.
lin = lin + 1.
ENDDO.
PERFORM selection.
ENDCASE.

************************ SUB ROUTINE Area
******************************
*This Process SubRoutine will assign the values from current
* -InternalTable (sal) into other IT(newsal), by date which is
* - selected by CheckBox
FORM process.
LOOP AT sal WHERE dat = dat.
newsal-ch = 'X'.
newsal-vbeln = sal-vbeln.
newsal-netwr = sal-netwr.
newsal-matnr = sal-matnr.
newsal-waerk = sal-waerk.
newsal-dat = sal-dat.
APPEND newsal.
ENDLOOP.
ENDFORM. "process

*&---------This will display the values for selected dates from new --*
*---------------------internal Table (newsal)-------------------------*
*& Form SELECTION
*&--------------------------------------------------------------------*
*---------------------------------------------------------------------*
FORM selection.
ULINE.
FORMAT COLOR = 1.
WRITE:sy-vline,'Date',AT 14 sy-vline, 'Order NO', AT 27 sy-vline,
'Order Material', AT 48 sy-vline,'Order Value(AMT) Currency '.
FORMAT COLOR OFF.
ULINE.
LOOP AT newsal.
ON CHANGE OF newsal-dat.
IF sy-tabix <> 1.
WRITE:/ sy-vline, AT 14 sy-vline,AT 27 sy-vline,AT 48 sy-vline.
WRITE:/ sy-vline,newsal-dat,sy-vline,AT 27 sy-vline,AT 48 sy-vline.
ELSE.
WRITE: sy-vline,newsal-dat,sy-vline,AT 27 sy-vline,AT 48 sy-vline.
ENDIF.
ENDON.
WRITE:/ sy-vline, AT 14 sy-vline,newsal-vbeln,sy-vline,
newsal-matnr, sy-vline, newsal-netwr, newsal-waerk.

AT LAST.
SUM.
ULINE. FORMAT COLOR = 3.
WRITE:/ sy-vline, AT 15 'Total Amount for selected month:',
newsal-netwr UNDER newsal-netwr.
FORMAT COLOR OFF.
ULINE.
ENDAT.
ENDLOOP.
lin = 1.
FREE newsal.
ENDFORM. "SELECTION

* This Date convertion is must for pick the particular Date from the
* -displayed line, and here we are reversing the Date like
YYYY/MM/DD
* -because to Check or assign the date we need to give in reverse
order

*&--------------------------------------------------------------------*
*& Form DATECON
*&--------------------------------------------------------------------*
* text
*---------------------------------------------------------------------*
FORM datecon.
date2 = sy-lisel(17).
SHIFT date2 LEFT BY 4 PLACES.
WHILE date2 <> ''.
SHIFT date2 RIGHT.
date4 = date2+11.
IF date4 <> '.'.
CONCATENATE date4 date3 INTO date3.
ENDIF.
ENDWHILE.
date5 = date3(2).
date6 = date3+2.
date3 = date3+4.
CONCATENATE date3 date6 date5 INTO date3.
dat = date3.
* SORT dat BY dat.
* DELETE ADJACENT DUPLICATES FROM dat COMPARING dat.
ENDFORM. "DATECON


* Here we are doing different kinds of selections by the EndUser's
needs

*&---------When user selectiong an Sales Organisation-----------------*
*& Form ORGANISATION
*&--------------------------------------------------------------------*
* text
*---------------------------------------------------------------------*
FORM organisation.
SELECT f~vbeln p~matnr c~netwr c~waerk p~audat INTO (sal-vbeln,
sal-matnr, sal-netwr,sal-waerk, sal-dat) FROM ( vakpa AS f INNER JOIN
vbak AS c ON f~vbeln = c~vbeln ) INNER JOIN vapma AS p ON
f~vbeln = p~vbeln WHERE p~audat IN date AND p~vkorg = vkorg.
APPEND sal.
ENDSELECT.
ENDFORM. "ORGANISATION


*&---------Without Sales Organisation i.e All Organisation------------*
*& Form ORGANISATION_ELSE
*&--------------------------------------------------------------------*
* text
*---------------------------------------------------------------------*
FORM organisation_else.
SELECT f~vbeln p~matnr c~netwr c~waerk p~audat INTO (sal-vbeln,
sal-matnr, sal-netwr,sal-waerk, sal-dat) FROM ( vakpa AS f INNER JOIN
vbak AS c ON f~vbeln = c~vbeln ) INNER JOIN vapma AS p ON
f~vbeln = p~vbeln WHERE p~audat IN date.

APPEND sal.
ENDSELECT.
ENDFORM. "ORGANISATION_ELSE

*&------------When Selecting Customer by choosing CheckBox------------*
*& Form CUS_ORGA
*&--------------------------------------------------------------------*
* text
*---------------------------------------------------------------------*
FORM cus_orga.
SELECT f~vbeln p~matnr c~netwr c~waerk p~audat INTO (sal-vbeln,
sal-matnr, sal-netwr,sal-waerk, sal-dat) FROM ( vakpa AS f INNER JOIN
vbak AS c ON f~vbeln = c~vbeln ) INNER JOIN vapma AS p ON
f~vbeln = p~vbeln WHERE p~audat IN date AND p~vkorg = vkorg AND
p~kunnr = kunnr1.

APPEND sal.
ENDSELECT.
ENDFORM. "CUS_ORGA

*&------------Without Customer by without choosing CheckBox-----------*
*& Form CUS_ORGA_ELSE
*&--------------------------------------------------------------------*
* text
*---------------------------------------------------------------------*
FORM cus_orga_else.
SELECT f~vbeln p~matnr c~netwr c~waerk p~audat INTO (sal-vbeln,
sal-matnr, sal-netwr,sal-waerk, sal-dat) FROM ( vakpa AS f INNER JOIN
vbak AS c ON f~vbeln = c~vbeln ) INNER JOIN vapma AS p ON
f~vbeln = p~vbeln WHERE p~audat IN date AND p~kunnr = kunnr1.

APPEND sal.
ENDSELECT.