Skip to Content

Personally I do not like using the BATCH INPUT, but can not always find a BAPI to do what we need.

On this occasion, I was required to perform the transfer of an asset to another (already existing) by ABUMN transaction.

I was looking for a BAPI or function that will do this, instead of a batch input but could not find anything about it.

After performing the transaction debug ABUMN could determine that AMDP_USER_COMMAND_PROCESS function is performed by the transfer of an asset to another, only there are two details in this role I was forced to create a function-based Z AMDP_USER_COMMAND_PROCESS:

1. No error messages returned an internal table (usually using BAPIRET2 structure

Two. Send messages using popup windows

Notes to consider:

The program calls commented AMDP_MESSAGE_SEND function because this function makes messages popup windows appear.

To get an idea of what the data that must be filled function parameters, I suggest you put a break in the function call AMDP_USER_COMMAND_PROCESS found in the INCLUDE FORM USER_COMMAND_PROCESS LAMDPFNN AMDP function group, ABUMN execute the transaction as it stops in debug mode, check each of the parameters is called AMDP_USER_COMMAND_PROCESS function.

The function I created is:

/wp-content/uploads/2013/07/import_241291.jpg

/wp-content/uploads/2013/07/export_241292.jpg

/wp-content/uploads/2013/07/changing_241293.jpg

Tables.png

/wp-content/uploads/2013/07/exceptions_241295.jpg

The source code is:

FUNCTION zfunc_abumn.
*”———————————————————————-
*”*”Interfase local
*”  IMPORTING
*”     VALUE(I_FCODE) LIKE  SY-UCOMM
*”     VALUE(I_DATAR) LIKE  SY-DATAR OPTIONAL
*”     VALUE(I_PROGN) LIKE  SY-REPID OPTIONAL
*”     VALUE(I_NUMDOC) TYPE  CHAR01
*”  EXPORTING
*”     VALUE(E_FCODE) LIKE  SY-UCOMM
*”     VALUE(E_FIRST_TAB) TYPE  CHAR01
*”     VALUE(E_LAST_TAB) TYPE  CHAR01
*”  TABLES
*”      T_RAIFP2 STRUCTURE  RAIFP2
*”      T_RAIFP3 STRUCTURE  RAIFP3 OPTIONAL
*”      T_ANEPI STRUCTURE  ANEPI OPTIONAL
*”      BAPIRET2 STRUCTURE  BAPIRET2
*”  CHANGING
*”     VALUE(C_RAIFP1) LIKE  RAIFP1 STRUCTURE  RAIFP1 OPTIONAL
*”     VALUE(C_RAIFP2) LIKE  RAIFP2 STRUCTURE  RAIFP2 OPTIONAL
*”     VALUE(C_RAIFP3) LIKE  RAIFP3 STRUCTURE  RAIFP3 OPTIONAL
*”  EXCEPTIONS
*”      ERROR_OCCURRED
*”———————————————————————-
DATA:    lt_bapiret2   LIKE  bapiret2      OCCURS 0 WITH HEADER LINE.
DATA:    lt_acchd      LIKE  acchd         OCCURS 0 WITH HEADER LINE.
DATA:    lt_accit      LIKE  accit         OCCURS 0 WITH HEADER LINE.
DATA:    lt_acccr      LIKE  acccr         OCCURS 0 WITH HEADER LINE.
DATA:    lt_accda      LIKE  accda         OCCURS 0 WITH HEADER LINE.
DATA:    ld_awref      LIKE  anek-belnr.
DATA:    ld_awtyp      LIKE  anek-awtyp.
DATA:    ld_aworg      LIKE  anek-aworg.
DATA:    ld_awsys      LIKE  anek-awsys.
DATA:    ld_bukrs      LIKE  anek-bukrs.
DATA:    ld_fcode      LIKE  syst-ucomm.
DATA:    lf_txnok.
DATA:    lf_datar.
DATA:    ld_answer.
DATA: vl_transacc TYPE sy-tcode.

e_fcode  = i_fcode.
ld_fcode = i_fcode.

lf_datar = i_datar.
IF lf_datar IS INITIAL.
lf_datar = sy-datar.
ENDIF.

sy-tcode = ‘ABUMN’.
MOVE ‘MIGO’ TO vl_transacc.
EXPORT vl_transacc  TO MEMORY ID ‘ZTCODE’.
EXPORT i_numdoc  TO MEMORY ID ‘ZNUMDOC’.
*  Reiterwechsel?
CALL FUNCTION ‘TABSTRIP_OKCODE_TRANSMIT’
EXPORTING
i_okcode            = i_fcode
IMPORTING
e_first_tab_reached = e_first_tab
e_last_tab_reached  = e_last_tab.

*  IF NOT SF_FCALL IS INITIAL.
CALL FUNCTION ‘AMDP_BAPI_CALL_ON_TRANSACTION’
EXPORTING
i_raifp1 = c_raifp1
IMPORTING
e_txnok  = lf_txnok
TABLES
t_raifp2 = t_raifp2
t_raifp3 = t_raifp3
CHANGING
c_fcode  = e_fcode.

IF lf_txnok IS INITIAL.
RAISE error_occurred.
ENDIF.
*  ENDIF.

CALL FUNCTION ‘ACC5_RETURN_APPEND_OR_CHECK’
EXPORTING
i_refresh_return =
‘X’.

CALL FUNCTION ‘AMBU_CALL_AC_DOCUMENT_CHECK’
TABLES
t_acchd  = lt_acchd
t_accit  = lt_accit
t_acccr  = lt_acccr
t_accda  = lt_accda
t_return = lt_bapiret2.

**           im RWIN aufgetretene Fehler bzw. Erfolgsmeldung ausgeben
*  CALL FUNCTION ‘AMDP_MESSAGE_SEND’
*    TABLES
*      t_return = lt_bapiret2
*    CHANGING
*      c_fcode  = e_fcode                                    “<0584750
*    EXCEPTIONS
*      OTHERS   = 4.

*           RWIN zwecks Verbuchung aufrufen
CHECK sy-subrc = 0.
CALL FUNCTION ‘ACC5_RETURN_APPEND_OR_CHECK’
EXPORTING
i_refresh_return =
‘X’.

CALL FUNCTION ‘AMBU_CALL_AC_DOCUMENT_POST’
IMPORTING
e_awref  = ld_awref
e_aworg  = ld_aworg
e_awtyp  = ld_awtyp
e_awsys  = ld_awsys
TABLES
t_acchd  = lt_acchd
t_accit  = lt_accit
t_acccr  = lt_acccr
t_accda  = lt_accda
t_return = lt_bapiret2.

**           <<<<<<<<<<<<<<<<<< Begin of note 722938 >>>>>>>>>>>>>>>>>>
**           im RWIN aufgetretene Fehler prüfen
*  CALL FUNCTION ‘AMDP_MESSAGE_SEND’
*    EXPORTING
*      i_just_check = ‘X’
*    TABLES
*      t_return     = lt_bapiret2
*    CHANGING
*      c_fcode      = e_fcode
*    EXCEPTIONS
*      OTHERS       = 4.
*  IF sy-subrc <> 0.
**              Fehler im Post -> Harte A-Msg wegen Rollback
*    MESSAGE ID sy-msgid TYPE ‘A’ NUMBER sy-msgno
*    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
*  ENDIF.
*
*  CHECK sy-subrc = 0.

*           BAPI für COMMIT aufrufen
CALL FUNCTION ‘BAPI_TRANSACTION_COMMIT’.
MOVE lt_bapiret2[] TO bapiret2[].
**           jetzt erst im RWIN aufgetretene Erfolgsmeldung ausgeben
*  CALL FUNCTION ‘AMDP_MESSAGE_SEND’
*    TABLES
*      t_return = lt_bapiret2
*    CHANGING
*      c_fcode  = e_fcode
*    EXCEPTIONS
*      OTHERS   = 4.
**           <<<<<<<<<<<<<<<<<<< End of note 722938 >>>>>>>>>>>>>>>>>>>

ENDFUNCTION.

I hope this will be useful.

Attentively

Moisés Collí Aké

¡¡ Orgullosamente Yucateco !!

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply