Deducting leave quota for multiple lates in a month

Hi Experts,
I am working on a Positive Time implementation and I am facing problem with one of the clientu2019s requirement. If an employee is late for more than 3 times in a single month (not necessarily consecutive) then his leave quota should be deducted (Priority: 1)CL  2) SL) by 0.50. I donu2019t have any idea about the same. Kindly help me on priority
Thanks in Advance.

Hi,
There isn't much config settings that you can do to achieve this. You will have to go with modification of schema TM00 and write PCRs in the same to implement this working time policy.
You need to write a PCR that compares the actual In time of the employee with his planned working time and store the difference in a time type.
Check if this time type value is more than permissible late coming for each working day.
If it is more..update a counter time type. then is the counter time type's value is more than 3 write a PCR to deduct value from CL / SL quota which ever is available.
Hope this helps.
Regards,
Shreyasi.

Similar Messages

  • HELP: Customizing ESS Leave Request for multiple entries in one submission

    Hi experts,
    I appreciate help on this urgent problem. We're on ECC6 with EP7. My customization requirements are below:
    1) Allow multiple leave entries to be submitted at one go. Standard ESS only allows one date range entry per submission. We've customized the Webdynpro Leave request form to allow multiple entries in table form.
    Assuming there's 3 requests:
    R1 ~ 01-Oct-2007
    R2 ~ 03-Oct-2007
    R3 ~ 05-Oct-2007
    Whenever user clicks 'New Entry' button, Webdynpro will call bapi PT_ARQ_REQUEST_PREPARE to generate a new request ID.
    When user clicks on 'Review' button, I will loop at the requests internal table and check each of the entries, which is an individual request, via BAPI PT_ARQ_REQUEST_CHECK. Am I doing correctly so far?
    The checks return no error. Next comes the problem. When I click the 'Send' button, I will loop at the request IDs (in ascending order) into BAPI PT_ARQ_REQUEST_EXECUTE. I will get a dump, saying that the object cannot be found. Debugging shows that it cannot find the first request ID (R1) in the memory. I found that if I sort the request IDs in descending order, it will be able to find the last request (R3) and could process it. However, when it comes to the 2nd last request (R2), it will give me the same dump saying that object can't not found. Both R1 and R2 cannot be found whereas only R3 can be found.
    In overview, the logic we adopted is like this:
    1) PT_ARQ_REQUEST_PREPARE-CREATE (R1)
    2) PT_ARQ_REQUEST_CHECK (R1) upon clicking 'New Entry' Button
    3) PT_ARQ_REQUEST_PREPARE-CREATE (R2)
    4) PT_ARQ_REQUEST_CHECK (R2) upon clicking 'New Entry' Button
    5) PT_ARQ_REQUEST_PREPARE-CREATE (R3)
    6) PT_ARQ_REQUEST_CHECK (R1, R2, R3) upon clicking 'Review' Button
    7) Loop PT_ARQ_REQUEST_EXECUTE ( R3 - Returns OK, R2 - Returns object not found and terminates, R1 - not processed because execution terminated by R2).
    Can anyone please advise me how I should go about changing the BAPIs? Or are the CLASSes/BADIs to be changed?
    <b>Points will be rewarded for helping with this urgent requirement.</b> Thank you.
    Regards,
    Damien

    Hi Kiran,
    Thanks for replying. My guess initially was also that the requests are overwritten.
    I heard of another company's implementation who did the same concept and was able to do it. Unfortunately, I'm unable to get any information from them.
    Initially, my frontend programmer and I thought of adopting the 'dummy checks' methodology. i.e. Do dummy checks when clicking 'New entry' or 'Review' button. This is to ensure that the entries were entered correctly at front end. Only when the user clicks on the 'Send' button, my BAPIs take in a table of request entries and perform the Request_Prepare&Request_Check&Request_Execute one at a time.
    This may be expensive as there will be double the processing needed. One set for dummy checks and one set for the actual backend processing.
    Is there any way that I can create multiple requests in 'transcient' state so that it won't be overwritten and I can still find it when I call the BAPI PT_ARQ_PREPARE_EXECUTE? PT_ARQ_PREPARE_EXECUTE only takes in request IDs instead of request structures.
    Thanks again, Kiran, for replying. Have a good weekend.
    Regards,
    Damien

  • Error while generating the annual leave quota.

    Hi All,
    For all the employee group's for the past 2 years we are generating the Annual leave quota.
    For one employee group, management decided not to give annual leave quota. i have done the necessary configuration so that the quota will not get generated for them.
    For the new employees quota is not getting generated.
    For the old employees i have deleted the annual leave absence quota and run PT60. For these employees system is throwing the following error.
        Error entry no. 83 Error when creating absence quota
         General information
         Rule: 000 quota type 00
        No quota type for key 7 99 01 20110930
    Please suggest the solution.
    Thanks & Regards,
    Sumathi.

    Hi ERP12345,
    This is for employee Group,
    We have 2 employee groups, 1. Permanent
                                                    2. Contract
    For all the contract employees, we have generated the annual leave quota for the past 2 years.
    Now management doesn't want any annual leave quota to be generated for this particulat employee group. so i have deleted all the configuration related to this employee group from base entitlement, accrual of quota generation, deduction rule,selection rule & couting rule.
    When i am hiring a new empoyee the quota is generating correctly, means annual leave quota is not generating, remaining leaves are generating.
    Is it a right way of doing, normally if this is the scenario, what we have do to,
    For the old employees, after deleting the 2006 IT also, system if thwoing the error as i mentioned in my first conversation.
    Please suggest.
    Thanks & Regards,
    Sumathi.

  • Leave Quota generation with diifferent rules for different countries

    Hi,
    I have the following requirement need help in achieving this.
    Employers must grant 10 days paid leave to employees that worked for six consecutive months from the time of hiring and who worked on not less than 80 per cent of all schedule work days. This paid leave may be taken consecutively or separately. Where an employee's application to take paid leave will hinder the normal business operations, the employer may require the employee to take such paid leave at a different time.
    The number of days of paid leave available to employees increases in proportion to employees' length of service as set forth in the below table.
    Years of Service  0.5  1.5  2.5  3.5   4.5   5.5   6.5+
    Paid Holidays         10    11  12   14    16    18    20
    The right to annual paid leave expires after two years. In other words, annual paid leave left over from one year may be carried over and taken the next year only. For example, if an employee is awarded 10 days paid leave after their first 6 months of employment; those paid holidays will become invalid after 2.5 years of employment. Use them or lose them.
    Simply put, holidays from one year can be carried over to the next year, but not to the third year. So, if you don't take your leave from one particular year within 12 months of that year ending, you will lose that first year's allowance.
    Employee can take leave encashment of holiday leave only when leaving their employer. It is not legal for companies to buy up the holiday leave of those still working for the firm.
    In my organization one PSG grouping has been used for all countries, it wont be possible to change the grouping now. In such a case how can we provide different rule for different country without customizing the Leave module.
    Do we have to use any PCR for this, if yes which??
    Regards,
    Jailakshmi
    Edited by: Jailakshmi on Aug 3, 2011 7:16 AM

    Hi,
    Use QUOMO Feature to give different entitilement to employees.
    Leave entitlement as per seniority can be configured in base entitlement.
    Keep validity and deduction period for 2 years by using :Relative postion" option in validity and deduction period table.
    Rgds,
    Lata
    Rgds,

  • Absences not deducted from Absence Quota for One Employee

    Dear Friends,
    I am facing an issue for one employee, when I recorded an Annual Leave absence to him, it is not updated in his Absence quotas infotype. But this is working fine for all other employees in the same employee group/subgroup grouping.
    But for Sick Leave absence type, it is updating in his absence quota records...
    I have checked the counting rules, deduction rules, base entitlement rules and other configuration settings.......It is fine and for other employees belonging to the same grouping, it is working fine, except this employee...
    I couldn't understand what will be the reason? Can anyone shed light on this issue?
    Thanks in advance,
    Sai Narayana,
    SAP Functional Consultant.

    Hi JS,
    I am checking the absence is deducted or not from his entitlement in the infotype 2006 after running the payroll for that month......
    The employee has taken leave on last month and the payroll is also run for that month.......This Absence is not deducted from his quota......
    I have checked for another employee in this department, no error/issue with that employee.......Only with this employee I am facing problem.....
    I found -
    1. The Absence Quota balance which is present in Infotype 2006 is not the same which is displayed in Remuneration Statement ( leave balance is displayed in payslip for every employee)
    2. Annual leave is not deducted from the employee's entitlement where as sick leave is deducted. I have checked the deduction rule too for this grouping, it is right.No issues in that.
    3. Absence Quota generation also produced different results when run time evaluation thru PT60.....which is not according to the entitlement to this employee grouping that too for this employee only.
    Or Friend, can you tell me some other option, to overcome this issue.....instead of repairing this all the time.......
    Thanks,
    Sai

  • Reg: wrong payment for leave quota

    Hi,
    Have a query on Employee leave quota. Employee separated with negative leave of almost 50 hrs. But got paid for this negative hrs in her first pay of rehire. what is the resolution?
    Regards,
    veena

    check the operations that were used for seaparation in V_T588D
    there u need to delimit the infotypes
    later on run the action Rehire with the same personal number

  • Holiday as Working day - Marked as leave is not deducting from Quota

    Hi Experts,
    Please help me with below mentioned scenario.
    We have one holiday calendar for two personnel areas however holidays are different in both personnel areas, and as it is middle of year so I can't create a new holiday calendar for other personnel area so we maintain special day as working day in factory calendar to change holiday as working day for one personnel area.
    Holiday Calendar :- HA (haryana) ,                      Personnel Area (A)           Personnel Area (B)
    Holidays :-     25th Till 28th Oct Diwalii,                25th till 28 Holiday             26 & 27 Holiday only (25 & 28 working in special day rule)
    Issue :- personnel area (B) Now if Employee is getting leave for 25th (which is holiday in calendar and maintained as working day in special day rule) it is not deducting leave from quotas.
    Issue :- Half Employee on 25th are marked as Holiday (HH) in system however half have Absent (AA) in report.
    **(Should I try to make a deduction rule and counting rule for 25th & 28th as it is holiday & working togather... if yes thn what needs to be selected in counting rule)**
    Please provide inputs in this regards as it is urgent.
    Thanks you!!
    Anshul

    Hi Swapnil,
    Thanks man, I understood now, Yes you are right as but it is not working when I am trying to solve this issue after maintaining IT 2003. Now I have to go with second solution however I made Counting rule and deduction rule but facing issue assigning counting rule to Absence Type so the question is Do i need to make new absence type then counting rule and deduction rule or I can just make a counting rule and assign it to the existing Absence type?????
    Please help me through the process as I am little confused, just explain a bit like.. I need to make counting rule and assign it from <so & so> place.
    Thank you so much for your precious time,
    Anshul Upadhyay

  • Generation of Annual Leave Quota at a time for the whole  year

    Hi All,
    Kindly give some suggestions.
    I am working on Time evaluation. We have a quota , Annual leave which is now given on monthly basis, means lets 12 annual leave are for whole year and employee are getting 1 leave on each month.
    Now  my requirement is to give this quota at a time in the start of every year. That means all the 12 annual leave should be generated in the start of a year.
    When I select the option no pro rata calculation then I am getting all this leave in the start of the year. But when an employee is joined in the mid of the year then also 12 leave is been generated which is not correct.
    Please suggest me how to make this leave as prorated so that for new joinee , this leave is generated taking into account the period and generate the prorate value for the whole year at the time of joining.
    Thanks
    Tanuja.

    Hi Sikinder,
    I am using + time evaluation Status-2. We have to generate quota in PT60 for each period.
    Write now we are getting annual leave quota getting generated in monthly basis. We want to genarate whole quota  for the  year in the 1st month of the year.
    When I have given calender year in the accrual period , i am not getting any quota in the 1st month rather getting the whole quota in the end of the year.
    Please suggest me what to do.
    Regards,
    Tanuja.

  • Error in generating quota for unpaid leaves

    hello gurus,
    I have 3 Absence Quotas - (1) Annual Leave    (2) Long Service Leave     (3) Sick Leave
    I have attached the same reduction rule for all 3 abs quotas
    I generated Leave without pay for a day in the month of May 2011.
    When generating quotas for May 2011 for Annual & Sick Leave its generating for 30 days but for Long Service Leave its generating for 31 days
    Any idea how the quota generation goes wrong only for Long Service Leave ??
    pls help!!
    rgds,

    0Requid :187.98
    what was this request ID...
    go to RSRQ and give the request ID and execute...it gives the load monitor...
    chk the load to which it belongs to either master or transaction...
    if it belongs to master...then try to find the object to which it was loaded...and schedule the change run for the same object....
    rgds,

  • No Quota for employee in EP- Leave Request error

    I am facing an issue with one employee.
    This employee is having a lot of quotas for all the absence types in R/3. However in EP when he goes to 'Quota Overview', it shows that the table is empty, and the dropdown list also does not contain any leave.
    When he clicks on 'Leave Request' there comes an error
    Critical Error
    +A critical error has occured. Processing of the service had to be terminated. Unsaved data has been lost.     +
    +Please contact your system administrator.     +
    java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
                    at java.util.ArrayList.RangeCheck(ArrayList.java:507)
                    at java.util.ArrayList.get(ArrayList.java:324)
                    at com.sap.aii.proxy.framework.core.JcoBaseList.get(JcoBaseList.java:268)
                    at com.sap.aii.proxy.framework.core.AbstractList.get(AbstractList.java:230)
                    at com.sap.tc.webdynpro.modelimpl.dynamicrfc.DynamicRFCList.get(DynamicRFCList.java:281)
                    at com.sap.tc.webdynpro.progmodel.context.Node$ModelElementList.getElement(Node.java:2549)
                    at com.sap.tc.webdynpro.progmodel.context.Node.getElementAtInternal(Node.java:621)
                    at com.sap.tc.webdynpro.progmodel.context.Node.setLeadSelection(Node.java:753)
                    at com.sap.xss.hr.lea.form.FcForm.setLeadSelectionForSubtype(FcForm.java:700)
                    at com.sap.xss.hr.lea.form.FcForm.setVisibility(FcForm.java:943)
                    at com.sap.xss.hr.lea.form.FcForm.prepareCommand(FcForm.java:308)
                    at com.sap.xss.hr.lea.form.wdp.InternalFcForm.prepareCommand(InternalFcForm.java:2041)
                    at com.sap.xss.hr.lea.form.FcFormInterface.prepareCommand(FcFormInterface.java:116)
                    at com.sap.xss.hr.lea.form.wdp.InternalFcFormInterface.prepareCommand(InternalFcFormInterface.java:1887)
                    at com.sap.xss.hr.lea.form.wdp.InternalFcFormInterface$External.prepareCommand(InternalFcFormInterface.java:1983)
                    at com.sap.xss.hr.lea.form.edit.VcFormEdit.onInit(VcFormEdit.java:299)
                    at com.sap.xss.hr.lea.form.edit.wdp.InternalVcFormEdit.onInit(InternalVcFormEdit.java:1084)
                    at com.sap.xss.hr.lea.form.edit.VcFormEditInterface.onInit(VcFormEditInterface.java:165)
                    at com.sap.xss.hr.lea.form.edit.wdp.InternalVcFormEditInterface.onInit(InternalVcFormEditInterface.java:204)
                    at com.sap.xss.hr.lea.form.edit.wdp.InternalVcFormEditInterface$External.onInit(InternalVcFormEditInterface.java:280)
                    at com.sap.pcuigp.xssfpm.wd.FPMComponent.doProcessEvent(FPMComponent.java:564)
                    at com.sap.pcuigp.xssfpm.wd.FPMComponent.doEventLoop(FPMComponent.java:438)
                    at com.sap.pcuigp.xssfpm.wd.FPMComponent.wdDoInit(FPMComponent.java:196)
                    at com.sap.pcuigp.xssfpm.wd.wdp.InternalFPMComponent.wdDoInit(InternalFPMComponent.java:110)
                    at com.sap.tc.webdynpro.progmodel.generation.DelegatingComponent.doInit(DelegatingComponent.java:108)
                    at com.sap.tc.webdynpro.progmodel.controller.Controller.initController(Controller.java:215)
                    at com.sap.tc.webdynpro.progmodel.controller.Controller.init(Controller.java:200)
                    at com.sap.tc.webdynpro.clientserver.cal.ClientComponent.init(ClientComponent.java:430)
                    at com.sap.tc.webdynpro.clientserver.cal.ClientApplication.init(ClientApplication.java:362)
                    at com.sap.tc.webdynpro.clientserver.session.ApplicationSession.initApplication(ApplicationSession.java:756)
                    at com.sap.tc.webdynpro.clientserver.session.ApplicationSession.doProcessing(ApplicationSession.java:291)
                    at com.sap.tc.webdynpro.clientserver.session.ClientSession.doApplicationProcessingPortal(ClientSession.java:733)
                    at com.sap.tc.webdynpro.clientserver.session.ClientSession.doApplicationProcessing(ClientSession.java:668)
                    at com.sap.tc.webdynpro.clientserver.session.ClientSession.doProcessing(ClientSession.java:250)
                    at com.sap.tc.webdynpro.clientserver.session.RequestManager.doProcessing(RequestManager.java:149)
                    at com.sap.tc.webdynpro.clientserver.session.core.ApplicationHandle.doProcessing(ApplicationHandle.java:73)
                    at com.sap.tc.webdynpro.portal.pb.impl.AbstractApplicationProxy.sendDataAndProcessActionInternal(AbstractApplicationProxy.java:860)
                    at com.sap.tc.webdynpro.portal.pb.impl.AbstractApplicationProxy.create(AbstractApplicationProxy.java:220)
                    at com.sap.portal.pb.PageBuilder.updateApplications(PageBuilder.java:1288)
                    at com.sap.portal.pb.PageBuilder.createPage(PageBuilder.java:355)
                    at com.sap.portal.pb.PageBuilder.init(PageBuilder.java:548)
                    at com.sap.portal.pb.PageBuilder.wdDoRefresh(PageBuilder.java:592)
                    at com.sap.portal.pb.PageBuilder$1.doPhase(PageBuilder.java:864)
                    at com.sap.tc.webdynpro.clientserver.window.WindowPhaseModel.processPhaseListener(WindowPhaseModel.java:755)
                    at com.sap.tc.webdynpro.clientserver.window.WindowPhaseModel.doPortalDispatch(WindowPhaseModel.java:717)
                    at com.sap.tc.webdynpro.clientserver.window.WindowPhaseModel.processRequest(WindowPhaseModel.java:136)
                    at com.sap.tc.webdynpro.clientserver.window.WebDynproWindow.processRequest(WebDynproWindow.java:335)
                    at com.sap.tc.webdynpro.clientserver.cal.AbstractClient.executeTasks(AbstractClient.java:143)
                    at com.sap.tc.webdynpro.clientserver.session.ApplicationSession.doProcessing(ApplicationSession.java:321)
                    at com.sap.tc.webdynpro.clientserver.session.ClientSession.doApplicationProcessing(ClientSession.java:684)
                    at com.sap.tc.webdynpro.clientserver.session.ClientSession.doProcessing(ClientSession.java:250)
                    at com.sap.tc.webdynpro.clientserver.session.RequestManager.doProcessing(RequestManager.java:149)
                    at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doContent(DispatcherServlet.java:62)
                    at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doPost(DispatcherServlet.java:53)
                    at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
                    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
                    at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:401)
                    at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:266)
                    at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:386)
                    at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:364)
                    at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:1039)
                    at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:265)
                    at com.sap.engine.services.httpserver.server.Client.handle(Client.java:95)
                    at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:175)
                    at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
                    at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
                    at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
                    at java.security.AccessController.doPrivileged(Native Method)
                    at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:102)
                    at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:172)
    Any suggestion regarding this?

    When Quotas table is empty then customisation is missing for his ESG AND PSG in v_t556a_web
    check his groupings from It2006 overview and maintain those in above for his rule group
    java dump :
    Please can you check if the Pernr used
    has correct information like It0105 etc, also the rules are
    correctly defined.
    For the Employee, First of all check the Period Work Schedule also
    the Quotas of the pernr needs to maintained in 2006, Please do
    this customisation and it should solve the issue.
    Maintain the absence quota in the IT2006 and then try once.
    Also make sure that the Settings in Webmo and PTARQ etc all is done
    The pernr belongs to the a Rule and have absences defined for him.

  • In an eMail message, when I attempt to save two photos by clicking the 'Save 2 Images' link, not the 'Save Image' link, the images are not saved. (I use I I apologize for the late notice, butOS7 on IPhone5). Is this feature broken?

    In an eMail message, when I attempt to save two photos by clicking the 'Save 2 Images' link, not the 'Save Image' link, the images are not saved. (I use I I apologize for the late notice, butOS7 on IPhone5). Is this feature broken?

    Please don't post the same question multiple times!

  • Issue while creating Absence Quota for one employee

    Hi Friends,
    Our customer has a weird issue. When time evaluation is run, One Absence Quota type (Leave in Bank) is not getting generated for Only One Employee.
    This leave type has been updated with quota in IT 2006 after running PT60 for all other employees in the PA. The issue is only with one employee.
    This absence quota is assigned "Increase" in table V_556A_B (Permit Generation of Quotas in Time Evaluation)
    Can any one please suggest how to generate the missing quota for this employee. Thank you !!

    Hi
    Thanks for your replies !!
    Please find the screenshots attached.
    Leave in Bank Absence type which is valid for 2014 is missing in IT 2006 instead This absence quota valid upto 31.12.9999 is present.
    Current requirement is to remove the quota which is valid upto 31.12.9999 and replace the quota which is valid upto 31.12.2014.
    I have checked for some PERNRs with same EG/ESG/PA/PSA combination. They have the absence quota valid upto 31.12.2014 Only.

  • Leave quota generation

    Hi Gurus,
    please help me in solving the following issue.
    12 leave quota is generated for the employees after they  had completed  working for 240 days (weekly-off and Public holiday's are excluded) and after that every 12 days of working days he will get one additional leave.
    we are using both Positive and negative Time Evolution and no CATS is used.
    how to do the configuration for the above ..please help me out.
    Akhil

    Hi,
    You have to use Postive time evaluation .. and can maintain dates for IT 19  after 240 days after joining dates and that date types u can have in the generation of Quota..
    Regards,
    Kapil Kaushal

  • Opening & closing balance for Multiple Vendors

    Hi Friends,
    I have an issue. This is my code.
    *& Report  ZVEN_OPEN_CLOSE_BAL
    REPORT  ZVEN_OPEN_CLOSE_BAL.
    *& Report  ZVEN_OPEN_CLOSE_BAL
    TABLES:lfa1,bsik.
    TYPES: BEGIN OF ty_bsik,
           bukrs TYPE bsik-bukrs,
           lifnr TYPE bsik-lifnr,
           augbl TYPE bsik-augbl,
           zuonr TYPE bsik-zuonr,
           gjahr TYPE bsik-gjahr,
           xblnr TYPE bsik-xblnr,
           belnr TYPE bsik-belnr,
           buzei TYPE bsik-buzei,
           blart TYPE bsik-blart,
           bldat TYPE bsik-bldat,
           budat TYPE bsik-budat,
           shkzg TYPE bsik-shkzg,
           dmbtr TYPE bsik-dmbtr,
    *       bal   TYPE char30,
           sgtxt TYPE bsik-sgtxt,
           END OF ty_bsik.
    TYPES: BEGIN OF ty_bsak,
           bukrs TYPE bsik-bukrs,
           lifnr TYPE bsak-lifnr,
           augbl TYPE bsak-augbl,
           zuonr TYPE bsak-zuonr,
           gjahr TYPE bsik-gjahr,
           belnr TYPE bsak-belnr,
           buzei TYPE bsik-buzei,
           budat TYPE bsak-budat,
           bldat TYPE bsak-bldat,
           xblnr TYPE bsak-xblnr,
           blart TYPE bsak-blart,
           shkzg TYPE bsak-shkzg,
           dmbtr TYPE bsik-dmbtr,
    *      shkzg1 TYPE bsak-shkzg,
           sgtxt TYPE bsak-sgtxt,
           END OF ty_bsak.
    TYPES: BEGIN OF ty_lfc1,
            lifnr TYPE lfc1-lifnr,
            bukrs TYPE lfc1-bukrs,
            gjahr TYPE lfc1-gjahr,
            umsav TYPE lfc1-umsav,
            END OF ty_lfc1.
    TYPES: BEGIN OF ty_all,
            lifnr TYPE bsik-lifnr,
            zuonr TYPE bsik-zuonr,
            xblnr TYPE bsik-xblnr,
            belnr TYPE bsik-belnr,
            hkont TYPE bseg-hkont,
            blart TYPE bsik-blart,
            ltext TYPE text20,
            bldat TYPE bsik-bldat,
            budat TYPE bsik-budat,
            opbal TYPE p DECIMALS 2,
            deb   TYPE p DECIMALS 2 ,"bsik-dmbtr,
            cre   TYPE p DECIMALS 2,"bsik-dmbtr,
            bal   TYPE p DECIMALS 2,
            augbl TYPE bsik-augbl,
            sgtxt TYPE bsik-sgtxt,
          END OF ty_all.
    TYPE-POOLS: slis.
    DATA:  t_layout   TYPE slis_layout_alv,
           s_fieldtab TYPE slis_fieldcat_alv,
           t_fieldtab TYPE slis_t_fieldcat_alv,
           wa_header TYPE slis_listheader,
           it_header TYPE  slis_t_listheader.
    DATA:it_bsik TYPE TABLE OF ty_bsik,
         it_bsak TYPE TABLE OF ty_bsak,
         it_all  TYPE TABLE OF ty_all,
         it_lfc1 TYPE TABLE OF ty_lfc1,
         it_t003 TYPE TABLE OF t003t,
         wa_bsik TYPE ty_bsik,
         wa_bsak TYPE ty_bsak,
         wa_all  TYPE ty_all,
         wa_lfc1 TYPE ty_lfc1,
         wa_t003 TYPE t003t.
    DATA:  gt_fldcat    TYPE slis_t_fieldcat_alv,
           gs_fldcat    TYPE slis_fieldcat_alv,
           gs_layout    TYPE slis_layout_alv,
           gv_save      TYPE c VALUE 'X'.
    types :BEGIN OF ty_bseg,
            BUKRS TYPE BUKRS,
            BELNR  TYPE BELNR_D,
            GJAHR  TYPE GJAHR,
            BUZEI  TYPE BUZEI,
            koart type koart,
            HKONT TYPE HKONT,
           END OF ty_bseg.
    DATA: it_bseg type TABLE OF ty_bseg,
          wa_bseg type ty_bseg.
      data t_balence TYPE TABLE OF BAPI3008_3 WITH HEADER LINE.
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS : s_lifnr FOR lfa1-lifnr,
                     s_bukrs FOR bsik-bukrs,
                     s_budat FOR bsik-budat OBLIGATORY.
    PARAMETERS : p_gjahr TYPE bsik-gjahr OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK b1.
    START-OF-SELECTION.
      PERFORM get_data.
      PERFORM process_data.
      PERFORM display.
    *&      Form  GET_DATA
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM get_data .
      break naidu.
      SELECT  bukrs
              lifnr
              augbl
              zuonr
              gjahr
              xblnr
              belnr
              buzei
              blart
              bldat
              budat
              shkzg
              dmbtr
              sgtxt FROM bsik
              INTO TABLE it_bsik
              WHERE lifnr IN s_lifnr AND
                    bukrs IN s_bukrs AND
                    budat IN s_budat AND
                    gjahr = p_gjahr .
      SELECT bukrs
             lifnr
             augbl
             zuonr
             gjahr
             belnr
             buzei
             budat
             bldat
             xblnr
             blart
             shkzg
             dmbtr
             sgtxt FROM bsak
             INTO TABLE it_bsak
             WHERE lifnr IN s_lifnr AND
                   bukrs IN s_bukrs AND
                   budat IN s_budat AND
                   gjahr = p_gjahr .
    if it_bsik is INITIAL and it_bsak  is INITIAL.
    *DATA  v_date type budat.
    *data :year(4),
    *      month(2),
    *      date(2).
    *  year  = s_budat-low+0(4).
    *  date  = s_budat-low+6(2).
    *  month = s_budat-low+4(2).
    *  month = month - 01.
    *CONCATENATE year month date INTO v_date .
    *  SELECT  bukrs
    *          lifnr
    *          augbl
    *          zuonr
    *          gjahr
    *          xblnr
    *          belnr
    *          buzei
    *          blart
    *          bldat
    *          budat
    *          shkzg
    *          dmbtr
    *          sgtxt FROM bsik
    *          INTO TABLE it_bsik
    *          WHERE lifnr IN s_lifnr AND
    *                bukrs in s_bukrs and
    *                budat eq v_date AND
    *                gjahr = p_gjahr .
    *  SELECT bukrs
    *         lifnr
    *         augbl
    *         zuonr
    *         gjahr
    *         belnr
    *         buzei
    *         budat
    *         bldat
    *         xblnr
    *         blart
    *         shkzg
    *         dmbtr
    *         sgtxt FROM bsak
    *         INTO TABLE it_bsak
    *         WHERE lifnr IN s_lifnr AND
    *               bukrs IN s_bukrs AND
    *               budat eq v_date AND
    *               gjahr = p_gjahr .
      CALL FUNCTION 'BAPI_AP_ACC_GETKEYDATEBALANCE'
        EXPORTING
          companycode        = s_bukrs-low
          vendor             = s_lifnr-low
          keydate            = s_budat-low
    *     BALANCESPGLI       = ' '
    *     NOTEDITEMS         = ' '
    *   IMPORTING
    *     RETURN             =
        TABLES
          keybalance         = t_balence
      endif.
    ENDFORM.                    " GET_DATA
    *&      Form  PROCESS_DATA
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM process_data .
      DATA:v_bal TYPE netpr.
      LOOP AT it_bsak INTO wa_bsak.
        wa_bsik-bukrs  =    wa_bsak-bukrs.
        wa_bsik-lifnr  =    wa_bsak-lifnr.
        wa_bsik-augbl  =    wa_bsak-augbl.
        wa_bsik-zuonr  =    wa_bsak-zuonr.
        wa_bsik-gjahr  =    wa_bsak-gjahr.
        wa_bsik-belnr  =    wa_bsak-belnr.
        wa_bsik-buzei  =    wa_bsak-buzei.
        wa_bsik-budat  =    wa_bsak-budat.
        wa_bsik-bldat  =    wa_bsak-bldat.
        wa_bsik-xblnr  =    wa_bsak-xblnr.
        wa_bsik-blart  =    wa_bsak-blart.
        wa_bsik-shkzg  =    wa_bsak-shkzg.
        wa_bsik-dmbtr  =    wa_bsak-dmbtr.
        wa_bsik-sgtxt  =    wa_bsak-sgtxt .
        APPEND wa_bsik TO it_bsik.
        CLEAR:wa_bsik.
      ENDLOOP.
      IF it_bsik IS NOT INITIAL .
        SELECT lifnr bukrs gjahr umsav
               FROM lfc1
              INTO TABLE it_lfc1 FOR ALL ENTRIES IN  it_bsik
              WHERE
                    lifnr  EQ it_bsik-lifnr AND
                    bukrs  EQ it_bsik-bukrs AND
                    gjahr  EQ it_bsik-gjahr.
        SELECT  * FROM t003t
          INTO TABLE it_t003
          FOR ALL ENTRIES IN it_bsik
            WHERE blart = it_bsik-blart AND
                  spras = 'EN'.
    *&Bindu........................................
          select bukrs  "Company Code
                 belnr  "Document Number
                 gjahr  "Fiscal Year
                 buzei  "Line item
                 koart  "Account Type
                 hkont  "General Ledger Account
            from bseg into TABLE it_bseg
                      FOR ALL ENTRIES IN it_bsik
                      WHERE belnr eq it_bsik-belnr and
                            bukrs in s_bukrs and
                            gjahr eq p_gjahr and
                            BUZEI eq it_bsik-buzei.
      ENDIF.
      SORT it_bsik BY lifnr.
      DATA:c,
            l_dmbtr type p DECIMALS 2.
    DATA:v1(15),
         v2(3).
    DATA:v_umsav(18).
    DATA v_fbal TYPE umsav.
      LOOP AT it_bsik INTO wa_bsik.
            READ TABLE it_lfc1 INTO wa_lfc1 WITH KEY lifnr = wa_bsik-lifnr
                                                 bukrs = wa_bsik-bukrs
                                                 gjahr = wa_bsik-gjahr.
        if sy-subrc = 0.
    at FIRST.
    v_umsav = wa_lfc1-umsav.
      SPLIT v_umsav at '.' INTO v1 v2.
          wa_all-LTEXT = 'Opening Balance'.
          IF v2+2(1) = '-'.
          wa_all-cre = wa_lfc1-umsav.
          ELSE.
            wa_all-deb = wa_lfc1-umsav.
          ENDIF.
           wa_all-bal = wa_lfc1-umsav.
           v_fbal = wa_all-bal.
    APPEND wa_all to it_all.
    CLEAR wa_all.
    endat.
    endif.
        AT NEW lifnr.
          c = 0.
        ENDAT.
        wa_all-lifnr = wa_bsik-lifnr.
        wa_all-zuonr = wa_bsik-zuonr.
        wa_all-xblnr = wa_bsik-xblnr.
        wa_all-belnr = wa_bsik-belnr.
        wa_all-blart = wa_bsik-blart.
        wa_all-bldat = wa_bsik-bldat.
        wa_all-budat = wa_bsik-budat.
    *&Bindu............
      READ TABLE it_bseg into wa_bseg WITH KEY belnr = wa_bsik-belnr
                                               buzei = wa_bsik-buzei."Bindu.......
    if sy-subrc = 0.
        wa_all-hkont = wa_bseg-hkont. "Bindu.....
    endif.
        IF wa_bsik-shkzg = 'S'.
          wa_all-deb = wa_bsik-dmbtr.
        ELSEIF wa_bsik-shkzg = 'H'.
          wa_all-cre = wa_bsik-dmbtr.
        ENDIF.
        READ TABLE  it_t003 INTO wa_t003 WITH KEY blart = wa_bsik-blart.
        IF sy-subrc = 0.
          wa_all-ltext = wa_t003-ltext.
        ENDIF.
    *    READ TABLE it_lfc1 INTO wa_lfc1 WITH KEY lifnr = wa_bsik-lifnr
    *                                             bukrs = wa_bsik-bukrs
    *                                             gjahr = wa_bsik-gjahr.
    *break naidu.
        IF sy-subrc = 0.
    *      IF c = 0.
    *        clear:l_dmbtr.
    *        wa_all-opbal = wa_lfc1-umsav.
    *        c = c + 1.
    *        IF wa_bsik-shkzg = 'S'.
    *          wa_all-bal =  wa_all-opbal + wa_bsik-dmbtr.
    *        ELSEIF wa_bsik-shkzg = 'H'.
    *          wa_all-bal =  wa_all-opbal - wa_bsik-dmbtr.
    *        ENDIF.
            l_dmbtr = wa_all-bal.
    *      ELSE.
    *          wa_all-bal =  l_dmbtr + wa_bsik-dmbtr.
    *        ELSEIF wa_bsik-shkzg = 'H'.
    *          wa_all-bal = l_dmbtr - wa_bsik-dmbtr.
    *        ENDIF.
          ENDIF.
    *  IF wa_bsik-shkzg = 'S'.
    *          wa_all-bal =  wa_all-opbal + wa_bsik-dmbtr.
    *        ELSEIF wa_bsik-shkzg = 'H'.
    *          wa_all-bal =  wa_all-opbal - wa_bsik-dmbtr.
    *        ENDIF.
    if v_fbal is NOT INITIAL.
    wa_all-bal = v_fbal + wa_all-deb - wa_all-cre.
    CLEAR:v_fbal.
    else.
    wa_all-bal = v_bal + wa_all-deb - wa_all-cre.
        ENDIF.
        wa_all-augbl = wa_bsik-augbl.
        wa_all-sgtxt = wa_bsik-sgtxt.
    *v_balance  = wa_all-bal.
    APPEND wa_all TO it_all.
    v_bal = wa_all-bal.
    CLEAR :wa_all.
    *& Closing Balence.................
        at last.
       wa_all-LTEXT = 'Closing Balance'.
    *      IF .
          wa_all-BAL = v_bal.
    APPEND wa_all to it_all.
    CLEAR wa_all.
    *      ENDIF.
    endat.
      ENDLOOP.
    ENDFORM.                    " PROCESS_DATA
    *&      Form  DISPLAY
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM display .
      DATA : ls_layout  TYPE  slis_layout_alv.
      PERFORM create_fldcat.
      ls_layout-expand_all = 'X'.
      ls_layout-colwidth_optimize = 'X'.
      ls_layout-expand_fieldname = 'X'.
      ls_layout-zebra = 'X'.
    if it_all is initial .
        wa_all-LTEXT = 'Opening Balance'.
        wa_all-bal = t_balence-LC_BAL.
        wa_all-lifnr = s_lifnr-low.
        APPEND wa_all to it_all.
        ENDIF.
      IF it_all IS NOT INITIAL.
            CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
          EXPORTING
            i_callback_program = sy-repid
            is_layout          = ls_layout
            it_fieldcat        = gt_fldcat
            i_save             = 'X'
          TABLES
            t_outtab           = it_all[]
          EXCEPTIONS
            program_error      = 1
            OTHERS             = 2.
      ELSE.
        MESSAGE 'There is no Data for the given selection screen' TYPE 'I' DISPLAY LIKE 'E'.
        LEAVE LIST-PROCESSING.
      ENDIF.
    ENDFORM.                    " DISPLAY
    *&      Form  CREATE_FLDCAT
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM create_fldcat .
      PERFORM : append_val USING 'LIFNR'       'IT_ALL' 'vendor'  '' '' 'X' ' '.
      PERFORM : append_val USING 'HKONT'       'IT_ALL' 'G/L Acc'  '' '' 'X' ' '.
      PERFORM : append_val USING 'ZUONR'       'IT_ALL' 'account'  '' '' '' ''.
      PERFORM : append_val USING 'XBLNR'       'IT_ALL' 'number'  '' '' 'X' ''.
      PERFORM : append_val USING 'BELNR'       'IT_ALL' 'ref no'  '' '' 'X' ''.
      PERFORM : append_val USING 'BLART'       'IT_ALL' 'type'  '' '' 'X' ''.
      PERFORM : append_val USING 'LTEXT'       'IT_ALL' 'type text'  '' '' 'X' ''.
      PERFORM : append_val USING 'BLDAT'       'IT_ALL' 'doc date'  '' '' 'X' ''.
      PERFORM : append_val USING 'BUDAT'       'IT_ALL' 'post date'  '' '' 'X' ''.
      PERFORM : append_val USING 'OPBAL'       'IT_ALL' 'op balance'  '' '' '' ''.
      PERFORM : append_val USING 'DEB'         'IT_ALL' 'debit' '' '' '' ''.
      PERFORM : append_val USING 'CRE'         'IT_ALL' 'credit'  '' '' '' ''.
      PERFORM : append_val USING 'BAL'         'IT_ALL' 'balance'  '' '' '' ''.
      PERFORM : append_val USING 'AUGBL'       'IT_ALL' 'clr doc'  '' '' 'X' ''.
      PERFORM : append_val USING 'SGTXT'       'IT_ALL' 'text '  '' '' 'X' ''.
    ENDFORM.                    " CREATE_FLDCAT
    *&      Form  APPEND_VAL
    *       text
    *      -->P_0578   text
    *      -->P_0579   text
    *      -->P_TEXT_010  text
    *      -->P_0581   text
    *      -->P_0582   text
    *      -->P_0583   text
    FORM append_val  USING    p_a
                              p_b
                              p_c
                              p_d
                              p_e
                              p_f
                              p_g.
      CLEAR gs_fldcat.
      gs_fldcat-fieldname  = p_a.
      gs_fldcat-tabname    = p_b.
      gs_fldcat-seltext_m  = p_c.
      gs_fldcat-qfieldname = p_d.
      gs_fldcat-datatype   = p_e.
      gs_fldcat-no_zero    = p_f.
      gs_fldcat-do_sum     = p_g.
      APPEND gs_fldcat TO gt_fldcat.
    ENDFORM.                    " APPEND_VAL
    This is working for single vendor.
    Now my problem is Opening & closing balance should be displayed for multiple vendors.
    Please suggest me.
    Thanks in advance.

    Hi Friends,
    I have an issue. This is my code.
    *& Report  ZVEN_OPEN_CLOSE_BAL
    REPORT  ZVEN_OPEN_CLOSE_BAL.
    *& Report  ZVEN_OPEN_CLOSE_BAL
    TABLES:lfa1,bsik.
    TYPES: BEGIN OF ty_bsik,
           bukrs TYPE bsik-bukrs,
           lifnr TYPE bsik-lifnr,
           augbl TYPE bsik-augbl,
           zuonr TYPE bsik-zuonr,
           gjahr TYPE bsik-gjahr,
           xblnr TYPE bsik-xblnr,
           belnr TYPE bsik-belnr,
           buzei TYPE bsik-buzei,
           blart TYPE bsik-blart,
           bldat TYPE bsik-bldat,
           budat TYPE bsik-budat,
           shkzg TYPE bsik-shkzg,
           dmbtr TYPE bsik-dmbtr,
    *       bal   TYPE char30,
           sgtxt TYPE bsik-sgtxt,
           END OF ty_bsik.
    TYPES: BEGIN OF ty_bsak,
           bukrs TYPE bsik-bukrs,
           lifnr TYPE bsak-lifnr,
           augbl TYPE bsak-augbl,
           zuonr TYPE bsak-zuonr,
           gjahr TYPE bsik-gjahr,
           belnr TYPE bsak-belnr,
           buzei TYPE bsik-buzei,
           budat TYPE bsak-budat,
           bldat TYPE bsak-bldat,
           xblnr TYPE bsak-xblnr,
           blart TYPE bsak-blart,
           shkzg TYPE bsak-shkzg,
           dmbtr TYPE bsik-dmbtr,
    *      shkzg1 TYPE bsak-shkzg,
           sgtxt TYPE bsak-sgtxt,
           END OF ty_bsak.
    TYPES: BEGIN OF ty_lfc1,
            lifnr TYPE lfc1-lifnr,
            bukrs TYPE lfc1-bukrs,
            gjahr TYPE lfc1-gjahr,
            umsav TYPE lfc1-umsav,
            END OF ty_lfc1.
    TYPES: BEGIN OF ty_all,
            lifnr TYPE bsik-lifnr,
            zuonr TYPE bsik-zuonr,
            xblnr TYPE bsik-xblnr,
            belnr TYPE bsik-belnr,
            hkont TYPE bseg-hkont,
            blart TYPE bsik-blart,
            ltext TYPE text20,
            bldat TYPE bsik-bldat,
            budat TYPE bsik-budat,
            opbal TYPE p DECIMALS 2,
            deb   TYPE p DECIMALS 2 ,"bsik-dmbtr,
            cre   TYPE p DECIMALS 2,"bsik-dmbtr,
            bal   TYPE p DECIMALS 2,
            augbl TYPE bsik-augbl,
            sgtxt TYPE bsik-sgtxt,
          END OF ty_all.
    TYPE-POOLS: slis.
    DATA:  t_layout   TYPE slis_layout_alv,
           s_fieldtab TYPE slis_fieldcat_alv,
           t_fieldtab TYPE slis_t_fieldcat_alv,
           wa_header TYPE slis_listheader,
           it_header TYPE  slis_t_listheader.
    DATA:it_bsik TYPE TABLE OF ty_bsik,
         it_bsak TYPE TABLE OF ty_bsak,
         it_all  TYPE TABLE OF ty_all,
         it_lfc1 TYPE TABLE OF ty_lfc1,
         it_t003 TYPE TABLE OF t003t,
         wa_bsik TYPE ty_bsik,
         wa_bsak TYPE ty_bsak,
         wa_all  TYPE ty_all,
         wa_lfc1 TYPE ty_lfc1,
         wa_t003 TYPE t003t.
    DATA:  gt_fldcat    TYPE slis_t_fieldcat_alv,
           gs_fldcat    TYPE slis_fieldcat_alv,
           gs_layout    TYPE slis_layout_alv,
           gv_save      TYPE c VALUE 'X'.
    types :BEGIN OF ty_bseg,
            BUKRS TYPE BUKRS,
            BELNR  TYPE BELNR_D,
            GJAHR  TYPE GJAHR,
            BUZEI  TYPE BUZEI,
            koart type koart,
            HKONT TYPE HKONT,
           END OF ty_bseg.
    DATA: it_bseg type TABLE OF ty_bseg,
          wa_bseg type ty_bseg.
      data t_balence TYPE TABLE OF BAPI3008_3 WITH HEADER LINE.
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS : s_lifnr FOR lfa1-lifnr,
                     s_bukrs FOR bsik-bukrs,
                     s_budat FOR bsik-budat OBLIGATORY.
    PARAMETERS : p_gjahr TYPE bsik-gjahr OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK b1.
    START-OF-SELECTION.
      PERFORM get_data.
      PERFORM process_data.
      PERFORM display.
    *&      Form  GET_DATA
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM get_data .
      break naidu.
      SELECT  bukrs
              lifnr
              augbl
              zuonr
              gjahr
              xblnr
              belnr
              buzei
              blart
              bldat
              budat
              shkzg
              dmbtr
              sgtxt FROM bsik
              INTO TABLE it_bsik
              WHERE lifnr IN s_lifnr AND
                    bukrs IN s_bukrs AND
                    budat IN s_budat AND
                    gjahr = p_gjahr .
      SELECT bukrs
             lifnr
             augbl
             zuonr
             gjahr
             belnr
             buzei
             budat
             bldat
             xblnr
             blart
             shkzg
             dmbtr
             sgtxt FROM bsak
             INTO TABLE it_bsak
             WHERE lifnr IN s_lifnr AND
                   bukrs IN s_bukrs AND
                   budat IN s_budat AND
                   gjahr = p_gjahr .
    if it_bsik is INITIAL and it_bsak  is INITIAL.
    *DATA  v_date type budat.
    *data :year(4),
    *      month(2),
    *      date(2).
    *  year  = s_budat-low+0(4).
    *  date  = s_budat-low+6(2).
    *  month = s_budat-low+4(2).
    *  month = month - 01.
    *CONCATENATE year month date INTO v_date .
    *  SELECT  bukrs
    *          lifnr
    *          augbl
    *          zuonr
    *          gjahr
    *          xblnr
    *          belnr
    *          buzei
    *          blart
    *          bldat
    *          budat
    *          shkzg
    *          dmbtr
    *          sgtxt FROM bsik
    *          INTO TABLE it_bsik
    *          WHERE lifnr IN s_lifnr AND
    *                bukrs in s_bukrs and
    *                budat eq v_date AND
    *                gjahr = p_gjahr .
    *  SELECT bukrs
    *         lifnr
    *         augbl
    *         zuonr
    *         gjahr
    *         belnr
    *         buzei
    *         budat
    *         bldat
    *         xblnr
    *         blart
    *         shkzg
    *         dmbtr
    *         sgtxt FROM bsak
    *         INTO TABLE it_bsak
    *         WHERE lifnr IN s_lifnr AND
    *               bukrs IN s_bukrs AND
    *               budat eq v_date AND
    *               gjahr = p_gjahr .
      CALL FUNCTION 'BAPI_AP_ACC_GETKEYDATEBALANCE'
        EXPORTING
          companycode        = s_bukrs-low
          vendor             = s_lifnr-low
          keydate            = s_budat-low
    *     BALANCESPGLI       = ' '
    *     NOTEDITEMS         = ' '
    *   IMPORTING
    *     RETURN             =
        TABLES
          keybalance         = t_balence
      endif.
    ENDFORM.                    " GET_DATA
    *&      Form  PROCESS_DATA
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM process_data .
      DATA:v_bal TYPE netpr.
      LOOP AT it_bsak INTO wa_bsak.
        wa_bsik-bukrs  =    wa_bsak-bukrs.
        wa_bsik-lifnr  =    wa_bsak-lifnr.
        wa_bsik-augbl  =    wa_bsak-augbl.
        wa_bsik-zuonr  =    wa_bsak-zuonr.
        wa_bsik-gjahr  =    wa_bsak-gjahr.
        wa_bsik-belnr  =    wa_bsak-belnr.
        wa_bsik-buzei  =    wa_bsak-buzei.
        wa_bsik-budat  =    wa_bsak-budat.
        wa_bsik-bldat  =    wa_bsak-bldat.
        wa_bsik-xblnr  =    wa_bsak-xblnr.
        wa_bsik-blart  =    wa_bsak-blart.
        wa_bsik-shkzg  =    wa_bsak-shkzg.
        wa_bsik-dmbtr  =    wa_bsak-dmbtr.
        wa_bsik-sgtxt  =    wa_bsak-sgtxt .
        APPEND wa_bsik TO it_bsik.
        CLEAR:wa_bsik.
      ENDLOOP.
      IF it_bsik IS NOT INITIAL .
        SELECT lifnr bukrs gjahr umsav
               FROM lfc1
              INTO TABLE it_lfc1 FOR ALL ENTRIES IN  it_bsik
              WHERE
                    lifnr  EQ it_bsik-lifnr AND
                    bukrs  EQ it_bsik-bukrs AND
                    gjahr  EQ it_bsik-gjahr.
        SELECT  * FROM t003t
          INTO TABLE it_t003
          FOR ALL ENTRIES IN it_bsik
            WHERE blart = it_bsik-blart AND
                  spras = 'EN'.
    *&Bindu........................................
          select bukrs  "Company Code
                 belnr  "Document Number
                 gjahr  "Fiscal Year
                 buzei  "Line item
                 koart  "Account Type
                 hkont  "General Ledger Account
            from bseg into TABLE it_bseg
                      FOR ALL ENTRIES IN it_bsik
                      WHERE belnr eq it_bsik-belnr and
                            bukrs in s_bukrs and
                            gjahr eq p_gjahr and
                            BUZEI eq it_bsik-buzei.
      ENDIF.
      SORT it_bsik BY lifnr.
      DATA:c,
            l_dmbtr type p DECIMALS 2.
    DATA:v1(15),
         v2(3).
    DATA:v_umsav(18).
    DATA v_fbal TYPE umsav.
      LOOP AT it_bsik INTO wa_bsik.
            READ TABLE it_lfc1 INTO wa_lfc1 WITH KEY lifnr = wa_bsik-lifnr
                                                 bukrs = wa_bsik-bukrs
                                                 gjahr = wa_bsik-gjahr.
        if sy-subrc = 0.
    at FIRST.
    v_umsav = wa_lfc1-umsav.
      SPLIT v_umsav at '.' INTO v1 v2.
          wa_all-LTEXT = 'Opening Balance'.
          IF v2+2(1) = '-'.
          wa_all-cre = wa_lfc1-umsav.
          ELSE.
            wa_all-deb = wa_lfc1-umsav.
          ENDIF.
           wa_all-bal = wa_lfc1-umsav.
           v_fbal = wa_all-bal.
    APPEND wa_all to it_all.
    CLEAR wa_all.
    endat.
    endif.
        AT NEW lifnr.
          c = 0.
        ENDAT.
        wa_all-lifnr = wa_bsik-lifnr.
        wa_all-zuonr = wa_bsik-zuonr.
        wa_all-xblnr = wa_bsik-xblnr.
        wa_all-belnr = wa_bsik-belnr.
        wa_all-blart = wa_bsik-blart.
        wa_all-bldat = wa_bsik-bldat.
        wa_all-budat = wa_bsik-budat.
    *&Bindu............
      READ TABLE it_bseg into wa_bseg WITH KEY belnr = wa_bsik-belnr
                                               buzei = wa_bsik-buzei."Bindu.......
    if sy-subrc = 0.
        wa_all-hkont = wa_bseg-hkont. "Bindu.....
    endif.
        IF wa_bsik-shkzg = 'S'.
          wa_all-deb = wa_bsik-dmbtr.
        ELSEIF wa_bsik-shkzg = 'H'.
          wa_all-cre = wa_bsik-dmbtr.
        ENDIF.
        READ TABLE  it_t003 INTO wa_t003 WITH KEY blart = wa_bsik-blart.
        IF sy-subrc = 0.
          wa_all-ltext = wa_t003-ltext.
        ENDIF.
    *    READ TABLE it_lfc1 INTO wa_lfc1 WITH KEY lifnr = wa_bsik-lifnr
    *                                             bukrs = wa_bsik-bukrs
    *                                             gjahr = wa_bsik-gjahr.
    *break naidu.
        IF sy-subrc = 0.
    *      IF c = 0.
    *        clear:l_dmbtr.
    *        wa_all-opbal = wa_lfc1-umsav.
    *        c = c + 1.
    *        IF wa_bsik-shkzg = 'S'.
    *          wa_all-bal =  wa_all-opbal + wa_bsik-dmbtr.
    *        ELSEIF wa_bsik-shkzg = 'H'.
    *          wa_all-bal =  wa_all-opbal - wa_bsik-dmbtr.
    *        ENDIF.
            l_dmbtr = wa_all-bal.
    *      ELSE.
    *          wa_all-bal =  l_dmbtr + wa_bsik-dmbtr.
    *        ELSEIF wa_bsik-shkzg = 'H'.
    *          wa_all-bal = l_dmbtr - wa_bsik-dmbtr.
    *        ENDIF.
          ENDIF.
    *  IF wa_bsik-shkzg = 'S'.
    *          wa_all-bal =  wa_all-opbal + wa_bsik-dmbtr.
    *        ELSEIF wa_bsik-shkzg = 'H'.
    *          wa_all-bal =  wa_all-opbal - wa_bsik-dmbtr.
    *        ENDIF.
    if v_fbal is NOT INITIAL.
    wa_all-bal = v_fbal + wa_all-deb - wa_all-cre.
    CLEAR:v_fbal.
    else.
    wa_all-bal = v_bal + wa_all-deb - wa_all-cre.
        ENDIF.
        wa_all-augbl = wa_bsik-augbl.
        wa_all-sgtxt = wa_bsik-sgtxt.
    *v_balance  = wa_all-bal.
    APPEND wa_all TO it_all.
    v_bal = wa_all-bal.
    CLEAR :wa_all.
    *& Closing Balence.................
        at last.
       wa_all-LTEXT = 'Closing Balance'.
    *      IF .
          wa_all-BAL = v_bal.
    APPEND wa_all to it_all.
    CLEAR wa_all.
    *      ENDIF.
    endat.
      ENDLOOP.
    ENDFORM.                    " PROCESS_DATA
    *&      Form  DISPLAY
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM display .
      DATA : ls_layout  TYPE  slis_layout_alv.
      PERFORM create_fldcat.
      ls_layout-expand_all = 'X'.
      ls_layout-colwidth_optimize = 'X'.
      ls_layout-expand_fieldname = 'X'.
      ls_layout-zebra = 'X'.
    if it_all is initial .
        wa_all-LTEXT = 'Opening Balance'.
        wa_all-bal = t_balence-LC_BAL.
        wa_all-lifnr = s_lifnr-low.
        APPEND wa_all to it_all.
        ENDIF.
      IF it_all IS NOT INITIAL.
            CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
          EXPORTING
            i_callback_program = sy-repid
            is_layout          = ls_layout
            it_fieldcat        = gt_fldcat
            i_save             = 'X'
          TABLES
            t_outtab           = it_all[]
          EXCEPTIONS
            program_error      = 1
            OTHERS             = 2.
      ELSE.
        MESSAGE 'There is no Data for the given selection screen' TYPE 'I' DISPLAY LIKE 'E'.
        LEAVE LIST-PROCESSING.
      ENDIF.
    ENDFORM.                    " DISPLAY
    *&      Form  CREATE_FLDCAT
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM create_fldcat .
      PERFORM : append_val USING 'LIFNR'       'IT_ALL' 'vendor'  '' '' 'X' ' '.
      PERFORM : append_val USING 'HKONT'       'IT_ALL' 'G/L Acc'  '' '' 'X' ' '.
      PERFORM : append_val USING 'ZUONR'       'IT_ALL' 'account'  '' '' '' ''.
      PERFORM : append_val USING 'XBLNR'       'IT_ALL' 'number'  '' '' 'X' ''.
      PERFORM : append_val USING 'BELNR'       'IT_ALL' 'ref no'  '' '' 'X' ''.
      PERFORM : append_val USING 'BLART'       'IT_ALL' 'type'  '' '' 'X' ''.
      PERFORM : append_val USING 'LTEXT'       'IT_ALL' 'type text'  '' '' 'X' ''.
      PERFORM : append_val USING 'BLDAT'       'IT_ALL' 'doc date'  '' '' 'X' ''.
      PERFORM : append_val USING 'BUDAT'       'IT_ALL' 'post date'  '' '' 'X' ''.
      PERFORM : append_val USING 'OPBAL'       'IT_ALL' 'op balance'  '' '' '' ''.
      PERFORM : append_val USING 'DEB'         'IT_ALL' 'debit' '' '' '' ''.
      PERFORM : append_val USING 'CRE'         'IT_ALL' 'credit'  '' '' '' ''.
      PERFORM : append_val USING 'BAL'         'IT_ALL' 'balance'  '' '' '' ''.
      PERFORM : append_val USING 'AUGBL'       'IT_ALL' 'clr doc'  '' '' 'X' ''.
      PERFORM : append_val USING 'SGTXT'       'IT_ALL' 'text '  '' '' 'X' ''.
    ENDFORM.                    " CREATE_FLDCAT
    *&      Form  APPEND_VAL
    *       text
    *      -->P_0578   text
    *      -->P_0579   text
    *      -->P_TEXT_010  text
    *      -->P_0581   text
    *      -->P_0582   text
    *      -->P_0583   text
    FORM append_val  USING    p_a
                              p_b
                              p_c
                              p_d
                              p_e
                              p_f
                              p_g.
      CLEAR gs_fldcat.
      gs_fldcat-fieldname  = p_a.
      gs_fldcat-tabname    = p_b.
      gs_fldcat-seltext_m  = p_c.
      gs_fldcat-qfieldname = p_d.
      gs_fldcat-datatype   = p_e.
      gs_fldcat-no_zero    = p_f.
      gs_fldcat-do_sum     = p_g.
      APPEND gs_fldcat TO gt_fldcat.
    ENDFORM.                    " APPEND_VAL
    This is working for single vendor.
    Now my problem is Opening & closing balance should be displayed for multiple vendors.
    Please suggest me.
    Thanks in advance.

  • Can I use the same Apple ID for multiple devices

    Can I use the same Apple ID for multiple devices?

    Yes. Up to five devices can be authorized on a single computer using the same Apple ID. You can also use the same Apple ID on multiple devices is they are all going to use the same iTunes Library by the same user. But it's ill-advised if multiple users are involved who wish to keep their devices separate from the devices belonging to other users.
    How to use multiple iPhone, iPad, or iPod devices with one computer
    Using More than One iDevice on the Same Computer
    This applies mainly to couples who are adding another device and do not want their email, messages, etc. being duplicated on both devices. To begin read: How to use multiple iPhone, iPad, or iPod devices with one computer. You need to establish a separate Apple ID and password for whomever will use the new iDevice. See Apple - My Apple ID and Frequently asked questions about Apple ID. The easiest way is to do this on the computer using iTunes: iTunes- How to set up an Apple ID within iTunes.
    On the computer create a new user account for the person with the new iDevice. This will be the user account that person will always use. He/She will no longer use the other user account. This way that person will have a separate iTunes Library
    Start by transferring the new device(s) to a new account along with all your data.  Save any photo stream photos that you want to keep to your camera roll (unless they are already in the camera roll) by opening your Photos app, tap on Albums icon at the bottom. Now, tap on My Photo Stream album; tap Select; tap on the photos you want to select;, tap the share icon (box with upward facing arrow) in the lower left corner; then tap Save to Camera Roll.
    If you are syncing notes with iCloud that you want to keep then you need to open each of your notes and email them to yourself. Later you can copy and paste the text into new notes created in your new account.
    Tap on Settings > iCloud > Delete Account (only deletes it from this device, not from iCloud; the person keeping the current account will not be affected,) provide the password to turn off Find My Phone and choose Keep on My iDevice when prompted.  Sign in with a different Apple ID to create your new account. Choose Merge to upload your data.
    Once you are on separate accounts, you can each go to icloud.com and delete the other person's data from your account.
    Note: The essence of the above was created by user, randers4. I
    have made substantial changes to improve readability and syntax.

Maybe you are looking for

  • Should I buy the Zen V Pl

    Hello everyone,?I'm looking for a new player that's compatible with Raphsody. I know the Zen V Plus is able to work with this program but has anyone ran into any problems or concerns that I should know of? My last player started having issues with Ra

  • Can we create a deep structure in RFC?

    Hi, My requirement is to create an RFC which has 3 output tables. out of which 1 table contains deep structure, but SAP is not allowing me to create an RFC with deep structure. Message shows only flat structures support in RFC. can any one tell is th

  • Custom logging in OSB

    I want to create a common proxy service in OSB which can be called by other services for logging body, fault etc. I intend to log to three different channels : File, Queue & Database. Now the approach is 1. While executing any OSB process, accept a "

  • SpryEffect Error, Element Not Found

    Hello, I am currently developing a web template which uses spry effects. However I have noticed that on random occasions I encounter a series of 4 errors. The first one states that an element on my webpage is not found, the second one states that the

  • Cannot open OLAP instance manager from oem

    When I tried to connect to the OLAP Service Instance Manager from OEM, I got the XPINSMGR-10565 and when i tried to start the olap service from control panel I spotted the error "......error 2"