Problem in Vendor Balance

Dear All,
I have a requirement to calculate the vendor balance....I have developed a report for it but the prob
For Eg if I check it in FBL1N with vendor and comp code given:
If I have 14 open items as on 30/12/2008 with a total of Rs.8433240.50
and on 31/12/2008 2 documents got cleared and the total is Rs.8400000.50
but as per my code I am getting 8400000.50 if i give the date as also 30/12/2008.
I have retrieved the data from table BSIK.Can u plz help me out if anyboy can.
Regards,
Pavani.

REPORT  Z_VEN_BAL NO STANDARD PAGE HEADING MESSAGE-ID zsp1.
TABLES : LFA1,
         BSIK,
         BSEG,
         T001.
types:BEGIN OF ITab_LFA1 ,
    LIFNR LIKE LFA1-LIFNR,           " Acc. No. of Vendor or Creditor
    NAME1 LIKE LFA1-NAME1,           " Name
    STRAS LIKE LFA1-STRAS,
    ORT01 LIKE LFA1-ORT01,           " City
    REGIO LIKE LFA1-REGIO,           " Region
    LAND1 LIKE LFA1-LAND1,           " Country
  END OF ITab_LFA1.
types: BEGIN OF ITab_BSIK,
       BUKRS   LIKE BSIK-BUKRS,
       LIFNR LIKE BSIK-LIFNR,
       augdt like bsik-augdt,
       ZUONR LIKE BSIK-ZUONR,
       BELNR LIKE BSIK-BELNR,
       BLDAT LIKE BSIK-BLDAT,
       XBLNR LIKE BSIK-XBLNR,
       BLART   LIKE BSIK-BLART,
       SHKZG   LIKE BSIK-SHKZG,
       WRBTR   LIKE BSIK-WRBTR,
      END OF ITab_BSIK.
types: BEGIN OF ITab_BSAK,
       BUKRS   LIKE BSAK-BUKRS,
       LIFNR LIKE BSAK-LIFNR,
       AUGDT LIKE BSAK-AUGDT,
       ZUONR LIKE BSAK-ZUONR,
       BELNR LIKE BSAK-BELNR,
       BLDAT LIKE BSAK-BLDAT,
       XBLNR LIKE BSAK-XBLNR,
       BLART   LIKE BSAK-BLART,
       SHKZG   LIKE BSAK-SHKZG,
       WRBTR   LIKE BSAK-WRBTR,
      END OF ITab_BSAK.
TYPES : BEGIN OF ITAB_T001,
       BUKRS LIKE T001-BUKRS,
        BUTXT LIKE T001-BUTXT,
        END OF ITAB_T001.
types:BEGIN OF ITab_FINAL,
       LIFNR LIKE LFA1-LIFNR,
       AUGDT LIKE BSIK-AUGDT,
       BUKRS   LIKE BSIK-BUKRS,
       BUTXT LIKE T001-BUTXT,
       ZUONR LIKE BSIK-ZUONR,
       BELNR LIKE BSIK-BELNR,
       NAME1 LIKE LFA1-NAME1,
       STRAS LIKE LFA1-STRAS,
       ORT01 LIKE LFA1-ORT01,
       REGIO LIKE LFA1-REGIO,
       LAND1 LIKE LFA1-LAND1,           " Country
       BLDAT LIKE BSIK-BLDAT,
       XBLNR LIKE BSIK-XBLNR,
       BLART   LIKE BSIK-BLART,
       SHKZG   LIKE BSIK-SHKZG,
       WRBTR   LIKE BSIK-WRBTR,
       END OF ITab_FINAL.
DATA:IT_final TYPE STANDARD TABLE OF ITAB_FINAL,
      IT_BSIK TYPE STANDARD TABLE OF ITAB_BSIK,
      IT_BSAK TYPE STANDARD TABLE OF ITAB_BSAK,
      IT_LFA1 TYPE STANDARD TABLE OF ITAB_LFA1,
      IT_T001 TYPE STANDARD TABLE OF ITAB_T001.
      IT_final TYPE STANDARD TABLE OF zVENBAL1.
