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: 

automatically post the lease rental charges for oprating lease asset using

Former Member
0 Kudos

hi.

all.

i am new to abap industry.

requirement is that automatically post the lease rental charges for operating lease asset

using bapi for transaction code f-02.

in selection-screen should the field will be

bukrs

anlkl

leafi

bupla

qsskz

mwskz

blart

bldat

budat

xblnr

bktxt

4 REPLIES 4

Former Member
0 Kudos

HI,

Check the BAPI that may hep you to solve the issue.

CALL FUNCTION 'BAPI_ACC_GL_POSTING_POST'

.

0 Kudos

ya

.

that i got it before but in that bapi i am not able to add wht tax code(qsskz) and tax code (mwskz)

and if u have sample code for that send me as soon as possible.

0 Kudos

Hi,

Check the code below.

REPORT  zaatest                                 .

DATA:
obj_type LIKE bapiache02-obj_type,
obj_key LIKE bapiache02-obj_key,
obj_sys LIKE bapiache02-obj_sys,
documentheader LIKE bapiache08,

accountgl LIKE bapiacgl08
OCCURS 0 WITH HEADER LINE,
currencyamount LIKE bapiaccr08
OCCURS 0 WITH HEADER LINE,
return LIKE bapiret2
OCCURS 0 WITH HEADER LINE,
extension1 LIKE bapiextc
OCCURS 0 WITH HEADER LINE,

t_edidd LIKE edidd OCCURS 0 WITH HEADER LINE,
bapi_retn_info LIKE bapiret2 OCCURS 0 WITH HEADER LINE.
DATA: error_flag.

documentheader-username = sy-uname.
documentheader-header_txt = 'Test using BAPI'.
documentheader-comp_code = '1000'.
documentheader-doc_date = sy-datum.
documentheader-pstng_date = sy-datum.
documentheader-doc_type = 'SA'.


accountgl-itemno_acc = '1'.
accountgl-gl_account = '0000160100'.
accountgl-comp_code = '1000'.
accountgl-pstng_date = sy-datum.
accountgl-doc_type = 'SA'.
accountgl-profit_ctr = '0000010000'.
APPEND accountgl.

accountgl-itemno_acc = '2'.
accountgl-gl_account = '0000160100'.
accountgl-comp_code = '1000'.
accountgl-pstng_date = sy-datum.
accountgl-doc_type = 'SA'.
accountgl-profit_ctr = '0000010000'.
APPEND accountgl.

currencyamount-itemno_acc = '1'.
currencyamount-currency = 'GBP'.
currencyamount-amt_doccur = '100.00'.
APPEND currencyamount.

currencyamount-itemno_acc = '2'.
currencyamount-currency = 'GBP'.
currencyamount-amt_doccur = '-100.00'.
APPEND currencyamount.


* call BAPI-function in this system *
CALL FUNCTION 'BAPI_ACC_GL_POSTING_POST'
  EXPORTING
    documentheader = documentheader
  TABLES
    accountgl      = accountgl
    currencyamount = currencyamount
    return         = return
    extension1     = extension1
  EXCEPTIONS
    OTHERS         = 1.
IF sy-subrc <> 0.
  MESSAGE e999(re) WITH 'Problem occured'.
ELSE.
  LOOP AT return.
    IF NOT return IS INITIAL.
      CLEAR bapi_retn_info.
      MOVE-CORRESPONDING return TO bapi_retn_info.
      IF return-type = 'A' OR return-type = 'E'.
        error_flag = 'X'.
      ENDIF.
      APPEND bapi_retn_info.
    ENDIF.
  ENDLOOP.
  IF error_flag = 'X'.
    MESSAGE e999(re) WITH 'Problem occured'.
    ROLLBACK WORK.
  ELSE.
    COMMIT WORK.
  ENDIF.
ENDIF.

0 Kudos

Hi,

Did the code help you ? If not let me know .

thanks