Code: Alles auswählen.
REPORT z_sd_test_cond_copy .
DATA:
cr LIKE TABLE OF komv WITH HEADER LINE, " copy_records
nr, "New_Record
key_fields LIKE TABLE OF komg WITH HEADER LINE,
komk LIKE TABLE OF komk with header line,
komp LIKE TABLE OF komp with header line.
key_fields-mandt = '100'.
key_fields-vkorg = '1000'.
key_fields-vtweg = '10'.
key_fields-werks = '1000'.
key_fields-spart = '00'.
key_fields-kunnr = '0000151935'.
key_fields-matnr = '5014042'.
key_fields-kdatu = sy-datum.
*********************************************************
* Neue Informationen zum Konditinssatz:
*cr-mandt = '100'.
cr-kappl = 'V'.
cr-kschl = 'PR00'.
cr-kbetr = '77.77'.
*cr-knumh = '0000380829'.
*cr-kposn = '999999'.
*cr-stfkz = 'A'.
*cr-krech = 'B'.
*cr-konws = 'CHF'.
cr-kdatu = '20070613'.
cr-kunnr = '0000151935'.
cr-kpein = '1'.
cr-kmein = 'ST'.
cr-waers = 'CHF'.
APPEND cr.
**********************************************************
* KOMK/KOMP Fuellen
data wa_pispr like table of pispr with header line.
wa_pispr-kunnr = '0000151935'.
wa_pispr-matnr = '5014042'.
wa_pispr-vkorg = '1000'.
append wa_pispr.
CALL FUNCTION 'SPR_KOMK_KOMP_FILL'
EXPORTING
pi_i_spr = wa_pispr
IMPORTING
PE_I_KOMK = komk
PE_I_KOMP = komp
.
* --> KOMK/KOMP werden korrekt gefüllt. Funktion i.o.
**********************************************************
break point.
CALL FUNCTION 'RV_CONDITION_COPY'
EXPORTING
application = 'V'
condition_table = '305'
condition_type = 'PR00'
* date_from = sy-datum
* date_to = '99990101'
enqueue = 'X'
i_komk = komk
i_komp = komp
key_fields = key_fields
maintain_mode = 'A'
no_authority_check = 'X'
no_field_check = 'X'
* keep_old_records = ' '
* overlap_confirmed = ' '
IMPORTING
e_komk = komk
e_komp = komp
new_record = nr
TABLES
copy_records = cr
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'.
CALL FUNCTION 'RV_CONDITION_RESET'.