Skip to Content

BAPI_MATERIAL_SAVEDATA - Extensionin with QUAN or CURR field

Hello,

I have a problem updating appended field in MARC.

MARC-Z1 is data type CURR length 11, decimal places 2.

In BAPI_TE_MARC I created Z1 as CHAR14 (because BAPI_TE_* supports only CHAR fields). I tried cl_abap_container_utilities=>fill_container_, but no difference.

Other field Z2, which is CHAR, is updating OK with same code. And BAPI always return update OK, without error.

Also I tried to debug standard code and "PERFORM EXTENSIONIN_UEBERGEBEN" seems to work OK and it does fill TMARC_UEB-Z1 with correct value. But after that, I lost a track in CALL FUNCTION 'MATERIAL_MAINTAIN_DARK'....

Any ideas where could be a problem or how to find it?

Example code:

APPEND INITIAL LINE TO lt_extensionin ASSIGNING <ls_extensionin>.
<ls_extensionin>-structure = 'BAPI_TE_MARC'.
ls_bapi_te_marc-plant = gc_werks_templ.
cl_abap_container_utilities=>fill_container_c(
  EXPORTING
    im_value               = l_z1 "CURR
  IMPORTING
    ex_container           = ls_bapi_te_marc-z1 "CHAR
  EXCEPTIONS
    illegal_parameter_type = 1
    OTHERS                 = 2 ).
<ls_extensionin>+30 = ls_bapi_te_marc.


APPEND INITIAL LINE TO lt_extensioninx ASSIGNING <ls_extensioninx>.
<ls_extensioninx>-structure = 'BAPI_TE_MARCX'.
ls_bapi_te_marcx-plant = gc_werks.
ls_bapi_te_marcx-z1 = 'X'.
<ls_extensioninx>+30 = ls_bapi_te_marcx.


CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA' DESTINATION 'NONE'
  EXPORTING
    headdata     = ls_headdata
  IMPORTING
    return       = ls_return
  TABLES
    extensionin  = lt_extensionin
    extensioninx = lt_extensioninx.
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Feb 27, 2017 at 03:06 PM

    You don't use correctly the method, code should be similar to

    ls_extensionin-structure = 'BAPI_TE_MARC'.
    cl_abap_container_utilities=>fill_container_c(
      EXPORTING
        im_value               = ls_bapi_te_marc " structure of type bapi_te_marc
      IMPORTING
        ex_container           = ls_extensionin+30 " values 1-4
      EXCEPTIONS
        illegal_parameter_type = 1
        OTHERS                 = 2 ).

    But as the documentation ask for character fields only, we can suppose that your current version of the BAPI won't be able to map fields, so the BAPI actually don't use this Unicode class. So you may consider using BAdI STANDARDMATERIAL_SAVE_DATA and map yourself data with method MAP_EXTENSIONIN from records with structure like BAPI_TE_E1<NAME>, e.g. BAPI_TE1_MARC.

    Add comment
    10|10000 characters needed characters exceeded