DATA : WA_FINAL type ITab_FINAL.
DATA : WA_BSIK type ITab_BSIK.
DATA : WA_BSAK type ITab_BSAK.
DATA : WA_LFA1 type ITab_LFA1.
DATA : WA_T001 TYPE ITAB_T001.
DATA: V_DATUM LIKE SY-DATUM.             " For Current Date
DATA  :   p_repid     TYPE   tdsfname VALUE 'Z_SF_VEN_BAL'.
DATA  :   v_fm_name   TYPE   rs38l_fnam.
data : v_wrbtr like bsik-wrbtr.
data : v_wrbtr1 like bsAk-wrbtr.
DATA : V_AMOUNT LIKE BSAK-WRBTR.
SELECT-OPTIONS: S_LIFNR FOR LFA1-LIFNR,
                S_BUKRS FOR BSIK-BUKRS.
parameters : p_augdt like bsik-augdt,
              p_budat like bsik-budat.
AT SELECTION-SCREEN.
DATA: L_BLDAT LIKE BSAK-BLDAT.
IF NOT S_BUDAT[] IS INITIAL.
*--- Check for a valid Vendor No.
SELECT SINGLE BUDAT
INTO L_BUDAT
FROM BSAK
WHERE BUDAT IN S_LIFNR.
endif.
SELECT SINGLE *
            INTO LFA1 FROM LFA1
            WHERE LIFNR IN S_LIFNR.
            IF SY-SUBRC <> 0.
           MESSAGE E000.
          ENDIF.
  SELECT SINGLE *
                INTO BSIK FROM BSIK
                WHERE BUKRS IN S_BUKRS.
            IF SY-SUBRC <> 0.
            ENDIF.
START-OF-SELECTION.
SELECT LIFNR
       NAME1
       STRAS
       ORT01
       REGIO
       LAND1
       INTO CORRESPONDING FIELDS OF TABLE IT_final
       FROM LFA1
       WHERE LIFNR in S_LIFNR.
      and bukrs in s_bukrs.
IF SY-SUBRC = 0.
  SELECT BUKRS
          LIFNR
          augdt
          ZUONR
          BELNR
          BLDAT
          XBLNR
          BLART
          SHKZG
          WRBTR
          INTO CORRESPONDING FIELDS OF TABLE IT_BSIK
          FROM BSIK
          WHERE LIFNR IN S_LIFNR
          AND  BUKRS IN S_BUKRS
          and budat <= p_budat.
SELECT BUKRS
          LIFNR
          AUGDT
          ZUONR
          BELNR
          BLDAT
          XBLNR
          BLART
          SHKZG
          WRBTR
          INTO CORRESPONDING FIELDS OF TABLE IT_BSAK
          FROM BSAK
          FOR ALL ENTRIES IN IT_FINAL
          WHERE LIFNR = IT_FINAL-LIFNR
          AND  BUKRS IN S_BUKRS
          and augdt >= p_augdt
          and budat <= p_budat.
SELECT BUTXT INTO TABLE IT_T001
FROM T001
FOR ALL ENTRIES IN IT_BSIK
WHERE BUKRS = IT_BSIK-BUKRS.
ENDIF.
LOOP AT IT_FINAL INTO WA_FINAL.
LOOP AT IT_BSAK INTO WA_BSAK.
READ TABLE IT_BSAK INTO WA_BSAK index sy-tabix.
IF SY-SUBRC = 0.
  MOVE WA_BSAK-SHKZG TO WA_FINAL-SHKZG.
  MOVE WA_BSAK-WRBTR TO WA_FINAL-WRBTR.
         IF WA_BSAK-SHKZG = 'H'.
          COMPUTE WA_FINAL-WRBTR = WA_BSAK-WRBTR * -1.
          V_WRBTR1 = V_WRBTR1 + WA_FINAL-WRBTR.
           else.
           compute wa_final-wrbtr = wa_bsak-wrbtr * 1.
            v_wrbtr1 = v_wrbtr1 - wa_final-wrbtr.
          ENDIF.
