Bapi for Retirement Asset

Berikut ini contoh coding untuk melakukan retirement asset menggunakan BAPI.

Berikut adalah parameter yang harus diisi dalam BAPI tersebut :

DATA:
lx_generalpostingdata TYPE bapifapo_gen_info,
lx_retirementdata TYPE bapifapo_ret,
lx_furtherpostingdata TYPE bapifapo_add_info,
lx_return TYPE bapiret2.

DATA: d_bukrs     TYPE bukrs,
      d_anlnr     TYPE anln1,
      d_amount    TYPE kwert,
      d_currency  TYPE waerk,
      d_vbeln     TYPE vbeln_vf,
      d_retire    TYPE symsgv.

lx_generalpostingdata-doc_type   = 'AA'.
lx_generalpostingdata-doc_date   = sy-datum.
lx_generalpostingdata-pstng_date = sy-datum.
lx_generalpostingdata-fis_period = sy-datum+4(2).
lx_generalpostingdata-trans_date = sy-datum.
lx_generalpostingdata-comp_code  = d_bukrs.
lx_generalpostingdata-assetmaino = d_anlnr.

IF d_currency = 'IDR'.
  lx_retirementdata-rev_on_ret     = d_amount * 100.
ELSE.
  lx_retirementdata-rev_on_ret     = d_amount.
ENDIF.
lx_retirementdata-currency_iso   = d_currency.
lx_retirementdata-valuedate      = sy-datum.

lx_furtherpostingdata-alloc_nmbr = d_vbeln.
lx_furtherpostingdata-ref_doc_no = d_vbeln.

CALL FUNCTION 'BAPI_ASSET_RETIREMENT_POST'
  EXPORTING
    generalpostingdata = lx_generalpostingdata
    retirementdata     = lx_retirementdata
    furtherpostingdata = lx_furtherpostingdata
  IMPORTING
    return             = lx_return.

IF lx_return-type = 'E'.
  CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
ELSE.
  CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
    EXPORTING
      wait = 'X'.
  d_retire = lx_return-message_v2.
ENDIF.

variable yang berawalan ‘d_’, diisi sesuai dengan data yang akan dilakukan retirement.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s