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

Настройка прайсинговой процедуры в IMG



 
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 Oct 30, 2007 5:59 pm    Post subject: Настройка прайсинговой процедуры в IMG Reply with quote

SPRO -> Sales and Distributions -> Basic Functions -> Pricing -> Pricing Control -> Define and Assign Pricing Procedures -> Maintain pricing procedures

Расчет прайсинга:
Программа
SALPV61A

Инклюде
LV61AA55

Подпрограмма
XKOMV_BEWERTEN

Прайсинговые формулы
RV64Axxx

User-exit:
Code:
***INCLUDE RV61AFZA .

************************************************************************
*                                                                      *
* This include is reserved for user modifications                      *
* Forms for pricing                                                    *
* The name of modification modules should begin with 'Z'.             *
*                                                                      *
************************************************************************
*       USEREXIT_PRICING_RULE                                          *
************************************************************************

*---------------------------------------------------------------------*
*       FORM USEREXIT_PRICING_RULE                                    *
*---------------------------------------------------------------------*
*       Define new rules for data element KNPRS or                    *
*       modify existing rules                                         *
*---------------------------------------------------------------------*
FORM USEREXIT_PRICING_RULE.

* the following example for the new pricing type 'X' makes new
* pricing for condition types X,Y,Z when creating an invoice
* (use pricing type 'X' in the document flow for invoicing)
*
*   STEU-KNPRS = 'X'.
*   STEU-KNTYP = 'XYZ.......'.        "new pricing for condition types
*   STEU-KOAID = '..........'.        "new pricing for condition class
*   STEU-MAUEB = ' '.                 "X means: manually entered
*   APPEND STEU.                      "conditions will be copied

ENDFORM.
*eject

*---------------------------------------------------------------------*
*       FORM USEREXIT_PRICING_COPY                                    *
*---------------------------------------------------------------------*
*       modify KONV before copying                                    *
*---------------------------------------------------------------------*
FORM USEREXIT_PRICING_COPY.

* the following example modifies the calculation rule within invoices
* for condition type HD00
*
*   CHECK VBTYP_NEW CA VBTYP_FAKT.
*   IF KONV-KSCHL = 'HD00'.
*     KONV-KRECH = 'B'.
*   ENDIF.

ENDFORM.


Code:

* INCLUDE RV61AFZB
*---------------------------------------------------------------------*
*       FORM USEREXIT_PRINT_ITEM                                      *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
FORM userexit_print_item.
ENDFORM.

*---------------------------------------------------------------------*
*       FORM USEREXIT_PRINT_HEAD                                      *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
FORM userexit_print_head.

