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: 

BAPI_FIXEDASSET_CREATE1 using EXTENSIONIN parameter

Former Member
0 Kudos

Hi,

Has Someone used the screen exit for master data of fixed assets through group of functions XAIS?

How can I create fixed assets through the BAPI_FIXEDASSET_CREATE1 using EXTENSIONIN parameter to fill the user fields? I tried to use it but the BAPI allows sending just a registry in table EXTENSIONIN and in addition it does not place the values in the correct fields.

Thanks,

7 REPLIES 7

Former Member
0 Kudos

Hi,

I solved a part of my problem, but I still have a question, I need to fill some fields of currency and integer that are user-defined fields. How can I fill them in the EXTENSIONIN parameter?

Thanks...

0 Kudos

Hi,

I had a similar problem so I can indicate to you the right way to follow.

1. First of all, you must implement <b>SAP NOTE 947304 - BAPIs : ANLU value fields table</b>

-> you have to create and include an INCLUDE which has some typecasting routines

2. Use as example the below code sequence (ask if questions)

a) Define necessary variables


DATA: g_extensionin TYPE TABLE OF bapiparex, 
          g_extin     TYPE bapiparex.
DATA: g_bapi_te_anlu TYPE bapi_te_anlu.

b) Prepare / fill variables with what you need:


    REFRESH g_extensionin.

    CLEAR g_bapi_te_anlu.
    g_bapi_te_anlu-comp_code = g_mm_doc-bukrs.
    g_bapi_te_anlu-assetmaino = ''.
    g_bapi_te_anlu-assetsubno = ''.
    g_bapi_te_anlu-zz_mblnr = g_mm_doc-mblnr.
    g_bapi_te_anlu-zz_mjahr = g_mm_doc-mjahr.
    g_bapi_te_anlu-zz_zeile = g_mm_doc-zeile.
    g_bapi_te_anlu-zz_matnr = g_mm_doc-matnr.
    g_bapi_te_anlu-zz_name_rec = g_mm_doc-wempf.
    g_bapi_te_anlu-zz_name_asg = ''.

c) Now, use this FORM routine from the above SAP Note, to correctly fill the EXTENSIONIN structure


    CLEAR g_extin.

    PERFORM value_to_string_transform
                USING
                   g_bapi_te_anlu
                CHANGING
                   g_extin.
    APPEND g_extin TO g_extensionin.

d) Finally call the BAPI with what you need / want, etc


      CALL FUNCTION 'BAPI_FIXEDASSET_CREATE1'
        EXPORTING
          key                        = g_key
*     REFERENCE                  =
*     CREATESUBNUMBER            =
*     POSTCAP                    =
*     CREATEGROUPASSET           =
          testrun                    = p_test
          generaldata                = g_gendata
          generaldatax               = g_gendatax
*     INVENTORY                  =
*     INVENTORYX                 =
          postinginformation         = g_postinfo
          postinginformationx        = g_postinfox
          timedependentdata          = g_timedep
          timedependentdatax         = g_timedepx
*     ALLOCATIONS                =
*     ALLOCATIONSX               =
          origin                     = g_original
          originx                    = g_originalx
*     INVESTACCTASSIGNMNT        =
*     INVESTACCTASSIGNMNTX       =
*     NETWORTHVALUATION          =
*     NETWORTHVALUATIONX         =
*     REALESTATE                 =
*     REALESTATEX                =
*     INSURANCE                  =
*     INSURANCEX                 =
*     LEASING                    =
*     LEASINGX                   =
       IMPORTING
*         companycode                =
         asset                      = g_mm_aa-anln1
         subnumber                  = g_mm_aa-anln2
*     ASSETCREATED               =
         return                     = g_bapi_return
       TABLES
*     DEPRECIATIONAREAS          =
*     DEPRECIATIONAREASX         =
*     INVESTMENT_SUPPORT         =
         extensionin                = g_extensionin
                .

0 Kudos

This information is helpful but I am unable to find the Note specified by Doru (947304). How can this be implemented without it OR where can I find it?

0 Kudos

Hi,

Sorry, I forgot that note was not released yet - I received it directly from SAP.

