Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
cancel
Showing results for 
Search instead for 
Did you mean: 
hemanth_kumar46
Explorer

Introduction:


Updating VC characteristic values is some what tricky in this case BAPI_OBJCL_CHANGE  BAPI will not support .In this blog i will explain how to update VC characterist values Using Function Modules step by step.

 

Below Function Modules used to Update the Variant Characteristic Values .

To Set the Config Values...

1. CUCB_SET_CONFIGURATION

Save multi-level configuration to one instance...

2.CUCB_CONFIGURATION_TO_DB

Commit Work...

3.BAPI_TRANSACTION_COMMIT

In This scenario , i will explain with example .

Here i am updating the characteristic values of Project Network Components .

Example


Step 1:

ROOT_INSTANCE -> Manditory Value need to pass to Function module .(Internal object number we will get from RESB table , if particular component is a configurable)

CONFIGURATION -> Manditory Value need to pass to Function module .

In this Parameter we need to Pass Base instance ,Root Instance ,General data related to Base Components .

We will catch errors using exceptions.

INVALID_INPUT
INVALID_INSTANCE
INSTANCE_IS_A_CLASSIFICATION

 
            CALL FUNCTION 'CUCB_SET_CONFIGURATION'
EXPORTING
root_instance = i_root_instance
is_cbase_header = is_cbase_header
CHANGING
configuration = et_cfg
EXCEPTIONS
invalid_input = 1
invalid_instance = 2
instance_is_a_classification = 3
OTHERS = 4.

For is_cbase_header below values need to pass
**** To get Installed Base (IBASE) against cuobj(Obj Number)
SELECT SINGLE * FROM ibin WHERE instance = i_root_instance.
IF sy-subrc = 0.
***Filling IBase details
is_cbase_header-ibase = ibin-ibase.
is_cbase_header-conf-cstatus = '1'.
ENDIF.

For et_cfg (instance and the values of the characteristics )
***Filling Characteristic Values for Update or Change.

es_cfg-instance = i_root_instance.
es_cfg-parent = i_root_instance.
es_cfg-root = i_root_instance.

** >>> general data SOC..
es_cfg-com-mlang = sy-langu.
es_cfg-com-objnr = ibin-objnr.
es_cfg-com-ibase = ibin-ibase.
es_cfg-com-amount = ibin-amount.
es_cfg-com-unit = ibin-unit.
es_cfg-com-datuv = ibin-datuv.
es_cfg-com-in_objnr = ibin-in_objnr.
es_cfg-com-objecttyp = ibin-objecttyp.
** >>> general data EOC..

** >>> configuration data instance SOC..
es_cfg-conf-cstatus = ibin-cstatus.
es_cfg-conf-cucocnt = ibin-cucocnt.
es_cfg-conf-klart = ibin-klart.
** >>> configuration data instance EOC..

** >>> Observer Data SOC...
es_cfg-type_of-object_type = 'MARA' "Object Table(Based On Scenario).
es_cfg-type_of-object_key = wa_resb-matnr.

** >>> Observer Data EOC...

es_cfg-ind-indcha = 'X'.


** >>> OWNER Data SOC...
es_cfg-owner-object_type = 'RESB' "(Based On Scenario).
CONCATENATE wa_resb-rsnum wa_resb-rspos INTO es_cfg-owner-object_key(Based On Scenario).
** >>> OWNER Data EOC...

**Need to Pass characteristic Value with instance .
wa_values-atinn = GV_atinn "(Internal characteristic)
wa_values-atwrt = GV_Value "(characteristic value).
wa_values-atcod = '1' "(1= Lower limit) (Check Domain Level and Pass values).
APPEND wa_values TO it_values.
CLEAR wa_values.

es_cfg-values = it_values.
APPEND es_cfg TO et_cfg.
CLEAR es_cfg .

 

Step 2:

Below Function Module used to Save multi-level configuration to one instance.
**** Save multi-level configuration to one instance...
CALL FUNCTION 'CUCB_CONFIGURATION_TO_DB'
EXPORTING
root_instance = i_root_instance
root_object = root_object
iv_material = wa_resb-matnr
iv_location = wa_resb-lgort
IMPORTING
new_instance = new_instance
TABLES
exp_new_nested_cuobjs = exp_new_nested_cuobjs
EXCEPTIONS
invalid_instance = 1
invalid_root_instance = 2
no_changes = 3
already_registered_for_update = 4
instance_is_a_classification = 5
OTHERS = 6.

Here Root_object Consit of root table and Key

EX:

root_object-object_type 'RESB'.

CONCATENATE wa_resb-rsnum wa_resb-rspos INTO root_object-object_key.

Here we will catch errors using Exceptions .

INVALID_INSTANCE
INVALID_ROOT_INSTANCE
NO_CHANGES
ALREADY_REGISTERED_FOR_UPDATE
INSTANCE_IS_A_CLASSIFICATION

Final Step Need to call Commit work .
**** Commit Work...
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.

 

Hope This will helpful .

 

Thanks For Reading ....... ?
1 Comment