Urgent: Report

Hi Guru's...
My Program Perfomance is very slow....
Plz tell me wat can i do....
TABLES : VBAK, VBRP, VBRK, KNA1, T001, LIKP, VBPA, TVKBT, TVGRT, KONV, VBKD, VBFA, T052, BSAD.
TYPE-POOLS: SLIS.
DATA: BEGIN OF ITAB OCCURS 0,
      VKBUR   LIKE VBAK-VKBUR ,              "  Sales Office
      BEZEI   LIKE TVKBT-BEZEI,              "  Description
      KUNNR   LIKE VBAK-KUNNR ,              "  Sold to party
      BSTNK   LIKE VBAK-BSTNK ,              "  Customer PO No.
      NAME1   LIKE KNA1-NAME1 ,              "  CUSTOMER NAME
      VBELN   LIKE VBAK-VBELN ,              "  Sale Order Number
      AUDAT   LIKE VBAK-AUDAT ,              "  SALES DOC. DATE
      NETWR   LIKE VBAK-NETWR ,              "  SALES DOC VALUE
      VBELN1  LIKE VBRP-VBELN ,              "  BILLING DOCUMENT NO.
      FKDAT   LIKE VBRK-FKDAT ,              "  BILLING DATE
      NETWR1  LIKE VBRK-NETWR ,              "  BILLING DOCUMENT VALUE
      MWSBK   LIKE VBRK-MWSBK ,              "  TAX AMOUNT
      CD_AMT  TYPE P DECIMALS 2 ,            "  CD AMOUNT
      AMT_DUE TYPE P DECIMALS 2 ,            "  AMOUNT DUE
      FKART   LIKE VBRK-FKART ,              "  BILLING TYPE
      BLART   LIKE BSID-BLART ,              "  DOC TYPE
      DAYS    LIKE T052-ZTAG1 ,              "  Number of days
      DUE_DT  LIKE SY-DATUM   ,              "  Due Date
      ZTERM   LIKE VBKD-ZTERM ,              "  PAYMENT TERM
      KNUMV   LIKE VBRK-KNUMV ,              "  VBRK DOCUMENT CONDITION
      BELNR   LIKE BSAD-BELNR ,              "  DOC. NO.
      AUGBL   LIKE BSAD-AUGBL ,              "  CLEARING DOC.
      END OF ITAB .
DATA: BEGIN OF ITAB1 OCCURS 0,
      KNUMV LIKE KONV-KNUMV ,                "  DOCUMENT CONDITION
      KSCHL LIKE KONV-KSCHL ,
      KAWRT LIKE KONV-KAWRT ,
      KBETR LIKE KONV-KBETR ,
      KWERT LIKE KONV-KWERT ,                "  Condition Value
      END OF ITAB1 .
DATA : WA1 LIKE ITAB1.
DATA: BEGIN OF ITAB2 OCCURS 0,
      KNUMV LIKE KONV-KNUMV ,                "  DOCUMENT CONDITION
      KSCHL LIKE KONV-KSCHL ,
      KAWRT LIKE KONV-KAWRT ,
      KBETR LIKE KONV-KBETR ,
      KWERT LIKE KONV-KWERT ,                "  Condition Value
      END OF ITAB2 .
DATA : BEGIN OF ITAB3 OCCURS 0.
        INCLUDE STRUCTURE ITAB.
DATA : END OF ITAB3.
DATA : X TYPE I.
DATA : W_CONTAINER TYPE SCRFNAME VALUE 'CL_GRID',
       W_CPROG TYPE LVC_S_LAYO,
       G_REPID LIKE SY-REPID,
       W_SAVE TYPE C,
       W_EXIT TYPE C,
       CL_GRID TYPE REF TO CL_GUI_ALV_GRID,
       CL_CUSTOM_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
       IT_FLD_CATALOG TYPE SLIS_T_FIELDCAT_ALV,
       WA_FLD_CATALOG TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE ,
       LAYOUT TYPE SLIS_LAYOUT_ALV,
       COL_POS  LIKE SY-CUCOL ,
       ALVFC TYPE SLIS_T_FIELDCAT_ALV,
       IT_SORT TYPE SLIS_T_SORTINFO_ALV.
SELECTION-SCREEN BEGIN OF BLOCK A WITH FRAME.
SELECT-OPTIONS: VKBUR FOR VBAK-VKBUR,  " Sales Office
                KUNNR FOR VBAK-KUNNR,  " Sold to party
                FKDAT FOR VBRK-FKDAT, " OBLIGATORY .  " Created on
                FKART FOR VBRK-FKART,  " Billing Type
                DUE_DT FOR SY-DATUM.   " Due Date
SELECTION-SCREEN END OF BLOCK A.
SELECTION-SCREEN BEGIN OF BLOCK B WITH FRAME.
PARAMETERS: NORMAL RADIOBUTTON GROUP GR1,
            FULL RADIOBUTTON GROUP GR1.
SELECTION-SCREEN END OF BLOCK B.
IF FULL = 'X'.
  PERFORM FILL_CATALOG1 USING:
  'BEZEI'    'ITAB'    'BRANCH NAME',
  'KUNNR'    'ITAB'    'CUST CODE',
  'NAME1'    'ITAB'    'NAME' ,
  'BSTNK'    'ITAB'    'CUST PO NO.' ,
  'VBELN'    'ITAB'    'SALES DOC NO.',
  'AUDAT'    'ITAB'    'SALES DOC DATE',
  'VBELN1'   'ITAB'    'BILLING DOC NO.' ,
  'FKDAT'    'ITAB'    'BILLING DATE',
  'NETWR1'   'ITAB'    'NET VALUE'  ,
  'MWSBK'    'ITAB'    'TAX AMOUNT' ,
  'CD_AMT'   'ITAB'    'CD AMOUNT' ,
  'AMT_DUE'  'ITAB'    'AMOUNT DUE' ,
  'FKART'    'ITAB'    'BILL TYPE' ,
  'BLART'    'ITAB'    'DOC TYPE' ,
  'AUGBL'    'ITAB'    'CLEARING DOC.' ,
  'DUE_DT'   'ITAB'    'DUE DATE',
  'ZTERM'    'ITAB'    'PAYMENT TERMS'.
ELSE.
  PERFORM FILL_CATALOG1 USING:
  'BEZEI'    'ITAB'    'BRANCH NAME',
  'KUNNR'    'ITAB'    'CUST CODE',
  'NAME1'    'ITAB'    'NAME' ,
  'BSTNK'    'ITAB'    'CUST PO NO.' ,
  'VBELN'    'ITAB'    'SALES DOC NO.',
  'AUDAT'    'ITAB'    'SALES DOC DATE',
  'VBELN1'   'ITAB'    'BILLING DOC NO.' ,
  'FKDAT'    'ITAB'    'BILLING DATE',
  'NETWR1'   'ITAB'    'NET VALUE'  ,
  'MWSBK'    'ITAB'    'TAX AMOUNT' ,
  'CD_AMT'   'ITAB'    'CD AMOUNT' ,
  'AMT_DUE'  'ITAB'    'AMOUNT DUE' ,
  'FKART'    'ITAB'    'BILL TYPE' ,
  'DUE_DT'   'ITAB'    'DUE DATE',
  'ZTERM'    'ITAB'    'PAYMENT TERMS'.
ENDIF.
SELECT DISTINCT AVKBUR AKUNNR AVBELN AAUDAT ANETWR ABSTNK BVBELN CBEZEI
                INTO (ITAB-VKBUR, ITAB-KUNNR, ITAB-VBELN, ITAB-AUDAT, ITAB-NETWR, ITAB-BSTNK, ITAB-VBELN1, ITAB-BEZEI)
                FROM VBAK AS A INNER JOIN VBRP AS B ON AVBELN = BAUBEL
                               INNER JOIN TVKBT AS C ON AVKBUR = CVKBUR
                               WHERE A~VKBUR IN VKBUR
                               AND A~KUNNR IN KUNNR
                               AND C~SPRAS = 'EN'.
  APPEND ITAB.
