Автор Тема: RV_CONDITION_COPY - Копирование условий (схемы калькуляции)  (Прочитано 7369 раз)

0 Пользователей и 1 Гость просматривают эту тему.

Оффлайн Uukrul

  • SAP ECC 6.0 Ehp(*)
  • Administrator
  • Epic Member
  • *****
  • Сообщений: 3 758
  • Репутация: +47/-0
  • Пол: Мужской
  • YearsYearsYearsYearsYearsYearsYearsYearsYearsYearsYearsYearsYears
    • Sapforum.BIZ
Пример взят с SCN, оригинальная ссылка: You are not allowed to view links. Register or Login . Помниться тоже возникали какие-то вопросы о работе с условиями схемы калькуляции.
Цитировать
RV_CONDITION_COPY Example with Scales

I have seen many people had question about creating scales prices using the function module RV_CONDITION_COPY. However I did not find the answer.
The below sample code will help you load the sales prices including scales. Hope this hepls .
Код: You are not allowed to view links. Register or Login
***********************************************************************************
* This sample program can create sales price including scales.
* Author: Murali Mikkili
***********************************************************************************
REPORT zz_apct_upload_new_cond_fm.
*- Data
DATA: cr LIKE TABLE OF komv WITH HEADER LINE,
           key_fields LIKE TABLE OF komg WITH HEADER LINE,
           copy_staffel LIKE TABLE OF condscale WITH HEADER LINE,
           lt_knumh   TYPE STANDARD TABLE OF knumh_comp.

*- Fill Key fields
CALL FUNCTION 'SD_CONDITION_KOMG_FILL'
  EXPORTING
    p_kotabnr = '304'
    p_kvewe   = 'A'
    p_vakey   = '100010F-01'
  IMPORTING
    p_komg    = key_fields.
*- Fill KOMV
cr-kappl = 'V'.
cr-kschl = 'PR00'.
cr-kbetr = '20'. " Unit Price
cr-krech = 'C'.
cr-kpein = '1'.
cr-kmein = 'EA'.
cr-waers = 'EUR'.
* Bellow are the important fields in KOMV for scales.
cr-kopos = 1.
cr-kzbzg = 'C'.
cr-konms = 'EA'.
cr-stfkz = 'A'.
APPEND cr.
* - Fill Scales
*- Scale Item 1
copy_staffel-klfn1      = '0001'.
copy_staffel-kopos      = '01'.
copy_staffel-kstbm      = '1'.
copy_staffel-kbetr      = '20'. " Scale Price
copy_staffel-kzbzg      = 'C'.
copy_staffel-rv13akonwa = 'EUR'.
copy_staffel-konpkmein  = 'EA'.
copy_staffel-konpkonms  = 'EA'.
APPEND copy_staffel.
*- Scales item 2
copy_staffel-klfn1      = '0002'.
copy_staffel-kopos      = '01'.
copy_staffel-kstbm      = '10'.
copy_staffel-kbetr      = '15'. " Scale Price
copy_staffel-kzbzg      = 'C'.
copy_staffel-rv13akonwa = 'EUR'.
copy_staffel-konpkmein  = 'EA'.
copy_staffel-konpkonms  = 'EA'.
APPEND copy_staffel.

CALL FUNCTION 'RV_CONDITION_COPY'
  EXPORTING
    application              = 'V'
    condition_table          = '304'
    condition_type           = 'PR00'
    date_from                = '20130408'
    date_to                  = '99991231'
    enqueue                  = 'X'
    key_fields               = key_fields
    maintain_mode            = 'A'
    no_authority_check       = 'X'
    keep_old_records         = 'X'
    used_by_idoc             = 'X'      " when supplying scales prices, this flag must be X else price will be created with Zero price.
    overlap_confirmed        = 'X'
  TABLES
    copy_records             = cr
    copy_staffel             = copy_staffel
  EXCEPTIONS
    enqueue_on_record        = 01
    invalid_application      = 02
    invalid_condition_number = 03
    invalid_condition_type   = 04
    no_authority_ekorg       = 05
    no_authority_kschl       = 06
    no_authority_vkorg       = 07
    no_selection             = 08
    table_not_valid          = 09.
 
CALL FUNCTION 'RV_CONDITION_SAVE'
  TABLES
    knumh_map = lt_knumh.
CALL FUNCTION 'RV_CONDITION_RESET'.
 
COMMIT WORK AND WAIT.