** Example: Dual currency prices output in SD printed docs.
*  DATA : EURO_CURRENCY LIKE KOMK-WAERK VALUE 'EUR'.
*  DATA : ENDVALUE_CONVERT(1)           VALUE 'X'.
*  DATA : HEAD_CONDITIONS_CONVERT(1)    VALUE 'X'.
*  DATA : SEPARATE_BLOCK(1)             VALUE 'X'.
*
*  CHECK : SY-UNAME NE 'PODHAJSKY'.
*  CHECK : KOMK-WAERK EQ 'ATS' OR
*          KOMK-WAERK EQ 'BEF' OR
*          KOMK-WAERK EQ 'DEM' OR
*          KOMK-WAERK EQ 'ESP' OR
*          KOMK-WAERK EQ 'FIM' OR
*          KOMK-WAERK EQ 'FRF' OR
*          KOMK-WAERK EQ 'IEP' OR
*          KOMK-WAERK EQ 'ITL' OR
*          KOMK-WAERK EQ 'LUF' OR
*          KOMK-WAERK EQ 'NLG' OR
*          KOMK-WAERK EQ 'PTE' OR
*          KOMK-WAERK EQ EURO_CURRENCY.
*  IF KOMK-WAERK EQ EURO_CURRENCY.
** determine national currency of the ship-to country
*    CASE KOMK-LAND1.
*      WHEN 'AT'. KOMK-WAERK_EURO = 'ATS'.
*      WHEN 'BE'. KOMK-WAERK_EURO = 'BEF'.
*      WHEN 'DE'. KOMK-WAERK_EURO = 'DEM'.
*      WHEN 'ES'. KOMK-WAERK_EURO = 'ESP'.
*      WHEN 'FI'. KOMK-WAERK_EURO = 'FIM'.
*      WHEN 'FR'. KOMK-WAERK_EURO = 'FRF'.
*      WHEN 'IE'. KOMK-WAERK_EURO = 'IEP'.
*      WHEN 'IT'. KOMK-WAERK_EURO = 'ITL'.
*      WHEN 'LU'. KOMK-WAERK_EURO = 'LUF'.
*      WHEN 'NL'. KOMK-WAERK_EURO = 'NLG'.
*      WHEN 'PT'. KOMK-WAERK_EURO = 'PTE'.
*      WHEN OTHERS. EXIT.
*    ENDCASE.
*  ELSE.
*    KOMK-WAERK_EURO = EURO_CURRENCY.
*  ENDIF.
*
*  IF NOT ENDVALUE_CONVERT IS INITIAL.
** issue additional currency in end line
*    CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'
*         EXPORTING
*              DATE             = SY-DATUM
*              FOREIGN_AMOUNT   = KOMK-FKWRT
*              FOREIGN_CURRENCY = KOMK-WAERK
*              LOCAL_CURRENCY   = KOMK-WAERK_EURO
*         IMPORTING
*              LOCAL_AMOUNT     = KOMK-FKWRT_EURO
*         EXCEPTIONS
*              NO_RATE_FOUND    = 1
*              OVERFLOW         = 2
*              NO_FACTORS_FOUND = 3
*              NO_SPREAD_FOUND  = 4
*              OTHERS           = 5.
*  ENDIF.
*
*  IF NOT HEAD_CONDITIONS_CONVERT IS INITIAL.
** Issue additional currency in sum lines
*    DATA : LD_KOMVD_WA LIKE TKOMVD.
*    DATA : LT_KOMVD    LIKE TKOMVD OCCURS 5 WITH HEADER LINE.
*    DATA : LD_TABIX    LIKE SY-TABIX.
*
*    LD_TABIX    = 1.
*    LOOP AT TKOMVD FROM LD_TABIX.
*      LD_KOMVD_WA = TKOMVD.
*      CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'
*           EXPORTING
*                DATE             = SY-DATUM
*                FOREIGN_AMOUNT   = TKOMVD-KWERT
*                FOREIGN_CURRENCY = KOMK-WAERK
*                LOCAL_CURRENCY   = KOMK-WAERK_EURO
*           IMPORTING
*                LOCAL_AMOUNT     = LD_KOMVD_WA-KWERT
*           EXCEPTIONS
*                NO_RATE_FOUND    = 1
*                OVERFLOW         = 2
*                NO_FACTORS_FOUND = 3
*                NO_SPREAD_FOUND  = 4
*                OTHERS           = 5.
*
*      CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'
*           EXPORTING
*                DATE             = SY-DATUM
*                FOREIGN_AMOUNT   = TKOMVD-KAWRT
*                FOREIGN_CURRENCY = KOMK-WAERK
*                LOCAL_CURRENCY   = KOMK-WAERK_EURO
*           IMPORTING
*                LOCAL_AMOUNT     = LD_KOMVD_WA-KAWRT
*           EXCEPTIONS
*                NO_RATE_FOUND    = 1
*                OVERFLOW         = 2
*                NO_FACTORS_FOUND = 3
*                NO_SPREAD_FOUND  = 4
*                OTHERS           = 5.
*
*      IF NOT SEPARATE_BLOCK IS INITIAL.
*        APPEND LD_KOMVD_WA TO LT_KOMVD.
*      ELSE.
*        LD_KOMVD_WA-KAWRT = TKOMVD-KAWRT.
*        CONCATENATE TEXT-001 KOMK-WAERK_EURO
*               INTO LD_KOMVD_WA-VTEXT SEPARATED BY SPACE.
*        ADD 1 TO LD_TABIX.
*        INSERT LD_KOMVD_WA INTO TKOMVD INDEX LD_TABIX.
*        ADD 1 TO LD_TABIX.
*      ENDIF.
*    ENDLOOP.
*    IF NOT SEPARATE_BLOCK IS INITIAL.
** Additional currency in separated block
*      READ TABLE LT_KOMVD INDEX 1.
*      IF SY-SUBRC IS INITIAL.
*        CLEAR LD_KOMVD_WA.
*        CONCATENATE TEXT-001 KOMK-WAERK_EURO
*               INTO LD_KOMVD_WA-VTEXT SEPARATED BY SPACE.
*        ADD 1 TO LD_TABIX.
*        INSERT LD_KOMVD_WA INTO LT_KOMVD INDEX 1.
*      ENDIF.
*      APPEND LINES OF LT_KOMVD TO TKOMVD.
*    ENDIF.
*  ENDIF.

ENDFORM.

*---------------------------------------------------------------------*
*       FORM USEREXIT_XKOMV_BEWERTEN_INIT                             *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
FORM userexit_xkomv_bewerten_init.
ENDFORM.

*---------------------------------------------------------------------*
*       FORM USEREXIT_XKOMV_BEWERTEN_END                              *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
FORM userexit_xkomv_bewerten_end.
  DATA: ls_xkomv LIKE xkomv.

*RFC call checking
  IF sy-oncom NE c_true.

    IF NOT xt_komv[] IS INITIAL.
      LOOP AT xkomv INTO ls_xkomv.

        READ TABLE xt_komv WITH KEY knumv = ls_xkomv-knumv
                                    kposn = ls_xkomv-kposn
                                    stunr = ls_xkomv-stunr
                                    kappl = ls_xkomv-kappl
                                    kschl = ls_xkomv-kschl
                                    kdatu = ls_xkomv-kdatu
                                    krech = ls_xkomv-krech.

        IF sy-subrc EQ 0 AND ls_xkomv-kbetr NE xt_komv-kbetr.
          ls_xkomv-kbetr = xt_komv-kbetr. MODIFY xkomv FROM ls_xkomv
                                            TRANSPORTING kbetr.
        ENDIF."..xt_xkomv[]
      ENDLOOP.
  ENDIF."..sy-oncom
ENDFORM.

*---------------------------------------------------------------------*
*       FORM USEREXIT_XKOMV_ERGAENZEN                                 *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
FORM userexit_xkomv_ergaenzen.
ENDFORM.

*---------------------------------------------------------------------*
*       FORM USEREXIT_XKOMV_ERGAENZEN_MANU                            *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
FORM userexit_xkomv_ergaenzen_manu.
ENDFORM.

*---------------------------------------------------------------------*
*       FORM USEREXIT_XKOMV_FUELLEN                                   *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
*  -->  RETURNCODE                                                    *
*---------------------------------------------------------------------*
FORM userexit_xkomv_fuellen USING returncode.
ENDFORM.

*---------------------------------------------------------------------*
*       FORM USEREXIT_XKOMV_FUELLEN_O_KONP                            *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
FORM userexit_xkomv_fuellen_o_konp.
ENDFORM.
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.