ENDSELECT.
SORT ITAB BY VBELN.
LOOP AT ITAB.
  SELECT SINGLE FKDAT NETWR MWSBK KNUMV FKART FROM VBRK INTO (ITAB-FKDAT, ITAB-NETWR1, ITAB-MWSBK, ITAB-KNUMV, ITAB-FKART)
  WHERE VBELN = ITAB-VBELN1
  AND FKDAT IN FKDAT.
  IF SY-SUBRC NE 0.
    DELETE ITAB.
    CONTINUE.
  ENDIF.
  MODIFY ITAB INDEX SY-TABIX TRANSPORTING FKDAT NETWR1 MWSBK KNUMV FKART.
  SELECT NAME1 FROM KNA1 INTO ITAB-NAME1 WHERE KUNNR = ITAB-KUNNR .
    MODIFY ITAB INDEX SY-TABIX TRANSPORTING NAME1 .
  ENDSELECT .
  SELECT AUGBL BLART FROM BSAD INTO (ITAB-AUGBL, ITAB-BLART) WHERE BELNR = ITAB-VBELN1.
    MODIFY ITAB INDEX SY-TABIX TRANSPORTING AUGBL BLART.
  ENDSELECT .
  SELECT ZTERM FROM VBKD INTO ITAB-ZTERM WHERE VBELN = ITAB-VBELN .
    MODIFY ITAB INDEX SY-TABIX TRANSPORTING ZTERM .
  ENDSELECT.
  SELECT KNUMV KAWRT KBETR KSCHL INTO CORRESPONDING FIELDS OF TABLE ITAB1 FROM KONV
               WHERE KNUMV = ITAB-KNUMV AND KSCHL IN ('SKTO') .
  X = 0.
  LOOP AT ITAB1 INTO WA1.
    ON CHANGE OF WA1-KNUMV.
    ITAB2[] = ITAB1[].              
      DELETE ITAB2 WHERE KNUMV NE WA1-KNUMV.
    ENDON.
  ENDLOOP.
  IF SY-SUBRC <> 0.
    IF FULL <> 'X'.
      DELETE ITAB.
      CONTINUE.
    ENDIF.
  ELSE.
    LOOP AT ITAB2.
      X = X + ITAB2-KAWRT * ITAB2-KBETR / 1000 .
    ENDLOOP .
    ITAB-CD_AMT = X.
    MODIFY ITAB.
    REFRESH ITAB1.
    REFRESH ITAB2.
  ENDIF.
ENDLOOP .
LOOP AT ITAB .
  ITAB-AMT_DUE = ITAB-NETWR1 + ITAB-MWSBK + ITAB-CD_AMT .
  MODIFY ITAB INDEX SY-TABIX TRANSPORTING AMT_DUE .
ENDLOOP .
LOOP AT ITAB.
  SELECT SINGLE ZTAG1 INTO ITAB-DAYS FROM T052 WHERE ZTERM = ITAB-ZTERM.
  ITAB-DUE_DT = ITAB-FKDAT + ITAB-DAYS.
  IF DUE_DT-LOW <> 0 OR DUE_DT-HIGH <> 0.
    IF DUE_DT-LOW = 0.
      DUE_DT-LOW = DUE_DT-HIGH.
    ENDIF.
    IF DUE_DT-HIGH = 0.
      DUE_DT-HIGH = DUE_DT-LOW.
    ENDIF.
    IF ITAB-DUE_DT LT DUE_DT-LOW OR ITAB-DUE_DT GT DUE_DT-HIGH.
      DELETE ITAB.
      CLEAR ITAB.
      CONTINUE.
    ENDIF.
  ENDIF.
  MODIFY ITAB INDEX SY-TABIX TRANSPORTING DUE_DT .
ENDLOOP.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
  EXPORTING
    I_CALLBACK_PROGRAM = 'ZSALES_REPORT'
    IS_LAYOUT          = LAYOUT
    IT_FIELDCAT        = IT_FLD_CATALOG
    IT_SORT            = IT_SORT
    I_DEFAULT          = 'X'
    I_SAVE             = 'A'
  TABLES
    T_OUTTAB           = ITAB
  EXCEPTIONS
    PROGRAM_ERROR      = 1
    OTHERS             = 2.
IF SY-SUBRC <> 0.
ENDIF.
FORM FILL_CATALOG1  USING   P_FIELDNAME TYPE ANY
                            P_REF_TABLE TYPE ANY
                            P_SCRTEXT   TYPE ANY.
  CLEAR : WA_FLD_CATALOG.
  WA_FLD_CATALOG-FIELDNAME  = P_FIELDNAME.
  WA_FLD_CATALOG-TABNAME    = P_REF_TABLE.
  WA_FLD_CATALOG-SELTEXT_S  = P_SCRTEXT.
  WA_FLD_CATALOG-SELTEXT_M  = P_SCRTEXT.
  WA_FLD_CATALOG-SELTEXT_L  = P_SCRTEXT.
  APPEND WA_FLD_CATALOG TO IT_FLD_CATALOG.
ENDFORM.                    " fill_catalog1
Thanks....

