Projectcode wise aging ?

hi all
  please help me out of this query. one of client requriment  project wise aging
   please check this query if need to bechange  please tell me
  please help me.......................................................................
DECLARE @CutOff datetime
DECLARE @Projectcode varchar(50)
set @CutOff = '04/05/2011'
set @Projectcode ='MH28'
declare @openinvoice table(
  docnum numeric(19,0),
  proCode varchar(100),
  cardcode varchar(15),
  cardname varchar(100),
  unapplied numeric(19,2),
  source varchar(5),
  docdate datetime,
  docduedate datetime,
  daysPastDue int,
  Balance numeric(19,2)
insert into @openinvoice(docnum,proCode, cardcode, cardname,docdate,docduedate,dayspastdue,balance)
select DISTINCT
  t9.docnum, t10.project,  t9.cardcode,  t9.cardname,  t9.docdate, t9.docduedate, cast(@cutoff-t9.docduedate as int) as DaysPastDue,  t9.doctotal- t9.paidtodate
from
oinv t9 inner join inv1 t10
on
t9.docentry=t10.docentry
where
  t9.docdate < @cutoff+1
and t10.project=@Projectcode
insert into @openinvoice(docnum,proCode, cardcode,cardname,unapplied,source)
select
   t0.docnum, t0.prjcode,t0.cardcode, t0.cardname, doctotal, 'OR' as Src
from
  orct t0  join rct2 t1 on t0.docnum=t1.docnum
where
  t0.doctype='C' and
  t0.docdate < @CutOff+1 
and t0.prjcode =@Projectcode
insert into @openinvoice(docnum, proCode,cardcode,cardname,unapplied,source)
select
  t2.transid,t0.project,t0.shortname, t1.cardname,
  case when t0.debit>0 then t0.debit else t0.credit*-1 end AmtPosted,
  'JE' as Src
from
    ojdt t2 inner join jdt1 t0 on t2.transid=t0.transid inner join ocrd t1 on t0.shortname=t1.cardcode
where
  t1.cardtype='C' and
  t2.transtype=30 and
  t2.REFdate < @CutOff+1
  and t2.project=@Projectcode
INSERT into @openinvoice(docnum,cardcode, cardname,unapplied,source)
select
  t0.docnum, t0.cardcode, t0.cardname,
  doctotal-PAIDTODATE as balance, 'CM' as Src
from
orin t0 inner join (select distinct docentry,baseentry from rin1 where docdate < @CutOff+1 ) T1 on t0.docentry=t1.docentry
where
  t0.docstatus='O' and
t1.baseentry is null and
  t0.docdate<@cutoff+1
select 
   cardcode, cardname,
  sum(case when DaysPastDue<=0 then balance else 0 end) as CurrBal,
  sum(unapplied) as UnApplied, source,
  sum(case when DaysPastDue<=30 then balance else 0 end) as Days30,
  sum(case when DaysPastDue<=60 then balance else 0 end) as Days60,
  sum(case when DaysPastDue<=90 then balance else 0 end) as Days90
  sum(case when DaysPastDue>90 then balance else 0 end) as Days90Over
from
  @openinvoice
group by
  cardcode, cardname,source
order by
cardcode
Edited by: sinha0010 on May 3, 2010 2:44 PM
Edited by: sinha0010 on May 3, 2010 2:48 PM
Edited by: sinha0010 on May 3, 2010 2:50 PM

DECLARE @CutOff datetime
DECLARE @Projectcode varchar(50)
set @CutOff = '04/05/2011'
set @Projectcode ='MH28'
declare @openinvoice table(
  docnum numeric(19,0),
  proCode varchar(100),
  cardcode varchar(15),
  cardname varchar(100),
  unapplied numeric(19,2),
  source varchar(5),
  docdate datetime,
  docduedate datetime,
  daysPastDue int,
  Balance numeric(19,2)
insert into @openinvoice(docnum,proCode, cardcode, cardname,docdate,docduedate,dayspastdue,balance)
select DISTINCT
  t9.docnum, t10.project,  t9.cardcode,  t9.cardname,  t9.docdate, t9.docduedate, cast(@cutoff-t9.docduedate as int) as DaysPastDue,  t9.doctotal- t9.paidtodate
from
oinv t9 inner join inv1 t10
on
t9.docentry=t10.docentry
where
  t9.docdate < @cutoff+1
and t10.project=@Projectcode
insert into @openinvoice(docnum,proCode, cardcode,cardname,unapplied,source)
select
   t0.docnum, t0.prjcode,t0.cardcode, t0.cardname, doctotal, 'OR' as Src
from
  orct t0  join rct2 t1 on t0.docnum=t1.docnum
where
  t0.doctype='C' and
  t0.docdate < @CutOff+1 
and t0.prjcode =@Projectcode
insert into @openinvoice(docnum, proCode,cardcode,cardname,unapplied,source)
select
  t2.transid,t0.project,t0.shortname, t1.cardname,
  case when t0.debit>0 then t0.debit else t0.credit*-1 end AmtPosted,
  'JE' as Src
from
    ojdt t2 inner join jdt1 t0 on t2.transid=t0.transid inner join ocrd t1 on t0.shortname=t1.cardcode
where
  t1.cardtype='C' and
  t2.transtype=30 and
  t2.REFdate < @CutOff+1
  and t2.project=@Projectcode
INSERT into @openinvoice(docnum,cardcode, cardname,unapplied,source)
select
  t0.docnum, t0.cardcode, t0.cardname,
doctotal-PAIDTODATE as balance, 'CM' as Src
from
  orin t0 inner join (select distinct docentry,baseentry from rin1 where docdate < @CutOff+1 ) T1 on t0.docentry=t1.docentry
where
  t0.docstatus='O' and
  t1.baseentry is null and
  t0.docdate<@cutoff+1
Edited by: sinha0010 on May 4, 2010 7:53 AM
Edited by: sinha0010 on May 4, 2010 7:59 AM
Edited by: sinha0010 on May 4, 2010 8:00 AM
Edited by: sinha0010 on May 4, 2010 8:04 AM

Similar Messages

  • Supplier Wise Aging Report As of Date

    Hi,
    We are on 12.1.3
    I have wrote a query to find the Supplier Wise Aging Report .But it is not working for back date i.e if we applied Amount 1000  today, in report patameter if a pass the value from to yesterday date - report should display sum of all aging. If we gave till today.. the value should be 1000 less
    My Query:
    SELECT   yy.vendor_name, yy.vendor_id vendor_num, yy.segment1,
             yy.SUM remaining_advance_amount, yy.less30, yy.greater30,
             yy.greater60, yy.greater90, yy.greater120
    --         (SELECT COUNT (1)
    --            FROM ap_invoices_all aia
    --           WHERE aia.cancelled_date IS NULL
    --             AND aia.vendor_id = yy.vendor_id
    --             AND TRUNC (aia.invoice_date) BETWEEN :p_from_date AND :p_to_date
    --             AND aia.amount_paid <> aia.invoice_amount) out_stnd_bill,
    --         (SELECT SUM (NVL (apd.prepay_amount_remaining, 0))
    --            FROM ap_invoices_all aib,
    --                 ap_invoice_distributions_all apd
    --           WHERE aib.cancelled_date IS NULL
    --             AND aib.vendor_id = yy.vendor_id
    --             AND aib.invoice_id = apd.invoice_id
    --             AND apd.reversal_flag = 'N'
    --             AND TRUNC (aib.invoice_date) BETWEEN :p_from_date AND :p_to_date
    --             AND aib.invoice_type_lookup_code = 'PREPAYMENT') on_ac_amount
    FROM     (SELECT   xx.vendor_name, xx.vendor_id, xx.segment1,
                       SUM (NVL (xx.less_30, 0)) less30,
                       SUM (NVL (xx.greater_30, 0)) greater30,
                       SUM (NVL (xx.greater_60, 0)) greater60,
                       SUM (NVL (xx.greater_90, 0)) greater90,
                       SUM (NVL (xx.greater_120, 0)) greater120,
                       (  SUM (NVL (xx.less_30, 0))
                        + SUM (NVL (xx.greater_30, 0))
                        + SUM (NVL (xx.greater_60, 0))
                        + SUM (NVL (xx.greater_90, 0))
                        + SUM (NVL (xx.greater_120, 0))
                       ) SUM
                  FROM (SELECT   c.vendor_name, c.vendor_id, c.segment1,
                                 (CASE
                                     WHEN ((SYSDATE) - TRUNC (b.invoice_date) <=
                                                                                30
                                        THEN NVL ((  NVL (b.invoice_amount, 0)
                                                   - NVL (b.prepay_amount_applied,
                                                          0
                                                  0
                                     ELSE 0
                                  END
                                 ) less_30,
                                 (CASE
                                     WHEN ((SYSDATE) - TRUNC (b.invoice_date)
                                              BETWEEN 31
                                                  AND 60
                                        THEN NVL ((  NVL (b.invoice_amount, 0)
                                                   - NVL (b.prepay_amount_applied,
                                                          0
                                                  0
                                     ELSE 0
                                  END
                                 ) greater_30,
                                 (CASE
                                     WHEN ((SYSDATE) - TRUNC (b.invoice_date)
                                              BETWEEN 61
                                                  AND 90
                                        THEN NVL ((  NVL (b.invoice_amount, 0)
                                                   - NVL (b.prepay_amount_applied,
                                                          0
                                                  0
                                     ELSE 0
                                  END
                                 ) greater_60,
                                 (CASE
                                     WHEN ((SYSDATE) - TRUNC (b.invoice_date)
                                              BETWEEN 91
                                                  AND 120
                                        THEN NVL ((  NVL (b.invoice_amount, 0)
                                                   - NVL (b.prepay_amount_applied,
                                                          0
                                                  0
                                     ELSE 0
                                  END
                                 ) greater_90,
                                 (CASE
                                     WHEN ((SYSDATE) - TRUNC (b.invoice_date) >
                                                                               120
                                        THEN NVL ((  NVL (b.invoice_amount, 0)
                                                   - NVL (b.prepay_amount_applied,
                                                          0
                                                  0
                                     ELSE 0
                                  END
                                 ) greater_120
                            FROM ap_payment_schedules_all a,
                                 ap_invoices_v b,
                                 po_vendors c
                           WHERE a.invoice_id = b.invoice_id
                             AND b.vendor_id = c.vendor_id
                             AND b.invoice_type_lookup_code = 'PREPAYMENT'
                             -- AND a.amount_remaining <> 0
                             AND TRUNC (b.invoice_date) BETWEEN :p_from_date
                                                            AND :p_to_date
                             AND b.cancelled_date IS NULL
                        --AND c.segment1 = 837
                        ORDER BY c.vendor_name) xx
              GROUP BY xx.vendor_name, xx.vendor_id, xx.segment1) yy
    ORDER BY yy.vendor_name;

    Hi Octavio,
    As per this note 1290116.1.
    There is no replacement for this table
    Thanks
    Vishwa

  • Project code  wise aging

    dear   expert all
    parameter    from date  to to date , project code
      one of my client requriment  i have  need   project  code wise  aging report .
    send  me the query.

    Hi Zal....
    Very Good Afternoon.........
              The question was simple. Sinha was simply asking about the Project code wise aging report. If I'm not wrong then for every marketing document level, on header level as well as on row level the project code field is there with the help of which we can categorise the transactions. So if sinha is doing billing as per the project code then he can get the project code wise aging report.
    Even you can get the project code wise trial balance sheet also............
    Regards,
    Rahul

  • Accounts Receivable Report: Customer Wise Ageing Analysis report -FI module

    Hi Gurus,
                 Can anyone help me in providing standard report(source code) or already done sample report(source code) for Accounts Receivable Report: Customer Wise Ageing AnalysisThis is in FI Module. Though it is FI Module we need to fetch details related to Sales Module, and the days should be <0     30     60     90     120     180     365     >365     
    It is urgent I need to deliver this report by this week end.
    Please help me . Waiting for your reply.
    Points Rewarded for help rendered and I would personally send a good gift if you can help me
    Yours Truly,
    Rajiv Christopher.
    Edited by: Rajiv Christopher on Apr 2, 2008 11:33 AM

    Hi,
    i am attaching aging report.
    see if this is useful to you.
    REPORT ZFUS0102 MESSAGE-ID OA
                    LINE-SIZE 270.
    Title:      GR/IR AGING REPORT
    Date:       January 2001
    TABLES: DISVARIANT, EKPO.
    TYPE-POOLS: SLIS.
    Tables
    TABLES:
      BSIS,
      EKKO.
    working table
    DATA:  BEGIN OF RTAB OCCURS 0,
             HKONT   LIKE BSIS-HKONT,
             ZUONR   LIKE BSIS-ZUONR,
             BUDAT   LIKE BSIS-BUDAT,
             SHKZG   LIKE BSIS-SHKZG,
             DMBTR   LIKE BSIS-DMBTR,
             PRCTR   LIKE BSIS-PRCTR,
          END OF RTAB.
    DATA: BEGIN OF WTAB OCCURS 0,
             ZUONR(2) TYPE N,
             PRCTR   LIKE BSIS-PRCTR,
             DAYS(4)  TYPE P,
             DMBTR   LIKE BSIS-DMBTR,
          END OF WTAB.
    DATA: BEGIN OF PTAB OCCURS 0,
             ZUONR(2),
             PRCTR   LIKE BSIS-PRCTR,
             AMT30   LIKE BSIS-WRBTR,
             AMT60   LIKE BSIS-WRBTR,
             AMTPL   LIKE BSIS-WRBTR,
             TOTAL   LIKE BSIS-WRBTR,
          END OF PTAB.
    PARAMETERS:  COMPANY LIKE BSIS-BUKRS OBLIGATORY,
                 ACCT    LIKE BSIS-HKONT OBLIGATORY,
                 DATE    LIKE SY-DATUM OBLIGATORY.
    SELECT-OPTIONS: S_EKORG FOR EKKO-EKORG.
    PARAMETERS: P_VARI LIKE DISVARIANT-REPORT.
    DATA: WS-AMT30 LIKE BSIS-WRBTR.
    DATA: WS-AMT60 LIKE BSIS-WRBTR.
    DATA: WS-AMTPL LIKE BSIS-WRBTR.
    DATA: TITLE(21) VALUE 'GR/IR Aging Report'.
    DATA: LIN TYPE I.
    DATA: GX_VARIANT LIKE DISVARIANT,
          G_VARIANT LIKE DISVARIANT.
    DATA:  LAYOUT   TYPE SLIS_LAYOUT_ALV,
           L_F      TYPE SLIS_T_FIELDCAT_ALV   WITH HEADER LINE,
           GROUP    TYPE SLIS_T_SP_GROUP_ALV   WITH HEADER LINE,
           COLOR    TYPE SLIS_T_SPECIALCOL_ALV WITH HEADER LINE.
    DATA:  LT_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER,
           LS_LINE TYPE SLIS_LISTHEADER,
           T_EVENTS   TYPE SLIS_T_EVENT.
    CONSTANTS: FORMNAME_TOP_OF_PAGE TYPE SLIS_FORMNAME VALUE 'TOP_OF_PAGE'.
    INITIALIZATION.
      PERFORM EVENTTAB_AUFBAUEN USING T_EVENTS[].
      PERFORM VARIANT_INIT.
    Get default variant
      GX_VARIANT = G_VARIANT.
      CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
           EXPORTING
                I_SAVE     = 'A'
           CHANGING
                CS_VARIANT = GX_VARIANT
           EXCEPTIONS
                NOT_FOUND  = 2.
      IF SY-SUBRC = 0.
        P_VARI = GX_VARIANT-VARIANT.
      ENDIF.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_VARI.
      PERFORM VARIANT_INPUTHELP_F14.
    START-OF-SELECTION.
      LS_LINE-TYP  = 'S'.
      WRITE SY-DATUM TO LS_LINE-INFO DD/MM/YY.
      WRITE SY-UZEIT TO LS_LINE-INFO+10.
      WRITE SY-UNAME TO LS_LINE-INFO+20.
      WRITE TITLE    TO LS_LINE-INFO+30.
      APPEND LS_LINE TO LT_TOP_OF_PAGE.
      PERFORM FIELDS.
      IF NOT P_VARI IS INITIAL.
        PERFORM PAI_OF_SELECTION_SCREEN.
      ELSE.
        CALL FUNCTION 'REUSE_ALV_VARIANT_SELECT'
             EXPORTING
                  I_DIALOG            = ' '
                  I_USER_SPECIFIC     = 'A'
                  I_DEFAULT           = ' '
            I_TABNAME_HEADER    =
            I_TABNAME_ITEM      =
                  IT_DEFAULT_FIELDCAT = L_F[]
                  I_LAYOUT            = LAYOUT
             IMPORTING
            E_EXIT              =
                  ET_FIELDCAT         = L_F[]
            ET_SORT             =
            ET_FILTER           =
             CHANGING
                  CS_VARIANT          = DISVARIANT
             EXCEPTIONS
                  WRONG_INPUT         = 1
                  FC_NOT_COMPLETE     = 2
                  NOT_FOUND           = 3
                  PROGRAM_ERROR       = 4
                  OTHERS              = 5.
      ENDIF.
    Decide which tables to access.
      PERFORM MAIN_SELECT.
      MOVE TITLE  TO LAYOUT-WINDOW_TITLEBAR.
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
           EXPORTING
                I_CALLBACK_PROGRAM      = 'ZFUS0102'
                I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
                IS_LAYOUT               = LAYOUT
                IT_FIELDCAT             = L_F[]
                IT_SPECIAL_GROUPS       = GROUP[]
                I_SAVE                  = 'A'
                IS_VARIANT              = G_VARIANT
                IT_EVENTS               = T_EVENTS
           TABLES
                T_OUTTAB                = PTAB
           EXCEPTIONS
                PROGRAM_ERROR           = 1
                OTHERS                  = 2.
          FORM FIELDS                                                   *
    FORM FIELDS.
      L_F-FIELDNAME     = 'ZUONR'.
      L_F-OUTPUTLEN     = 6.
      L_F-SELTEXT_L     = 'SERIES'.
      L_F-REPTEXT_DDIC  = 'SERIES'.
      L_F-REF_TABNAME   = 'PTAB'.
      L_F-SP_GROUP      = 'A'.
      APPEND L_F. CLEAR L_F.
      L_F-FIELDNAME     = 'PRCTR'.
      L_F-OUTPUTLEN     = 10.
      L_F-SELTEXT_L     = 'PROFIT CTR.'.
      L_F-REPTEXT_DDIC  = 'PROFIT CTR.'.
      L_F-REF_TABNAME   = 'PTAB'.
      L_F-SP_GROUP      = 'A'.
      APPEND L_F. CLEAR L_F.
      L_F-FIELDNAME     = 'AMT30'.
      L_F-SELTEXT_L     = '30 DAYS'.
      L_F-REPTEXT_DDIC  = '30 DAYS'.
      L_F-REF_TABNAME   = 'PTAB'.
      L_F-SP_GROUP      = 'A'.
      L_F-REF_TABNAME   = 'BSIS'.
      L_F-REF_FIELDNAME = 'WRBTR'.
      L_F-DO_SUM        = 'X'.
      APPEND L_F. CLEAR L_F.
      L_F-FIELDNAME     = 'AMT60'.
      L_F-SELTEXT_L     = '60 DAYS'.
      L_F-REPTEXT_DDIC  = '60 DAYS'.
      L_F-REF_TABNAME   = 'PTAB'.
      L_F-SP_GROUP      = 'A'.
      L_F-REF_TABNAME   = 'BSIS'.
      L_F-REF_FIELDNAME = 'WRBTR'.
      L_F-DO_SUM        = 'X'.
      APPEND L_F. CLEAR L_F.
      L_F-FIELDNAME     = 'AMTPL'.
      L_F-SELTEXT_L     = '60+ DAYS'.
      L_F-REPTEXT_DDIC  = '60+ DAYS'.
      L_F-REF_TABNAME   = 'PTAB'.
      L_F-SP_GROUP      = 'A'.
      L_F-REF_TABNAME   = 'BSIS'.
      L_F-REF_FIELDNAME = 'WRBTR'.
      L_F-DO_SUM        = 'X'.
      APPEND L_F. CLEAR L_F.
      L_F-FIELDNAME     = 'TOTAL'.
      L_F-SELTEXT_L     = 'TOTAL'.
      L_F-REPTEXT_DDIC  = 'TOTAL'.
      L_F-REF_TABNAME   = 'PTAB'.
      L_F-SP_GROUP      = 'A'.
      L_F-REF_TABNAME   = 'BSIS'.
      L_F-REF_FIELDNAME = 'WRBTR'.
      L_F-DO_SUM        = 'X'.
      APPEND L_F. CLEAR L_F.
    ENDFORM.
          FORM MAIN_SELECT                                              *
    FORM MAIN_SELECT.
      SELECT HKONT ZUONR BUDAT SHKZG DMBTR PRCTR
           INTO TABLE RTAB
           FROM BSIS
           WHERE BUKRS = COMPANY
           AND   HKONT = ACCT.
      IF SY-SUBRC = 0.
        SORT RTAB.
        PERFORM PROCESS_RTAB.
        PERFORM PROCESS_WTAB.
      ENDIF.
    ENDFORM.                    " MAIN SELECT
          FORM VARIANT_INPUTHELP_F14                                    *
    FORM VARIANT_INPUTHELP_F14.
      DATA:  G_EXIT(1) TYPE C.
      CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
           EXPORTING
                IS_VARIANT          = G_VARIANT
                I_SAVE              = 'A'  " g_save
              it_default_fieldcat =
           IMPORTING
                E_EXIT              = G_EXIT
                ES_VARIANT          = GX_VARIANT
           EXCEPTIONS
                NOT_FOUND = 2.
      IF SY-SUBRC = 2.
        MESSAGE ID SY-MSGID TYPE 'S'      NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ELSE.
        IF G_EXIT = SPACE.
          P_VARI = GX_VARIANT-VARIANT.
        ENDIF.
      ENDIF.
    ENDFORM.
          FORM USER_COMMAND                                             *
    -->  UCOMM                                                         *
    -->  SELFIELD                                                      *
    FORM USER_COMMAND USING UCOMM LIKE SY-UCOMM SELFIELD TYPE
    SLIS_SELFIELD.
      IF UCOMM EQ '&IC1'.
        IF SELFIELD-TABINDEX <= 0.
          MESSAGE S108.
          EXIT.
        ENDIF.
      IF SELFIELD-SEL_TAB_FIELD CS 'LIFNR'.
        SET PARAMETER ID 'LIF' FIELD SELFIELD-VALUE.
        CALL TRANSACTION 'XK02'.
      ELSE.
        IF SELFIELD-SEL_TAB_FIELD CS 'VEND'.
          SET PARAMETER ID 'LIF' FIELD SELFIELD-VALUE.
          CALL TRANSACTION 'FBL1'.
        ENDIF.
      ENDIF.
        CLEAR SY-UCOMM. CLEAR UCOMM.
      ENDIF.
    ENDFORM.
          FORM TOP_OF_PAGE                                              *
    FORM TOP_OF_PAGE.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
           EXPORTING
                IT_LIST_COMMENTARY = LT_TOP_OF_PAGE.
    ENDFORM.
          FORM EVENTTAB_AUFBAUEN                                        *
    -->  P_T_EVENTS                                                    *
    FORM EVENTTAB_AUFBAUEN USING P_T_EVENTS TYPE SLIS_T_EVENT.
      DATA: LS_EVENT TYPE SLIS_ALV_EVENT.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
           EXPORTING
                I_LIST_TYPE = 0
           IMPORTING
                ET_EVENTS   = P_T_EVENTS.
      READ TABLE P_T_EVENTS WITH KEY NAME = SLIS_EV_TOP_OF_PAGE
                                                     INTO LS_EVENT.
      IF SY-SUBRC = 0.
        MOVE FORMNAME_TOP_OF_PAGE TO LS_EVENT-FORM.
        APPEND LS_EVENT TO P_T_EVENTS.
      ENDIF.
    ENDFORM.                               " EVENTTAB_AUFBAUEN
          FORM PAI_OF_SELECTION_SCREEN                                  *
    FORM PAI_OF_SELECTION_SCREEN.
      IF NOT P_VARI IS INITIAL.
        MOVE G_VARIANT TO GX_VARIANT.
        MOVE P_VARI TO GX_VARIANT-VARIANT.
        CALL FUNCTION 'REUSE_ALV_VARIANT_EXISTENCE'
             EXPORTING
                  I_SAVE     = 'A'  " g_save
             CHANGING
                  CS_VARIANT = GX_VARIANT.
        G_VARIANT = GX_VARIANT.
      ELSE.
        PERFORM VARIANT_INIT.
      ENDIF.
    ENDFORM.                               " PAI_OF_SELECTION_SCREEN
          FORM VARIANT_INIT                                             *
    FORM VARIANT_INIT.
      CLEAR G_VARIANT.
      G_VARIANT-REPORT = 'ZFUS0102'.
    ENDFORM.                               " VARIANT_INIT
    *&      Form  PROCESS_RTAB
          text
    -->  p1        text
    <--  p2        text
    FORM PROCESS_RTAB.
      DATA TLNS TYPE I.
      DESCRIBE TABLE S_EKORG LINES TLNS.
      LOOP AT RTAB.
        IF TLNS GT 0.
          SELECT SINGLE EKORG FROM EKKO INTO EKKO-EKORG
            WHERE EBELN = RTAB-ZUONR(10).
          CHECK EKKO-EKORG IN S_EKORG.
        ENDIF.
        IF NOT RTAB-BUDAT > DATE.
          MOVE RTAB-ZUONR(2) TO WTAB-ZUONR.
          COMPUTE WTAB-DAYS = DATE - RTAB-BUDAT.
          IF RTAB-SHKZG = 'H'.
            WTAB-DMBTR = RTAB-DMBTR * -1.
          ELSE.
            WTAB-DMBTR = RTAB-DMBTR * 1.
          ENDIF.
          MOVE RTAB-PRCTR TO WTAB-PRCTR.
          APPEND WTAB.
        ENDIF.
      ENDLOOP.
      FREE RTAB.
    ENDFORM.                    " PROCESS_RTAB
    *&      Form  PROCESS_WTAB
          text
    -->  p1        text
    <--  p2        text
    FORM PROCESS_WTAB.
      SORT WTAB BY ZUONR PRCTR DAYS.
      LOOP AT WTAB.
        PTAB-ZUONR = WTAB-ZUONR.
        PTAB-PRCTR = WTAB-PRCTR.
        AT END OF DAYS.
          SUM.
          IF WTAB-DAYS > 60.
            WS-AMTPL = WS-AMTPL + WTAB-DMBTR.
          ELSE.
            IF WTAB-DAYS > 30.
              WS-AMT60 = WS-AMT60 + WTAB-DMBTR.
            ELSE.
              WS-AMT30 = WS-AMT30 + WTAB-DMBTR.
            ENDIF.
          ENDIF.
        ENDAT.
        AT END OF PRCTR.
          PTAB-AMTPL = WS-AMTPL.
          PTAB-AMT30 = WS-AMT30.
          PTAB-AMT60 = WS-AMT60.
          COMPUTE PTAB-TOTAL = PTAB-AMTPL + PTAB-AMT30 + PTAB-AMT60.
          APPEND PTAB.
          WS-AMTPL = 0.
          WS-AMT30 = 0.
          WS-AMT60 = 0.
        ENDAT.
      ENDLOOP.
      SORT PTAB BY ZUONR PRCTR.
    ENDFORM.                    " PROCESS_WTAB
    regards,
    Sindhu

  • Division wise Aging for Customers

    Hi,
    Can we take division wise ageing for customers and add the division field at the time of payment entry(F-28)?
    Thanks in advance

    Hi
    Use T code S_ALR_87012167. It depends on your organizational structure also
    Regards
    Sanil

  • Account Group wise vendor aging report

    Dear Gurus,
    How can I see vedor account group wise ageing report in a company code?i.e Trade Vendors, Non Trade Vndors wise aging report
    Thanks in adv.
    N.M.B

    Dear Raghavender
    No need to create to variant and all.
    You just go to S_ALR_87012085 then go to dynamic selections. There we can give account group whatever we want.
    If u have any doubts reg. this pls ask me
    Bye
    Murali

  • Customer Ageing analysis-Region wise

    Hi,
    There is a requirement to see Customer ageing analysis region wise. Regions in SD are defined as Sales Offices. Sales offices are at the header level in Sales Order.
    If we can bring Sales office in Accounting document in some field, is there any way to see region wise ageing analysis in standard report.
    They also want to see Sales employee wise ageing analysis.Please let me know If there is any way out for this in standard.
    Regards,

    Hi,
    In the Standard Report Itself, if you select dynamic selection, you get the option of selecting the region from the Customer Master.  TCode (S_ALR_87012178)
    With this, you can achieve the result of getting the ageing report region wise.
    Hope this information is of some help to you.
    Appreciate any points awarded if found useful.
    Regards,
    Venkat

  • AP aging report from SAP

    We found that AP aging report from SAP  is not tie with Balance in Balance sheet.  Please advise how to find the report which match with our requirement.
    Concept of the AP aging report is to age outstanding AP as at the end of month (Open item date).  We found that A/P aging report which we currently use is cannot match to balance per G/L. (Please see detail in attached file). And the balance in AP aging report is always changes if we retrieve data on difference timing.
    Additionally, this report is not show the reconciliation account, please advise whether it is possible to show summary line which sum by reconciliation account.
    Please advise if you have another SAP transaction or any advise on this.
    kindly suggest

    Hi,
    For ageing report please go to fbl3n and go for change layout there is a option for ageing and posting period choose those two and subtotal it according to posting then you will get period wise meand month wise ageing  report for vendor.
    S_ALR_87012078 - Due Date Analysis for Open Items
    Hope this is clear if yes assign points
    Regards,
    Sankar

  • Reports for Itemwise ageing and Stock with opening and closing

    Dear All,
    Is there any default reports in SAP for Item wise ageing and the stock status with
    opening stock,In and Out stock and closing stock
    for a given period.
    Regards,
    Shyam

    Hi,
             Thanks for the quick reply.....But is there any accurate query for that....Bcoz i found a query which shows the qty but nothing is coming in the value...
    Regards,
    shyam

  • Customer Aging Report. Pl help me in this issue.

    Problem in Customer Aging Report.
    1. No concrete solution given to take project wise, bill wise. 2. Opening dues break up - project wise. Bill wise. 3. Aging days not able to select the required interval. Only standard intervals are available. 4. How to find the exact payment payable/ receivable for an vendor/customer.

    Hi Arun...........
    You can get the invoice wise aging. Once you run aging report you have to only double click on the sequence no grid.
    Hope this will solve the issue........
    Regards,
    Rahul

  • Inventory Stock Aging Report

    Hi All.
    I need Inventory Stock Quantity wise aging report from sap b1 sp 00 pl 47 .
    0-30, 31-60,61-90 and above 90
    Regards,
    Haider

    Check below link tooo
    Re: Stock Aging report in SAP Business One
    Re: Inventory Aging Report
    Stock Aging Report
    and this toooo
    SELECT distinct T0.ITEMCODE, T1.itemName,T0.ONHAND as 'Total Qty', T1.ManBtchNum,T1.ManSerNum,
    CASE WHEN Datediff (day,T1.LastPurDat, Getdate ()) <45 THEN T0.ONHAND END '<45 Days (Qty)',
    CASE WHEN Datediff (day,T1.LastPurDat, Getdate ()) <45 THEN T0.ONHAND * T0.Avgprice END  '<45 Days (Value)',
    CASE WHEN Datediff (day,T1.LastPurDat, Getdate ())>45 AND Datediff (day,T1.LastPurDat, Getdate ()) <90 THEN T0.ONHAND END '<45 T0 90 Days (Qty)',
    CASE WHEN Datediff (day,T1.LastPurDat, Getdate ())>45 AND Datediff (day,T1.LastPurDat, Getdate ()) <90 THEN T0.ONHAND * T0.Avgprice END  '<45 T0 90 Days (Value)',
    CASE WHEN Datediff (day,T1.LastPurDat, Getdate ()) >90 THEN T0.ONHAND END '>90 Days (Qty)',
    CASE WHEN Datediff (day,T1.LastPurDat, Getdate ())>90 THEN T0.ONHAND * T0.Avgprice END  '>90 Days (Value)'
    FROM OITW T0 INNER JOIN OITM T1 ON T0.ITEMCODE = T1.ITEMCODE
    INNER JOIN OITB T2 ON T1.ITMSGRPCOD=T2.ITMSGRPCOD
    left join ibt1 t3 on t3.itemcode = t0.whscode
    WHERE T0.ONHAND >0 AND T0.WhsCode = '[%0]' AND T2.ItmsGrpNam ='[%1]'

  • Aging - 7 Buckets - By Account Report

    Hi All,
    I need sql script to get the same output of Oracle Standard Report 'Aging - 7 Buckets - By Account Report' as i am gone through the data model but the query is written in Dynamically and using Dual table.
    Can anyone tell me how to write the sql script for this Oracle standard report.
    Regards,
    Sushant

    Hi,
    Oracle Standard Report 'Aging - 7 Buckets Report' giving output of Customer Name and Customer Number with Outstanding Amount of aging between 7 bucket(0-30 days, 31-45 days, 46-60 days, 61-90 days, 91-120 days, 121-150 days, 151-99999 days)
    As i an able to get the aging colum by below query.
    select a.*, b.*
    from AR_AGING_BUCKETS a,
    AR_AGING_BUCKET_LINES b
    where a.aging_bucket_id=b.AGING_BUCKET_ID
    and a.AGING_BUCKET_ID=1003
    but how to relate the customer name ,customer no (RA_CUSTOMER table) and outstanding amount with this aging bucket table.
    so i need to develop a report customer wise aging 7 bucket and their outstanding amount.
    Please give me idea how to proceed .
    if you need more information please update the forums.
    Regards,
    Sushant
    Edited by: user605933 on Jun 11, 2009 9:17 AM

  • Spilled water in my MacBook Pro its been slow ever since fixable or not?

    Hi All
    My daughter spilt a full glass over my MBP, to cut a long story short, dried it, aired it all out and after a day or two started working again.
    The issue that i now face is since then (1 year ago i would say) my Mac has been really slow performance wise, ages to open anything considering it has an i5 processor. Crashes frequently or freezes for long period, is this all due to the water spilt into it (yes i know obvious but need to make sure)? I have wiped the laptop and started from new and hasnt really made any difference.
    If it is the due to the water damage is there something that i can do?
    Many Thanks
    Mo

    ****7547 wrote:
    jus to ask what exactly could the store do to help me if there is water damage?
    Mo
    Replace the damaged parts.  

  • Project Wise -- Vendor Liabilities Aging

    Hello Experts,
    How to see project wise "Vendor Liabilities Aging" report. If it's available through query Please share the query. Please help me in this issue.
    Regards,
    Umamahesh.

    HI
    When you click the "Vendor Liabilities Aging",you will get a selection criteria window..
    After selecting the criteria and clicking 'OK' will get you a report right..
    When you get the report,click "Form Settings" window and in 'Table format',you will find 'Project Code' which made invisible by default,so you make it visible by clicking the 'Visible' check box..and click ok...
    Then the project code also appear in that report...
    Got it?..revert me for any clarifications...

  • Vendor Ageing Report Business Area and Profit Center wise

    Dear Experts,
    I have a requirement where user wants a Report for Vendor Ageing Business Area and Profit Center wise.I checked Standard T Codes but the same were Business Area wise but i could'nt find Profit Center wise Report.If their is any standard functionality then please advice.
    We are using SAP ECC 6.0 Classic GL with Spl Purpose Ledger active.Can someone please advice can i derive such a report through Report Painter.If possible please advice in details.
    Your Valuable inputs shall be appreciated....
    Regards
    Rahul

    Hi Durga,
    Can you please elaborate further on the same how you are determining the Report in FBL1N.What are the prerequisited to be taken care of and some further details on the same.
    My Bus Area is not as same as Profit Center eg
    BA          PC
    FXRT     RT0001 / 2 / 3
    TMMG   TM0001/ 2 / 3
    LTOB     LO0001/ 2 / 3
    I checked in my system but we do not have the Program for the following T Codes
    S_PCO_36000218 - Segment Receivables
    S_PCO_36000219 - Segment Payables
    S_AC0_52000887 - Profit Center Receivables
    S_AC0_52000888 - Profit Center Payables
    Regards
    Rahul

Maybe you are looking for

  • Can i convert an ix-2 to raid 0

    In the provided documents it says the operating system for the ix-2 is on the hard drives. So if i convert from raid 1 to raid 0 will it erase the operating system? Thanks

  • Computers on network can't see each other and can't communicate

    I have a Linksys router, WRT54G, which calls itself wireless but has only wired connections.   I have my computer and my phone (for Vonage service) plugged into it.    My router is then connected to the household router by a CAT 5 cable.   The househ

  • My iphone 6 flashes red then shuts off

    My iphone 6 will flash a red screen then shut down. When i try to turn it back on it will flash the logo a few times. what is going on? what do i need to do to get it fixed?

  • ACE: 4710 Policy-Map NAT

    Greets. I have a scenario where the rservers are located on two different VLAN's in One Arm Mode. My question is, am I able to assign two different NAT commands in my policy map (as written below)? Will the NAT command only kick off for the selected

  • IPhoto 08 keeps crashing

    I purchase iLife 08 this weekend and installed it on my MacBook Pro. Everytime I open iPhoto, within a few mintues it crashes. I tried rebuilding iPhoto, reinstalling iPhoto, and extended prayer. Nada. Any suggestions?