2013 Jun 14 4:40 PM
Dear All,
I created class using BAPI_CLASS_CREATE, then Created 2 Characteristics using BAPI_CHARACT_CREATE.
Which means I class created as "CLS_001" and characteristics created as "CHAR_001_01" and "CHAR_001_02" respectively.
Now my question is, how can I assign "CHAR_001_01" and "CHAR_001_02" to that class "CLS_001"? Which BAPI i can use for this?
Thanks in advance.
-JANARAJA
2013 Jul 04 2:18 PM
Thank you all. Finally I found the Solution. The solution is First we should create charact then class then Assign charact to that class. let me explain bit easier.
loop.
Check Charact n = exist
If true
{
Check Class = Exist
If true
{
Assign Charact to Class with specific Class type.
If False
{
Create Class.
}
If false Create Charact
{
Then Assign Charact(s) to Class
}
Endloop.
-Thanks.
-Regards
Janaraja
Dear All,
I created class using BAPI_CLASS_CREATE, then Created 2 Characteristics using BAPI_CHARACT_CREATE.
Which means I class created as "CLS_001" and characteristics created as "CHAR_001_01" and "CHAR_001_02" respectively.
Now my question is, how can I assign "CHAR_001_01" and "CHAR_001_02" to that class "CLS_001"? Which BAPI i can use for this?
Thanks in advance.
-JANARAJA
2013 Jun 14 9:29 PM
2013 Jun 14 9:40 PM
Hi Janaraja,
You have two options to assign characteristics to class.
Option1 ) In BAPI BAPI_CLASS_CREATE -> While creating you the Class you can assign.
OPtion 2) In BAPI BAPI_CLASS_CHANGE -> You can assign a created characteristic to the already created class.
After these call BAPI_TRANSACTION_COMMIT and should work.
Revert in case further questions,
BR,
Ankit.
2013 Jun 17 6:55 AM
Dear Ankit,
I tried to assign characteristics to my particular class using BAPI_CLASS_CREATE.
But Still I can not assign the characteristics. I am using the following code.
*&---------------------------------------------------------------------*
*& Report ZRBAPI_CLASS_CREATE
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT zrbapi_class_create.
PARAMETERS: pclass TYPE klasse_d,
pcls_typ TYPE klassenart ,
pcls_des TYPE klschl ,
cls_car1 TYPE atnam ,
cls_car2 TYPE atnam ,
cls_car3 TYPE atnam .
DATA: cls_bas_dat LIKE bapi1003_basic,
it_cls_desc LIKE bapi1003_catch OCCURS 0 WITH HEADER LINE,
it_cls_car LIKE bapi1003_charact OCCURS 0 WITH HEADER LINE,
it_ret LIKE bapiret2 OCCURS 0 WITH HEADER LINE.
it_cls_desc-langu = 'EN'.
it_cls_desc-langu_iso = 'EN'.
it_cls_desc-catchword = pcls_des.
APPEND it_cls_desc.
it_cls_car-name_char = cls_car1.
APPEND it_cls_car.
it_cls_car-name_char = cls_car2.
APPEND it_cls_car.
it_cls_car-name_char = cls_car3.
APPEND it_cls_car.
CALL FUNCTION 'BAPI_CLASS_CREATE'
EXPORTING
classnumnew = pclass
classtypenew = pcls_typ
* CHANGENUMBER =
classbasicdata = cls_bas_dat
* CLASSDOCUMENT =
* CLASSADDITIONAL =
* CLASSSTANDARD =
TABLES
return = it_ret
classdescriptions = it_cls_desc
* CLASSLONGTEXTS =
classcharacteristics = it_cls_car
* CHARACTOVERWRITE =
* CHARACTVALUEOVERWRITE =
* CHARACTVALUETEXTOVR =
.
LOOP AT it_ret.
WRITE: / it_ret-type, /, it_ret-id, /, it_ret-number, /, it_ret-message.
WRITE: /, '_______________________________________________'.
ENDLOOP.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'
IMPORTING
return = it_ret.
But Characteristics not getting assign. Where I am doing mistake.?
Thanks.
2013 Jun 17 11:11 AM
hey, i checked your code its working perfectly, i don't see any reason you should continue this thread.
its perfectly fine..
the only thing is you should have characteristics ready to assign them to the class.
everything else is fine.
Thumbs UP.
if you still have doubts. give me what is the message you are getting back... but your code is good.
2013 Jun 17 1:12 PM
Hi Janaraja,
The characteristic which you intend to pass from selection screen to it_cls_car should exist and be visible in CT04 transaction. Then your code works fine.
See your code modified by me and attached screenshots for your reference.
REPORT YTEST.
PARAMETERS: pclass TYPE klasse_d,
pcls_typ TYPE klassenart ,
pcls_des TYPE klschl ,
cls_car1 TYPE atnam .
*cls_car2 TYPE atnam ,
*cls_car3 TYPE atnam .
DATA: cls_bas_dat LIKE bapi1003_basic,
it_cls_desc LIKE bapi1003_catch OCCURS 0 WITH HEADER LINE,
it_cls_car LIKE bapi1003_charact OCCURS 0 WITH HEADER LINE,
it_ret LIKE bapiret2 OCCURS 0 WITH HEADER LINE.
it_cls_desc-langu = 'EN'.
it_cls_desc-langu_iso = 'EN'.
it_cls_desc-catchword = pcls_des.
APPEND it_cls_desc.
it_cls_car-name_char = cls_car1.
APPEND it_cls_car.
*it_cls_car-name_char = cls_car2.
*APPEND it_cls_car.
*
*it_cls_car-name_char = cls_car3.
*APPEND it_cls_car.
CALL FUNCTION 'BAPI_CLASS_CREATE'
EXPORTING
classnumnew = pclass
classtypenew = pcls_typ
* CHANGENUMBER =
classbasicdata = cls_bas_dat
* CLASSDOCUMENT =
* CLASSADDITIONAL =
* CLASSSTANDARD =
TABLES
return = it_ret
classdescriptions = it_cls_desc
* CLASSLONGTEXTS =
classcharacteristics = it_cls_car
* CHARACTOVERWRITE =
* CHARACTVALUEOVERWRITE =
* CHARACTVALUETEXTOVR =
.
LOOP AT it_ret.
WRITE: / it_ret-type, /, it_ret-id, /, it_ret-number, /, it_ret-message.
WRITE: /, '_______________________________________________'.
ENDLOOP.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'
IMPORTING
return = it_ret.
Run Procedure -
Output -
Now see the class (901) and characteristic (Test 3) in CL03.
Please revert in case of further Q's.
BR.
2013 Jun 17 10:17 AM
Hi Janaraja,
Check these Information Notes also Sample Code given by SAP :
Note 1083986 - BAPIs for classification - Overview
Note 1323945 - BAPI_CLASS_CREATE: Instructions for use
Note 1479120 - BAPI_CHARACT_CREATE: Operating instructions
Note 1235844 - BAPI_CLASS_CHANGE: Operating instructions
As per your requirement , if you already create class using "BAPI_CLASS_CREATE" without Characteristics .
then you create two characteristics using "BAPI_CHARACT_CREATE" .
Now you want to assign these characteristics to class , mean you must change your class with assign these characteristics, for Changing the Class use
BAPI_CLASS_CHANGE. if you use this Class change BAPI , use one more BAPI (i.e. "BAPI_CLASS_GETDETAIL") before assign any value into "BAPI_CLASS_CHANGE" .
Check the Sample Code in Note 1235844 - BAPI_CLASS_CHANGE: Operating instructions
Regard's
Smruti
2013 Jun 17 10:29 AM
Hi lakshmanan,
use BAPI BAPI_CLASS_CHANGE,
CLASSNUM = class_name
CLASSTYPE = 003 "class type
CLASSDESCRIPTIONS = description ' key word
CLASWSCHARACTERISTICSNEW = character name " which we want to assign to the class.
call BAPI_TRANSACTION_COMMIT.
Regards
Satish Chandra
2013 Jun 17 10:38 AM
Hi Lakshmanan,
If you are using BAPI_CLASS_CREATE, here the Character should already exist.
hence what we are doing here is, we creating a new class and assigning a character which already exists to it.
BAPI_CLASS_CREATE
CLASSNUMNEW = class name
CLASSTYPENEW = class type
CLASSDESCRIPTIONS = description " en en description
CLASSCHARACTERISTICS = character_name " name_char = character name
Regards
Satish Chandra
2013 Jun 17 10:46 AM
2013 Jun 17 10:54 AM
Hi Venkateswaran,
i don't see how could the bapi u gave could solve the issue?
Regards
satish Chandra
2013 Jun 17 10:47 AM
Hi,
try below Bapis.
BAPI_OBJCL_CREATE and BAPI_OBJCL_CHANGE
Thanks,
Pradeep P
2013 Jun 17 12:03 PM
Pradeeep,
those BAPIs are for object class assignment.
if you want to assign a classification to a Functional location or Equipment or Material then, we could use the BAPIs you mentioned.
2013 Jul 04 2:18 PM
Thank you all. Finally I found the Solution. The solution is First we should create charact then class then Assign charact to that class. let me explain bit easier.
loop.
Check Charact n = exist
If true
{
Check Class = Exist
If true
{
Assign Charact to Class with specific Class type.
If False
{
Create Class.
}
If false Create Charact
{
Then Assign Charact(s) to Class
}
Endloop.
-Thanks.
-Regards
Janaraja
2013 Jul 04 6:30 PM
Welcome Janaraja.. .Happy to hear that.
Please close this thread now.
BR.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |