Application Development 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: 

characteristic value update

Former Member
0 Kudos

hi masters,

i am using fm : BAPI_OBJCL_CHANGE to update the characteirsctic values

ex : if their are 14 characterisic values where by i need to update just 3 of them so am using an internal table and and passing those 3 values to update.

yes it does update but it clears the rest of the values.

what could be the problem?

can i have some info pls?

thank you,

pasala.

1 ACCEPTED SOLUTION

former_member320332
Contributor
0 Kudos

Hi Pasala,

I also faced the same issue with BAPI then I used following approach to solve it.

First read the existing characteristics with BAPI_OBJCL_GETDETAIL and then modify the internal table of this BAPI with

the values to be updated and characteristics and then pass it to BAPI_OBJCL_CHANGE.

Regards,

Pawan

5 REPLIES 5

Former Member
0 Kudos

Hi,

Can you please post your code??

regards,

Sakshi

0 Kudos

PERFORM f_build_chars TABLES lt_chars

addchar 'COMMODITY' gc_group var4.

addchar 'COMMODITY' gc_grouptype var3.

addchar 'COMMODITY' gc_sealreq var1.

addchar 'COMMODITY' gc_sbu var6.

addchar 'COMMODITY' gc_traffictype var2.

addchar 'COMMODITY' gc_businesssector var5.

addchar 'COMMODITY' gc_notes var7.

SORT lt_chars.

l_objecttable = 'MARA'.

l_objectkey = object.

LOOP AT lt_chars.

AT NEW classnum.

CLEAR: lt_allocvaluesnumnew,

lt_allocvaluescharnew,

lt_allocvaluescurrnew,

lt_return.

REFRESH: lt_allocvaluesnumnew,

lt_allocvaluescharnew,

lt_allocvaluescurrnew,

lt_return.

l_classnum = lt_chars-classnum.

l_classtype = lt_chars-classtype.

ENDAT.

REFRESH lt_return.

CALL FUNCTION 'BAPI_CHARACT_GETDETAIL'

EXPORTING

charactname = lt_chars-atnam

  • KEYDATE = SY-DATUM

  • LANGUAGE =

IMPORTING

charactdetail = ls_charactdetail

TABLES

return = lt_return.

READ TABLE lt_return INTO ls_return WITH KEY type = 'E'.

CASE ls_charactdetail-data_type.

WHEN 'CHAR'.

ls_allocvaluescharnew-charact = lt_chars-atnam.

ls_allocvaluescharnew-value_neutral = lt_chars-atwrt_from.

APPEND ls_allocvaluescharnew TO lt_allocvaluescharnew.

ENDCASE.

AT END OF classnum.

REFRESH lt_return.

CALL FUNCTION 'BAPI_OBJCL_CHANGE'

EXPORTING

objectkey = l_objectkey

objecttable = l_objecttable

classnum = l_classnum

classtype = l_classtype

TABLES

allocvaluesnumnew = lt_allocvaluesnumnew

allocvaluescharnew = lt_allocvaluescharnew

allocvaluescurrnew = lt_allocvaluescurrnew

return = lt_return.

READ TABLE lt_return INTO ls_return WITH KEY type = 'E'.

IF sy-subrc = 0.

  • g_input_error = gc_yes.

MESSAGE e002(zfiex) WITH ls_return-message(90).

ELSE.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

wait = 'X'

  • IMPORTING

  • RETURN =

.

ENDIF.

ENDAT.

ENDLOOP.

0 Kudos

Hi,

You can use BAPI_CHARACT_CHANGE to change the particular characterstic value rather than using BAPI_OBJCL_CHANGE.

Regards,

Pawan

former_member320332
Contributor
0 Kudos

Hi Pasala,

I also faced the same issue with BAPI then I used following approach to solve it.

First read the existing characteristics with BAPI_OBJCL_GETDETAIL and then modify the internal table of this BAPI with

the values to be updated and characteristics and then pass it to BAPI_OBJCL_CHANGE.

Regards,

Pawan

Former Member
0 Kudos

helpful answers and thank you all.