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.
Thursday, July 9, 2009
Subscribe to:
Post Comments (Atom)
Archives
-
▼
2009
(413)
-
▼
July
(138)
- SAP PP - Define the default components reservation...
- PP Goods Receipt (101) for Process Order
- SAP PP Goods receipt and goods issue through a PI ...
- SAP PP Goods Movement Steps for Subcontracting
- SAP PP Goods Movement Stock in Transit - liquidati...
- Restricting Good Receipt Unless Production Order C...
- SAP BOM How to link BOM component to storage locat...
- When is a Material BOM Not Exploded?
- Simple BOM & Group BOM
- Explode SAP PP BOM
- Where used list for SAP PP BOM
- SAP PP - Controlling data for your Bill of Materials
- Allocating PP BOM to Other Plant
- SAP PP BOM Mass Change Bill of Materials
- Multi-level configuration with variants PP BOM
- SAP PP BOM What exactly is a Phantom item or Assem...
- Attachment Of Drawings in PP BOMs
- Variant Configuration for an Order
- SAP BOM components never explode
- Checking Costs and Revenues from the Sales Order
- Production Planning - Extract data from MRP Table
- ABAP Reports Production Order Quantity Change Dail...
- SAP PP ABAP Reports Compare Production Confirmatio...
- ABAP Reports Customized Work Center List PP
- Tcodes used for SAP Plant Maintenance
- SAP TCode for SAP ArchiveLink: Link check
- Transparent Table Relate With PM Module
- Effective SAP PM Implementation SAP
- Deadline Monitoring for Maintenance Plans
- Scheduling function in SAP
- Definition and Formula for PM terms SAP
- SAP Plant Maintenance Assembly
- SAP Track New Plant Machine Installed at Customer ...
- Questions Answers on Functional Locations SAP PM
- SAP Questions Answers on PM Equipment
- SAP PM Measuring Points Questions
- Plant Maintenance Q & A - Rept & Analyses - Mgt of...
- SAP PM Maintenance Planning Questions and Answers
- SAP PM Support Problem Solution
- Maintenance of FT Data in Purchasing Documents
- Control the SAP PM Order Type
- Maintenance Notifications Order Link
- Work Order Cost Control SAP
- Impact on Business if PM Order Not Settled
- SAP In PM how to Return Material Backflushed
- Change Maintenance Strategy in General Task List
- User Status Set Date in Maintenance order
- SAP to best handle Repeat Maintenance Jobs
- Recording Measuring Docs. Against Work Orders
- Stop Complete Confirmation (IW41) before (IW32)
- Difference Between TECO & Business Completion
- SAP Settlement Rule In Maintenance Order
- Integration Between PM, QM and PP
- PM Integration With Other Modules
- Control Maintenance Budget in SAP PM
- Before customizing the Master Data in SAP Plant Ma...
- SAP PM - Material Master Vs. Equipment Master
- SAP PM Equipment FAQ
- Show Equipments Characteristics in a List
- Component Allocation in Task List
- Scenario of Rotating Equipment
- Attach a Drawing To Equipment Master Data
- Plant Maintenance Reservations
- SAP Deletion and control of materials Reservations...
- SAP PM - SM notifications
- PM (Service Management) Geographical Work Centres
- SM Revenue and Non Revenue Combination Orders
- Open and Close Posting FICO Periods
- SAP SD Output/Email Sending a billing document by ...
- SAP Output/Email SAP SD Customizing Picking Output
- SAP SD Output/Email Program for Sales Order by Cus...
- Purchase Order and Sales Order Workflow
- Workflow of Purchase Requisition Release Strategy
- Changing Vendor on Purchase Order
- One Time Vendors SAP MM
- Vendor Evaluation for Purchasing
- Process of Subcontract in SAP MM
- Subcontracting - Key Points
- Procedure for Setting Partner Functions
- What Is Outline and Scheduling Agreement
- What is Vendor Consignment?
- Multiple Currency Quotation or Invoice From Vendor
- User Exits In MM Area
- IMG MM Transaction Codes Organizational Structures
- SAP MM Transaction codes
- SAP TCode for Personal Menu Volker Hofmann
- SAP Transaction Code for: Waive Acceptance Order T...
- SAP Transaction Code for: New Monthly Returns Repo...
- SAP MM Important Tcodes 2
- IMG Change Logs and can ACCT Tables be Deleted
- Common Tables used by SAP MM
- SAP MM All The Tables In SAP MM Purchasing
- SAP MM Tables - click to enlarge
- Interview Questions on SAP MM
- SAP Material Management Interview Questions
- SAP MM Support Problem Solution
- Common SAP MM Questions I
- SAP MM Material Management Frequently Asked Question
- What Is The DataFlow Of MM?
- SAP MM User Exit That Is Applied In MM Area
-
▼
July
(138)
No comments:
Post a Comment