ENDIF.
MODIFY IT_FINAL FROM WA_FINAL.
ENDLOOP.
ENDLOOP.
LOOP AT IT_FINAL INTO WA_FINAL.
LOOP AT IT_BSIK INTO WA_BSIK.
READ TABLE IT_BSIK INTO WA_BSIK INDEX SY-TABIX.
IF SY-SUBRC = 0.
  MOVE WA_BSIK-BUKRS TO WA_FINAL-BUKRS.
  MOVE WA_BSIK-ZUONR TO WA_FINAL-ZUONR.
  MOVE WA_BSIK-BELNR TO WA_FINAL-BELNR.
  MOVE WA_BSIK-BLDAT TO WA_FINAL-BLDAT.
  MOVE WA_BSIK-XBLNR TO WA_FINAL-XBLNR.
  MOVE WA_BSIK-BLART TO WA_FINAL-BLART.
  MOVE WA_BSIK-SHKZG TO WA_FINAL-SHKZG.
  MOVE WA_BSIK-WRBTR TO WA_FINAL-WRBTR.
       IF WA_BSIK-SHKZG = 'H'.
          COMPUTE WA_FINAL-WRBTR = WA_BSIK-WRBTR * -1.
       ELSE.
          COMPUTE WA_FINAL-WRBTR = WA_BSIK-WRBTR * 1.
       ENDIF.
  ENDIF.
  READ TABLE IT_T001 INTO WA_T001 INDEX SY-TABIX.
  IF SY-SUBRC = 0.
    MOVE WA_T001-BUTXT TO WA_FINAL-BUTXT.
  ENDIF.
       MODIFY IT_FINAL FROM WA_FINAL.
       v_wrbtr = v_wrbtr + wa_final-wrbtr.
       write : / v_wrbtr.
    ENDLOOP.
ENDLOOP.
V_AMOUNT = V_WRBTR + V_WRBTR1.
write / v_amount.

