SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

Pricing Report



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> SD
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1640

PostPosted: Tue Sep 09, 2008 5:01 pm    Post subject: Pricing Report Reply with quote

Pricing Report

Code:
REPORT ZRVPRICE MESSAGE-ID ZZ LINE-COUNT 65 LINE-SIZE 255.
************************************************************************
* Author: Joe Mason - SAP Chicago                                      *
* Purpose : Pricing Report                                             *
*  - uses a supplied Customer Number as the basis for determining      *
*    specific type of Pricing report                                   *
*   - it is up to USER personnel to create the Customer Numbers        *
*     -- this includes Organization Data, Price Groups, etc.           *
*       (the number of reports is based upon the Creativity of         *
*        the USER Creating and Maintining the Customers)              *
*   - the program loops thru selected Materials (based upon either/and *
*     Material Number Selection & Material Type selection).            *
*     The report gives prices by Quantity Breaks ( supplied at         *
*     execution time)                                                  *
*    - Prices calculated show the Unit of Measure for the             *
*      calculated Price                                               *
*    - The Report also converts based upon the Currency Entered in     *
*      the initiqal selection screen                                   *
*      (if Currency is not Converted - the used Currency is shown      *
*       with the Price)                                                *
************************************************************************
TABLES: KNA1, MARA, MAKT, TCURT, KNVV, KNB1, MVKE.
DATA: QTY      LIKE KOMP-MGLME.
DATA: QTY0     TYPE P.
DATA: PRICE(20).
DATA: PRICE1 LIKE PRICE.
DATA: PRICE2 LIKE PRICE.
DATA: PRICE3 LIKE PRICE.
DATA: PRICE4 LIKE PRICE.
DATA: PRICE5 LIKE PRICE.
DATA: PRICE6 LIKE PRICE.
DATA: PRICE7 LIKE PRICE.
DATA: PRICE8 LIKE PRICE.
DATA: BIG-TEXT(100).
DATA: LITTLE-TEXT(060).
DATA: REC-COUNT(8) TYPE N.
DATA: DO-SELECT.
DATA: BEGIN OF TAB OCCURS 500,
      MATNR LIKE MARA-MATNR,
        END OF TAB.
SELECTION-SCREEN BEGIN OF BLOCK FRAME1 WITH FRAME
                 TITLE TEXT-001.
*SELTEXT E "General and Organizational Structure Related Parameters
PARAMETERS:
  CUSTOMER LIKE KOMK-KUNNR DEFAULT '?',
*SELTEXT E "Customer Number
  CURRENCY LIKE KOMK-HWAER DEFAULT 'USD',
*SELTEXT E "Currency
  ORDERTYP LIKE VBAK-AUART DEFAULT 'OR',
*SELTEXT E "Order Type
  PRSDT    LIKE KOMK-PRSDT DEFAULT SY-DATUM,
*SELTEXT E "Pricing Date
  SALESORG LIKE KOMK-VKORG DEFAULT 'SB01',
*SELTEXT E "Sales Organization
  DISTCHNL LIKE KOMK-VTWEG DEFAULT '01',
*SELTEXT E "Distribution Channel
  DIVISION LIKE KOMK-SPART DEFAULT '01',
*SELTEXT E "Division
  COMPANY  LIKE KOMK-BUKRS DEFAULT '10'.
*SELTEXT E "Company Code
SELECTION-SCREEN END OF BLOCK FRAME1.
SELECTION-SCREEN BEGIN OF BLOCK FRAME2 WITH FRAME
                 TITLE TEXT-002.
*SELTEXT E "Quantity Related Parameters
PARAMETERS:
  QTY1   LIKE QTY0 DEFAULT 1,
*SELTEXT E "Quantity Base Price Break
  QTY2   LIKE QTY0,
*SELTEXT E "Quantity Price Break 2
  QTY3   LIKE QTY0,
*SELTEXT E "Quantity Price Break 3
  QTY4   LIKE QTY0,
*SELTEXT E "Quantity Price Break 4
  QTY5   LIKE QTY0,
*SELTEXT E "Quantity Price Break 5
  QTY6   LIKE QTY0,
*SELTEXT E "Quantity Price Break 6
  QTY7   LIKE QTY0,
*SELTEXT E "Quantity Price Break 7
  QTY8   LIKE QTY0.
*SELTEXT E "Quantity Price Break 8
SELECTION-SCREEN END OF BLOCK FRAME2.
SELECTION-SCREEN BEGIN OF BLOCK FRAME3 WITH FRAME
                 TITLE TEXT-003.
*SELTEXT E "Materials to be Selected for Report Related Parameters
SELECT-OPTIONS: MTART FOR MARA-MTART.
*SELTEXT E "Material Type(s) to be Selected
SELECT-OPTIONS:
  MATNR    FOR MARA-MATNR.
*SELTEXT E "Specific Material(s) Selection
SELECT-OPTIONS:
  PRDHA    FOR MARA-PRDHA.
*SELTEXT E "Product Hierarchy Selection
SELECT-OPTIONS:
  VMSTA    FOR MVKE-VMSTA.
*SELTEXT E "Specific Sales Status(s)
SELECT-OPTIONS:
  KONDM    FOR MVKE-KONDM.
*SELTEXT E "Specific MaterialPricing Group(s)
PARAMETERS:
  COND1    LIKE MVKE-PRAT1 DEFAULT ' ',
*SELTEXT E "Accept Based ABOVE Selection
  PRAT1    LIKE MVKE-PRAT1 DEFAULT ' ',
*SELTEXT E "Price Group 1
  PRAT2    LIKE MVKE-PRAT1 DEFAULT ' ',
*SELTEXT E "Price Group 2
  PRAT3    LIKE MVKE-PRAT1 DEFAULT ' ',
*SELTEXT E "Price Group 3
  PRAT4    LIKE MVKE-PRAT1 DEFAULT ' ',
*SELTEXT E "Price Group 4
  PRAT5    LIKE MVKE-PRAT1 DEFAULT ' ',
*SELTEXT E "Price Group 5
  PRAT6    LIKE MVKE-PRAT1 DEFAULT ' ',
*SELTEXT E "Price Group 6
  PRAT7    LIKE MVKE-PRAT1 DEFAULT ' ',
*SELTEXT E "Price Group 7
  PRAT8    LIKE MVKE-PRAT1 DEFAULT ' ',
*SELTEXT E "Price Group 8
  PRAT9    LIKE MVKE-PRAT1 DEFAULT ' ',
*SELTEXT E "Price Group 9
  PRATA    LIKE MVKE-PRAT1 DEFAULT ' '.
*SELTEXT E "Price Group 10
SELECTION-SCREEN END OF BLOCK FRAME3.
SET BLANK LINES ON.
SELECT SINGLE * FROM KNA1 WHERE KUNNR EQ CUSTOMER.
IF SY-SUBRC NE 0.
  MESSAGE A999 WITH 'Customer' CUSTOMER 'Does Not Exist'.
ENDIF.
SELECT SINGLE * FROM KNB1 WHERE KUNNR EQ CUSTOMER
                            AND BUKRS EQ COMPANY.
IF SY-SUBRC NE 0.
  MESSAGE A999 WITH 'Customer' CUSTOMER
               'Does Not Exist in Company' COMPANY.
ENDIF.
SELECT SINGLE * FROM KNVV WHERE KUNNR EQ CUSTOMER
                            AND VKORG EQ SALESORG
                            AND VTWEG EQ DISTCHNL
                            AND SPART EQ DIVISION.
IF SY-SUBRC NE 0.
  MESSAGE A999 WITH 'Customer' CUSTOMER 'Does Not Exist in Sales Org'.
ENDIF.

CLEAR TCURT.
SELECT SINGLE * FROM TCURT WHERE SPRAS EQ SY-LANGU
                             AND WAERS EQ CURRENCY.
IF TCURT-LTEXT CS 'America'.
  CLEAR TCURT-LTEXT.
ENDIF.
SELECT * FROM MARA WHERE   MATNR IN MATNR
                     AND   PRDHA IN PRDHA
                     AND   MTART IN MTART.
  SELECT * FROM MVKE WHERE MATNR EQ MARA-MATNR
                       AND VKORG EQ SALESORG
                       AND VTWEG EQ DISTCHNL
                       AND VMSTA IN VMSTA
                       AND KONDM IN KONDM.
    MOVE-CORRESPONDING MVKE TO TAB.
    CLEAR DO-SELECT.
    IF PRAT1 EQ MVKE-PRAT1
       AND NOT MVKE-PRAT1 IS INITIAL.
      MOVE 'Y' TO DO-SELECT.
    ENDIF.
    IF PRAT2 EQ MVKE-PRAT2
       AND NOT MVKE-PRAT2 IS INITIAL.
      MOVE 'Y' TO DO-SELECT.
    ENDIF.
    IF PRAT3 EQ MVKE-PRAT3
       AND NOT MVKE-PRAT3 IS INITIAL.
      MOVE 'Y' TO DO-SELECT.
    ENDIF.
    IF PRAT4 EQ MVKE-PRAT4
       AND NOT MVKE-PRAT4 IS INITIAL.
      MOVE 'Y' TO DO-SELECT.
    ENDIF.
    IF PRAT5 EQ MVKE-PRAT5
       AND NOT MVKE-PRAT5 IS INITIAL.
      MOVE 'Y' TO DO-SELECT.
    ENDIF.
    IF PRAT6 EQ MVKE-PRAT6
       AND NOT MVKE-PRAT6 IS INITIAL.
      MOVE 'Y' TO DO-SELECT.
    ENDIF.
    IF PRAT7 EQ MVKE-PRAT7
       AND NOT MVKE-PRAT7 IS INITIAL.
      MOVE 'Y' TO DO-SELECT.
    ENDIF.
    IF PRAT8 EQ MVKE-PRAT8
       AND NOT MVKE-PRAT8 IS INITIAL.
      MOVE 'Y' TO DO-SELECT.
    ENDIF.
    IF PRAT9 EQ MVKE-PRAT9
       AND NOT MVKE-PRAT9 IS INITIAL.
      MOVE 'Y' TO DO-SELECT.
    ENDIF.
    IF PRATA EQ MVKE-PRATA
       AND NOT MVKE-PRATA IS INITIAL.
      MOVE 'Y' TO DO-SELECT.
    ENDIF.
    IF NOT COND1 IS INITIAL.
      MOVE 'Y' TO DO-SELECT.
    ENDIF.
    IF DO-SELECT EQ 'Y'.
      APPEND TAB.
    ENDIF.
  ENDSELECT.