COPY PASTE THIS CODE
report zmftest2.
TABLES : VBAK, VBRP, VBRK, KNA1, T001, LIKP, VBPA, TVKBT, TVGRT, KONV, VBKD, VBFA, T052, BSAD.
TYPE-POOLS: SLIS.
DATA: BEGIN OF ITAB OCCURS 0,
VKBUR LIKE VBAK-VKBUR , " Sales Office
KUNNR LIKE VBAK-KUNNR , " Sold to party
VBELN LIKE VBAK-VBELN , " Sale Order Number
AUDAT LIKE VBAK-AUDAT , " SALES DOC. DATE
NETWR LIKE VBAK-NETWR , " SALES DOC VALUE
BSTNK LIKE VBAK-BSTNK , " Customer PO No.
VBELN1 LIKE VBRP-VBELN , " BILLING DOCUMENT NO.
BEZEI LIKE TVKBT-BEZEI, " Description
NAME1 LIKE KNA1-NAME1 , " CUSTOMER NAME
FKDAT LIKE VBRK-FKDAT , " BILLING DATE
NETWR1 LIKE VBRK-NETWR , " BILLING DOCUMENT VALUE
MWSBK LIKE VBRK-MWSBK , " TAX AMOUNT
CD_AMT TYPE P DECIMALS 2 , " CD AMOUNT
AMT_DUE TYPE P DECIMALS 2 , " AMOUNT DUE
FKART LIKE VBRK-FKART , " BILLING TYPE
BLART LIKE BSID-BLART , " DOC TYPE
DAYS LIKE T052-ZTAG1 , " Number of days
DUE_DT LIKE SY-DATUM , " Due Date
ZTERM LIKE VBKD-ZTERM , " PAYMENT TERM
KNUMV LIKE VBRK-KNUMV , " VBRK DOCUMENT CONDITION
BELNR LIKE BSAD-BELNR , " DOC. NO.
AUGBL LIKE BSAD-AUGBL , " CLEARING DOC.
END OF ITAB .
DATA: BEGIN OF ITAB1 OCCURS 0,
KNUMV LIKE KONV-KNUMV , " DOCUMENT CONDITION
KSCHL LIKE KONV-KSCHL ,
KAWRT LIKE KONV-KAWRT ,
KBETR LIKE KONV-KBETR ,
KWERT LIKE KONV-KWERT , " Condition Value
END OF ITAB1 .
DATA : WA1 LIKE ITAB1.
DATA: BEGIN OF ITAB2 OCCURS 0,
KNUMV LIKE KONV-KNUMV , " DOCUMENT CONDITION
KSCHL LIKE KONV-KSCHL ,
KAWRT LIKE KONV-KAWRT ,
KBETR LIKE KONV-KBETR ,
KWERT LIKE KONV-KWERT , " Condition Value
END OF ITAB2 .
DATA : BEGIN OF ITAB3 OCCURS 0.
INCLUDE STRUCTURE ITAB.
DATA : END OF ITAB3.
DATA : X TYPE I.
DATA : W_CONTAINER TYPE SCRFNAME VALUE 'CL_GRID',
W_CPROG TYPE LVC_S_LAYO,
G_REPID LIKE SY-REPID,
W_SAVE TYPE C,
W_EXIT TYPE C,
CL_GRID TYPE REF TO CL_GUI_ALV_GRID,
CL_CUSTOM_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
IT_FLD_CATALOG TYPE SLIS_T_FIELDCAT_ALV,
WA_FLD_CATALOG TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE ,
LAYOUT TYPE SLIS_LAYOUT_ALV,
COL_POS LIKE SY-CUCOL ,
ALVFC TYPE SLIS_T_FIELDCAT_ALV,
IT_SORT TYPE SLIS_T_SORTINFO_ALV.
SELECTION-SCREEN BEGIN OF BLOCK A WITH FRAME.
SELECT-OPTIONS: VKBUR FOR VBAK-VKBUR, " Sales Office
KUNNR FOR VBAK-KUNNR, " Sold to party
FKDAT FOR VBRK-FKDAT, " OBLIGATORY . " Created on
FKART FOR VBRK-FKART, " Billing Type
DUE_DT FOR SY-DATUM. " Due Date
SELECTION-SCREEN END OF BLOCK A.
SELECTION-SCREEN BEGIN OF BLOCK B WITH FRAME.
PARAMETERS: NORMAL RADIOBUTTON GROUP GR1,
FULL RADIOBUTTON GROUP GR1.
SELECTION-SCREEN END OF BLOCK B.
IF FULL = 'X'.
PERFORM FILL_CATALOG1 USING:
'BEZEI' 'ITAB' 'BRANCH NAME',
'KUNNR' 'ITAB' 'CUST CODE',
'NAME1' 'ITAB' 'NAME' ,
'BSTNK' 'ITAB' 'CUST PO NO.' ,
'VBELN' 'ITAB' 'SALES DOC NO.',
'AUDAT' 'ITAB' 'SALES DOC DATE',
'VBELN1' 'ITAB' 'BILLING DOC NO.' ,
'FKDAT' 'ITAB' 'BILLING DATE',
'NETWR1' 'ITAB' 'NET VALUE' ,
'MWSBK' 'ITAB' 'TAX AMOUNT' ,
'CD_AMT' 'ITAB' 'CD AMOUNT' ,
'AMT_DUE' 'ITAB' 'AMOUNT DUE' ,
'FKART' 'ITAB' 'BILL TYPE' ,
'BLART' 'ITAB' 'DOC TYPE' ,
'AUGBL' 'ITAB' 'CLEARING DOC.' ,
'DUE_DT' 'ITAB' 'DUE DATE',
'ZTERM' 'ITAB' 'PAYMENT TERMS'.
ELSE.
PERFORM FILL_CATALOG1 USING:
'BEZEI' 'ITAB' 'BRANCH NAME',
'KUNNR' 'ITAB' 'CUST CODE',
'NAME1' 'ITAB' 'NAME' ,
'BSTNK' 'ITAB' 'CUST PO NO.' ,
'VBELN' 'ITAB' 'SALES DOC NO.',
'AUDAT' 'ITAB' 'SALES DOC DATE',
'VBELN1' 'ITAB' 'BILLING DOC NO.' ,
'FKDAT' 'ITAB' 'BILLING DATE',
'NETWR1' 'ITAB' 'NET VALUE' ,
'MWSBK' 'ITAB' 'TAX AMOUNT' ,
'CD_AMT' 'ITAB' 'CD AMOUNT' ,
'AMT_DUE' 'ITAB' 'AMOUNT DUE' ,
'FKART' 'ITAB' 'BILL TYPE' ,
'DUE_DT' 'ITAB' 'DUE DATE',
'ZTERM' 'ITAB' 'PAYMENT TERMS'.
ENDIF.
**SELECT DISTINCT AVKBUR AKUNNR AVBELN AAUDAT ANETWR ABSTNK BVBELN CBEZEI
**INTO (ITAB-VKBUR, ITAB-KUNNR, ITAB-VBELN, ITAB-AUDAT, ITAB-NETWR, ITAB-BSTNK, ITAB-VBELN1, ITAB-BEZEI)
**FROM VBAK AS A INNER JOIN VBRP AS B ON AVBELN = BAUBEL
**INNER JOIN TVKBT AS C ON AVKBUR = CVKBUR
**WHERE A~VKBUR IN VKBUR
**AND A~KUNNR IN KUNNR
**AND C~SPRAS = 'EN'.
**APPEND ITAB.
**ENDSELECT.
****************************MODIFIED CODE*************************************************************
SELECT AVKBUR AKUNNR AVBELN AAUDAT ANETWR ABSTNK BVBELN CBEZEI
INTO TABLE ITAB
FROM VBAK AS A INNER JOIN VBRP AS B ON AVBELN = BAUBEL
INNER JOIN TVKBT AS C ON AVKBUR = CVKBUR
WHERE A~VKBUR IN VKBUR
AND A~KUNNR IN KUNNR
AND C~SPRAS = 'EN'.
****************************END OF MODIFIED CODE*****************************************************
SORT ITAB BY VBELN.
LOOP AT ITAB.
SELECT SINGLE FKDAT NETWR MWSBK KNUMV FKART FROM VBRK INTO (ITAB-FKDAT, ITAB-NETWR1, ITAB-MWSBK, ITAB-KNUMV, ITAB-FKART)
WHERE VBELN = ITAB-VBELN1
AND FKDAT IN FKDAT.
IF SY-SUBRC NE 0.
DELETE ITAB.
CONTINUE.
ENDIF.
MODIFY ITAB INDEX SY-TABIX TRANSPORTING FKDAT NETWR1 MWSBK KNUMV FKART.
SELECT NAME1 FROM KNA1 INTO ITAB-NAME1 WHERE KUNNR = ITAB-KUNNR .
MODIFY ITAB INDEX SY-TABIX TRANSPORTING NAME1 .
ENDSELECT .
SELECT AUGBL BLART FROM BSAD INTO (ITAB-AUGBL, ITAB-BLART) WHERE BELNR = ITAB-VBELN1.
MODIFY ITAB INDEX SY-TABIX TRANSPORTING AUGBL BLART.
ENDSELECT .
SELECT ZTERM FROM VBKD INTO ITAB-ZTERM WHERE VBELN = ITAB-VBELN .
MODIFY ITAB INDEX SY-TABIX TRANSPORTING ZTERM .
ENDSELECT.
SELECT KNUMV KAWRT KBETR KSCHL INTO CORRESPONDING FIELDS OF TABLE ITAB1 FROM KONV
WHERE KNUMV = ITAB-KNUMV AND KSCHL IN ('SKTO') .
X = 0.
LOOP AT ITAB1 INTO WA1.
ON CHANGE OF WA1-KNUMV.
ITAB2 = ITAB1.
DELETE ITAB2 WHERE KNUMV NE WA1-KNUMV.
ENDON.
ENDLOOP.
IF SY-SUBRC = 0.
IF FULL = 'X'.
DELETE ITAB.
CONTINUE.
ENDIF.
ELSE.
LOOP AT ITAB2.
X = X + ITAB2-KAWRT * ITAB2-KBETR / 1000 .
ENDLOOP .
ITAB-CD_AMT = X.
MODIFY ITAB.
REFRESH ITAB1.
REFRESH ITAB2.
ENDIF.
ENDLOOP .
LOOP AT ITAB .
ITAB-AMT_DUE = ITAB-NETWR1 + ITAB-MWSBK + ITAB-CD_AMT .
MODIFY ITAB INDEX SY-TABIX TRANSPORTING AMT_DUE .
ENDLOOP .
LOOP AT ITAB.
SELECT SINGLE ZTAG1 INTO ITAB-DAYS FROM T052 WHERE ZTERM = ITAB-ZTERM.
ITAB-DUE_DT = ITAB-FKDAT + ITAB-DAYS.
IF DUE_DT-LOW = 0 OR DUE_DT-HIGH = 0.
IF DUE_DT-LOW = 0.
DUE_DT-LOW = DUE_DT-HIGH.
ENDIF.
IF DUE_DT-HIGH = 0.
DUE_DT-HIGH = DUE_DT-LOW.
ENDIF.
IF ITAB-DUE_DT LT DUE_DT-LOW OR ITAB-DUE_DT GT DUE_DT-HIGH.
DELETE ITAB.
CLEAR ITAB.
CONTINUE.
ENDIF.
ENDIF.
MODIFY ITAB INDEX SY-TABIX TRANSPORTING DUE_DT .
ENDLOOP.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = 'ZSALES_REPORT'
IS_LAYOUT = LAYOUT
IT_FIELDCAT = IT_FLD_CATALOG
IT_SORT = IT_SORT
I_DEFAULT = 'X'
I_SAVE = 'A'
TABLES
T_OUTTAB = ITAB
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
IF SY-SUBRC = 0.
ENDIF.
FORM FILL_CATALOG1 USING P_FIELDNAME TYPE ANY
P_REF_TABLE TYPE ANY
P_SCRTEXT TYPE ANY.
CLEAR : WA_FLD_CATALOG.
WA_FLD_CATALOG-FIELDNAME = P_FIELDNAME.
WA_FLD_CATALOG-TABNAME = P_REF_TABLE.
WA_FLD_CATALOG-SELTEXT_S = P_SCRTEXT.
WA_FLD_CATALOG-SELTEXT_M = P_SCRTEXT.
WA_FLD_CATALOG-SELTEXT_L = P_SCRTEXT.
APPEND WA_FLD_CATALOG TO IT_FLD_CATALOG.
ENDFORM. " fill_catalog1