Similar Messages

  • Problem in dynamic selection in vendor balance report  tcode S_ALR_87012082

    Hello Friends,
    After upgrading from 4.7 to ecc 6.0 we are facing the below mentioned problem.
    In a Vendor Balances report, the document selection is not available in the dynamic selections and hence i am not able to select the business area to suit the requirement. We have only, vendor master and company code in the dynamic selections.
    Is there any customization tht needs to be set???
    Thanks,
    Sunny

    Hi Vas,
    I am not sure..... but you can view the details in "S_ALR_87012079", you need to chnage the layout....
    If the hint is useful… Say thanks by reward….
    Regards,
    Prabhu Rajesh

  • Problem  in dynamic selection in vendor balances report

    Hello Friends,
    We are facing the below mentioned problem after upgradation ie 4.7 to ecc 6.0
    In a Vendor Balances report, the document selection is not available in the dynamic selections and hence i am not able to select the business area to suit the requirement. We have only, vendor master and company code in the dynamic selections.
    Is there any customization tht needs to be set???
    Thanks,
    Sunny

    NS

  • Vendor balance confirmation - F.18 printing problem

    Hi,
    I made all the settings for vendor balance confirmation form, and now I have one problem. When I try to print this form from F.18 I cannot print it. I get the Message no. TD433 - Spool request (number 93.645) sent to output device locl. Does anybody know what should I do to print this?
    Thanks,
    Regards
    Sorin

    Dear,
    For default printing set your settings as below from printing properties:
    Sorage Mode:- Print Only
    Print Priority: Select Accordingly
    Time of Print: Immediately
    Set the same as defualt settings on every time you print rather going to spools for print.
    Regards
    Valay Pandya

  • Difference between vendor open items and vendor balance

    Hi all,
    I have the following problem: When I display open items for a vendor with a special general ledger code, it happens that for some vendors, the total of these open items do not equal the vendor balance concerning this special GL code.
    Or in other words, the sum of BSIK and BSAK entries are not equal to the totals in table LFC3.
    I identified SAP standard program RFEWA003, that gives me exactly these differences, but how can I correct the entry in LFC3?
    The difference only occurs in the current fiscal year and is in the carryforward amount of LFC3. I checked the totals of debits and credits for the current year which are 100% correct.
    Our last fiscal year was shortened (only 11 months). Could this be the reason?
    How to correct LFC3 entries? Any correction program existing that is not related to Euro conversion?
    Thanks for your appreciated help,
    andie.m
    Edited by: andie.m on Jul 2, 2009 2:49 PM

    Hi Michael,
    Thanks for your answer, but I tried already the carry forward. It just says there is nothing to be treated.
    I thought there might be a special carry forward transaction for special general ledger accounts, but it does not seem.
    Any other ideas?
    Thanks for your help.
    Andreas

  • Vendor balance shows discrepancy between S_ALR_87012082 and FAGLB03.

    Dear expert,
    These 2 reports currently shows discrepancy in balance.
    I came to know S_ALR_87012082  report ( vendor balance in local currnecy) has more vendor records than FAGLB03.
    Namely, some of vendors are not displaying in FAGLB03 but showing S_ALR_87012082 .
    Could you inspire me why this problem arised and how to fix it?
    Is it related to balance carry forward something?
    where should i doubt?
    Sincerely,
    J.
    Edited by: Jimmy Choi on Jan 3, 2011 5:51 PM

    If you do not see balance carryforward amounts in FAGBL03 are you using all vendor Recon accounts?

  • Vendor balance differencess urgent

    Hi  Sap gurus,
    In our company we r facing one problem
    For year end closing actives one is carriforworded balances last year to this yaear.
    all vendors balancess is correct but one vendor balance is in correct
    The problem is last year balnce is 60 rs that balance we carri forwordeed to this year
    but it displaying wrong balance 48120 but here one mistery is there when ever we double click this 48120  the total amount is showing 60 rs
    for this problem any one having solution or sap note  plz explain me
    for good answer i will assign points
    Thanks
    Jyotsna
    Edited by: jyotsna devi on May 23, 2008 8:02 AM

    Hi
    SAP Note 637554 is not dependant on any patch level, hence you can check this note once, whereas the chances of this note solving your problem is remote.
    Also I hope  you would have checked the closing balance of last year for this account and satify that it is 60 only.
    Also refer SAP 402917.
    If in vain, I feel that you better create a OSS message with SAP.
    Regards

  • Vendor balance mismatch

    We have a custom liability report that shows the list of all the open items for all the vendors for the given dates. The problem is that for one of the vendors, the standard SAP vendor balance is not equal to the balance that shows on the liability report. Could any of you shed light on why this might be happening? Can you give me some advise on how to approach and dissect this problem?
    Any help on this is really appreciated. Thanks in advance.

    Hi, Where from do you read the open items in your custom program? I hope it is BSIK. Please check if the field "Open at key date" in FBL1N is the same date criteria you provide in your custom program. Hope this helps.
    Edited by: Lakshmi Aparna on Oct 14, 2009 5:06 PM
    Edited by: Lakshmi Aparna on Oct 14, 2009 5:07 PM

  • Runtime error - FBL1N - vendor balance with customer line item

    Hi gurus,
    One scenario where i have assign vendor as customer & customer as vendor in vendor & customer data. also make tick mark for both clearing with vendor & customer.
    when i see the customer report with vendor item it shows me the customer & vendor dues but when i tried to see the vendor balance with customer line item it gives dump error.
    Runtime Errors         PERFORM_NOT_FOUND
    Exception              CX_SY_DYN_CALL_ILLEGAL_FORM
    Error analysis
        An exception occurred that is explained in detail below.
        The exception, which is assigned to class 'CX_SY_DYN_CALL_ILLEGAL_FORM', was
         not caught in
        procedure "%_LDB_CALLBACK" "(FORM)", nor was it propagated by a RAISING clause.
        Since the caller of the procedure could not have anticipated that the
        exception would occur, the current program is terminated.
        The reason for the exception is:
        The program "RSDBRUNT" is meant to execute an external PERFORM,
        namely the routine "CB_DDF_GET_KNA1 " of the program "RFITEMAP ", but
        this routine does not exist.
        This may be due to any of the following reasons:
        1. One of the programs "RSDBRUNT" or "RFITEMAP " is currently being developed.
        The name "CB_DDF_GET_KNA1 " of the called routine may be incorrect, or
        the routine "CB_DDF_GET_KNA1 " is not yet implemented in the program "RFITEMAP
        2. If the program SAPMSSY1 is involved in the runtime error, one of
        the function modules called via RFC is not flagged as remote-capable.
        (see Transaction SE37  Goto -> Administration -> RFC flag)
        3. There is an inconsistency in the system. The versions of the
        programs "RSDBRUNT" and "RFITEMAP " do not match.
    Warm regards,
    Dhananjay R.

    Hi martin
    still problem was not solved. actually i am working on ECC 6.0 & not required to implement the sap note on development. i had done the configuration in vendor master & customer master for clearing.
    please suggest me.....what to do ?
    Than'x
    Dhananjay R

  • Conflict in recording and filed mapping in LSMW For vendor balances

    Hi,
    I am trying to create an upload for vendor initial balances upload through f-02. now while creating a simple invoice i have to give input in following fields:
    1) Document date
    2) Document type
    3) Company Code
    4) Posting Date
    5) Posting Key
    6) Account
    7) Amount
    8) Base line date
    9) Posting Key
    10) Account
    11) Amount
    This is the sequence in which following transaction is posted:
    Initial Balance Upload Account      Dr
                                                           Vendor Cr
    Now every thing is fine. after recording the system shows me the exact fields that i gave input during my recording. but when i go for further, in step 5 (Maintain Field Mapping and Conversion Rules) I can not find  fields from step 9 to 11. i further found that this is because the input fields 9 to 11 are exactly same as 5 to 7. this is why system removes them considering them to be a duplication. can anyone help me in this regards and tell me how can we create vendor balance upload through f-02?
    Regards,

    Solved any one facing the same problem can view the solution bellow:
    I was right about system behavior. what system do is it excludes all duplication of fields. to fix this all you have to do is change the names of your fields after recording so that system can consider them to be separate fields.

  • Open items not displaying in vendor balances

    Dear All,
    I would like to say that I am facing one problem related to open items are not displaying in vendor balances. So for that purchase order created, MIGO & MIRO has made for particular vendor. After that in vendor balances open item is not displaying, for that purpose my client was unable to process make payment to vendor. so plz guide me how to solve this issue.
    Regards,
    RAJA

    Hi Raja,
    1.have you checked whether accounting document got generated first you need to check for this transation code FB03 for Accounting docuement display.
    2. have you checked for GR/IR account line item wise wheter it is showing lineitem wise bal. or not.?
    3. have you checked for whether system has Stored table level or not .? Check for this table-BSIK Vendor openitem.
    4. when you checking for Line item Selection under Openitem  Open at key will be there try to update when invoice docuemt got posted.
    5. you need to activite Type under 1.Normalitem2.Noted item 3.parked item .
    please check for this 5 point still you facing any problem please let me know.
    Regards,
    Upendra.

  • Customisation for business area in vendor balances

    Hello friends,
    what is the customisation tht needs to be configured to make business area option available in dynamic selection tab in vendor balances report like f.42
    I want to show business area wise vendor balances report.
    Pls let me knw the path to do it.
    Thanks
    Sunny

    I am also facing the same problem. I need business area wise vendor balances. However as a temporary solution, I have used
    S_ALR_87012079 - Transaction Figures: Account Balance for the business area wise transactions to ascertain the business areawise balances.

  • Vendor balance display (fk10n)

    hi gurus,
    i have a problem in transactions fk10n(vendor balance display) there are three i/p fields 1-vendor,2-company code 3-fiscal year,
    my task is that i have to add one more field plant code so that our display is shown according to plant code also.
    so pls guide me how to i proceed .
    regards
    Anuj jain

    thanx

  • Vendor balance confirmation form.

    Hi Experts,
    I want to change the vendor balance confirmation form.
    The form is F130_CONFIRM_01 .I have copied this form and changed according to my requirment and
    now i attatched it to the program . Here i have to display on total vendor balance(cumilitive amount) in
    digit and words also but i am not getting the total vendor balance
    I am designing only one page in script i am using 3 windows only
    Header, Address, and Main Windows The page Layout come correctly
    but I will run F18 tcode i am selecting single vendor only first Header address and main correctly come but secound page will
    come  In secound page Header and address will come
    How to solve this problem ?
    Thanks.
    Suresh

    Hi   shelly Malik
       Thanks for your reply
               In my Script only one page only
    Thanks
    Suresh

  • Payable to the bank gets multiplied in the vendor balance

    HI SAP GURUS
    My problem is there are several employees who have taken loan from Bank of Maharashtra. The EMI for them is to be deducted from the salary and paid to the bank. This linkage has been done. The deductions from employee salary are correct. The report is also correct. However , the payable to the bank gets multiplied in the vendor balance. Please suggest why the payable to the bank gets multiplied in the vendor balance . This creates a problem because every month this excess amount has to be neutralized.

    Hi,
    While defining the GL Account in Financial Statement Version, check box for Debit balance under Current Assets and Credit check box under current liability.  We can define one GL Account twice in Financial statement version.
    Customer when takes the report with tcode: F.01 using the financial statement version, the account will appear based on its balance as required.
    Hope this resolves the query.
    Thanks & Regards,
    Harish

Maybe you are looking for