Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

VARIANT CONFIGURATION

Former Member
0 Likes
3,260

Hello there,

i try to implement my own configurator using several BAPI's around the variant configuration. Based on BAPI_CFG_CREATE i can do my own configuration of a material. The BAPI provides as Exporting values CFG_HANDLE and ROOT_INSTANCE both values are temporary. Once i have finished the configuration i try to save the configuration using FM CUCB_CONFIGURATION_TO_DB. But i cant't save my configuration because i only have the temporary ROOT_INSTANCE.

Does anybody know how i can save my configuration to the data base? Or how i can make my teporary instance to a persistent instance to make me able to save with FM CUCB_CONFIGURATION_TO_DB?

Here is a part of my coding:

DATA l_handle TYPE bapicu-cfg_handle.

DATA l_instance TYPE bapicu-instance.

CALL FUNCTION 'BAPI_CFG_CREATE'

EXPORTING

object_id = 'KM000004'

root_type = 'MARA'

root_name = 'KM000004'

plant = '0001'

IMPORTING

cfg_handle = l_handle

root_instance = l_instance

EXCEPTIONS

error = 1

OTHERS = 2.

After launching my test report the values are filled like this:

l_handle = 999999999999990001

l_instance = 00000001

l_instance contains the temporary instance number. I need to know how i can transfrom it to a persistent instance configuration id.

Many thanks in advance for your help.

BR,

Josef

9 REPLIES 9
Read only

Former Member
0 Likes
2,356

I fond the solution by myself.

Read only

0 Likes
2,356

What was your solution?

Read only

0 Likes
2,356

Hi,

the solution is very simple if you know what to do. but it is allways the same question. How?

Here the solution:

After launching my test report the values are filled like this:

l_handle = 999999999999990001

l_instance = 00000001

l_instance contains the temporary instance number. I need to know how i can transfrom it to a persistent instance configuration id.

Transform the temporary instance id to a persistent id:

the save function will do this for you. here is a code example:

...

ls_root_object-object_type = 'VBPS'.

ls_root_object-object_key = <your object key>.

"Save configuration to database

CALL FUNCTION 'CUCB_CONFIGURATION_TO_DB'

EXPORTING

root_instance = l_handle

root_object = ls_root_object

IMPORTING

new_instance = ev_new_instance ==> NEW PERSISTENT INSTANCE ID

EXCEPTIONS

invalid_instance = 1

invalid_root_instance = 2

no_changes = 3

already_registered_for_update = 4

instance_is_a_classification = 5

OTHERS = 6.

IF sy-subrc <> 0.

"Your error handling

ELSE.

COMMIT WORK AND WAIT.

ENDIF.

...

Read only

0 Likes
2,356

Josef, thanks for the reply. It seems to want to work.

But the problem Im having now with this FM is I get a short dump MESSAGE_TYPE_X

Technical information about the message:

Message classe...... "CUIB1"

Number.............. 699

I think the problem is that I have an entry in the table IBINOWN for the material Im creating the configuration for.

Any ideas of how I initialize that entry?

Read only

0 Likes
2,356

Hi,

that is no problem. I solved the problem with this code. I generated a unique KEY:

ls_root_object-object_type = 'VBPS'.

SELECT SINGLE objkey FROM ibinown INTO ls_root_object-object_key

WHERE instance = v_handle.

IF sy-subrc <> 0.

CALL FUNCTION 'GUID_CREATE'

IMPORTING

ev_guid_32 = lv_guid.

CONCATENATE lv_guid v_matnr INTO ls_root_object-object_key SEPARATED BY '_'.

ENDIF.

BR,

Josef

Read only

0 Likes
2,356

Josef - you are a champion. Thats got it.

I give you a big sloppy digital kiss.

Read only

0 Likes
2,356

Read only

0 Likes
2,356

hi Josef,

I am also facing the same prbolem that the FM 'CUCB_CONFIGURATION_TO_DB', gives me shortdump

Duplicate owners: Contact LO-VC development

Message class....... "CUIB1"

Number.............. 699

I am not able to understand how are you fetching the object-key from IBINOWN because the l_handle is not existing in IBINOWN.

can you pls help me in identifying the value of objct-key??

FYI.. I wanna assign this cuobj in a purchase order line item..

thanks in adv.

Husain

Read only

wbenkahla
Explorer
0 Likes
1,800

Hello,

I try to havé the same behaviour than CU50. Following your post, I used the MF :

BAPI_CFG_CREATE

BAPI_CFGINST_CHARCS_VALS_SET

GUID_CREATE

CUCB_CONFIGURATION_TO_DB

CS_BOM_EXPL_MAT_V2
but I can not reproduce the result of CU50

can you please help me