Similar Messages

  • V V URGENT Report  for Vendor Aging

    Hi ABAP Gurus,
    I have to develop a report for VENDOR AGING. My requirement is i have to post an invoice. From Payment terms i have to get Dependent on posting date. Let us assume if payment term is 100 by adding posting date + payment term (100) i have to get due date. I'am giving I/P terms as Company code & Period. If i enter company code i have to get O/P as vendor name(lfa1-name1),vendor no(bsik-lifnr),bill no(bsik-xblnr),bill date(bsik-bldat) i.e., baseline date,amount(bsik-dmbtr) and duedate (this i have to pick from payment terms). For period i have to get O/P as 1st week bucket,2nd week bucket,3rd week bucket,4th week bucket and beyond. For this you have to take the difference b/n due date and that buckets based on this result you have to put that amount of rupees whether it is going to pay in 1st week r 2nd r 3rd r 4th or beyond this. If that due date is less than or equal to 1st week it has to come and fall in 1st week. THIS IS MY REQUIREMENT.
    For this i'am using tables BSIK,LFA1.
    Can any body send me the code on this. For this my delivery date is on monday.
    Please help me on this it's very Urgent...
    I will REWARD you the points definitely for those who help me on this.
    my mail id : [email protected]
    waiting for your VALUABLE REPLIES. Please intimate me if you send it to my mail.
    Thanks and Regards,
    Sundeep.

    Hi
    See the report code and modify as per your requirements
    REPORT  zfi_vendor_ageing
            NO STANDARD PAGE HEADING
            LINE-COUNT 58
           line-size 168
            MESSAGE-ID zh_msg.
           D A T A B A S E  T A B L E S   D E C L A R A T I O N
    TABLES: lfa1,           " Vendor Master (General)
            t001,           " Company Codes
            rfpdo.
         I N T E R N A L  T A B L E S  D E C L A R A T I O N S           *
    Internal Table for Vendor Open Items Data
    DATA: BEGIN OF int_bsik OCCURS 0,
            lifnr   LIKE bsik-lifnr,         " Vendor Number
            name1   LIKE lfa1-name1,         " Vendor Name
            shkzg   LIKE bsik-shkzg,         " Dr/Cr Indicator
            belnr   LIKE bsik-belnr,         " Document Number
            xblnr   LIKE bsik-xblnr,         " Ref Doc No
            blart   LIKE bsik-blart,         " Document Type
            zfbdt   LIKE bsik-zfbdt,         " Base Line Date
            zbd1t   LIKE bsik-zbd1t,         " Due date1
            zbd2t   LIKE bsik-zbd2t,         " Due Date2
            zbd3t   LIKE bsik-zbd3t,         " Due Date3
            waers   LIKE bsik-waers,         " Currency
            dmbtr   LIKE bsik-dmbtr,         " Amount in Local Curr
          END OF int_bsik.
    Internal Table for Amounts Sum Up Data
    DATA: BEGIN OF int_final OCCURS 0,
            lifnr   LIKE bsik-lifnr,         " Vendor Number
            name1   LIKE lfa1-name1,         " Vendor Name
            total1  LIKE bsik-dmbtr,         " Amount in Local Curr
            total2  LIKE bsik-dmbtr,         " Amount in Local Curr
            total3  LIKE bsik-dmbtr,         " Amount in Local Curr
            total4  LIKE bsik-dmbtr,         " Amount in Local Curr
            total5  LIKE bsik-dmbtr,         " Amount in Local Curr
            total6  LIKE bsik-dmbtr,         " Amount in Local Curr
            total   LIKE bsik-dmbtr,         " Amount in Local Curr
          END OF int_final.
               D A T A  D E C L A R A T I O N S
    DATA : v_flag,                          " Flag
           v_gtotal1     LIKE bsik-dmbtr,   " Amount Totals
           v_gtotal2     LIKE bsik-dmbtr,   " Amount Totals
           v_gtotal3     LIKE bsik-dmbtr,   " Amount Totals
           v_gtotal4     LIKE bsik-dmbtr,   " Amount Totals
           v_gtotal5     LIKE bsik-dmbtr,   " Amount Totals
           v_gtotal6     LIKE bsik-dmbtr,   " Amount Totals
           v_gtotal      LIKE bsik-dmbtr,   " Amount Totals
           v_subtotal1   LIKE bsik-dmbtr,   " Amount Totals
           v_subtotal2   LIKE bsik-dmbtr,   " Amount Totals
           v_subtotal3   LIKE bsik-dmbtr,   " Amount Totals
           v_subtotal4   LIKE bsik-dmbtr,   " Amount Totals
           v_subtotal5   LIKE bsik-dmbtr,   " Amount Totals
           v_subtotal6   LIKE bsik-dmbtr,   " Amount Totals
           v_subtotal    LIKE bsik-dmbtr,   " Amount Totals
           v_date        LIKE bsik-zfbdt,   " Due Date
           v_tage1(4),                      " Age 30 days
           v_tage2(4),                      " Age 60 days
           v_tage3(4),                      " Age 90 days
           v_fir(15),                       " Column Text1
           v_sec(15),                       " Column Text2
           v_thir(15),                      " Column Text3
           v_four(17),                      " Column Text4
           v_fidd(4),                       " Days field1
           v_sedd(4),                       " Days field2
           v_thdd(4),                       " Days field3
           v_fodd(4),                       " Days field4
           v_str  TYPE  SY-LISEL,           " String
           v_str1(11),                      " String
           v_tage(3),                       " String
           v_date1(10).                     " Date field
         R A N G E   D E C L A R A T I O N S
    RANGES: r_date1 FOR bsik-zfbdt,      " Date Range 1
            r_date2 FOR bsik-zfbdt,      " Date Range 2
            r_date3 FOR bsik-zfbdt,      " Date Range 3
            r_date4 FOR bsik-zfbdt.      " Date Range 4
             S E L E C T I O N  S C R E E N                      *
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS: s_lifnr FOR lfa1-lifnr. "Vendor account
    PARAMETERS:     p_bukrs LIKE t001-bukrs. "Co. Code
    SELECTION-SCREEN END OF BLOCK b1.
    SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
    PARAMETERS:   p_allgst LIKE rfpdo-allgstid OBLIGATORY DEFAULT sy-datum.
    "Open items at key date
    SELECTION-SCREEN END OF BLOCK b2.
    SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-003.
    PARAMETERS: p_tage1 LIKE rfpdo1-allgfael DEFAULT '30',
                p_tage2 LIKE rfpdo1-allgfael DEFAULT '60',
                p_tage3 LIKE rfpdo1-allgfael DEFAULT '90',
                p_tage4 LIKE rfpdo1-allgfael DEFAULT '120'.
    SELECTION-SCREEN END OF BLOCK b3.
                  A T  S E L E C T I O N  S C R E E N                   *
    AT SELECTION-SCREEN.
    Validate the screen fields
      PERFORM validate_flds.
                   S T A R T  O F  S E L E C T I O N                    *
    START-OF-SELECTION.
    Fetch main data
      PERFORM fetch_data.
                           T O P  O F  P A G E
    Header
    TOP-OF-PAGE.
      PERFORM header.
                           E N D  O F  P A G E
    Footer
    END-OF-PAGE.
      ULINE.
       T O P  O F  P A G E  D U R I N G  L I N E  S E L E C T I O N     *
    Top of Page in Secondary List
    TOP-OF-PAGE DURING LINE-SELECTION.
      PERFORM header1.
                  A T  L I N E  S E L E C T I O N                    *
    AT LINE-SELECTION.
    Perform Line Selections
      PERFORM line_selection.
                     E N D  O F  S E L E C T I O N
    END-OF-SELECTION.
    List generation
      PERFORM basic_list.
    *&      Form  validate_flds
    Validation of Selection Screen fields
    FORM validate_flds .
    Validate Vendor Code
      CLEAR lfa1-lifnr.
      SELECT lifnr UP TO 1 ROWS
          INTO lfa1-lifnr
          FROM lfa1
          WHERE lifnr IN s_lifnr AND
                spras = sy-langu.
      ENDSELECT.
      IF sy-subrc <> 0.
        MESSAGE e000 WITH 'Invalid Vendor Code range'(023).
      ENDIF.
    Validate Company Code
      CLEAR t001-bukrs.
      SELECT bukrs  UP TO 1 ROWS
          INTO t001-bukrs
          FROM t001
          WHERE bukrs =  p_bukrs AND
                spras = sy-langu.
      ENDSELECT.
      IF sy-subrc <> 0.
        MESSAGE e021.      " Invalid Company Code range
      ENDIF.
      IF ( p_tage1 > p_tage2 ) OR ( p_tage1 > p_tage3 ) OR
          ( p_tage1 > p_tage4 ).
        MESSAGE e999 WITH 'Column 1 greater'(004)
                    'than Column# 2 or 3 or 4'(005).
      ENDIF.
    *column 2
      IF ( p_tage2 > p_tage3 ) OR ( p_tage1 > p_tage4 ).
        MESSAGE e999 WITH 'Column 2 greater'(006)
                    'than Column# 3 or 4'(007).
      ENDIF.
    *column3
      IF ( p_tage3 > p_tage4 ).
        MESSAGE e999 WITH 'Column 3 greater'(008)
                    'than Column#4'(009).
      ENDIF.
    ENDFORM.                    " validate_flds
    *&      Form  fetch_data
    Fetching Data from Database Tables
    FORM fetch_data .
    Date Range Population
      r_date1-sign   = 'I'.
      r_date1-option = 'BT'.
      r_date1-low    = p_allgst.
      r_date1-high    = r_date1-low + p_tage1.
      APPEND r_date1.
      r_date2-sign   = 'I'.
      r_date2-option = 'BT'.
      r_date2-low    =  r_date1-high + 1.
      r_date2-high    = r_date1-low + p_tage2.
      APPEND r_date2.
      r_date3-sign   = 'I'.
      r_date3-option = 'BT'.
      r_date3-low    = r_date2-high + 1.
      r_date3-high    = r_date1-low + p_tage3.
      APPEND r_date3.
      r_date4-sign   = 'I'.
      r_date4-option = 'BT'.
      r_date4-low    = r_date3-high + 1.
      r_date4-high    = r_date1-low + p_tage4.
      APPEND r_date4.
    Select the Vendor Open Items data from BSIK
      SELECT l~lifnr
             l1~name1
             b~waers
             b~dmbtr
             b~zfbdt
             b~zbd1t
             b~zbd2t
             b~zbd3t
             b~belnr
             b~xblnr
             b~shkzg
             b~blart
       INTO CORRESPONDING FIELDS OF TABLE int_bsik
       FROM lfb1 AS l INNER JOIN lfa1 AS l1
                    ON llifnr  = l1lifnr
           INNER JOIN   bsik AS b
             ON llifnr  = blifnr AND
                lbukrs  = bbukrs
             WHERE l~lifnr  IN s_lifnr AND
                   l~bukrs = p_bukrs and
                   b~zfbdt le p_allgst.
      IF SY-SUBRC <> 0.
        MESSAGE i000 WITH 'No Data found'(027).
      ENDIF.
    Removing the date limit to get the due items in the past
      DELETE int_bsik WHERE
                  ( blart  NE 'RE' AND blart  NE 'KR' ) OR
                    shkzg  NE 'H'.
      SORT int_bsik BY lifnr.
    ENDFORM.                    " fetch_data
    *&      Form  header
    Display the Report Columns
    FORM header .
      v_tage1 = p_tage1 + 1.
      v_tage2 = p_tage2 + 1.
      v_tage3 = p_tage3 + 1.
      v_fidd = p_tage1.
      v_sedd = p_tage2.
      v_thdd = p_tage3.
      v_fodd = p_tage4.
      MOVE v_fodd0(4) TO v_fodd1(3).
      v_fodd+0(1) = space.
      CONCATENATE '1 to'(010) v_fidd INTO v_fir.
      CONCATENATE v_tage1 ' to '(011) v_sedd INTO v_sec.
      CONCATENATE v_tage2 ' to '(011) v_thdd INTO v_thir.
      CONCATENATE v_tage3 ' to '(011) space v_fodd INTO v_four.
    Standard header
      clear: v_date1, v_str, v_str1, v_tage.
      write p_allgst to v_date1.
      Move  p_tage4 to v_tage.
      concatenate '>' v_tage text-025 into v_str1.
      concatenate
      'Summary of Ageing Analysis for Vendor Open Invoices as on'(013)
       v_date1 into v_str separated by space.
      CALL FUNCTION 'Z_STANDARD_HEADER'
        EXPORTING
         title1 = 'Saudi International Petrochemical Company'(012)
         title2 = v_str.
      FORMAT COLOR OFF.
      WRITE  : /1(168) sy-uline.
      FORMAT COLOR 1 INTENSIFIED.
      WRITE :/1 sy-vline, 13 sy-vline, 49 sy-vline,
            50(101) 'Invoices Due For(In Days)'(014) CENTERED,
           151 sy-vline, 168 sy-vline .
      WRITE :/1 sy-vline,  2(11)  'Vendor#'(015) CENTERED,
             13 sy-vline ,14(35) 'Vendor Name'(016) CENTERED,
             49 sy-vline,
             50(101) sy-uline,151 sy-vline,
            152(16) 'Total'(017) CENTERED,
            168 sy-vline.
      WRITE : /1 sy-vline,13 sy-vline,      49 sy-vline,
              50(16) v_fir CENTERED,        66 sy-vline,
              67(16) v_sec CENTERED,        83 sy-vline,
              84(16) v_thir CENTERED,      100 sy-vline,
             101(16) v_four CENTERED,      117 sy-vline,
             118(16) v_str1 centered,      134 sy-vline,
             135(16) 'Already Overdue'(018) CENTERED,151 sy-vline,
             168 sy-vline.
      FORMAT COLOR OFF.
      WRITE  : /1(168) sy-uline.
    ENDFORM.                    " header
    *&      Form  basic_list
    Display the Basic List
    FORM basic_list .
      NEW-PAGE LINE-SIZE 168.
      LOOP AT int_bsik.
        CLEAR v_date.
        IF int_bsik-zbd3t <> ' '.
          v_date = int_bsik-zfbdt + int_bsik-zbd3t.
        ELSE.
          IF int_bsik-zbd2t <> ' '.
            v_date = int_bsik-zfbdt + int_bsik-zbd2t.
          ELSE.
            v_date = int_bsik-zfbdt + int_bsik-zbd1t.
          ENDIF.
        ENDIF.
        IF int_bsik-zbd1t = ' '.
          v_date = int_bsik-zfbdt.
        ENDIF.
        IF v_date IN r_date1.
          int_final-total1 =   int_final-total1 +  int_bsik-dmbtr.
        ELSEIF v_date IN r_date2.
          int_final-total2 =   int_final-total2 +  int_bsik-dmbtr.
        ELSEIF v_date IN r_date3.
          int_final-total3 =   int_final-total3 +  int_bsik-dmbtr.
        ELSEIF v_date IN r_date4.
          int_final-total4 =   int_final-total4 +  int_bsik-dmbtr.
        ELSEif v_date > r_date4-high.
          int_final-total5 =   int_final-total5 +  int_bsik-dmbtr.
        ELSEif v_date < p_allgst.
          int_final-total6 =   int_final-total6 +  int_bsik-dmbtr.
        ENDIF.
        AT END OF lifnr.
          v_flag = 1.
        ENDAT.
        IF v_flag = 1.
          int_final-lifnr = int_bsik-lifnr.
          int_final-name1 = int_bsik-name1.
          int_final-total =   int_final-total1 + int_final-total2 +
           int_final-total3 + int_final-total4 + int_final-total5 +
           int_final-total6.
          APPEND int_final.
          v_gtotal1 = v_gtotal1 + int_final-total1.
          v_gtotal2 = v_gtotal2 + int_final-total2.
          v_gtotal3 = v_gtotal3 + int_final-total3.
          v_gtotal4 = v_gtotal4 + int_final-total4.
          v_gtotal5 = v_gtotal5 + int_final-total5.
          v_gtotal6 = v_gtotal6 + int_final-total6.
          v_gtotal = v_gtotal + int_final-total.
          WRITE: /1 sy-vline,
                  2 int_final-lifnr COLOR 4 INTENSIFIED ON,
                 13 sy-vline,
                 14 int_final-name1 COLOR 4 INTENSIFIED ON,
                 49 sy-vline.
          DATA : v_rem.
          v_rem = sy-tabix MOD 2.
          IF v_rem NE 0.
            FORMAT COLOR 2 INTENSIFIED.
            WRITE :    50 int_final-total1 CURRENCY int_bsik-waers,
                       66 sy-vline,
                       67 int_final-total2 CURRENCY int_bsik-waers,
                       83 sy-vline,
                       84 int_final-total3 CURRENCY int_bsik-waers,
                      100 sy-vline,
                      101 int_final-total4 CURRENCY int_bsik-waers,
                      117 sy-vline,
                      118 int_final-total5 CURRENCY int_bsik-waers,
                      134 sy-vline,
                      135 int_final-total6 CURRENCY int_bsik-waers,
                      151 sy-vline,
                      152 int_final-total CURRENCY int_bsik-waers,
                      168 sy-vline.
          ELSE.
            WRITE :    50 int_final-total1 CURRENCY int_bsik-waers,
                       66 sy-vline,
                       67 int_final-total2 CURRENCY int_bsik-waers,
                       83 sy-vline,
                       84 int_final-total3 CURRENCY int_bsik-waers,
                      100 sy-vline,
                      101 int_final-total4 CURRENCY int_bsik-waers,
                      117 sy-vline,
                      118 int_final-total5 CURRENCY int_bsik-waers,
                      134 sy-vline,
                      135 int_final-total6 CURRENCY int_bsik-waers,
                      151 sy-vline,
                      152 int_final-total CURRENCY int_bsik-waers,
                      168 sy-vline.
          ENDIF.
          FORMAT COLOR OFF.
          HIDE int_final.
          CLEAR int_final.
          v_flag = 0.
        ENDIF.
        AT LAST.
          WRITE  : /1(168) sy-uline.
          FORMAT COLOR 3 INTENSIFIED.
          WRITE : /1 sy-vline,  2(47) 'GRAND TOTAL'(022) CENTERED,
                  49 sy-vline, 50 v_gtotal1 CURRENCY int_bsik-waers,
                  66 sy-vline, 67 v_gtotal2 CURRENCY int_bsik-waers,
                  83 sy-vline, 84 v_gtotal3 CURRENCY int_bsik-waers,
                 100 sy-vline,101 v_gtotal4 CURRENCY int_bsik-waers,
                 117 sy-vline,118 v_gtotal5 CURRENCY int_bsik-waers,
                 134 sy-vline,135 v_gtotal6 CURRENCY int_bsik-waers,
                 151 sy-vline,152 v_gtotal CURRENCY int_bsik-waers,
                 168 sy-vline.
          HIDE :  v_gtotal1,
                  v_gtotal2,
                  v_gtotal3,
                  v_gtotal4,
                  v_gtotal5,
                  v_gtotal6,
                  v_gtotal.
        ENDAT.
        FORMAT COLOR OFF.
      ENDLOOP.
      WRITE  : /1(168) sy-uline.
    ENDFORM.                    " basic_list
    *&      Form  line_selection
    When double clicked on the line display the seconday list
    FORM line_selection .
      NEW-PAGE LINE-SIZE 206.
    Sy-lsind = 1.
      DATA : v_rem,v_cnt LIKE sy-tabix.
      v_cnt = 0.
      SORT int_bsik BY belnr zfbdt.
      LOOP AT int_bsik WHERE lifnr EQ int_final-lifnr.
        v_rem = v_cnt MOD 2.
        CLEAR v_date.
        IF int_bsik-zbd3t <> ' '.
          v_date = int_bsik-zfbdt + int_bsik-zbd3t.
        ELSE.
          IF int_bsik-zbd2t <> ' '.
            v_date = int_bsik-zfbdt + int_bsik-zbd2t.
          ELSE.
            v_date = int_bsik-zfbdt + int_bsik-zbd1t.
          ENDIF.
        ENDIF.
        IF int_bsik-zbd1t = ' '.
          v_date = int_bsik-zfbdt.
        ENDIF.
        IF v_rem NE 0.
          format color 2 intensified.
          WRITE :/1 sy-vline, 2 int_bsik-belnr,
                 12 sy-vline,13 int_bsik-lifnr,
                 23 sy-vline,24 int_bsik-name1,
                 59 sy-vline,60 int_bsik-xblnr,
                 76 sy-vline,77 int_bsik-zfbdt,
                 87 sy-vline.
          WRITE : 104 sy-vline,121 sy-vline,
                  138 sy-vline,155 sy-vline,
                  172 sy-vline, 189 sy-vline,
                  190 int_bsik-dmbtr CURRENCY int_bsik-waers,
                  206 sy-vline.
          IF v_date IN r_date1.
            v_subtotal1 =   v_subtotal1 +  int_bsik-dmbtr.
            WRITE : 88 int_bsik-dmbtr  CURRENCY int_bsik-waers.
          ELSEIF v_date IN r_date2.
            v_subtotal2 =   v_subtotal2 +  int_bsik-dmbtr.
            WRITE : 105 int_bsik-dmbtr CURRENCY int_bsik-waers.
          ELSEIF v_date IN r_date3.
            v_subtotal3 =   v_subtotal3 +  int_bsik-dmbtr.
            WRITE : 122 int_bsik-dmbtr CURRENCY int_bsik-waers.
          ELSEIF v_date IN r_date4.
            v_subtotal4 =   v_subtotal4 +  int_bsik-dmbtr.
            WRITE : 139 int_bsik-dmbtr CURRENCY int_bsik-waers.
          ELSEif v_date > r_date4-high.
            v_subtotal5 =   v_subtotal5 +  int_bsik-dmbtr.
            WRITE : 156 int_bsik-dmbtr CURRENCY int_bsik-waers.
          ELSEif v_date < p_allgst.
            v_subtotal6 =   v_subtotal6 +  int_bsik-dmbtr.
            WRITE : 173 int_bsik-dmbtr CURRENCY int_bsik-waers.
          ENDIF.
          format color off.
        ELSE.
          WRITE :/1 sy-vline, 2 int_bsik-belnr,
                 12 sy-vline,13 int_bsik-lifnr,
                 23 sy-vline,24 int_bsik-name1,
                 59 sy-vline,60 int_bsik-xblnr,
                 76 sy-vline,77 int_bsik-zfbdt,
                 87 sy-vline.
          WRITE : 104 sy-vline,121 sy-vline,
                  138 sy-vline,155 sy-vline,
                  172 sy-vline,189 sy-vline,
                  190 int_bsik-dmbtr CURRENCY int_bsik-waers,
                  206 sy-vline.
          IF v_date IN r_date1.
            v_subtotal1 =   v_subtotal1 +  int_bsik-dmbtr.
            WRITE : 88 int_bsik-dmbtr CURRENCY int_bsik-waers.
          ELSEIF v_date IN r_date2.
            v_subtotal2 =   v_subtotal2 +  int_bsik-dmbtr.
            WRITE : 105 int_bsik-dmbtr CURRENCY int_bsik-waers.
          ELSEIF v_date IN r_date3.
            v_subtotal3 =   v_subtotal3 +  int_bsik-dmbtr.
            WRITE : 122 int_bsik-dmbtr CURRENCY int_bsik-waers.
          ELSEIF v_date IN r_date4.
            v_subtotal4 =   v_subtotal4 +  int_bsik-dmbtr.
            WRITE : 139 int_bsik-dmbtr CURRENCY int_bsik-waers.
          ELSEif v_date > r_date4-high.
            v_subtotal5 =   v_subtotal5 +  int_bsik-dmbtr.
            WRITE : 156 int_bsik-dmbtr CURRENCY int_bsik-waers.
          ELSEif v_date < p_allgst.
            v_subtotal6 =   v_subtotal6 +  int_bsik-dmbtr.
            WRITE : 173 int_bsik-dmbtr CURRENCY int_bsik-waers.
          ENDIF.
        ENDIF.
        FORMAT COLOR OFF.
        v_cnt = v_cnt + 1.
      ENDLOOP.
      WRITE : /1(206) sy-uline.
      v_subtotal = v_subtotal1 + v_subtotal2 + v_subtotal3
                  + v_subtotal4 + v_subtotal5 + v_subtotal6.
      FORMAT COLOR 3 INTENSIFIED.
      WRITE : /1 sy-vline,
                 2(85) 'Total'(017) CENTERED CURRENCY int_bsik-waers ,
                 87 sy-vline,
                 88 v_subtotal1 CURRENCY int_bsik-waers,
                104 sy-vline,
                105 v_subtotal2 CURRENCY int_bsik-waers,
                121 sy-vline,
                122 v_subtotal3 CURRENCY int_bsik-waers,
                138 sy-vline,
                139 v_subtotal4 CURRENCY int_bsik-waers,
                155 sy-vline,
                156 v_subtotal5 CURRENCY int_bsik-waers,
                172 sy-vline,
                173 v_subtotal6 CURRENCY int_bsik-waers,
                189 sy-vline,
                190 v_subtotal CURRENCY int_bsik-waers,
                206 sy-vline.
      FORMAT COLOR OFF.
      WRITE : /1(206) sy-uline.
      CLEAR : v_subtotal,v_subtotal1,v_subtotal2,v_subtotal3,
              v_subtotal4,v_subtotal5,v_gtotal1,v_gtotal2,v_gtotal3,
              v_gtotal4, v_gtotal5,v_gtotal,v_subtotal6,v_gtotal6.
    ENDFORM.                    " line_selection
    *&      Form  header1
    Secondary List Header
    FORM header1 .
    Standard header
      clear: v_date1, v_str, v_str1, v_tage.
      write p_allgst to v_date1.
      Move  p_tage4 to v_tage.
      concatenate '>' v_tage text-025 into v_str1.
      concatenate
       'Details of Ageing Analysis for Vendor Open Invoices as on'(024)
        v_date1 into v_str separated by space.
      CALL FUNCTION 'Z_STANDARD_HEADER'
        EXPORTING
         title1 = 'Company'(012)
         title2 =  v_str.
      FORMAT COLOR 1 intensified.
      WRITE  :/1(206) sy-uline.
      WRITE  :/1 sy-vline,12 sy-vline ,
              23 sy-vline,59 sy-vline,76 sy-vline,87 sy-vline,
              88(101) 'Invoices Due For(In Days)'(014) CENTERED,
             189 sy-vline,206 sy-vline.
      WRITE  : /1 sy-vline,  2(10) 'Doc Number'(021) CENTERED,
               12 sy-vline, 13(10) 'Vendor#'(015) CENTERED,
               23 sy-vline, 24(35) 'Vendor Name'(016) CENTERED,
               59 sy-vline, 60(16) 'Ref invoice#'(019) CENTERED,
               76 sy-vline, 77(10) 'Inv dt'(020) CENTERED,
               87 sy-vline, 88(101) sy-uline,
              189 sy-vline,190(16) 'Total'(017) CENTERED,
              206 sy-vline.
      WRITE : /1 sy-vline, 12 sy-vline,
               23 sy-vline,59 sy-vline,
               76 sy-vline,87 sy-vline,
               88(16) v_fir CENTERED, 104 sy-vline,
              105(16) v_sec CENTERED, 121 sy-vline,
              122(16) v_thir CENTERED, 138 sy-vline,
              139(16) v_four CENTERED, 155 sy-vline,
              156(16) v_str1 CENTERED,
              172    sy-vline,
              173(16) 'Already Overdue'(018) CENTERED,
              189 sy-vline,
              206 sy-vline.
              format color off.
      WRITE  : /1(206) sy-uline.
    ENDFORM.                                                    " header1
    Reward points if useful
    Regards
    Anji

  • Urgent --report urgent

    Hallo
    very urgent
      i would like to have the master data "relationsship" included in the BW report.
    It is important information for me when user plan production, as both preparation, processing and cleaning time as well as the "delay" between the start of each equipment adds up being our total production time.
    At this stage user can only get the times for relationsships by clicking on each operation in SAP (for each material).
    what should i do
    regards
    mangra

    Hi mangra
    Include the master data infoobject in your cube and use it in the query
    For calculation like delay, you can creata a formula in the report
    Cheers
    N Ganesh

  • Very urgent-Report

    hi,
    i have a product  and i am saving like that in my ods. and then it goes state wise
    ODS
    exp. mumbai
    PRODUCT----
    total
    pepsi -
    10 botel
    coke----
    20 botel
    fanta----
    30 botel
    now i want to show in the report like that
    pepsi--cokefanta-market share pepsi-----coke and so on
    10--2030--
    16%  -
    32%    and so on
    its very urgent kindly do help me

    The way that appears in my head is make RKF for each product.  A total one and then make CKF with percent of calculations.  This would be hard if you dont' know all the products and be a lot to maintain.  This is unless you have it the way you listed where you have pepsi, fanta, coke, etc and have limited products.  Beyond that I think you would have to do it outside the report.

  • Urgent: Reports 9i - PDF

    I'm having an urgent problem and was wondering if somebody here could help me.
    I have to print a PDF report on several windows workstations with a bar code font that is installed on my
    Oracle 9iAS Release 2 server.
    This server is installed on a Red Hat Linux 7.3 system.
    One of the main objectives is that the bar code font should be installed ONLY on the 9iAS server.
    I heard about the new PDF Embed and PDF subsetting features of Oracle Reports 9i and i've tryed to implement this in
    my environment following documents that i got on OTN and Metalink.
    I already took the following steps:
    1- PDF Embed:
    -Put the AFM, PFA and PFB files, the report.rdf file in $ORACLE_HOME/reports/samples/demo.
    -Put the following entry in section [ PDF:Embed ] the uifont.ali file:
    X317349A = "X317349A.afm X317349A.pfa" (i tryed with pfm and pfb files too) (this font is Type1)
    - Use the command PDFEMBED=YES in the rwservlet call.
    2- PDF Subsetting:
    - Put the I20501P.ttf file, the report.rdf file in $ORACLE_HOME/reports/samples/demo.
    - Put the following entry in section [ PDF:Subsetting ] the uifont.ali file:
    I2510P = "I2501P.ttf"
    - Put the following mapping information in the uifont.ali file:
    [ Global ] # Put mappings for all surfaces here.
    # Mapping from MS Windows
    Arial = helvetica
    "Courier New" = courier
    "Courier" = I2501p
    In both cases (using PDF Embed or Subsetting), i couldn't print the bar codes. The Adobe Acrobat document properties
    of the windows clients was showing other fonts like lucida and etc. The I2501P and X317349A are not showing up, instead
    i have "Ws" and "Ns" sequences (the bar code font use this 2 letters) on the screen.
    I can print the bar codes only if i use the regular Font Aliasing that i used to print the bar codes with reports 6i, but i need the fonts to
    be installed on both clients and server to do that. This is not interesting anymore because the number of client increased a lot
    and the clients are located on different places.
    What else can I do??
    Do i have to put something in the [PDF] section of uifont.ali??
    This is kind of urgent. Any suggestion is accepted.
    Thank you all,
    Marcus Santos ([email protected])

    Hi,
    Since I saw you guys answering each other. I just posted a question regarding compiling a form from command line and thru forms builder. When I compile the fomr from forms builder it works fine. But if I compile it from command line the forms terminates abnormally with FRM-921-01. No changes were made. So, do you guys have any idea about this. Please please please help. Please.........................
    Thanks,
    Asha

  • URGENT : REPORT for sales register

    Hi Guys,
    Anybody is having the report on sales register? logic follows like this:-
    The logic which needs to be developed is, as per input criteria given by user, which will be sales organization, plant & date range.Program needs to pick all the billing document which will satisfy the above criteria.
    Except for document cateroty N i.e. invoice cancellation (VBRK -VBTYP not equal to N) and which are marked for cancellation (VBRK-FKSTO not equal to
    X)
    From the VBRK table pick up the document condition number (VBRk-KNUMV) and then go to KONV table you will find all condition with value over their. Pick up the values as per condition type and print it. (Condition types are already mentioned in format attached).
    Their are 3 different format they have asked for, the format types will depend on the plant i.e. if plant start with 21 then it is RMC plant and accordingly appropriate format needs to be picked. Please check config for plant descrption.
    By looking at format, i feel that some changes needs to be done into it like their is no material number or descprtion mentioned in format but qty & base rate fields their. Now whether register needs to printed for every line item in invoice or ony one line item for every invoice i.e.
    consoliadted  per invoice number. If it is consolidated then what about base rate which can be different for each line item. In this case what rate needs to be print.
    Always print the invoice values line item by line item, giving each line item quantity, base price, and other pricing conditions but should have facility to sum up     fields like Quantity, Base price, all pricing conditions each customer wise. 
    I have to get this report in ALV format.
    I will reward points for useful answers.
    My mail id is [email protected]
    Waiting for reply...
    Thanks,
    Sundeep.

    Hi
          If you are using sales and operation planning in make to stock scenario its simple . As You input target sale plan and target production plan for whole one year (MC84) . So this data can be pulled out from the tables .
    For Action Need to be taken and revision you may need to have new table .
    Neal

  • Urgent:Report in Excel format

    Hi,
    Iam trying to send the report output to a comma delimited
    textfile and then openeing this text file in Excel. When I do
    this using "DELIMITED" the column heading is repeating for each
    row. And We don't have the patch installed for using
    "Delimited_hdr=no". So Is there any other way of doing it.
    I would appreciate if any one could help me with this problem.
    Thanks
    Anu

    Rajesh,
    yes, with BI Publisher (formerly known as XML Publisher) it's easy.
    But with Reports you don't need to code utl_file to get your excel-output. Beginning with 10g there's for example the possibility to use desformat=spreadsheet. Beginning with 9i there's a nice way to use WebLayout to create excel output.
    Regards
    Rainer

  • URGENT REPORT START AND END DATE

    GUYZ help me how to generate a report with start date and end date, two text item or calendar rpresent start and end date, it will generate only the start to end date... plzz put the code guyss..
    this is my code when i call my report in runtime only in client server .. i want to generate it wit start and end date but dunno newbie ..
    Declare
    v_Rep varchar2 (30);
    repid report_Object;
    begin
    repid:=find_report_object('dept');
    v_rep:=run_report_object(repid);
    end;

    Check this sample Code..
    DECLARE
    pl_id ParamList;
    pl_name VARCHAR2(10) := 'repdata';
    BEGIN
    pl_id := Get_Parameter_List(pl_name);
    IF Id_Null(pl_id) THEN
    pl_id := Create_Parameter_List(pl_name);
    Add_Parameter(pl_id, 'P_STARTDATE', TEXT_PARAMETER,:BLK_CTRL.P_TODATE);
    Add_Parameter(pl_id, 'P_ENDDATE', TEXT_PARAMETER, :BLK_CTRL.P_CURRENCY);
    Add_Parameter(pl_id, 'PARAMFORM', TEXT_PARAMETER, 'NO');
    ELSE
    Destroy_Parameter_List( pl_id );
    END IF
    RUN_PRODUCT(REPORTS, 'D:\MMRROLDL.RDF' ,SYNCHRONOUS, RUNTIME, FILESYSTEM, pl_id ,NULL);
    END;

  • URGENT: Report parameter form set to yes in calling report from menu

    I have write this code for calling report from menu module. But where i put the code
    PARAMFORM='YES' to display the report parameter form in order to enter the parameter by user.
    DECLARE
    pl_id ParamList;
    repid REPORT_OBJECT;
    v_rep varchar2(100);
    v_server VARCHAR2(100);
    rep_status varchar2(100);
    v_host VARCHAR2(100);
    BEGIN
         select rep_server into v_server from reports_data;
         select machine into v_host from reports_data;
         pl_id := Get_Parameter_List('tmpdata');
         IF NOT Id_Null(pl_id) THEN
         Destroy_Parameter_List( pl_id );
         END IF;
         pl_id := Create_Parameter_List('tmpdata');           
    Add_Parameter(pl_id,'P_C_NAME',TEXT_PARAMETER,:GLOBAL.COMPANY);
    Add_Parameter(pl_id,'P_B_NAME',TEXT_PARAMETER,:GLOBAL.BRANCH);
    Add_Parameter(pl_id,'P_user',TEXT_PARAMETER,:GLOBAL.user);
         repid := find_report_object('REPORTOBJ');
         SET_REPORT_OBJECT_PROPERTY(repid,REPORT_FILENAME,getpath||'E_open_balance.RDF');
              SET_REPORT_OBJECT_PROPERTY(repid,REPORT_COMM_MODE,SYNCHRONOUS);
              SET_REPORT_OBJECT_PROPERTY(repid,REPORT_DESFORMAT,'htmlcss');
              SET_REPORT_OBJECT_PROPERTY(repid,REPORT_SERVER,v_server);
              v_rep := RUN_REPORT_OBJECT(repid, pl_id);
              rep_status := REPORT_OBJECT_STATUS(v_rep);
              WHILE rep_status in ('RUNNING','OPENING_REPORT','ENQUEUED')
                   LOOP
                        rep_status := report_object_status(v_rep);
                             message('Running');
                   END LOOP;
              IF rep_status = 'FINISHED' or rep_status is NULL THEN
              WEB.SHOW_DOCUMENT('http://'||v_host||'/reports/rwservlet/getjobid'||substr(v_rep,instr(v_rep,'_',-1)+1)||'?'||'server='||v_server,'_blank');
              ELSE
                   null;
         END IF;
    END;

    Jeneesh,
    SET_REPORT_OBJECT_PROPERTY(report_id,REPORT_OTHER,
    'paramform=YES
    what about this variable ?
    P_VAR1 = ........');

  • URGENT Report problem

    hi to all master
    using form6i and run in client server..
    i'm a student please be patient, school requirements.
    in report builder, query statement i put 'select * from booking'
    in report property pallete:
    Query name= select * from booking where customer_name=:rep
    other reports paramenter= :rep
    in form6i:
    i created one button and one text item.. the text item name =rep
    the trigger for button si when button pressed and code below:
    declare
    repid report_object;
    v_rep varchar2(100);
    begin
    repid:=find_report_object('report');
    set_report_property(repid,report_other,'customer_name='||:login.rep);
    v_rep:=run_report_object(repid);
    end;
    the problem is. i want that when i put name in the text item only that name will appear but dont work with my code all names appears..
    can anyone knows what is wrong with my code? ..

    sorry for duplicate post.. human error

  • Urgent report compatability question

    Post Author: BruceLawrence
    CA Forum: General
    We have some reports that are out of wack.   The original .rpt file was created with CR v8.
    I've already tried to modify and save it with visual studio.net but the application that prints the report stated that it couldnt open the report.
    I can get my hands on CR v. 8.5 but I open and modify the report, will it stay with v.8 compatibility ?
    Thanks for any replies

    Post Author: sharonmtowler
    CA Forum: General
    once you save an rpt file in a newer version, it will contain the new version format. i would make a copy 1st to double check to ensure that is your issue, the file may be corrupt also.

  • Urgent: Reports Output File location on 9iAS -Repost:

    Hi,
    Reference my earlier posts last one appended below:
    1- Jun 12, 2006 6:39 AM
    2- Jun 13, 2006 10:08 PM
    Please help me my manager is now getting upset. Or at least point me to the list of documents that I should study to sort this problem out.
    Thanks
    ---------------------------------------------------------------------------------------------------<Hi,
    I need your help in producing report output to OS file and dowloading it on to client's machine. This is 9iAS and Reports 6i patch 15 on Windows 2000 server.
    Output as PDF is stored in ...\Server\Cache, but output as Delimited or DelimitedData is un-traceable on server.
    I have created a folder with changed rights to "Everyone" and directing output to the folder. The report server displays a message that report output has been created succefully, but the folder remains empty.
    Please help!
    TIA!

    Hi,
    did you chaeck with customer support (metalink.oracle.com) in case you are hitting a bug ?
    Frank

  • URGENT: report output to spool

    hi experts,
    i have a program and i want it to have the output as a spool order. how will i do this? for example the output of the report is a list:
    MATERIAL   PLANT   DESCRIPTION
    XXXXXXXXX   XXXX        XXXXXXXXX
    XXXXXXXXX   XXXX        XXXXXXXXX
    once the program is executed, it should automatically create a spool depending on the material and plant entered in the selection screen. the list must be shown when checking the spool request in SP01. how will i do this?
    please help me. thank you very much...
    -march

    You can try with NEW-PAGE PRINT ON to send it to spool.
    Try like :
    START-OF-SELECTION.
      DO 10 TIMES.
        WRITE: / SY-ABCDE.
      ENDDO.
      DATA: PRINT_PARAMETERS TYPE PRI_PARAMS,
            VALID_FLAG(1) TYPE C.
      CALL FUNCTION 'GET_PRINT_PARAMETERS'
        IMPORTING
          OUT_PARAMETERS       = PRINT_PARAMETERS
          VALID                = VALID_FLAG
        EXCEPTIONS
          INVALID_PRINT_PARAMS = 2
          OTHERS               = 4.
      NEW-PAGE PRINT ON PARAMETERS PRINT_PARAMETERS
                          NO DIALOG.
    * call the same write data perform again
      DO 10 TIMES.
        WRITE: SY-ABCDE.
      ENDDO.
      NEW-PAGE PRINT OFF.
    Regards,
    Naimesh Patel

  • Urgent:Report customizing

    Hello everybody!
    I have created a report, I have added bind variables in the SQL query, and I'm using a
    template which was made by me. I specified all the buttons to appear in the customization page.
    When I run the customization from the reports
    manage page all of the buttons, and the template is the one which I choosed, and the report works with the bind variables.
    But when I put this report to a page as a portlet, the appearance of the report and the customization form is different from which I have specified, and reporting doesn't
    work.
    Do you have any idea why?
    Thanx for your help in advance?
    Zsolt

    hai laposa...
    what i understood...
    that's u were put the report in the page
    as a portlet ok...i thing u know when u create a report,we can't just click the
    run link to show all the values,we have to
    specify the values yes am i correct...
    i have a question,what page u were set as
    portlet parameter page and that tun page
    if u set the parameter page as a portlet then it will work,if error then tell me what is the error........
    hope.....
    bye
    null

  • Urgent - Report Column based on LOV - Value not found in LOV

    Hi All,
    Recently, we have upgraded to HTMLDB 2.0 from HTMLDB 1.5.
    I have a SQL report. One of the columns is based upon LOV - Display as Text (Based on LOV, does not save state).
    For the "Ids" of the report, it should display the corresponding "Names" from the LOV.
    But, for the cases, where no record exist in LOV for some Id, then it is directly showing the Id instead of "-" (which i have specified in Display Null Text) in the report column attributes.
    Before upgrade, it was working fine.
    Any idea where is the issue.
    Please help.
    Thanks in advance,
    Monika

    Hi,
    Can anybody help me in sorting out this issue please.
    For your reference, i have made a test case on
    http://apex.oracle.com/pls/otn/f?p=20451:4:3519837362944582:::::
    Here, there are 2 tables
    1. MY_EMP_COUNTRY(emoid, empname, cntry_id)
    2. MY_COUNTRY_LOOKUP(id, name,active)
    LOV is created on table 2
    select name d, id r
    from my_country_lookup
    where active = 'Y'
    And, on the page a SQL report is created
    select empname, cntry_id
    from my_emp_country
    where, cntry_id is based upon the LOV.
    Since, in lookup table, cntry_id = 4 is set inactive, it is not picked up by the LOV and hence on the report instead of showing the NULL text it is showing the cntry_id (4).
    The attributes of report column cntry id -
    Named LOV = CNTRY_LOV
    Display Null = YES
    NULL text = -
    Display Extra Value = YES
    Am I missing anything.
    thanks,
    Monika

Maybe you are looking for