I_DATA TYPE DATA OPTIONAL
value( I_CHANGE_NUMBER ) TYPE BAPI1003_KEY-CHANGENUMBER OPTIONAL -> Change Number
NO_DATA
method save_charact_from_ref_data.
field-symbols:
<char> type bapi1003_alloc_values_char,
<curr> type bapi1003_alloc_values_curr,
<num> type bapi1003_alloc_values_num,
<charnew> type bapi1003_alloc_values_char,
<currnew> type bapi1003_alloc_values_curr,
<numnew> type bapi1003_alloc_values_num.
data: f_objectkey type bapi1003_key-object.
data: f_objecttable type bapi1003_key-objecttable.
data: f_classnum type bapi1003_key-classnum.
data: f_classtype type bapi1003_key-classtype.
data: f_different type c.
data: ft_allocvaluesnum type standard table of bapi1003_alloc_values_num.
data: ft_allocvalueschar type standard table of bapi1003_alloc_values_char.
data: ft_allocvaluescurr type standard table of bapi1003_alloc_values_curr.
data: ft_allocvaluesnumnew type standard table of bapi1003_alloc_values_num.
data: ft_allocvaluescharnew type standard table of bapi1003_alloc_values_char.
data: ft_allocvaluescurrnew type standard table of bapi1003_alloc_values_curr.
data: ft_return type standard table of bapiret2.
check i_data is not initial .
zcl_abapblog_com_classific=>move_ref_data_to_bapi_tables(
exporting
i_data = i_data
changing
ct_objvaluesnum = ft_allocvaluesnumnew
ct_objvalueschar = ft_allocvaluescharnew
ct_objvaluescurr = ft_allocvaluescurrnew
exceptions
no_data_to_pass = 1
others = 2
).
if sy-subrc <> 0.
raise no_data.
endif.
call function 'BAPI_OBJCL_GETDETAIL'
exporting
objectkey = f_objectkey
objecttable = f_objecttable
classnum = f_classnum
classtype = f_classtype
* KEYDATE = SY-DATUM
* UNVALUATED_CHARS = ' '
* LANGUAGE = SY-LANGU
* IMPORTING
* STATUS = STATUS
* STANDARDCLASS = STANDARDCLASS
tables
allocvaluesnum = ft_allocvaluesnum
allocvalueschar = ft_allocvalueschar
allocvaluescurr = ft_allocvaluescurr
return = ft_return
.
"compare old and current entries
sort ft_allocvalueschar by charact value_neutral.
sort ft_allocvaluescharnew by charact value_neutral.
sort ft_allocvaluesnum by charact value_from value_to value_relation unit_from unit_to.
sort ft_allocvaluesnumnew by charact value_from value_to value_relation unit_from unit_to.
sort ft_allocvaluescurr by charact value_from value_to value_relation currency_from currency_to.
sort ft_allocvaluescurrnew by charact value_from value_to value_relation currency_from currency_to.
loop at ft_allocvalueschar assigning <char>.
if f_different is not initial.
exit.
endif.
read table ft_allocvaluescharnew with key charact = <char>-charact
value_neutral = <char>-value_neutral
transporting no fields
binary search.
if sy-subrc ne 0.
f_different = 'X'.
endif.
endloop.
loop at ft_allocvaluescharnew assigning <char>.
if f_different is not initial.
exit.
endif.
read table ft_allocvalueschar with key charact = <char>-charact
value_neutral = <char>-value_neutral
transporting no fields
binary search.
if sy-subrc ne 0.
f_different = 'X'.
endif.
endloop.
loop at ft_allocvaluesnum assigning <num>.
if f_different is not initial.
exit.
endif.
read table ft_allocvaluesnumnew with key charact = <num>-charact
value_from = <num>-value_from
value_to = <num>-value_to
value_relation = <num>-value_relation
unit_from = <num>-unit_from
unit_to = <num>-unit_to
transporting no fields
binary search.
if sy-subrc ne 0.
f_different = 'X'.
endif.
endloop.
loop at ft_allocvaluesnumnew assigning <num>.
if f_different is not initial.
exit.
endif.
read table ft_allocvaluesnum with key charact = <num>-charact
value_from = <num>-value_from
value_to = <num>-value_to
value_relation = <num>-value_relation
unit_from = <num>-unit_from
unit_to = <num>-unit_to
transporting no fields
binary search.
if sy-subrc ne 0.
f_different = 'X'.
endif.
endloop.
loop at ft_allocvaluescurr assigning <curr>.
if f_different is not initial.
exit.
endif.
read table ft_allocvaluescurrnew with key charact = <curr>-charact
value_from = <curr>-value_from
value_to = <curr>-value_to
value_relation = <curr>-value_relation
currency_from = <curr>-currency_from
currency_to = <curr>-currency_to
transporting no fields
binary search.
if sy-subrc ne 0.
f_different = 'X'.
endif.
endloop.
loop at ft_allocvaluescurrnew assigning <curr>.
if f_different is not initial.
exit.
endif.
read table ft_allocvaluescurr with key charact = <curr>-charact
value_from = <curr>-value_from
value_to = <curr>-value_to
value_relation = <curr>-value_relation
currency_from = <curr>-currency_from
currency_to = <curr>-currency_to
transporting no fields
binary search.
if sy-subrc ne 0.
f_different = 'X'.
endif.
endloop.
check f_different is not initial.
call function 'BAPI_OBJCL_CHANGE'
exporting
objectkey = f_objectkey
objecttable = f_objecttable
classnum = f_classnum
classtype = f_classtype
* STATUS = '1'
* STANDARDCLASS = STANDARDCLASS
changenumber = i_change_number
* KEYDATE = SY-DATUM
* NO_DEFAULT_VALUES = ' '
* IMPORTING
* CLASSIF_STATUS = CLASSIF_STATUS
tables
allocvaluesnumnew = ft_allocvaluesnumnew
allocvaluescharnew = ft_allocvaluescharnew
allocvaluescurrnew = ft_allocvaluescurrnew
return = ft_return
.
endmethod. "save_charact_from_ref_data