Skip to Content
0
Former Member
Jul 14, 2014 at 10:14 AM

RV_CONDITION_COPY FUNCTION MODULE

2029 Views

Hi,

My requirement is to update the price for the condition record no in konp table by using rv_condition_copy function module.

In this program i am trying to change the price of this condition record number but it is not affecting to the database.

program is successfully executing but it doesnt affect the database.

DATA:i_komv TYPE TABLE OF komv. " Pricing Communications-Condition Record

DATA:wa_key_fields TYPE komg, "

wa_konp TYPE konp, " Konp table - Conditions (Item)

w_komv LIKE LINE OF i_komv,

w_mara LIKE mt06e, " Material Master Fields: Purchasing

komk TYPE komk, " Communication Header for Pricing

komp TYPE komp, " Communication Item for Pricing

wa_pispr TYPE pispr,

l_new_record.

START-OF-SELECTION.

SELECT SINGLE *

FROM konp

INTO wa_konp

WHERE knumh = '0000032426'

AND loevm_ko <> 'X'.

CLEAR : wa_key_fields, w_komv.

REFRESH : i_komv.

wa_pispr-matnr = 'T-EC0101'.

wa_pispr-vkorg = '0005'.

wa_pispr-vtweg = '12'.

CALL FUNCTION 'SPR_KOMK_KOMP_FILL'

EXPORTING

pi_i_spr = wa_pispr

IMPORTING

pe_i_komk = komk

pe_i_komp = komp.

wa_key_fields-matnr = 'T-EC0101'.

w_komv-knumh = wa_konp-knumh. " Condition record number

w_komv-kposn = wa_konp-kopos. " Sequential number of the condition

w_komv-kappl = wa_konp-kappl. " Application

w_komv-kschl = wa_konp-kschl. " Condition type

w_komv-kbetr = '49.99'. " Rate (condition amount or percentage) where no scale exists

w_komv-waers = wa_konp-konwa. " Rate unit (currency or percentage)

w_komv-krech = wa_konp-krech. " Calculation type for condition

w_komv-stfkz = wa_konp-stfkz. " Scale Type

w_komv-kpein = wa_konp-kpein. " Condition pricing unit

w_komv-kmein = wa_konp-kmein. " Unit of measurement

w_komv-zaehk_ind = wa_konp-zaehk_ind. " Condition item index

w_komv-loevm_ko = 'X'. " Deletion indicator for condition item

APPEND w_komv TO i_komv.

w_mara-matkl = '009'. " Material group

w_mara-meins = 'ST'. " Basic Unit of measure

w_mara-mtart = 'HAWA'. " Material type

w_mara-maktx = 'Saddle bag'. " Material Description

CALL FUNCTION 'RV_CONDITION_COPY'

EXPORTING

application = 'V' " Application V = Sales

condition_table = '304' " Condition table

condition_type = 'PR00' " Condition type

date_from = '20060327' " Validity start date of the condition record

date_to = '99991231' " Validity End date of the condition record

enqueue = 'X'

i_komk = komk " Communication block for header(pricing)

i_komp = komp " Communication block for item(pricing)

selection_date = '20060327'

key_fields = wa_key_fields

maintain_mode = 'B' " Mode: Create(A), Change(B), Display(C).

* no_authority_check = 'X'

* no_field_check = ' '

keep_old_records = 'X'

material_m = w_mara

overlap_confirmed = 'X'

no_db_update = ' '

IMPORTING

e_komk = komk

e_komp = komp

new_record = l_new_record

TABLES

copy_records = i_komv

EXCEPTIONS

enqueue_on_record = 1

invalid_application = 2

invalid_condition_number = 3

invalid_condition_type = 4

no_authority_ekorg = 5

no_authority_kschl = 6

no_authority_vkorg = 7

no_selection = 8

table_not_valid = 9

no_material_for_settlement = 10

no_unit_for_period_cond = 11

no_unit_reference_magnitude = 12

invalid_condition_table = 13

OTHERS = 14.

IF sy-subrc ne 0.

WRITE:/10 'not executed successfully'.

ELSE.

CALL FUNCTION 'RV_CONDITION_SAVE'.

COMMIT WORK.

CALL FUNCTION 'RV_CONDITION_RESET'.

COMMIT WORK.

WRITE:/10 ' executed successfully'.

ENDIF.



Regards,

Avinash.