ENDSELECT.
COMMIT WORK.
SORT TAB BY MATNR.
LOOP AT TAB.
  CLEAR PRICE1.
  CLEAR PRICE2.
  CLEAR PRICE3.
  CLEAR PRICE4.
  CLEAR PRICE5.
  CLEAR PRICE6.
  CLEAR PRICE7.
  CLEAR PRICE8.
  ADD 1 TO REC-COUNT.
  MOVE QTY1 TO QTY.
  IF QTY > 0.
 PERFORM PRICING(ZPRICING) USING CUSTOMER  SALESORG  DISTCHNL  DIVISION
                                     COMPANY  CURRENCY  ORDERTYP  PRSDT
                                      TAB-MATNR  QTY PRICE.
    IF PRICE CS 'Available'.
      CLEAR PRICE.
    ENDIF.
    MOVE PRICE TO PRICE1.
  ENDIF.
  MOVE QTY2 TO QTY.
  IF QTY > 0.
 PERFORM PRICING(ZPRICING) USING CUSTOMER  SALESORG  DISTCHNL  DIVISION
                                     COMPANY  CURRENCY  ORDERTYP  PRSDT
                                      TAB-MATNR  QTY PRICE.
    IF PRICE CS 'Available'.
      CLEAR PRICE.
    ENDIF.
    MOVE PRICE TO PRICE2.
  ENDIF.
  MOVE QTY3 TO QTY.
  IF QTY > 0.
 PERFORM PRICING(ZPRICING) USING CUSTOMER  SALESORG  DISTCHNL  DIVISION
                                     COMPANY  CURRENCY  ORDERTYP  PRSDT
                                      TAB-MATNR  QTY PRICE.
    IF PRICE CS 'Available'.
      CLEAR PRICE.
    ENDIF.
    MOVE PRICE TO PRICE3.
  ENDIF.
  MOVE QTY4 TO QTY.
  IF QTY > 0.
 PERFORM PRICING(ZPRICING) USING CUSTOMER  SALESORG  DISTCHNL  DIVISION
                                     COMPANY  CURRENCY  ORDERTYP  PRSDT
                                      TAB-MATNR  QTY PRICE.
    IF PRICE CS 'Available'.
      CLEAR PRICE.
    ENDIF.
    MOVE PRICE TO PRICE4.
  ENDIF.
  MOVE QTY5 TO QTY.
  IF QTY > 0.
 PERFORM PRICING(ZPRICING) USING CUSTOMER  SALESORG  DISTCHNL  DIVISION
                                     COMPANY  CURRENCY  ORDERTYP  PRSDT
                                      TAB-MATNR  QTY PRICE.
    IF PRICE CS 'Available'.
      CLEAR PRICE.
    ENDIF.
    MOVE PRICE TO PRICE5.
  ENDIF.
  MOVE QTY6 TO QTY.
  IF QTY > 0.
 PERFORM PRICING(ZPRICING) USING CUSTOMER  SALESORG  DISTCHNL  DIVISION
                                     COMPANY  CURRENCY  ORDERTYP  PRSDT
                                      TAB-MATNR  QTY PRICE.
    IF PRICE CS 'Available'.
      CLEAR PRICE.
    ENDIF.
    MOVE PRICE TO PRICE6.
  ENDIF.
  MOVE QTY7 TO QTY.
  IF QTY > 0.
 PERFORM PRICING(ZPRICING) USING CUSTOMER  SALESORG  DISTCHNL  DIVISION
                                     COMPANY  CURRENCY  ORDERTYP  PRSDT
                                      TAB-MATNR  QTY PRICE.
    IF PRICE CS 'Available'.
      CLEAR PRICE.
    ENDIF.
    MOVE PRICE TO PRICE7.
  ENDIF.
  MOVE QTY8 TO QTY.
  IF QTY > 0.
 PERFORM PRICING(ZPRICING) USING CUSTOMER  SALESORG  DISTCHNL  DIVISION
                                     COMPANY  CURRENCY  ORDERTYP  PRSDT
                                      TAB-MATNR  QTY PRICE.
    IF PRICE CS 'Available'.
      CLEAR PRICE.
    ENDIF.
    MOVE PRICE TO PRICE8.
  ENDIF.
  IF PRICE8 EQ PRICE7.
    CLEAR PRICE8.
  ENDIF.
  IF PRICE7 EQ PRICE6.
    CLEAR PRICE7.
  ENDIF.
  IF PRICE6 EQ PRICE5.
    CLEAR PRICE6.
  ENDIF.
  IF PRICE5 EQ PRICE4.
    CLEAR PRICE5.
  ENDIF.
  IF PRICE4 EQ PRICE3.
    CLEAR PRICE4.
  ENDIF.
  IF PRICE3 EQ PRICE2.
    CLEAR PRICE3.
  ENDIF.
  IF PRICE2 EQ PRICE1.
    CLEAR PRICE2.
  ENDIF.
  CLEAR MAKT.
  SELECT * FROM MAKT WHERE MATNR EQ TAB-MATNR
                       AND SPRAS EQ SY-LANGU.
    EXIT.
  ENDSELECT.
  WRITE: / TAB-MATNR, 20 MAKT-MAKTX(40),
           PRICE1, PRICE2, PRICE3, PRICE4,
           PRICE5, PRICE6, PRICE7, PRICE8.
  IF REC-COUNT+6(2) EQ '00'.
    COMMIT WORK.
  ENDIF.
