ABAP Query on Recent Posting Date in G/L Account

Dear All
This is the new request that has come from the client. What they want to see is the G/L account and the most recent Posting Date. For eg Lets say that 220000 has 3 line items
1000 in march 06
2000 in april 06
3000 in may 06
End user wants to see Balance as 6000 and the most recent Posting date as may 06. If i Pull Accounting Doc # and Posting Date it will give me all the details and date which i dont really want. How do i do it ?
Please help me
Thanks
Sameer

Hi,
try table GLT0 (for Rel. 4.6C)
A.

Similar Messages

  • Abap Query on most Latest Posting Date in G/L Account

    Dear All
    This is the new request that has come from the client. What they want to see is the G/L account and the most recent Posting Date. For eg Lets say that 220000 has 3 line items
    1000 in march 06
    2000 in april 06
    3000 in may 06
    End user wants to see Balance as 6000 and the most recent Posting date as may 06. If i Pull Accounting Doc # and Posting Date it will give me all the details and date which i dont really want. How do i do it ?
    Please help me
    Thanks
    Sameer

    Hi,
    what we can do is that get all the line items for a G/L account in an internal table. Sort it descending by date. Pick the first row's date and then simply sum up the quantities.
    Hope this helps.
    Regards,
    Himanshu.

  • Report on most recent posting date

    Hi experts,
    My report needs to show the fields profit center and its posting date.posting date should have a selection variable for the user to enter a key date.The report should show only the last posting date for every profit center before the key date.
    my doubt is that the data in the infoprovider should be compared to get the last posting date. is it possible to read the data and get the recent posting date in the customer exit for the variable on posting date.
    Please suggest the possible ways of doing this.

    Hi Krishna,
    The recent posting date for the profit centre can not be stored as a transaction data in the cube and it can not be derived in the customer exit.
    You have to add a date field as the master data attribute of profit centre and populate that from the transaction cube data to get last posting date for each profit centre.
    You can then show is as the nav attaribute of profit centre in the report.
    Thanks,
    Krishnan

  • Query for todays Posting Date

    Currently my query is as follows, I want to create report that pulls produciton orders that are either planned or released where the post date is today...as my understanding getdate() does not work...may I get some assistance?
    SELECT T0.[DocNum], T0.[PostDate], T0.[DueDate], T0.[ItemCode], T0.[PlannedQty]
    FROM OWOR T0
    WHERE T0.[PostDate] = GetDate() AND
    T0.[Status] = 'p' OR
    T0.[Status] = 'r'
    Thank you
    Sarith

    Hi Sarith,
    Try:
    SELECT T0.DocNum, T0.PostDate, T0.DueDate, T0.ItemCode, T0.PlannedQty
    FROM OWOR T0
    WHERE DateDiff(dd,T0.PostDate,GetDate()) = 0 AND T0.Status in ('p','r')
    Thanks,
    Gordon

  • Posting data to g/l account

    hi all,
       i am trying to post data to gl account through trasaction FB01.
       so what are the general views required to be selected?
       can any one send the functional spec and coding in bdc .
       Thanks in advance.
      rgds
    umakanth
    [email protected]

    Hi umakanth,
    100 % agree to Arun.
    the following code my give you an idea as how to use the BAPI. Please be aware that this is sample code that must be understood and adapted to the specific needs of your environment.
    [code]
    *&      Form  post_diff
          post difference to notes account against technical
    FORM post_diff  CHANGING ps_alv_display   TYPE LINE OF ty_t_alv_display.
      STATICS:
        lv_logsys                             TYPE t000-logsys.
      DATA:
       lv_prctr                             TYPE prctr,
        lv_currency_iso                       TYPE isocd,
        ls_documentheader                     TYPE bapiache08,
        lv_obj_type                           TYPE bapiache02-obj_type,
        lv_obj_key                            TYPE bapiache02-obj_key,
        lv_obj_sys                            TYPE bapiache02-obj_sys,
        lt_accountgl                          TYPE TABLE OF bapiacgl08,
        ls_accountgl                          TYPE          bapiacgl08,
        lt_currencyamount                     TYPE TABLE OF bapiaccr08,
        ls_currencyamount                     TYPE          bapiaccr08,
        lt_extension1                         TYPE TABLE OF bapiextc,
        ls_extension1                         TYPE          bapiextc,
        lt_return                             TYPE TABLE OF bapiret2.
      CHECK:
        p_echt IS NOT INITIAL,
        ps_alv_display-diff_h                 <> 0.
      IF lv_logsys IS INITIAL.
        SELECT SINGLE logsys INTO lv_logsys FROM t000 WHERE mandt = sy-mandt.
    get dummy profit center as well
       PERFORM get_dummy_prctr USING ps_alv_display-rbukrs CHANGING lv_prctr.
      ENDIF." lv_logsys is initial.
      PERFORM get_curr_4_ccode
        USING ps_alv_display-rbukrs CHANGING lv_currency_iso.
      ls_documentheader-obj_type              = 'BKPFF'.
      ls_documentheader-obj_sys               = lv_logsys.
      ls_documentheader-obj_key               = '$'.
      ls_documentheader-username              = sy-uname.
      ls_documentheader-header_txt            = 'reconciliation'(a04).
      ls_documentheader-comp_code             = ps_alv_display-rbukrs.
      ls_documentheader-doc_date              = sy-datum.
      ls_documentheader-fisc_year             = sy-datum(4).
      ls_documentheader-pstng_date            = p_budat.
      ls_documentheader-fis_period            = p_bper .
      ls_documentheader-doc_type              = p_blart.
      ls_accountgl-itemno_acc                 = 1.
      ls_accountgl-gl_account                 = ps_alv_display-racctnote.
      ls_accountgl-comp_code                  = ps_alv_display-rbukrs.
      ls_accountgl-item_text                  = 'reconciliation'(a04).
      ls_accountgl-profit_ctr                 = ps_alv_display-prctr.
      APPEND ls_accountgl TO lt_accountgl.
      ls_accountgl-itemno_acc                 = 2.
      ls_accountgl-gl_account                 = p_gkont.
      ls_accountgl-comp_code                  = ps_alv_display-rbukrs.
      ls_accountgl-item_text                  = 'reconciliation'(a04).
      ls_accountgl-profit_ctr                 = ps_alv_display-prctr.
      APPEND ls_accountgl TO lt_accountgl.
    Company Code Currency
      ls_currencyamount-curr_type             = '10'. "Company code currency
      ls_currencyamount-itemno_acc            = 1.
      ls_currencyamount-currency              = ps_alv_display-hwaer.
      ls_currencyamount-amt_doccur            = ps_alv_display-diff_h.
      APPEND ls_currencyamount TO lt_currencyamount.
      ls_currencyamount-itemno_acc            = 2.
      ls_currencyamount-amt_doccur            = - ps_alv_display-diff_h.
      APPEND ls_currencyamount TO lt_currencyamount.
    Transaction Currency
      ls_currencyamount-curr_type             = '00'. "Transaction currency
      ls_currencyamount-itemno_acc            = 1.
      ls_currencyamount-currency              = ps_alv_display-rtcur.
      ls_currencyamount-amt_doccur            = ps_alv_display-diff_t.
      APPEND ls_currencyamount TO lt_currencyamount.
      ls_currencyamount-itemno_acc            = 2.
      ls_currencyamount-amt_doccur            = - ps_alv_display-diff_t.
      APPEND ls_currencyamount TO lt_currencyamount.
    Addtl fields via Extension
    partner company                         in field RASSC for both positions
      ls_extension1-field1                    =  'RASSC'.
      ls_extension1-field2                    =  1.
      ls_extension1-field3                    =  ps_alv_display-rassc.
      APPEND ls_extension1 TO lt_extension1.
      ls_extension1-field2                    =  2.
      ls_extension1-field3                    =  ps_alv_display-rassc.
      APPEND ls_extension1 TO lt_extension1.
    Transactiontype
      ls_extension1-field1                    =  'RMVCT'.
      ls_extension1-field2                    =  1.
      ls_extension1-field3                    =  ps_alv_display-rmvct.
      APPEND ls_extension1 TO lt_extension1.
      ls_extension1-field2                    =  2.
      ls_extension1-field3                    =  ps_alv_display-rmvct.
      APPEND ls_extension1 TO lt_extension1.
    ZZMULTI
      ls_extension1-field1                    =  'ZZMULTI'.
      ls_extension1-field2                    =  1.
      ls_extension1-field3                    =  ps_alv_display-zzmulti.
      APPEND ls_extension1 TO lt_extension1.
      ls_extension1-field2                    =  2.
      ls_extension1-field3                    =  ps_alv_display-zzmulti.
      APPEND ls_extension1 TO lt_extension1.
      CALL FUNCTION 'BAPI_ACC_GL_POSTING_POST'
        EXPORTING
          documentheader = ls_documentheader
        IMPORTING
          obj_type       = lv_obj_type
          obj_key        = lv_obj_key
          obj_sys        = lv_obj_sys
        TABLES
          accountgl      = lt_accountgl
          currencyamount = lt_currencyamount
          return         = lt_return
          extension1     = lt_extension1.
      APPEND LINES OF lt_return TO ps_alv_display-t_prot.
      ps_alv_display-protocol                 = icon_protocol.
      LOOP AT lt_return TRANSPORTING NO FIELDS WHERE type CA 'EAX'.
      ENDLOOP." at lt_return where            TYPE ca 'EAX'.
      IF sy-subrc                             = 0.
    error encountered
        ps_alv_display-lights                 = icon_failure.
      ELSE.
    posted - turn lights green
        ps_alv_display-lights                 = icon_green_light.
    posted - get document number
        ps_alv_display-docnum                 = lv_obj_key(10).
      ENDIF." sy-subrc                        = 0.
    ENDFORM.                    " post_diff
    [/code]
    Hope it helps,
    Clemens

  • A/r Invoice report query based on posting date selection criteria

    Hi experts,
    I am trying to write a query to get the A/r invoice report including Docnum, Docdate, cardname, project, linetotal, taxcode, taxtotal.
    and i tried the below query
    SELECT T0.[DocNum], T0.[DocDate], T0.[CardCode], T0.[CardName],T1.[LineTotal] FROM OINV T0  INNER JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry WHERE T0.[DocDate] >=[%0] AND  T0.[DocDate] <=[%1]
    In this query ,
    1) i am unable to sum up the linetotal( total before tax) 
    2) also unable to fetch the sum of taxamount.
    3) its more important , the above query will  me docnum , when i try to open that doc, it opens the 2007 docments. whereas the other details are correct like docdate, amount and all.
    example:   from date: 1/04/2011    to date: 28/07/2011
    Docnum    Docdate  cardname   linetotal.... etc
        2              1/04/11   XYZ              5000
    when i click the 2 (docnum)  it opens me the 04/04/2007  documents.
    how to limit the doc within the periods given?
    thanks in advance
    Dwarak

    Hi Rahul/Gordon,
    thanks for your query's .
    additionally,   i want this query without the A/r invoices whichever having credit memo as target doc. 
    and
    i have selection criteria as  T0.[U_Sec_Category] = '[%2]'  and this has 3 values like  1)CIM 2)BIN 3)DMP
    among these  CIM should be seen only only user1  and BIN & DMP only by user2.
    can u plz get me this
    thanks,
    Dwarak

  • Query related to Siebel Data Bean - Business Object - Account - Update

    Hello,
    I am using Siebel Databean to update Business object - Account fields. I am using the field names displayed in browser to update the Account properties.
    But sometimes it fails with below error:-
    For e.g. Field 'Account Team' -
    Field 'AccountTeam' does not exist in definition for business component 'Account'.
    Please ask your systems administrator to check your application configuration.(SBL-DAT-00398)
    Where I can find the information related to mapping of fields in business object 'Account' which I can use in Siebel Data bean program?
    Thanks in advance !!

    Hi!
    You need to use Siebel Tools to determine the Business Component Field Mappings to the Applet Controls that you're looking at.
    Regards,
    Oli

  • Tricky dynamic date variant in ABAP query

    Hello All,
    In an abap query there is a date field in the selection screen with from & to values.
    I am trying to create a dynamic variant that will fill the following data into those fields:
    From date: will be left blank
    To date: will show today's date - 90 days
    For example, if today's date is 01/12/2006 the variant should fill the following data into the fields:
    From date: <blank>
    To date: 01/09/2006
    I have tried all the methods I know with dynamic dates calculation in the variant definition but did not manage to create such variant.
    Any help will be very appreciated and points would be rewarded generously !
    Thank you very much,
    Ronen

    If the "from" date is meant to be left blank (beginning of time) and the "to" date is some date plus or minus number of days from today, you use the "current +/- days" dynamic date calculation format as was mentioned earlier.  Likewise if the "from" date is some date plus or minus today's date, and the "to" date is infinity -- you only need the one Dynamic Date calculation.
    To do this, first don't think about this as a date range, think of your Dynamic Date calculation as if this were a single parameter and not a select-option.  You are really saying "my date is anything LT/LE this date" or "my date is anything GT/GE this date" -- not a range
    In the Save Variant screen, find the desired date select-option and:
    1. Choose in column "Selection Variable", a "D" (Dynamic date calculation)
    2. Use F4 in the "Name of Variable" column
    3. Find "Current date +/- ??? days" or "Current date +/- ??? work days" in the popup, as appropriate
    4. For "I/E" (include/exclude) column select as appropriate
    5. For "Option" column, choose "LE", "LT", "GE", "GT", "NE" as appropriate
    6. After clicking green check mark, enter your plus or minus days (and factory calendar if using work days).
    7. Finish saving your variant.
    8. You may not see your changes in your variant until you back all the way out of the variant and then redisplay it.  You'll see a greyed out date along with the symbol matching your choice (LT, LE, etc.)
    Unfortunately if you don't have infinity on either end of the date you are limited to 999 days differences as far as I am aware.  If that is the case you can populate TVARVC table with parameter or selection variables, maintain them with STVARV transaction by hand, or use an ABAP program in batch to regularly calculate the values.  Then you can reference the TVARVC values in your variant instead of the Dynamic Date calculation.
    If someone knows a way to bypass the use of TVARVC for date ranges that are more than 999 days apart please let me know.  TVARVC works well but it is extra effort whereas Dynamic Date calculation would be much easier to maintain if the date range could be made larger than 999 days.

  • Query - How to output data to multiple Excel tabs?

    Hello,
    I have a quick question. Is it possible to build an ABAP query to send output data to multiple tabs in an Excel spreadsheet? I know this can be done at a single (first) tab level, but I am not sure if outputting data to multiple tabs is possible.
    For example, the address data for the different European countries should be directed to different tabs such as U.K., France, Germany, etc based on the country of residence.
    I appreciate your help with this.
    Thanks!

    Hi
    I think it is possible
    You define a common internal table with the address fields  and  based on the Language condition this table will be populated
    call the fun module to donwload to excel in a PERFORM using this Internal table and Language as paramter
    so that based on the language selection/condition the internal table will be filled from the data and that data will be passed to the fun module and downloaded to the file name given .
    pass the different file names to the fun module along with the PERFORM statement, so that different files will be created based on language
    <b>Reward points for useful Answers</b>
    Regards
    Anji

  • Need to create an ABAP query on 2 tables BSIK and BSAK

    Hi,
      I need to create an ABAP query which has the fields document no, doc date, amount in doc currency and some other fields from 2 tables BSIK and BSAK. Is it possible to write a single abap query to fetch the data from both the tables.
    The selection screen fields are doc number, date and doc type.
      I need to display invoices for open items and cleared items together.
      Please let me know if this is possible.
    Thanks and Regards,
    Ajith

    See if this is anything like what you need:
    REPORT ztest MESSAGE-ID 00.
    TABLES: bkpf, bseg.
    SELECT-OPTIONS: s_bukrs FOR bkpf-bukrs,
                    s_belnr FOR bkpf-belnr,
                    s_gjahr FOR bkpf-gjahr,
                    s_blart FOR bkpf-blart,
                    s_budat FOR bkpf-budat.
    DATA: BEGIN OF bkpf_int OCCURS 0.
            INCLUDE STRUCTURE bkpf.
    DATA: END   OF bkpf_int.
    DATA: BEGIN OF bseg_int OCCURS 0.
            INCLUDE STRUCTURE bseg.
    DATA: END   OF bseg_int.
    DATA: BEGIN OF bsik_int OCCURS 0.
            INCLUDE STRUCTURE bsik.
    DATA: END   OF bsik_int.
    SELECT  *
      FROM  bkpf
      INTO  TABLE bkpf_int
      WHERE bukrs  IN s_bukrs
        AND belnr  IN s_belnr
        AND gjahr  IN s_gjahr
        AND blart  IN s_blart
        AND bldat  IN s_budat.
    SORT bkpf_int BY bukrs belnr gjahr.
    SELECT  *
      FROM  bseg
      INTO  TABLE bseg_int
      FOR ALL ENTRIES IN bkpf_int
      WHERE bukrs = bkpf_int-bukrs
        AND belnr = bkpf_int-belnr
        AND gjahr = bkpf_int-gjahr
        AND koart = 'K'.
    SORT bseg_int BY bukrs belnr gjahr buzei.
    LOOP AT bseg_int.
      MOVE-CORRESPONDING bseg_int TO bsik_int.
      READ TABLE bkpf_int WITH KEY
        bukrs = bseg_int-bukrs
        belnr = bseg_int-belnr
        gjahr = bseg_int-gjahr
        BINARY SEARCH.
      IF sy-subrc = 0.
        MOVE-CORRESPONDING bkpf_int TO bsik_int.
        APPEND bsik_int.
      ELSE.
        MESSAGE e001 WITH 'Error during read'.
      ENDIF.
    ENDLOOP.
    Rob

  • Present date - posting date

    hi ,
    the query contains char posting date(0pstng_date).
    query should bring the values which are longer than 6 months.when the user  run the query it should calculate the present date(sys date) - document posting date .if it is longer than 6 months it should bring that record.
    *how the query calculates the sys date(todays date)?
    *how to get whether it is older than 6 months?
    how can we acheive this.please advise.
    regards
    sri

    Search for it here, you will get a no of posts describing the steps for a user-exit. One such post is Re: Bex : selection variable - write default values
    In the code of the user exit, you may write something similar to
    data : w_date like sy-datum.
    WHEN '<Var Name>'.
    IF i_step = '2'.
    w_date = sy-datum.
    w_date+6(2) = '01'.
    w_date = w_date - 160.
    w_date+6(2) = sy-datum+6(2).
    l_s_range-low = w_date.
    l_s_range-sign = 'I'.
    l_s_range-opt = 'BT'.
    l_s_Range-high = sy-datum.
    APPEND l_s_range TO e_t_range.
    ENDIF.
    If you want to exclude the last six months data from the report, mention "l_s_range-sign = 'E'." instead in the above code. (current code will show the last six month data).
    Once done, you can restrict your pstg_date field (context menu-->restrict) with this variable.

  • Posting date and billing date changes on release to accounting

    Hello,
    I wants to change invoive billing date (VBRK-FKDAT) automatically with current system date (SY-UDATE) when release to accounting invoice.
    Because always, our posting date (BKPF-BUDAT) on accounting document) must equal to current system date (SY-UDATE).
    Our billing type  is not blocked for transfer to accounting. We are using manually release to acounting invoice.
    I can't find user exit for VF02-Release to accounting document process. (for change VBRK-FKDAT and BKPF-BUDAT)
    Can you help me please?
    Thank you
    Gulay Celik

    Dear Gulay Celik
    Go to VTFL, select your item category for the combination of your delivery type and billing type and maintain routine 11  and save.
    Now try to create a billing for which PGI has done already on the previous date and post the outcome.
    thanks
    G. Lakshmipathi

  • Unable to access Archived data with an ABAP Query

    I have an ABAP Query that uses Logical Database KDF (Vendor) for reporting.
    KDF is Archive Enabled and I can access archived document via SAP standard programs that used the KDF Logical Database.
    the query appears accessing the data but nothing shows on the report.
    Has anyone successfully written and ABAP query and included access to the Archived data?
    Any help is appreciated.

    Hi Gena,
    I'm facing exactly the same problem as you...
    Since this post is an old one, I imagine that you may not remember, but I have to try...
    Have you solved it? If yes, could you please tell me how?
    I've tried to use CL_ABAP_GZIP and CL_ABAP_UNGZIP_BINARY_STREAM and I'm getting the same error 30 at the  IctDecompressStream function.
    Tks in advance,
    Flavio.

  • ABAP Query: creation of local field (Subtraction between 2 dates)

    Hi,
    I want to create a local field which will calculate the number of days between 2 dates (for example, document date - posting date).
    What I did:
    1) Created the user group in SQ03
    2) Created the infoset in SQ02
    3) I'm stucked at the creation of the Query in SQ01. I'm at the «Create Query: Select field screen». I clicked on Edit --> Local Field --> Create. I selected the «calculation field» attribute. I clicked on the «Complex calculation button», but I don't know how to write my formulate DOCUMENT DATE - POSTING DATE.
    Thanks a lot for your help.
    Julien

    Try these FM's to calculate difference between two dates..
    DAYS_BETWEEN_TWO_DATES
    LEAP_DAYS_BETWEEN_TWO_DATES
    HR_SEN_CALE_DAYS_DATE
    ISB_DAYS_BETWEEN_TWO_DATES
    FIMA_DAYS_BETWEEN_TWO_DATES
    FIMA_DAYS_BETWEEN_TWO_DATES_2
    FIMA_LEAP_DAYS_BETWEEN_2_DATES
    SD_DATETIME_DIFFERENCE

  • How can we post data from CRM to SAP using ABAP proxies???

    Hi ,
      Can anyone hep me to create interface for the following scenario How can we post data from CRM to SAP using ABAP proxies???, can I find any document ???????
    Thanks in advance
    Andy

    Andy,
    Please look at these weblogs.
    /people/ravikumar.allampallam/blog/2005/03/14/abap-proxies-in-xiclient-proxy
    /people/ravikumar.allampallam/blog/2005/03/03/creating-purchase-order-idoc-through-xi
    /people/siva.maranani/blog/2005/04/03/abap-server-proxies
    /people/vijaya.kumari2/blog/2006/01/26/how-do-you-activate-abap-proxies
    These should give a good idea about implementing Proxies.
    Regards,
    Ravi

Maybe you are looking for

  • How do I import just PART of a song from a CD into iTunes Library?

    I am trying to get just a little bit of one of my songs from my CD into iTunes Library so I can use it on a website. I do not want the entire song. Can this be done?

  • How can I stop ipod from defaulting on "on this ipod" page instead of "settings" in itunes?

    Itunes 11 has causedl problems with my shuffle: 1) when I plug it in, the screen defaults on the "Settings"page  instead of the "on this ipod" page. This is  a hassle to have to click away from settings every time I plug it in 2) Also, when I try to

  • DMS document attachment

    Hi, I am new to DMS & I have to attached scanned images of invoices through MIRO transaction to SAP object. How should I go with it? Anyone has worked on DMS??? kindly help...

  • Java.rmi.AccessException: Registry.Registry.rebind disallowed

    I am getting the following error while creating a client socket. I am not exactly sure what is causing the problem. This is happening on windows 2k3 sp2 French dual stack machine. java.rmi.AccessException: Registry.Registry.rebind disallowed; origin

  • New Organizational Unit Code

    Dear Folks, I want to create a new Organizational Unit code for a rollout project. For Example, the current company organization unit say 500000000 - Pepsi Corporation Limited and now I need to create a new company code and for that company code I ne