Skip to Content
0
Former Member
Apr 04, 2014 at 06:29 AM

BAPI_CHANGE_CLASS not work

50 Views

Hi experts,


I want to add a characteristics value in class.

I use below code, it run successful and give class change message but it not not attach a characteristics value to class.

Pl. help.


DATA: cl_class TYPE bapi_class_key-classnum,

cl_cltyp TYPE bapi_class_key-classtype,

ls_classbasicdata LIKE bapi1003_basic,

ls_classbasicdata1 TYPE bapi1003_basic_new,

ls_classdocument LIKE bapi1003_docu,

lt_clret TYPE STANDARD TABLE OF bapiret2 WITH HEADER LINE,

lt_clgetdes TYPE STANDARD TABLE OF bapi1003_catch_r WITH HEADER LINE,

lt_clsetdes TYPE STANDARD TABLE OF bapi1003_catch WITH HEADER LINE,

lt_clsetdes1 TYPE STANDARD TABLE OF bapi1003_catch WITH HEADER LINE,

lt_clsetchr TYPE STANDARD TABLE OF bapi1003_charact_value_ovr_new WITH HEADER LINE,

lt_clsetchds TYPE STANDARD TABLE OF bapi1003_charvaltext_new WITH HEADER LINE.

CLEAR : lt_clsetchr[], ls_classbasicdata, ls_classdocument, lt_clret, lt_clsetdes.

LOOP AT it_chrvl INTO wa_chrvl WHERE sel = 'X'.

lt_clsetchr-name_char = v_atnam.

lt_clsetchr-char_value = wa_chrvl-chrvl.

lt_clsetchds-charact = v_atnam.

lt_clsetchds-value = wa_chrvl-chrvl.

lt_clsetchds-valdescr = wa_chrvl-chrds.

APPEND : lt_clsetchr, lt_clsetchds.

CLEAR : lt_clsetchr, lt_clsetchds.

ENDLOOP.

IF lt_clsetchr[] IS NOT INITIAL.

LOOP AT it_cls INTO wa_cls WHERE sel = 'X'.

cl_class = wa_cls-classname.

cl_cltyp = wa_cls-classtype.

CALL FUNCTION 'BAPI_CLASS_GETDETAIL'

EXPORTING

classtype = cl_cltyp

classnum = cl_class

* LANGUISO =

languint = sy-langu

keydate = sy-datum

IMPORTING

classbasicdata = ls_classbasicdata

classdocument = ls_classdocument

* CLASSADDITIONAL =

* CLASSSTANDARD =

* RETURN =

TABLES

classdescriptions = lt_clgetdes[]

* CLASSLONGTEXTS =

* CLASSCHARACTERISTICS =

* CLASSCHARVALUES =

.

LOOP AT lt_clgetdes.

MOVE-CORRESPONDING lt_clgetdes TO lt_clsetdes.

APPEND lt_clsetdes. CLEAR lt_clsetdes.

ENDLOOP.

ls_classbasicdata1 = ls_classbasicdata.

lt_clsetdes1 = lt_clsetdes.

CALL FUNCTION 'BAPI_CLASS_CHANGE'

EXPORTING

classnum = cl_class

classtype = cl_cltyp

* CHANGENUMBER =

keydate = sy-datum

classbasicdata = ls_classbasicdata

classbasicdatanew = ls_classbasicdata1

classdocument = ls_classdocument

* CLASSDOCUMENTNEW =

* CLASSADDITIONAL =

* CLASSADDITIONALNEW =

* CLASSSTANDARD =

* CLASSSTANDARDNEW =

TABLES

return = lt_clret[]

classdescriptions = lt_clsetdes[]

* CLASSLONGTEXTS =

* CLASSCHARACTERISTICS =

* CHARACTERISTICOVERWRITE =

* CHARACTVALUEOVERWRIT =

* CHARACTERISTICVALUETEXTOVR =

classdescriptionsnew = lt_clsetdes1[]

* CLASSLONGTEXTSNEW =

* CLASSCHARACTERISTICSNEW =

* CHARACTERISTICOVERWRITENEW =

charactvalueoverwritnew = lt_clsetchr[]

characteristicvaluetextovrnew = lt_clsetchds[].

LOOP AT lt_clret WHERE type = 'A' OR type = 'E'.

EXIT.

ENDLOOP.

IF sy-subrc <> 0.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

wait = 'X'.

ENDIF.