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: 

calculate the balance

Former Member
0 Kudos

hi

i need some information regarding how to calculate

the vendor balances,

i.e., from present date to last 15 monthhs vendor balace i need to calculate.

select options are lifnr and bukrs. table is LFC1.

can any one please help how to calculate its urgent.

thanks in advance.

5 REPLIES 5

Former Member
0 Kudos

check this bapi may be helpful for you....

BAPI_AP_ACC_GETSTATEMENT

0 Kudos

to calculate vendor balances if i use the following function module please tell me how to pass the fields.

i am new to this ,please help me how to pass fileds.

CALL FUNCTION 'BAPI_AP_ACC_GETSTATEMENT'

EXPORTING

companycode =

vendor =

date_from =

date_to =

  • NOTEDITEMS = ' '

  • IMPORTING

  • RETURN =

  • tables

  • lineitems =

0 Kudos

Hi,

FUNCTION ZSP_AP_ACC_GETSTAMT.

*"----


""Local interface:

*" IMPORTING

*" VALUE(COMPANYCODE) LIKE BAPI3008_1-COMP_CODE

*" VALUE(VENDOR) LIKE BAPI3008_1-VENDOR

*" VALUE(DATE_FROM) LIKE BAPI3008-FROM_DATE

*" VALUE(DATE_TO) LIKE BAPI3008-TO_DATE

*" VALUE(SPRAS) LIKE T008T-SPRAS

*" EXPORTING

*" VALUE(RETURN) LIKE BAPIRETURN STRUCTURE BAPIRETURN

*" TABLES

*" LINEITEMS STRUCTURE SUPP_BAPI3008_2

*"----


DATA: BEGIN OF XLINEITEMS OCCURS 10.

INCLUDE STRUCTURE BAPI3008_2.

DATA: END OF XLINEITEMS.

CALL FUNCTION 'BAPI_AP_ACC_GETSTATEMENT'

EXPORTING

COMPANYCODE = COMPANYCODE

VENDOR = VENDOR

DATE_FROM = DATE_FROM

DATE_TO = DATE_TO

IMPORTING

RETURN = RETURN

TABLES

LINEITEMS = XLINEITEMS.

  • add language specific information to all open items

  • Todo: replace select statements

LOOP AT XLINEITEMS.

CLEAR LINEITEMS.

MOVE-CORRESPONDING XLINEITEMS TO LINEITEMS.

IF NOT XLINEITEMS-REASON_CDE IS INITIAL.

SELECT TXT20 FROM T053S INTO LINEITEMS-RSTGRT WHERE

BUKRS = COMPANYCODE AND

RSTGR = XLINEITEMS-REASON_CDE AND

SPRAS = SPRAS.

ENDSELECT.

ENDIF.

IF NOT XLINEITEMS-PYMT_METH IS INITIAL.

SELECT TEXT1 FROM T042Z INTO LINEITEMS-ZLSCHLT WHERE

LAND1 = XLINEITEMS-COUNTRY AND

ZLSCH = XLINEITEMS-PYMT_METH.

ENDSELECT.

ENDIF.

SELECT TEXTL FROM T008T INTO LINEITEMS-ZAHLST WHERE

ZAHLS = XLINEITEMS-PMNT_BLOCK AND

SPRAS = SPRAS.

ENDSELECT.

IF NOT XLINEITEMS-POST_KEY IS INITIAL.

SELECT LTEXT FROM TBSLT INTO LINEITEMS-BSCHLT WHERE

BSCHL = XLINEITEMS-POST_KEY AND

UMSKZ = XLINEITEMS-SP_GL_IND AND

SPRAS = SPRAS.

ENDSELECT.

ENDIF.

APPEND LINEITEMS.

ENDLOOP.

ENDFUNCTION.

+++++++++++++++++++++++++++++++

Please change according to your reqt in the above fm.

Regds

Sivaparvathi

Please reward points if helpful...

Former Member
0 Kudos

Hai,

In your coding add the bello code :

DATA: gv_date TYPE sy-datum.

CALL FUNCTION 'CCM_GO_BACK_MONTHS'

EXPORTING

currdate = sy-datum

backmonths = 15

IMPORTING

newdate = gv_date.

And in your selection check the dates :

select ...... from ...

into ....

where ... <= sy-datum

and ... >= gv_date.

Regards,

Nagaraju.

Former Member
0 Kudos

Hi,

as u said 15 months is the fixed one or you given the date range?

if so, give the given input value into the mention table and retrieve the value.

additionally u give the date parameter in your selection range

Select * from LFC1 into table itab_lfc where <date>.