Using BAPI upload excel file for t-code AS02 in SAP

Using BAPI " BAPI_FIXEDASSET_CHANGE " create a zprogram to upload excel file for mass change fixed asset in SAP. REPORT  ZAS02_ASSET_CHANGE_UPLOAD . TYPE-POOLS :  truxs . " Structure for Excel data TYPES :  BEGIN  OF  ty_excel ,          anln1  TYPE  anln1 ,          bukrs  TYPE  bukrs ,          kostl  TYPE  kostl ,          werks  TYPE  werks ,          prctr  TYPE  prctr ,         END  OF  ty_excel . DATA :  lt_excel     TYPE  TABLE  OF  ty_excel ,       ls_excel     TYPE  ty_excel ,     ...

Inline Declaration in ABAP (Keyword: DATA)

 The new declaration operator DATA allows inline declarations of variables with declaration expressions in declaration positions. Declaration positions are write positions where the operand type can be determined from the context statically. lets look at below examples on how to use this in real world programming.

Example:  while use loop:

     Loop at itab into DATA(wa_itab).

     ...........

 Endloop.

   Call transformation .... result XML  DATA(xml). 

  • The work area can now be dynamically defined and used via inline declaration.
  • While importing data in methods, the target variables can now be dynamically defined and used by inline declaration.
  • using in select query also:

        SELECT a~prueflosa~plntya~plnnra~plnalb~vorglfnrb~merknrb~verwmerkmb~formelsl
        FROM qals AS a INNER JOIN qamv AS ON a~prueflos b~prueflos
          INTO TABLE @DATA(lt_qals_qamvWHERE a~prueflos @p_inslot
                                            AND b~formelsl NE 'X'.

     we need to use comma separator (,) between table field.

    Comments

    Popular posts from this blog

    New commodity code create in SAP S/4 Hana

    BAPI to Change STO PO/ PO Delivery date in SAP

    Decimal remove in a smartforms report