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

Issue with BAPI BAPI_CHARACT_CHANGE

former_member185558
Active Participant
0 Likes
991

Dear Gurus,


We are unable to use this BAPI to modify existing characteristics.

No error returned in return.


following is sample code


*Program

CHARACTERISTICS-NAME_CHAR = 'ZPLM_T1'.

CALL FUNCTION 'BAPI_CHARACT_GETDETAIL'

   EXPORTING

     charactname   = CHARACTERISTICS-NAME_CHAR

*   KEYDATE       = SY-DATUM

*   LANGUAGE      =

   IMPORTING

     CHARACTDETAIL = wa_detail

   tables

     CHARACTDESCR  = t_desc

     return        = t_return.

wa_detail-DECIMALS = '1'.

append wa_detail to wa_detail_1.

CALL FUNCTION 'BAPI_CHARACT_CHANGE'

   EXPORTING

     charactname      = CHARACTERISTICS-NAME_CHAR

*   CHANGENUMBER     =

*   KEYDATE          = SY-DATUM

   tables

     charactdetailnew = wa_Detail_1

     CHARACTDESCRNEW  = t_desc

     return           = t_return.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

   EXPORTING

     WAIT = 'X'.


However if we do this in SE37 with Commit BAPI in sequence it works.

Not sure what is wrong.


Thanks and regards

1 REPLY 1
Read only

Flavio
Active Contributor
0 Likes
637

Hi Niketan,

looking at your code above, I think that the field template must be cleared, before appending wa_detail to wa_detail_1.

That is, just add the following  CLEAR wa_detail-template.  line between the existing code:


wa_detail-DECIMALS = '1'.

CLEAR wa_detail-template.

append wa_detail to wa_detail_1.

and I do believe it will work (just tried in my sandbox system, successfully).

The reason why the 'template' must be cleared is explained by the fact that, as it is read from the BAPI_CHARACT_GETDETAIL, it is showing the value template before the decimal change, and hence it is not in line with the change itself.

Hope this will help.

Thanks and regards,

Flavio