Look here for the code from within the note. You have to save it in a Z* program which has to be included wherever you need.

*&---------------------------------------------------------------------*
*&  Include           ZVALUEFIELD
*&---------------------------------------------------------------------*
* <<< BEGIN OF INSERTION - SPC947304 >>>

FORM string_to_value_transform TABLES it_extensionout CHANGING ls_bapi_anlu.

  DATA: ls_extensionout TYPE bapiparex.
  DATA: ld_string TYPE string.
  DATA: cp_tab  TYPE nls_langu_cp_tab.
  DATA: l_ref_cont  TYPE REF TO cl_nls_struc_container.
  field-symbols <lfs_anlu> type c.


*Read extension fields
  READ TABLE it_extensionout INDEX 1 INTO ls_extensionout.
  ld_string = ls_extensionout-valuepart1.

* a) Read Codepage
  CALL FUNCTION 'NLS_GET_LANGU_CP_TAB'
    EXPORTING
      destination = 'NONE'
    TABLES
      cp_tab      = cp_tab.
* b) create conversion object
  l_ref_cont = cl_nls_struc_container=>create( cp_tab = cp_tab ).

* c) change structure to container
  ASSIGN ls_bapi_anlu TO <lfs_anlu> CASTING.



* Fill structure out of container
  l_ref_cont->cont_to_struc( EXPORTING langu = sy-langu
                                       cont  = ld_string
                             IMPORTING struc = <lfs_anlu> ).
ENDFORM.                    "string_to_value_transform

*&---------------------------------------------------------------------*
*&      Form  VALUE_TO_STRING_TRANSFORM
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->IS_BAPI_ANLU    text
*      -->LS_EXTENSIONIN  text
*----------------------------------------------------------------------*
FORM value_to_string_transform USING is_bapi_anlu CHANGING ls_extension STRUCTURE bapiparex.
  FIELD-SYMBOLS: <lfs_anlu> TYPE c.
  DATA: ld_string TYPE string.
  FIELD-SYMBOLS: <lfs_extension> TYPE c.
  DATA: ld_offset_anlu  TYPE i.
  DATA: l_ref_cont  TYPE REF TO cl_nls_struc_container,
        cp_tab  TYPE nls_langu_cp_tab.


  DESCRIBE FIELD ls_extension-structure LENGTH ld_offset_anlu
  IN CHARACTER MODE. "Unicode

  CALL FUNCTION 'NLS_GET_LANGU_CP_TAB'
    EXPORTING
      destination = 'NONE'
    TABLES
      cp_tab      = cp_tab.
*
  l_ref_cont = cl_nls_struc_container=>create( cp_tab =
cp_tab ).


  ASSIGN is_bapi_anlu TO <lfs_anlu> CASTING.
  l_ref_cont->struc_to_cont( EXPORTING langu = sy-langu
                                       struc = <lfs_anlu>
                              IMPORTING cont = ld_string ).

  ASSIGN ls_extension  TO <lfs_extension>  CASTING.
  MOVE ld_string      TO <lfs_extension>+ld_offset_anlu.

  MOVE 'BAPI_TE_ANLU' TO  ls_extension-structure.



ENDFORM.                    "VALUE_TO_STRING_TRANSFORM

* <<< END  OF INSERTION - SPC947304 >>>






*&---------------------------------------------------------------------*
*&  Include           ZVALUEFIELD                                      *
*&---------------------------------------------------------------------*

This could be used together with previous message posted by me on this thread.

If questions, plz. ask

0 Kudos

Thanks, Doru.

I've implemented the code that you recommended but my custom fields are still not being populated. Is there anything I might be missing? Another change or note that needs to be applied?

Thanks again!

0 Kudos

Nevermind. I was able to find the problem. EXIT_SAPL1022_001 was missing the ANLU assignment to E_ANLU, so I added the following line to include ZXAISU05:

e_anlu = i_anlu.

This works as expected.

Thanks for the help!

0 Kudos

I followed  all  of this , including "e_anlu = i_anlu" in "EXIT_SAPL1022_001 - ZXAISU05" , but also the content of ANLU were not active .