ENDLOOP.

INCLUDE ZCONINC3.
WRITE: /30 KNA1-NAME1.
IF  KNA1-KUNNR CO '0123456789'.
  WRITE: /30 KNA1-STRAS.
  CLEAR: BIG-TEXT, LITTLE-TEXT.
  MOVE KNA1-ORT01 TO BIG-TEXT.
  MOVE KNA1-REGIO TO BIG-TEXT+40.
  MOVE KNA1-PSTLZ TO BIG-TEXT+45.
  MOVE KNA1-LAND1 TO BIG-TEXT+56.
  CONDENSE BIG-TEXT.
  MOVE BIG-TEXT TO LITTLE-TEXT.
  WRITE: /30 LITTLE-TEXT.
ENDIF.
IF TCURT-LTEXT IS INITIAL.
  WRITE: /30 'AS OF:', PRSDT.
ELSE.
  WRITE: /30 'AS OF:', PRSDT, '    in', TCURT-LTEXT.
ENDIF.
WRITE: /.
WRITE:  'Model', 20 'Description'.
IF QTY1 > 0.
  WRITE 70 'Qty of'.
ENDIF.
IF QTY2 > 0.
  WRITE 91 'Qty of'.
ENDIF.
IF QTY3 > 0.
  WRITE 112 'Qty of'.
ENDIF.
IF QTY4 > 0.
  WRITE 133 'Qty of'.
ENDIF.
IF QTY5 > 0.
  WRITE 154 'Qty of'.
ENDIF.
IF QTY6 > 0.
  WRITE 175 'Qty of'.
ENDIF.
IF QTY7 > 0.
  WRITE 196 'Qty of'.
ENDIF.
IF QTY8 > 0.
  WRITE 217 'Qty of'.
ENDIF.
WRITE: /.
IF QTY1 > 0.
  WRITE 60 QTY1.
ENDIF.
IF QTY2 > 0.
  WRITE 81 QTY2.
ENDIF.
IF QTY3 > 0.
  WRITE 102 QTY3.
ENDIF.
IF QTY4 > 0.
  WRITE 123 QTY4.
ENDIF.
IF QTY5 > 0.
  WRITE 144 QTY5.
ENDIF.
IF QTY6 > 0.
  WRITE 165 QTY6.
ENDIF.
IF QTY7 > 0.
  WRITE 186 QTY7.
ENDIF.
IF QTY8 > 0.
  WRITE 207 QTY8.
ENDIF.
ULINE.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> SD All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum


All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG.
Every effort is made to ensure content integrity. Use information on this site at your own risk.