2023 Jul 05 9:14 PM
Hi ABAP experts
How to update asset custom fields (in table ANLU) non-unicode system.
If I use the standard method:
LS_BAPI_TE_ANLU-Z_FIELD2 = '123'.<br>LS_BAPI_TE_ANLU-Z_FIELD5 = 'ABC'.
LS_EXTENSIONIN = LS_BAPI_TE_ANLU.
APPEND LS_EXTENSIONIN TO LT_EXTENSIONIN.
it returns the error "LS_EXTENSIONIN and LS_BAPI_TE_ANLU are not mutually convertible. In Unicode programs, S_EXTENSIONIN must have the same structure layout as BAPI_TE_ANLU, independent of the length of a Unicode character."
Is it possible to update one field, out of many, another method?
And, how do you set data if a field crosses between valueparts? (i.e. if a field in position 230 has a length of 50)?
2023 Jul 05 9:51 PM
I can't see in your post but you have probably made BAPI_TE_ANLU not flat character-like.
These kind of appends are designed to have only character fields in the structure, otherwise there are limitations.
Anyway, you can search CL_ABAP_CONTAINER_UTILITIES=>FILL_CONTAINER_C in the forum.
2023 Jul 06 10:33 AM
Thanks sandrarossi, at least I am past the unicode issue by using the ABAP_CONTAINER_UTILITIES class.
One thing I cant figure out is how the measure the size of the structure of the "+30" factor.
If incorrect, I get the error "Use the table enhancement BAPI_TE_ANLU, which I am specifying:
DATA: wa_bapi type BAPI_TE_ANLU.
DATA: lt_EXTENSIONIN type table of BAPIPAREX.
DATA: wa_EXTENSIONIN type BAPIPAREX.
wa_bapi-ZZLONGITUDE = '12.345.
wa_bapi-ZZBUILDING = '1 Main Street'.
lt_EXTENSIONIN2-STRUCTURE = 'BAPI_TE_ANLU'.
CALL METHOD cl_abap_container_utilities=>fill_container_c
EXPORTING
im_value = wa_bapi
IMPORTING
ex_container = wa_EXTENSIONIN+30
EXCEPTIONS
illegal_parameter_type = 1
OTHERS = 2.
APPEND wa_EXTENSIONIN TO lt_EXTENSIONIN2.
Any ideas?
2023 Jul 06 10:34 AM
(Please ignore the use of lt_EXTENSION2. Been corrected already)
2023 Jul 06 1:47 PM
Thanks sandrarossi , the fill_container_c method worked like a charm.
For anybody else who needs the info
wa_bapi-ZZBUILDING = wa_iasset-Z3PBUILDING.
wa_bapi-ZZPROJ_ID = wa_iasset-PSPID.
wa_EXTENSIONIN-STRUCTURE = 'BAPI_TE_ANLU'.
CALL METHOD cl_abap_container_utilities=>fill_container_c
EXPORTING
im_value = wa_bapi
IMPORTING
ex_container = wa_EXTENSIONIN+30
EXCEPTIONS
illegal_parameter_type = 1
OTHERS = 2.
APPEND wa_EXTENSIONIN TO lt_EXTENSIONIN2.
2024 Jun 05 4:14 PM
Hi oppenheim_jm,
I'm trying to do the same thing as you bu I cant get through the BAPI_FIXEDASSET_CHANGE.
I'm doing it this way:
REFRESH lt_extensionin.
CLEAR ls_anlu.
ls_anlu-assetmaino = wa_results_stock-refid+4(12).
ls_anlu-comp_code = wa_results_stock-refid(4).
ls_anlu-zzenv_sf = 'X'.
MOVE 'BAPI_TE_ANLU' TO ls_extensionin-structure.
CALL METHOD cl_abap_container_utilities=>fill_container_c
EXPORTING
im_value = ls_anlu
IMPORTING
ex_container = ls_extensionin+30
EXCEPTIONS
illegal_parameter_type = 1
OTHERS = 2.
APPEND ls_extensionin TO lt_extensionin.
CALL FUNCTION 'BAPI_FIXEDASSET_CHANGE'
EXPORTING
companycode = '1000'
asset = ls_anlu-assetmaino
IMPORTING
return = lt_return
TABLES
extensionin = lt_extensionin.
IF lt_return[] IS INITIAL.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
ENDIF.
¿Am I missing any parameters?
Thank you in advance!
2024 Jun 05 4:29 PM
Does your ls_anlu have structure BAPI_TE_ANLU?
2024 Jun 05 4:39 PM
Sorry raymond,
I figured out myself after a break 😁.
I totally forgot about EXIT_SAPL1022_001 to update my fields.
Thank you for the post, was so helpful!!!