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: 

How to update custom field in ANLU for Non-unicode system via extension structure?

oppenheim_jm
Participant
0 Kudos
1,123

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)?

7 REPLIES 7

Sandra_Rossi
Active Contributor
1,016

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.

oppenheim_jm
Participant
0 Kudos
1,016

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?

0 Kudos
1,016

(Please ignore the use of lt_EXTENSION2. Been corrected already)

oppenheim_jm
Participant
0 Kudos
1,016

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.

0 Kudos
833

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!

0 Kudos
831

Does your ls_anlu have structure BAPI_TE_ANLU?

0 Kudos
829

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!!!