Analytics Catalog/Oracle Fusion ERP/General Ledger/Greece Daily Journal Book - Line Descriptions Report
Explore the catalogReportsModulesEnterprise modelOTBI subject areasBICC PVOs
Oracle Fusion · General Ledger

Greece Daily Journal Book - Line Descriptions Report

General Ledger

The Greek statutory daily journal book — every journal posted, in date order, with line-level descriptions, in the legally prescribed format for the daily book of original entry.

Run note · BIP run  High-volume GL extracts can exceed BI Publisher's online output limit and time out. Run it as a scheduled process (ESS) with output bursted to file or email rather than online preview, and bound it by ledger and period.

Sample build of the Greece Daily Journal Book - Line Descriptions Report — reconciled, and rendered tool-neutral so it runs in Power BI, ThoughtSpot, or Tableau.

Greece Daily Journal Book - Line Descriptions Report
Sample build · illustrative
Filters
Entity
Globex Holdings
Entity Name
Globex Holdings
From Effective Date
2026-02-28
From Gl Date
2026-02-28
Subledger
US Primary
To Effective Date
2026-02-28
8,400
Journals
41,000
Lines
120
Missing description
Journal DateVoucherAccountLine DescriptionDebitCredit
2026-04-30Sample1000-2100-000Sample$1,240,500.00$1,240,500.00
2026-03-311000-5400-000$842,150.75$842,150.75
2026-02-28Sample1000-1410-000Sample$96,400.00$96,400.00
2026-01-312000-2100-000$1,005,233.10$1,005,233.10
2025-12-31Sample1000-6300-000Sample$58,720.40$58,720.40
2026-04-30Sample1000-2100-000Sample$1,240,500.00$1,240,500.00
AI Analyst · active
reading

The report reads GL_JE_LINES in date order with their descriptions, in the Greek daily-book layout.

flag

120 lines have no description — the Greek statutory daily book requires one on every line, so these would fail the legal format.

root cause & next step

Enforce line descriptions at entry or backfill before filing; a blank description is the most common Greek daily-book rejection.

Illustrative data. The live interactive version — drill-through, filters, export, and the AI Analyst — runs on your warehouse. See it live →

This is the report's BI Publisher data model — the SQL data set BI Publisher runs against Oracle tables to produce the output. The same SQL becomes a dbt model in your warehouse, so one definition drives both the formatted report and the analytics layer.

Data sources

How it interconnects: this data set reads the physical tables above. Those same tables surface in OTBI as subject areas and in BICC as PVOs — three lenses on one source. Open any table to trace its subject areas and View Objects.
SQL data set · genericized · parameterized · no hardcoded segments
Show / hide SQL
--ORIGINAL QUERY

select * from (
WITH SECURITY_TBL AS
(

SELECT DISTINCT GL.LEDGER_ID
FROM 
GL_LEDGERS GL,
GL_ACCESS_SETS GAS,
	FUN_USER_ROLE_DATA_ASGNMNTS FURDA,
	PER_ROLES_DN PRD,
	PER_USER_ROLES PUR,
	PER_USERS PU

WHERE 
UPPER(GL.LEDGER_CATEGORY_CODE) <> 'NONE'
AND GAS.ACCESS_SET_ID=GL.IMPLICIT_ACCESS_SET_ID
	AND (GAS.ACCESS_SET_ID =FURDA.ACCESS_SET_ID OR GL.LEDGER_ID=FURDA.LEDGER_ID)
	AND UPPER(FURDA.role_name) in ('XXC_GL_INQUIRY_JOB','XXC_GENERAL_ACCOUNTANT_JOB','XXC_GENERAL_ACCOUNTING_MANAGER_JOB')
	AND UPPER(FURDA.ACTIVE_FLAG) = 'Y'
	AND UPPER(FURDA.ROLE_NAME) = UPPER(PRD.ROLE_COMMON_NAME)
	AND PRD.ROLE_ID = PUR.ROLE_ID
	AND PUR.USER_ID = PU.USER_ID
	AND  UPPER(PU.USERNAME) = UPPER(:xdo_user_name)
	AND PU.USER_GUID = FURDA.USER_GUID

)

SELECT BALANCING_SEGMENT
,INTERNAL_REF
,ACCOUNT_SEGMENT
,BALANCING_SEGMENT_DESC
,ACCOUNT_SEGMENT_DESC
,GL_DATE
,TRANSACTION_DATE
--,je_batch_name
,period_name
,JE_SOURCE_NAME
,GL_JE_NAME
,JOURNAL_ENTRY
,JE_HEADER_ID
,JE_CATEGORY_NAME
,LEDGER_NAME
,Reporting_sequence_of_the_Journal
,Document_Number_of_the_Transaction
,Transaction_Type
,Journal_Description
,NVL(SUM(DEBIT),0) DEBIT
,CREDIT CREDIT

FROM 

(
SELECT
            LPAD(CAST(cc.segment1 AS VARCHAR(4)), 4, '0') BALANCING_SEGMENT
,   CASE WHEN gjct.JE_CATEGORY_NAME in ('Sales Invoices', 'Credit Memos' )
       THEN (SELECT ATTRIBUTE1 FROM RA_CUSTOMER_TRX_ALL WHERE CUSTOMER_TRX_ID = ent.SOURCE_ID_INT_1) 
	ELSE NVL(ent.transaction_number,GJH.NAME ) END INTERNAL_REF  ---NEW Condition

           , cc.segment4   ACCOUNT_SEGMENT
            ,A1.NAME BALANCING_SEGMENT_DESC
            ,At4.DESCRIPTION ACCOUNT_SEGMENT_DESC
        ,gjh.DEFAULT_EFFECTIVE_DATE GL_DATE 
		,XEV.TRANSACTION_DATE
        ,gjh.period_name
        ,gjst.user_je_source_name JE_SOURCE_NAME
--, gjb.name je_batch_name
        ,gjh.NAME GL_JE_NAME
		, gjh.name JOURNAL_ENTRY
        ,GJH.JE_HEADER_ID
        ,gjct.user_je_category_name JE_CATEGORY_NAME
        --,ent.transaction_number TRANSACTION_NUMBER
        ,gll.name LEDGER_NAME
        --,GJL.currency_code ENTERED_CUR
       /* ,nvl(nvl(ael.ENTERED_DR,GJL.ENTERED_DR),0)-nvl(nvl(ael.ENTERED_CR,GJL.ENTERED_CR),0) ENTERED_AMOUNT
        ,nvl(nvl(ael.ACCOUNTED_DR,gjl.ACCOUNTED_DR),0)-nvl(nvl(ael.ACCOUNTED_CR,gjl.ACCOUNTED_CR),0) ACCOUNTED_AMOUNT*/
        --,FAT.APPLICATION_NAME SUBLEDGER_APPLICATION
        --,xect.NAME EVENT_CLASS_NAME
        --,xet.NAME EVENT_TYPE_NAME
        --,decode(ael.PARTY_TYPE_CODE,'C', 'Customer','S', 'Supplier') PARTY_TYPE
         
    --,gll.currency_code LEDGER_CURRENCY
    , NVL(aeh.CLOSE_ACCT_SEQ_VALUE,GJH.CLOSE_ACCT_SEQ_VALUE )			Reporting_sequence_of_the_Journal
    , (	CASE WHEN  FAT.APPLICATION_ID IN (200,222) AND gjct.JE_CATEGORY_NAME in ('Sales Invoices', 'Credit Memos' )
       THEN (SELECT ATTRIBUTE1 FROM RA_CUSTOMER_TRX_ALL WHERE CUSTOMER_TRX_ID	=ent.SOURCE_ID_INT_1)
	WHEN  FAT.APPLICATION_ID IN (200,222)  THEN ent.transaction_number else null end)  	Document_Number_of_the_Transaction
    
     	 
     , (CASE WHEN gjst.user_je_source_name='Receivables'
            THEN (CASE WHEN gjct.JE_CATEGORY_NAME='Receipts' AND AEL.ACCOUNTING_CLASS_CODE = 'WRITE_OFF' 
		       Then 'ΔΙΑΓΡΑΦΗ ΕΙΣΠΡΑΚΤΕΟΥ ΥΠΟΛΟΙΠΟΥ'
		       WHEN  AEL.ACCOUNTING_CLASS_CODE = 'REFUND'
		       Then 'ΕΠΙΣΤΡΟΦΗ ΠΙΣΤΩΤΙΚΟΥ ΥΠΟΛΟΙΠΟΥ' 
		       When gjct.JE_CATEGORY_NAME='Receipts' AND AEL.ACCOUNTING_CLASS_CODE NOT IN ('WRITE_OFF', 'REFUND')				
                       THEN (SELECT (CASE WHEN ARM1.PRINTED_NAME = 'ORA_AP/AR Netting'  Then 'ΣΥΜΨΗΦΙΣΜΟΣ ΠΕΛΑΤΗ - ΠΡΟΜΗΘΕΥΤΗ'
					 ELSE ARM1.PRINTED_NAME END)  
					           FROM AR_CASH_RECEIPTS_ALL ACRA 
							      , ar_receipt_methods ARM1
							  WHERE ent.transaction_number = ACRA.RECEIPT_NUMBER 
								AND ACRA.RECEIPT_METHOD_ID = ARM1.RECEIPT_METHOD_ID
								AND ACRA.CASH_RECEIPT_ID  = ent.SOURCE_ID_INT_1
								AND ACRA.ORG_ID=(SELECT  BU_ID FROM FUN_ALL_BUSINESS_UNITS_V
                                                  WHERE BU_NAME='GR BU EUR'
                                                  AND STATUS='A'
                                                  AND ROWNUM=1)) 
                        WHEN gjct.JE_CATEGORY_NAME IN ('Misc Receipts', 'Adjustment')
                        THEN (SELECT ARTRX.DESCRIPTION FROM AR_RECEIVABLES_TRX_ALL ARTRX, AR_ADJUSTMENTS_ALL ARADJ 
			      WHERE ARTRX.RECEIVABLES_TRX_ID = ARADJ.RECEIVABLES_TRX_ID AND ARADJ.ADJUSTMENT_ID = ENT.SOURCE_ID_INT_1 )
                   
                        ELSE NVL(FLVCAT.MEANING,gjct.USER_JE_CATEGORY_NAME)
                        END)
            WHEN gjst.user_je_source_name='Payables'
            THEN (CASE WHEN gjct.JE_CATEGORY_NAME='Purchase Invoices' AND ENT.TRANSACTION_NUMBER LIKE 'EXP%' THEN 'Εξοδολόγια εργαζομένων' ---NEW Condition
		       WHEN gjct.JE_CATEGORY_NAME='Purchase Invoices' AND (SELECT SOURCE FROM AP_INVOICES_ALL WHERE INVOICE_ID=ent.SOURCE_ID_INT_1 AND PAY_PROC_TRXN_TYPE_CODE = 'AR_CUSTOMER_REFUND') = 'Receivables'
                        Then 'Αίτημα Πληρωμής' 
					   WHEN gjct.JE_CATEGORY_NAME='Purchase Invoices'
                       THEN FLVEVCL.MEANING
                       WHEN gjct.JE_CATEGORY_NAME='Payments' 
                       THEN (CASE WHEN (SELECT DISTINCT PAYMENT_METHOD_NAME FROM IBY_PAYMENT_METHODS_B PMB
                                                  , IBY_PAYMENT_METHODS_TL PMT
												  , AP_CHECKS_ALL ACA
                                                  WHERE PMB.PAYMENT_METHOD_CODE=PMT.PAYMENT_METHOD_CODE
                                                  AND PMT.LANGUAGE = USERENV('LANG')
												  AND ACA.PAYMENT_METHOD_CODE=PMB.PAYMENT_METHOD_CODE
												  AND ACA.check_id=ent.SOURCE_ID_INT_1)='AP/AR Netting'
                                  THEN 'ΣΥΜΨΗΦΙΣΜΟΣ ΠΕΛΑΤΗ - ΠΡΟΜΗΘΕΥΤΗ'
                                  ELSE 'ΠΛΗΡΩΜΗ' END)
                        
                        ELSE NVL(FLVCAT.MEANING,gjct.USER_JE_CATEGORY_NAME)
                        END)
                        ELSE NVL(FLVCAT.MEANING,gjct.USER_JE_CATEGORY_NAME) END )  Transaction_Type 
    
    , (CASE WHEN gjst.user_je_source_name='Receivables'
            THEN (CASE WHEN gjct.JE_CATEGORY_NAME in ('Sales Invoices', 'Credit Memos' )
                       THEN 	 hp1.party_name || ' / ' || hca.ACCOUNT_NUMBER  || ' / ' || (SELECT COMMENTS FROM RA_CUSTOMER_TRX_ALL WHERE CUSTOMER_TRX_ID	=ent.SOURCE_ID_INT_1 )
                                  
                   ELSE 	  hp1.party_name || ' / ' || hca.ACCOUNT_NUMBER  
                                   END )
            WHEN gjst.user_je_source_name='Payables'
            THEN (CASE WHEN ENT.TRANSACTION_NUMBER LIKE 'EXP%' 
			
					/*ect.EVENT_CLASS_CODE in ('EXPENSE REPORTS', 'MIXED')*/
					
                       then ( SELECT DISTINCT HZ1.PARTY_NAME || ' / ' || PAPF.PERSON_NUMBER || ' / ' || EXM.PURPOSE FROM EXM_EXPENSE_REPORTS EXM, PER_USERS PER, HZ_PARTIES HZ1, PER_ALL_PEOPLE_F PAPF WHERE HZ1.USER_GUID = PER.USER_GUID and EXM.PERSON_ID = PER.PERSON_ID  AND PER.PERSON_ID = PAPF.PERSON_ID AND EXM.EXPENSE_REPORT_NUM  = ENT.TRANSACTION_NUMBER) --NEW CONDITION
					   
					  /* hp2.PARTY_NAME || ' / ' ||  ps.SEGMENT1 || ' / ' || (SELECT distinct DESCRIPTION FROM AP_INVOICES_ALL WHERE VENDOR_ID=PS.VENDOR_ID AND INVOICE_ID=  ent.SOURCE_ID_INT_1 )*/
					   
		       WHEN gjct.JE_CATEGORY_NAME='Purchase Invoices' AND (SELECT SOURCE FROM AP_INVOICES_ALL WHERE INVOICE_ID=ent.SOURCE_ID_INT_1 AND PAY_PROC_TRXN_TYPE_CODE = 'AR_CUSTOMER_REFUND') = 'Receivables'
                        Then (SELECT HZP1.PARTY_NAME || ' / ' || HCA1.ACCOUNT_NUMBER FROM AP_INVOICES_ALL AP1, HZ_CUST_ACCOUNTS HCA1 , HZ_PARTIES HZP1 WHERE AP1.INVOICE_ID=ent.SOURCE_ID_INT_1 AND AP1.PARTY_ID = HCA1.PARTY_ID AND HCA1.PARTY_ID = HZP1.PARTY_ID)		   
                       WHEN gjct.JE_CATEGORY_NAME='Payments'
                       THEN hp2.PARTY_NAME || ' / ' ||  ps.SEGMENT1 || ' / ' || (select distinct BANK_ACCOUNT_NUM || ' / ' || vendor_name from AP_CHECKS_ALL 
																				where check_id = ent.SOURCE_ID_INT_1) 
					   
					   /*(SELECT distinct CBA.BANK_ACCOUNT_NUM FROM AP_CHECKS_ALL ACA, CE_BANK_ACCOUNTS CBA
                                                                               WHERE ACA.LEGAL_ENTITY_ID=ent.LEGAL_ENTITY_ID
																			   and ACA.LEGAL_ENTITY_ID=CBA.ACCOUNT_OWNER_ORG_ID
																			   and ACA.BANK_ACCOUNT_NAME=CBA.BANK_ACCOUNT_NAME
																			   ) 
                                           || ' / ' || (SELECT distinct BANK_ACCOUNT_NAME FROM AP_CHECKS_ALL ACA
                                                                               WHERE ACA.LEGAL_ENTITY_ID=ent.LEGAL_ENTITY_ID)*/
                       ELSE hp2.PARTY_NAME || ' / ' ||  ps.SEGMENT1  END )
                
            WHEN gjst.user_je_source_name='Assets' THEN gjh.period_name
            WHEN gjst.user_je_source_name='Projects' 	then 'ΚΙΝΗΣΗ ΜΕΤΑΞΥ ΕΡΓΩΝ' 
            ELSE gjl.description END ) Journal_Description  
    
    /*,( CASE WHEN gjst.user_je_source_name in ('Payables', 'Receivables')
           THEN (SELECT NVL(SUM(XAL1.ACCOUNTED_DR),0)
                         FROM XLA_AE_LINES XAL1
                         WHERE XAL1.APPLICATION_ID=ael.APPLICATION_ID
                         AND XAL1.AE_HEADER_ID=ael.AE_HEADER_ID
                         and xal1.ae_line_num=ael.ae_line_num
                         AND XAL1.CODE_COMBINATION_ID=ael.CODE_COMBINATION_ID
                         AND XAL1.APPLICATION_ID IN (200,222)
                         GROUP BY CC.SEGMENT4,XAL1.APPLICATION_ID)
            ELSE NVL(GJL.ACCOUNTED_DR,0) END ) DEBIT*/
	,NVL(ael.ACCOUNTED_DR,GJL.ACCOUNTED_DR) DEBIT
    ,0 CREDIT
            
            
        FROM
         gl_je_headers gjh
        ,gl_je_batches gjb
        ,GL_JE_LINES gjl
        ,GL_LEDGERS gll
        ,gl_code_combinations cc
        ,gl_je_sources_tl gjst
        ,gl_je_categories_tl gjct
        /*,gl_daily_conversion_types gdct
        ,gl_je_action_log gja
         ,per_users pu
        ,per_person_names_f ppf 
        ,gl_je_headers o*/
        ,XLA_EVENTS XEV
         ,xle_entity_profiles A1
        ,fnd_flex_values_vl A4
		,fnd_flex_values_tl at4
       
         ,GL_IMPORT_REFERENCES gir
        ,xla_ae_lines ael
        ,xla_ae_headers aeh
        ,xla_event_types_tl xet
        ,xla_event_classes_tl xect
        ,xla_transaction_entities ent
		,XLA_TRANSACTION_HEADERS XTH
        ,XLA_SUBLEDGERS_TL FAT 
         ,HZ_CUST_ACCOUNTS hca
        ,POZ_SUPPLIERS ps
        ,hz_parties hp1
, hz_parties hp2
,fnd_lookup_values FLVCAT
,fnd_lookup_values FLVEVCL
 ,SECURITY_TBL ST   
        WHERE 1=1
		
	    AND ST.LEDGER_ID=GLL.LEDGER_ID
        AND gjl.JE_HEADER_ID = gjh.JE_HEADER_ID
        AND gjh.JE_BATCH_ID = gjb.JE_BATCH_ID
       /* AND (nvl(GJL.ENTERED_DR,0)-nvl(GJL.ENTERED_CR,0)!=0 OR nvl(GJL.ACCOUNTED_DR,0)-nvl(GJL.ACCOUNTED_CR,0)!=0)*/
        AND gjl.code_combination_id = cc.code_combination_id
        AND gll.ledger_id = gjl.ledger_id
        AND gll.LEDGER_ID = gjh.LEDGER_ID
        AND gjst.je_source_name = gjh.je_source
        AND gjst.LANGUAGE = USERENV('LANG')
        AND gjct.je_category_name = gjh.JE_CATEGORY
        AND gjct.LANGUAGE = 'EL'
        --AND gjl.currency_conversion_type = gdct.conversion_type(+)
        AND gjb.status = 'P'
        AND gjh.status = 'P'
        AND gjl.currency_code!= 'STAT'
        /*AND gja.je_batch_id = gjb.je_batch_id
        AND gja.action_code = 'POSTED'
        AND upper(gja.user_id) = upper(pu.username)
        AND pu.person_id = ppf.person_id (+)
        AND 'GLOBAL' = ppf.name_type (+)
        AND gjh.je_header_id = o.accrual_rev_je_header_id (+)*/
    
    
    
         AND A1.LEGAL_ENTITY_IDENTIFIER = cc.segment1
        AND A4.flex_value = cc.segment4
        AND A4.VALUE_CATEGORY = 'GREECE ACCOUNT VALUE SET'
		and at4.flex_value_id=a4.flex_value_id
		and at4.language='EL'
    
        and gjst.je_source_name in ('Assets', 'Payables', 'Receivables', 'Cash Management', 'Projects', 'Project Accounting', 'Lease Accounting','Purchasing')
         AND (CASE WHEN gjst.user_je_source_name <> 'Payroll' 
            THEN gjb.JE_BATCH_ID
            ELSE null END) = gir.JE_BATCH_ID (+) 
    
         AND gjl.JE_HEADER_ID = gir.JE_HEADER_ID(+)
        AND gjl.JE_LINE_NUM = gir.JE_LINE_NUM(+)
        AND gir.GL_SL_LINK_ID = ael.GL_SL_LINK_ID(+)
        AND gir.GL_SL_LINK_TABLE = ael.GL_SL_LINK_TABLE(+)
        AND ael.ae_header_id = aeh.ae_header_id(+)
        AND ael.PARTY_ID = hca.cust_account_id (+)
        AND ael.PARTY_ID = ps.vendor_id (+)
        AND hca.PARTY_ID = hp1.PARTY_ID (+)
	and ps.party_id=hp2.party_id(+)
        AND aeh.application_id = ent.application_id(+)
        AND aeh.APPLICATION_ID = FAT.APPLICATION_ID(+)
        AND aeh.entity_id = ent.entity_id(+)
        AND aeh.ledger_id = ent.ledger_id(+) 
		AND aeh.application_id = XTH.application_id(+)
        AND AEH.event_id = XTH.event_id(+)
        AND aeh.ledger_id = XTH.ledger_id(+) 
		AND XEV.EVENT_ID(+)=aeh.EVENT_ID
		AND aeh.application_id = XEV.application_id(+)

		
        AND FAT.LANGUAGE(+) = USERENV('LANG')
        --AND NVL(FAT.APPLICATION_NAME,'ABC') = NVL(NVL((:P_SUBLEDGER),FAT.APPLICATION_NAME),'ABC')
        AND aeh.application_id = xet.application_id(+)
        AND aeh.event_type_code = xet.event_type_code(+)
        AND xet.LANGUAGE(+) = USERENV('LANG')
        AND xet.entity_code = xect.entity_code(+)
        AND xet.application_id = xect.application_id(+)
        AND xet.event_class_code = xect.event_class_code(+)
        AND  xect.LANGUAGE(+) ='US'
       AND FLVEVCL.LOOKUP_TYPE(+) ='XXC_EVENT_CLASSES_GREECE'
	   AND FLVEVCL.LOOKUP_CODE(+)=xect.EVENT_CLASS_CODE
       AND FLVEVCL.LANGUAGE(+)='US'
	   AND FLVCAT.LOOKUP_TYPE(+)='XXC_GREECE_TRASLATIONS'
	    AND FLVCAT.LOOKUP_CODE(+)=(CASE WHEN GJCT.JE_CATEGORY_NAME LIKE '30%'
                                        THEN  GJCT.USER_JE_CATEGORY_NAME
                                        ELSE GJCT.JE_CATEGORY_NAME
                                        END )
       AND FLVCAT.LANGUAGE(+)='US'
    AND gjl.EFFECTIVE_DATE BETWEEN nvl((select distinct START_DATE from GL_PERIODS gp where gp.period_name = :P_FROM_GL_DATE and gp.period_seT_name=gll.period_set_name),gjl.EFFECTIVE_DATE ) AND nvl((select distinct END_DATE from GL_PERIODS gp2 where gp2.period_name = :P_TO_GL_DATE and gp2.period_seT_name=gll.period_set_name),gjl.EFFECTIVE_DATE )
                              AND  
                            (CAST(cc.segment1 as numeric) IN (:P_ENTITY) OR 'All' IN ('All'||:P_ENTITY))
                            
            and (A1.NAME IN (:P_ENTITY_NAME) OR 'All' IN ('All'||:P_ENTITY_NAME))
            --AND UPPER(A1.DESCRIPTION)='CUSTOM ΜΟΝΟΠΡΟΣΩΠΗ Α.Ε.Β.Ε.'  
    AND gjl.EFFECTIVE_DATE BETWEEN nvl(:P_FROM_EFFECTIVE_DATE,gjl.EFFECTIVE_DATE) and  nvl(:P_TO_EFFECTIVE_DATE,gjl.EFFECTIVE_DATE)
        
        --and trunc(sysdate) between  trunc(NVL(ppf.EFFECTIVE_START_DATE,SYSDATE)) and trunc(NVL(ppf.EFFECTIVE_END_DATE,SYSDATE))
    
   and ((case when :P_FROM_GL_DATE  ='01-' || (select distinct substr(period_year,3,2) 
                                          from gl_periods 
										   where period_name=:P_FROM_GL_DATE
										   and period_set_name=gll.period_set_name) 
										then gjh.period_name else (select :P_FROM_GL_DATE from gl_periods where period_name=:P_FROM_GL_DATE and ADJUSTMENT_PERIOD_FLAG='N' and period_set_name=gll.period_set_name and period_name<>  '12-' || substr(period_year,3,2))  end  )    <>  'ΑΝΟΙΓ-' || (select distinct substr(period_year,3,2) 
                                                                                                                                                              from gl_periods 
								                                                                                                                               where period_name=:P_FROM_GL_DATE
		 								                                                                                                                          and period_set_name=gll.period_set_name)
		
or (case when :P_FROM_GL_DATE  ='ΑΝΟΙΓ-' || (select distinct substr(period_year,3,2) 
                                          from gl_periods 
										   where period_name=:P_FROM_GL_DATE
										   and period_set_name=gll.period_set_name) 
										then gjh.period_name  end   ) =gjh.period_name 
										
or (case when :P_FROM_GL_DATE  ='ΚΛΕΙΣ-' || (select distinct substr(period_year,3,2) 
                                          from gl_periods 
										   where period_name=:P_FROM_GL_DATE
										   and period_set_name=gll.period_set_name) 
										then gjh.period_name  end  )    <>  '12-' || (select distinct substr(period_year,3,2) 
                                                                                                                                                              from gl_periods 
								                                                                                                                               where period_name=:P_FROM_GL_DATE
		 								                                                                                                                          and period_set_name=gll.period_set_name)
																										or (case when :P_FROM_GL_DATE  ='12-' || (select distinct substr(period_year,3,2) 
                                          from gl_periods 
										   where period_name=:P_FROM_GL_DATE
										   and period_set_name=gll.period_set_name) 
										then gjh.period_name  end   ) =gjh.period_name														  										
										
										)

and ((case when :P_TO_GL_DATE  ='12-' || (select distinct substr(period_year,3,2) 
                                          from gl_periods 
										   where period_name=:P_TO_GL_DATE
										   and period_set_name=gll.period_set_name) 
										then gjh.period_name else (select :P_TO_GL_DATE from gl_periods where period_name=:P_TO_GL_DATE and ADJUSTMENT_PERIOD_FLAG='N' and period_set_name=gll.period_set_name  and period_name<>  '01-' || substr(period_year,3,2)) end  )    <>  'ΚΛΕΙΣ-' || (select distinct substr(period_year,3,2) 
                                                                                                                                                              from gl_periods 
								                                                                                                                               where period_name=:P_TO_GL_DATE
		 								                                                                                                                          and period_set_name=gll.period_set_name)
		
or (case when :P_TO_GL_DATE  ='ΚΛΕΙΣ-' || (select distinct substr(period_year,3,2) 
                                          from gl_periods 
										   where period_name=:P_TO_GL_DATE
										   and period_set_name=gll.period_set_name) 
										then gjh.period_name  end   ) =gjh.period_name 
										
or 	(case when :P_TO_GL_DATE  ='ΑΝΟΙΓ-' || (select distinct substr(period_year,3,2) 
                                          from gl_periods 
										   where period_name=:P_TO_GL_DATE
										   and period_set_name=gll.period_set_name) 
										then gjh.period_name  end  )    <>  '01-' || (select distinct substr(period_year,3,2) 
                                                                                                                                                              from gl_periods 
								                                                                                                                               where period_name=:P_TO_GL_DATE
		 								                                                                                                                          and period_set_name=gll.period_set_name)									
or (case when :P_TO_GL_DATE  ='01-' || (select distinct substr(period_year,3,2) 
                                          from gl_periods 
										   where period_name=:P_TO_GL_DATE
										   and period_set_name=gll.period_set_name) 
										then gjh.period_name  end   ) =gjh.period_name 										
										)	
	  																				  
	 
	    
) 
WHERE (DEBIT<>0 or CREDIT <> 0)

GROUP BY
BALANCING_SEGMENT
,INTERNAL_REF
,ACCOUNT_SEGMENT
,BALANCING_SEGMENT_DESC
,ACCOUNT_SEGMENT_DESC
,GL_DATE
,TRANSACTION_DATE
,period_name
--,je_batch_name
,JE_SOURCE_NAME
,GL_JE_NAME
,JOURNAL_ENTRY
,JE_HEADER_ID
,JE_CATEGORY_NAME
,LEDGER_NAME
,Reporting_sequence_of_the_Journal
,Document_Number_of_the_Transaction
,Transaction_Type
,Journal_Description
,CREDIT

UNION ALL

SELECT
BALANCING_SEGMENT
,INTERNAL_REF
,ACCOUNT_SEGMENT
,BALANCING_SEGMENT_DESC
,ACCOUNT_SEGMENT_DESC
,GL_DATE
,TRANSACTION_DATE
--,je_batch_name
,period_name
,JE_SOURCE_NAME
,GL_JE_NAME
,JOURNAL_ENTRY
,JE_HEADER_ID
,JE_CATEGORY_NAME
,LEDGER_NAME
,Reporting_sequence_of_the_Journal
,Document_Number_of_the_Transaction
,Transaction_Type
,Journal_Description
,DEBIT DEBIT
,NVL(SUM(CREDIT),0) CREDIT

FROM 

(
SELECT
            LPAD(CAST(cc.segment1 AS VARCHAR(4)), 4, '0') BALANCING_SEGMENT
,CASE WHEN gjct.JE_CATEGORY_NAME in ('Sales Invoices', 'Credit Memos' )
       THEN (SELECT ATTRIBUTE1 FROM RA_CUSTOMER_TRX_ALL WHERE CUSTOMER_TRX_ID	=ent.SOURCE_ID_INT_1) 
	ELSE NVL(ent.transaction_number,GJH.NAME ) END INTERNAL_REF
           , cc.segment4   ACCOUNT_SEGMENT
            ,A1.name BALANCING_SEGMENT_DESC
            ,At4.DESCRIPTION ACCOUNT_SEGMENT_DESC
        ,gjh.DEFAULT_EFFECTIVE_DATE GL_DATE 
		,XEV.TRANSACTION_DATE
        ,gjh.period_name
        ,gjst.user_je_source_name JE_SOURCE_NAME
--, gjb.name je_batch_name
        ,gjh.NAME GL_JE_NAME
		, gjh.name JOURNAL_ENTRY
        ,GJH.JE_HEADER_ID
        ,gjct.user_je_category_name JE_CATEGORY_NAME
        --,ent.transaction_number TRANSACTION_NUMBER
        ,gll.name LEDGER_NAME
        --,GJL.currency_code ENTERED_CUR
       /* ,nvl(nvl(ael.ENTERED_DR,GJL.ENTERED_DR),0)-nvl(nvl(ael.ENTERED_CR,GJL.ENTERED_CR),0) ENTERED_AMOUNT
        ,nvl(nvl(ael.ACCOUNTED_DR,gjl.ACCOUNTED_DR),0)-nvl(nvl(ael.ACCOUNTED_CR,gjl.ACCOUNTED_CR),0) ACCOUNTED_AMOUNT*/
        --,FAT.APPLICATION_NAME SUBLEDGER_APPLICATION
        --,xect.NAME EVENT_CLASS_NAME
        --,xet.NAME EVENT_TYPE_NAME
        --,decode(ael.PARTY_TYPE_CODE,'C', 'Customer','S', 'Supplier') PARTY_TYPE
         
    --,gll.currency_code LEDGER_CURRENCY
    ,  NVL(aeh.CLOSE_ACCT_SEQ_VALUE,GJH.CLOSE_ACCT_SEQ_VALUE )	 Reporting_sequence_of_the_Journal
    , (	CASE WHEN  FAT.APPLICATION_ID IN (200,222) AND gjct.JE_CATEGORY_NAME in ('Sales Invoices', 'Credit Memos' )
       THEN (SELECT ATTRIBUTE1 FROM RA_CUSTOMER_TRX_ALL WHERE CUSTOMER_TRX_ID	=ent.SOURCE_ID_INT_1)
	WHEN  FAT.APPLICATION_ID IN (200,222)  THEN ent.transaction_number else null end) 	Document_Number_of_the_Transaction
    
     	 
      , (CASE WHEN gjst.user_je_source_name='Receivables'
            THEN (CASE WHEN gjct.JE_CATEGORY_NAME='Receipts' AND AEL.ACCOUNTING_CLASS_CODE = 'WRITE_OFF' 
		       Then 'ΔΙΑΓΡΑΦΗ ΕΙΣΠΡΑΚΤΕΟΥ ΥΠΟΛΟΙΠΟΥ'
		       WHEN  AEL.ACCOUNTING_CLASS_CODE = 'REFUND'
		       Then 'ΕΠΙΣΤΡΟΦΗ ΠΙΣΤΩΤΙΚΟΥ ΥΠΟΛΟΙΠΟΥ' 
		       When gjct.JE_CATEGORY_NAME='Receipts' AND AEL.ACCOUNTING_CLASS_CODE NOT IN ('WRITE_OFF', 'REFUND') 
                       THEN (SELECT (CASE WHEN ARM1.PRINTED_NAME = 'ORA_AP/AR Netting'  Then 'ΣΥΜΨΗΦΙΣΜΟΣ ΠΕΛΑΤΗ - ΠΡΟΜΗΘΕΥΤΗ'
					 ELSE ARM1.PRINTED_NAME END)  
					           FROM AR_CASH_RECEIPTS_ALL ACRA 
							      , ar_receipt_methods ARM1
							  WHERE ent.transaction_number = ACRA.RECEIPT_NUMBER 
								AND ACRA.RECEIPT_METHOD_ID = ARM1.RECEIPT_METHOD_ID
								AND ACRA.CASH_RECEIPT_ID  = ent.SOURCE_ID_INT_1
								AND ACRA.ORG_ID=(SELECT  BU_ID FROM FUN_ALL_BUSINESS_UNITS_V
                                                  WHERE BU_NAME='GR BU EUR'
                                                  AND STATUS='A'
                                                  AND ROWNUM=1))
                        WHEN gjct.JE_CATEGORY_NAME IN ('Misc Receipts', 'Adjustment')
                        THEN (SELECT ARTRX.DESCRIPTION FROM AR_RECEIVABLES_TRX_ALL ARTRX, AR_ADJUSTMENTS_ALL ARADJ 
			      WHERE ARTRX.RECEIVABLES_TRX_ID = ARADJ.RECEIVABLES_TRX_ID AND ARADJ.ADJUSTMENT_ID = ENT.SOURCE_ID_INT_1 )
                   
                        ELSE NVL(FLVCAT.MEANING,gjct.USER_JE_CATEGORY_NAME)
                        END)
            WHEN gjst.user_je_source_name='Payables'
            THEN (CASE WHEN gjct.JE_CATEGORY_NAME='Purchase Invoices' AND ENT.TRANSACTION_NUMBER LIKE 'EXP%' THEN 'Εξοδολόγια εργαζομένων'
		       WHEN gjct.JE_CATEGORY_NAME='Purchase Invoices' AND (SELECT SOURCE FROM AP_INVOICES_ALL WHERE INVOICE_ID=ent.SOURCE_ID_INT_1 AND PAY_PROC_TRXN_TYPE_CODE = 'AR_CUSTOMER_REFUND') = 'Receivables'
                        Then 'Αίτημα Πληρωμής' 
		       WHEN gjct.JE_CATEGORY_NAME='Purchase Invoices'
                       THEN FLVEVCL.MEANING
                       WHEN gjct.JE_CATEGORY_NAME='Payments' 
                       THEN (CASE WHEN (SELECT DISTINCT PAYMENT_METHOD_NAME FROM IBY_PAYMENT_METHODS_B PMB
                                                  , IBY_PAYMENT_METHODS_TL PMT
												  , AP_CHECKS_ALL ACA
                                                  WHERE PMB.PAYMENT_METHOD_CODE=PMT.PAYMENT_METHOD_CODE
                                                  AND PMT.LANGUAGE = USERENV('LANG')
												  AND ACA.CHECK_ID  = ENT.SOURCE_ID_INT_1
												  AND ACA.PAYMENT_METHOD_CODE=PMB.PAYMENT_METHOD_CODE
												  AND ACA.VENDOR_ID=PS.VENDOR_ID)='AP/AR Netting'
                                  THEN 'ΣΥΜΨΗΦΙΣΜΟΣ ΠΕΛΑΤΗ - ΠΡΟΜΗΘΕΥΤΗ'
                                  ELSE 'ΠΛΗΡΩΜΗ' END)
                        
                        ELSE NVL(FLVCAT.MEANING,gjct.USER_JE_CATEGORY_NAME)
                        END)
                        ELSE NVL(FLVCAT.MEANING,gjct.USER_JE_CATEGORY_NAME) END )  Transaction_Type   
    
    , (CASE WHEN gjst.user_je_source_name='Receivables'
            THEN (CASE WHEN gjct.JE_CATEGORY_NAME in ('Sales Invoices', 'Credit Memos' )
                       THEN 	 hp1.party_name || ' / ' || hca.ACCOUNT_NUMBER  || ' / ' || (SELECT COMMENTS FROM RA_CUSTOMER_TRX_ALL WHERE CUSTOMER_TRX_ID	=ent.SOURCE_ID_INT_1 )
                                  
                   ELSE 	  hp1.party_name || ' / ' || hca.ACCOUNT_NUMBER  
                                   END )
            WHEN gjst.user_je_source_name='Payables'
            THEN (CASE WHEN ENT.TRANSACTION_NUMBER LIKE 'EXP%' 
			
					/*ect.EVENT_CLASS_CODE in ('EXPENSE REPORTS', 'MIXED')*/
					
                       then ( SELECT DISTINCT HZ1.PARTY_NAME || ' / ' || PAPF.PERSON_NUMBER || ' / ' || EXM.PURPOSE FROM EXM_EXPENSE_REPORTS EXM, PER_USERS PER, HZ_PARTIES HZ1, PER_ALL_PEOPLE_F PAPF WHERE HZ1.USER_GUID = PER.USER_GUID and EXM.PERSON_ID = PER.PERSON_ID  AND PER.PERSON_ID = PAPF.PERSON_ID AND EXM.EXPENSE_REPORT_NUM  = ENT.TRANSACTION_NUMBER) --NEW CONDITION
					   
					  /* hp2.PARTY_NAME || ' / ' ||  ps.SEGMENT1 || ' / ' || (SELECT distinct DESCRIPTION FROM AP_INVOICES_ALL WHERE VENDOR_ID=PS.VENDOR_ID AND INVOICE_ID=  ent.SOURCE_ID_INT_1 )*/
                       WHEN gjct.JE_CATEGORY_NAME='Purchase Invoices' AND (SELECT SOURCE FROM AP_INVOICES_ALL WHERE INVOICE_ID=ent.SOURCE_ID_INT_1 AND PAY_PROC_TRXN_TYPE_CODE = 'AR_CUSTOMER_REFUND') = 'Receivables'
                        Then (SELECT HZP1.PARTY_NAME || ' / ' || HCA1.ACCOUNT_NUMBER FROM AP_INVOICES_ALL AP1, HZ_CUST_ACCOUNTS HCA1 , HZ_PARTIES HZP1 WHERE AP1.INVOICE_ID=ent.SOURCE_ID_INT_1 AND AP1.PARTY_ID = HCA1.PARTY_ID AND HCA1.PARTY_ID = HZP1.PARTY_ID)
                       WHEN gjct.JE_CATEGORY_NAME='Payments'
                       THEN hp2.PARTY_NAME || ' / ' ||  ps.SEGMENT1 || ' / ' || (SELECT distinct CBA.BANK_ACCOUNT_NUM FROM AP_CHECKS_ALL ACA, CE_BANK_ACCOUNTS CBA
                                                                               WHERE ACA.LEGAL_ENTITY_ID=ent.LEGAL_ENTITY_ID
																			   and ACA.LEGAL_ENTITY_ID=CBA.ACCOUNT_OWNER_ORG_ID
																			   AND ACA.CHECK_ID  = ENT.SOURCE_ID_INT_1
																			   and ACA.BANK_ACCOUNT_NAME=CBA.BANK_ACCOUNT_NAME
																			   ) 
                                           || ' / ' || (SELECT distinct BANK_ACCOUNT_NAME FROM AP_CHECKS_ALL ACA
                                                                               WHERE ACA.LEGAL_ENTITY_ID=ent.LEGAL_ENTITY_ID
																			     AND ACA.CHECK_ID  = ENT.SOURCE_ID_INT_1)
                       ELSE hp2.PARTY_NAME || ' / ' ||  ps.SEGMENT1  END )
                
            WHEN gjst.user_je_source_name='Assets' THEN gjh.period_name
            WHEN gjst.user_je_source_name='Projects' 	then 'ΚΙΝΗΣΗ ΜΕΤΑΞΥ ΕΡΓΩΝ' 
            ELSE gjl.description END ) Journal_Description  
    
    ,0 DEBIT
    /*,( CASE WHEN gjst.user_je_source_name in ('Payables', 'Receivables')
           THEN (SELECT NVL(SUM(XAL1.ACCOUNTED_CR),0)
                         FROM XLA_AE_LINES XAL1
                         WHERE XAL1.APPLICATION_ID=ael.APPLICATION_ID
                         AND XAL1.AE_HEADER_ID=ael.AE_HEADER_ID
                          and xal1.ae_line_num=ael.ae_line_num
                         AND XAL1.CODE_COMBINATION_ID=ael.CODE_COMBINATION_ID
                         AND XAL1.APPLICATION_ID IN (200,222)
                         GROUP BY CC.SEGMENT4,XAL1.APPLICATION_ID)
            ELSE NVL(GJL.ACCOUNTED_CR,0) END ) CREDIT*/
	,NVL(ael.ACCOUNTED_CR,GJL.ACCOUNTED_CR) CREDIT
            
            
        FROM
         gl_je_headers gjh
        ,gl_je_batches gjb
        ,GL_JE_LINES gjl
        ,GL_LEDGERS gll
        ,gl_code_combinations cc
        ,gl_je_sources_tl gjst
        ,gl_je_categories_tl gjct
        /*,gl_daily_conversion_types gdct
        ,gl_je_action_log gja
         ,per_users pu
        ,per_person_names_f ppf 
        ,gl_je_headers o*/
        
         ,xle_entity_profiles A1
        ,fnd_flex_values_vl A4
		,fnd_flex_values_tl at4
         
		 ,XLA_EVENTS XEV
         ,GL_IMPORT_REFERENCES gir
        ,xla_ae_lines ael
        ,xla_ae_headers aeh
        ,xla_event_types_tl xet
        ,xla_event_classes_tl xect
        ,xla_transaction_entities ent
		,XLA_TRANSACTION_HEADERS XTH
        ,XLA_SUBLEDGERS_TL FAT 
         ,HZ_CUST_ACCOUNTS hca
        ,POZ_SUPPLIERS ps
        ,hz_parties hp1
        , hz_parties hp2
        ,fnd_lookup_values FLVCAT
        ,fnd_lookup_values FLVEVCL
    	, SECURITY_TBL ST
    
        WHERE 1=1
		AND ST.LEDGER_ID=GLL.LEDGER_ID
        AND gjl.JE_HEADER_ID = gjh.JE_HEADER_ID
        AND gjh.JE_BATCH_ID = gjb.JE_BATCH_ID
       /* AND (nvl(GJL.ENTERED_DR,0)-nvl(GJL.ENTERED_CR,0)!=0 OR nvl(GJL.ACCOUNTED_DR,0)-nvl(GJL.ACCOUNTED_CR,0)!=0)*/
        AND gjl.code_combination_id = cc.code_combination_id
        AND gll.ledger_id = gjl.ledger_id
        AND gll.LEDGER_ID = gjh.LEDGER_ID
        AND gjst.je_source_name = gjh.je_source
        AND gjst.LANGUAGE = USERENV('LANG')
        AND gjct.je_category_name = gjh.JE_CATEGORY
        AND gjct.LANGUAGE = 'US'
       -- AND gjl.currency_conversion_type = gdct.conversion_type(+)
        AND gjb.status = 'P'
        AND gjh.status = 'P'
        AND gjl.currency_code!= 'STAT'
        /*AND gja.je_batch_id = gjb.je_batch_id
        AND gja.action_code = 'POSTED'
        AND upper(gja.user_id) = upper(pu.username)
        AND pu.person_id = ppf.person_id (+)
        AND 'GLOBAL' = ppf.name_type (+)
        AND gjh.je_header_id = o.accrual_rev_je_header_id (+)*/
    
    
    
         AND A1.LEGAL_ENTITY_IDENTIFIER = cc.segment1
       
        AND A4.flex_value = cc.segment4
        AND A4.VALUE_CATEGORY = 'GREECE ACCOUNT VALUE SET'
		and at4.flex_value_id=a4.flex_value_id
		and at4.language='EL'
    
        and gjst.je_source_name in ('Assets', 'Payables', 'Receivables', 'Cash Management', 'Projects', 'Project Accounting', 'Lease Accounting','Purchasing')
         AND (CASE WHEN gjst.user_je_source_name <> 'Payroll' 
            THEN gjb.JE_BATCH_ID
            ELSE null END) = gir.JE_BATCH_ID (+) 
    
         AND gjl.JE_HEADER_ID = gir.JE_HEADER_ID(+)
        AND gjl.JE_LINE_NUM = gir.JE_LINE_NUM(+)
        AND gir.GL_SL_LINK_ID = ael.GL_SL_LINK_ID(+)
        AND gir.GL_SL_LINK_TABLE = ael.GL_SL_LINK_TABLE(+)
        AND ael.ae_header_id = aeh.ae_header_id(+)
        AND ael.PARTY_ID = hca.cust_account_id (+)
        AND ael.PARTY_ID = ps.vendor_id (+)
        AND hca.PARTY_ID = hp1.PARTY_ID (+)
and ps.party_id=hp2.party_id(+)
        AND aeh.application_id = ent.application_id(+)
        AND aeh.APPLICATION_ID = FAT.APPLICATION_ID(+)
        AND aeh.entity_id = ent.entity_id(+)
        AND aeh.ledger_id = ent.ledger_id(+)  
		AND aeh.application_id = XTH.application_id(+)
        AND aeh.event_id = XTH.event_id(+)
        AND aeh.ledger_id = XTH.ledger_id(+) 
		AND XEV.EVENT_ID(+)=aeh.EVENT_ID
		AND aeh.application_id = XEV.application_id(+)		
        AND FAT.LANGUAGE(+) = USERENV('LANG')
        --AND NVL(FAT.APPLICATION_NAME,'ABC') = NVL(NVL((:P_SUBLEDGER),FAT.APPLICATION_NAME),'ABC')
        AND aeh.application_id = xet.application_id(+)
        AND aeh.event_type_code = xet.event_type_code(+)
        AND xet.LANGUAGE(+) = USERENV('LANG')
        AND xet.entity_code = xect.entity_code(+)
        AND xet.application_id = xect.application_id(+)
        AND xet.event_class_code = xect.event_class_code(+)
        AND xect.LANGUAGE(+) ='US'
    AND FLVEVCL.LOOKUP_TYPE(+) ='XXC_EVENT_CLASSES_GREECE'
	   AND FLVEVCL.LOOKUP_CODE(+)=xect.EVENT_CLASS_CODE
       AND FLVEVCL.LANGUAGE(+)='US'
	   AND FLVCAT.LOOKUP_TYPE(+)='XXC_GREECE_TRASLATIONS'
	   AND FLVCAT.LOOKUP_CODE(+)=(CASE WHEN GJCT.JE_CATEGORY_NAME LIKE '30%'
                                       THEN  GJCT.USER_JE_CATEGORY_NAME
                                       ELSE GJCT.JE_CATEGORY_NAME
                                       END )
       AND FLVCAT.LANGUAGE(+)='US'
    AND gjl.EFFECTIVE_DATE BETWEEN nvl((select distinct START_DATE from GL_PERIODS gp where gp.period_name = :P_FROM_GL_DATE and gp.period_seT_name=gll.period_set_name),gjl.EFFECTIVE_DATE ) AND nvl((select distinct END_DATE from GL_PERIODS gp2 where gp2.period_name = :P_TO_GL_DATE and gp2.period_seT_name=gll.period_set_name),gjl.EFFECTIVE_DATE )
                              AND  
                            (CAST(cc.segment1 as numeric) IN (:P_ENTITY) OR 'All' IN ('All'||:P_ENTITY))
                            
            and (A1.name IN (:P_ENTITY_NAME) OR 'All' IN ('All'||:P_ENTITY_NAME))
            --AND UPPER(A1.DESCRIPTION)='CUSTOM ΜΟΝΟΠΡΟΣΩΠΗ Α.Ε.Β.Ε.'  
    AND gjl.EFFECTIVE_DATE BETWEEN nvl(:P_FROM_EFFECTIVE_DATE,gjl.EFFECTIVE_DATE) and  nvl(:P_TO_EFFECTIVE_DATE,gjl.EFFECTIVE_DATE)
        
        --and trunc(sysdate) between  trunc(NVL(ppf.EFFECTIVE_START_DATE,SYSDATE)) and trunc(NVL(ppf.EFFECTIVE_END_DATE,SYSDATE))
    
   and ((case when :P_FROM_GL_DATE  ='01-' || (select distinct substr(period_year,3,2) 
                                          from gl_periods 
										   where period_name=:P_FROM_GL_DATE
										   and period_set_name=gll.period_set_name) 
										then gjh.period_name else (select :P_FROM_GL_DATE from gl_periods where period_name=:P_FROM_GL_DATE and ADJUSTMENT_PERIOD_FLAG='N' and period_set_name=gll.period_set_name and period_name<>  '12-' || substr(period_year,3,2))  end  )    <>  'ΑΝΟΙΓ-' || (select distinct substr(period_year,3,2) 
                                                                                                                                                              from gl_periods 
								                                                                                                                               where period_name=:P_FROM_GL_DATE
		 								                                                                                                                          and period_set_name=gll.period_set_name)
		
or (case when :P_FROM_GL_DATE  ='ΑΝΟΙΓ-' || (select distinct substr(period_year,3,2) 
                                          from gl_periods 
										   where period_name=:P_FROM_GL_DATE
										   and period_set_name=gll.period_set_name) 
										then gjh.period_name  end   ) =gjh.period_name 
										
or (case when :P_FROM_GL_DATE  ='ΚΛΕΙΣ-' || (select distinct substr(period_year,3,2) 
                                          from gl_periods 
										   where period_name=:P_FROM_GL_DATE
										   and period_set_name=gll.period_set_name) 
										then gjh.period_name  end  )    <>  '12-' || (select distinct substr(period_year,3,2) 
                                                                                                                                                              from gl_periods 
								                                                                                                                               where period_name=:P_FROM_GL_DATE
		 								                                                                                                                          and period_set_name=gll.period_set_name)
																										or (case when :P_FROM_GL_DATE  ='12-' || (select distinct substr(period_year,3,2) 
                                          from gl_periods 
										   where period_name=:P_FROM_GL_DATE
										   and period_set_name=gll.period_set_name) 
										then gjh.period_name  end   ) =gjh.period_name														  										
										
										)

and ((case when :P_TO_GL_DATE  ='12-' || (select distinct substr(period_year,3,2) 
                                          from gl_periods 
										   where period_name=:P_TO_GL_DATE
										   and period_set_name=gll.period_set_name) 
										then gjh.period_name else (select :P_TO_GL_DATE from gl_periods where period_name=:P_TO_GL_DATE and ADJUSTMENT_PERIOD_FLAG='N' and period_set_name=gll.period_set_name  and period_name<>  '01-' || substr(period_year,3,2)) end  )    <>  'ΚΛΕΙΣ-' || (select distinct substr(period_year,3,2) 
                                                                                                                                                              from gl_periods 
								                                                                                                                               where period_name=:P_TO_GL_DATE
		 								                                                                                                                          and period_set_name=gll.period_set_name)
		
or (case when :P_TO_GL_DATE  ='ΚΛΕΙΣ-' || (select distinct substr(period_year,3,2) 
                                          from gl_periods 
										   where period_name=:P_TO_GL_DATE
										   and period_set_name=gll.period_set_name) 
										then gjh.period_name  end   ) =gjh.period_name 
										
or 	(case when :P_TO_GL_DATE  ='ΑΝΟΙΓ-' || (select distinct substr(period_year,3,2) 
                                          from gl_periods 
										   where period_name=:P_TO_GL_DATE
										   and period_set_name=gll.period_set_name) 
										then gjh.period_name  end  )    <>  '01-' || (select distinct substr(period_year,3,2) 
                                                                                                                                                              from gl_periods 
								                                                                                                                               where period_name=:P_TO_GL_DATE
		 								                                                                                                                          and period_set_name=gll.period_set_name)									
or (case when :P_TO_GL_DATE  ='01-' || (select distinct substr(period_year,3,2) 
                                          from gl_periods 
										   where period_name=:P_TO_GL_DATE
										   and period_set_name=gll.period_set_name) 
										then gjh.period_name  end   ) =gjh.period_name 										
										)	
	  																				  
	 
	    
) 
WHERE (DEBIT<>0 or CREDIT <> 0)

GROUP BY
BALANCING_SEGMENT
,INTERNAL_REF
,ACCOUNT_SEGMENT
,BALANCING_SEGMENT_DESC
,ACCOUNT_SEGMENT_DESC
,GL_DATE
,TRANSACTION_DATE
,period_name
--,je_batch_name
,JE_SOURCE_NAME
,GL_JE_NAME
,JOURNAL_ENTRY
,JE_HEADER_ID
,JE_CATEGORY_NAME
,LEDGER_NAME
,Reporting_sequence_of_the_Journal
,Document_Number_of_the_Transaction
,Transaction_Type
,Journal_Description
,DEBIT

UNION ALL

SELECT
BALANCING_SEGMENT
,INTERNAL_REF
,ACCOUNT_SEGMENT
,BALANCING_SEGMENT_DESC
,ACCOUNT_SEGMENT_DESC
,GL_DATE
,TRANSACTION_DATE
--,je_batch_name
,period_name
,JE_SOURCE_NAME
,GL_JE_NAME
,JOURNAL_ENTRY
,JE_HEADER_ID
,JE_CATEGORY_NAME
,LEDGER_NAME
,Reporting_sequence_of_the_Journal
,Document_Number_of_the_Transaction
,Transaction_Type
,Journal_Description
,NVL((DEBIT),0) DEBIT
,NVL((CREDIT),0) CREDIT

FROM 

(
SELECT
            LPAD(CAST(cc.segment1 AS VARCHAR(4)), 4, '0') BALANCING_SEGMENT
,GJH.NAME  INTERNAL_REF
           , cc.segment4   ACCOUNT_SEGMENT
            ,A1.name BALANCING_SEGMENT_DESC
            ,At4.DESCRIPTION ACCOUNT_SEGMENT_DESC
        ,gjh.DEFAULT_EFFECTIVE_DATE GL_DATE
		,XEV.TRANSACTION_DATE
        ,gjh.period_name
        ,gjst.user_je_source_name JE_SOURCE_NAME
--, gjb.name je_batch_name
        ,gjh.NAME GL_JE_NAME
		, gjh.name JOURNAL_ENTRY
        ,GJH.JE_HEADER_ID
        ,gjct.user_je_category_name JE_CATEGORY_NAME
        --,ent.transaction_number TRANSACTION_NUMBER
        ,gll.name LEDGER_NAME
        --,GJL.currency_code ENTERED_CUR
       /* ,nvl(nvl(ael.ENTERED_DR,GJL.ENTERED_DR),0)-nvl(nvl(ael.ENTERED_CR,GJL.ENTERED_CR),0) ENTERED_AMOUNT
        ,nvl(nvl(ael.ACCOUNTED_DR,gjl.ACCOUNTED_DR),0)-nvl(nvl(ael.ACCOUNTED_CR,gjl.ACCOUNTED_CR),0) ACCOUNTED_AMOUNT*/
        --,FAT.APPLICATION_NAME SUBLEDGER_APPLICATION
        --,xect.NAME EVENT_CLASS_NAME
        --,xet.NAME EVENT_TYPE_NAME
        --,decode(ael.PARTY_TYPE_CODE,'C', 'Customer','S', 'Supplier') PARTY_TYPE
         
    --,gll.currency_code LEDGER_CURRENCY
    ,  GJH.CLOSE_ACCT_SEQ_VALUE  Reporting_sequence_of_the_Journal
    , null 	Document_Number_of_the_Transaction
    
     	 
     , NVL(FLVCAT.MEANING,gjct.USER_JE_CATEGORY_NAME) Transaction_Type 
    
    , (CASE 
                
            WHEN gjst.user_je_source_name='Assets' THEN gjh.period_name
            WHEN gjst.user_je_source_name='Projects' 	then 'ΚΙΝΗΣΗ ΜΕΤΑΞΥ ΕΡΓΩΝ' 
            ELSE gjl.description END ) Journal_Description  
    
    , NVL(GJL.ACCOUNTED_DR,0)  DEBIT
    , NVL(GJL.ACCOUNTED_CR,0)  CREDIT
            
            
        FROM
         gl_je_headers gjh
        ,gl_je_batches gjb
        ,GL_JE_LINES gjl
        ,GL_LEDGERS gll
        ,gl_code_combinations cc
        ,gl_je_sources_tl gjst
        ,gl_je_categories_tl gjct
        /*,gl_daily_conversion_types gdct
        ,gl_je_action_log gja
         ,per_users pu
        ,per_person_names_f ppf 
        ,gl_je_headers o*/
        ,XLA_EVENTS XEV
         ,xle_entity_profiles A1
        ,fnd_flex_values_vl A4
		,fnd_flex_values_tl at4
    ,fnd_lookup_values FLVCAT
         , SECURITY_TBL ST
    
    
        WHERE 1=1
		AND ST.LEDGER_ID=GLL.LEDGER_ID
        AND gjl.JE_HEADER_ID = gjh.JE_HEADER_ID
        AND gjh.JE_BATCH_ID = gjb.JE_BATCH_ID
       /* AND (nvl(GJL.ENTERED_DR,0)-nvl(GJL.ENTERED_CR,0)!=0 OR nvl(GJL.ACCOUNTED_DR,0)-nvl(GJL.ACCOUNTED_CR,0)!=0)*/
        AND gjl.code_combination_id = cc.code_combination_id
        AND gll.ledger_id = gjl.ledger_id
        AND gll.LEDGER_ID = gjh.LEDGER_ID
        AND gjst.je_source_name = gjh.je_source
        AND gjst.LANGUAGE = USERENV('LANG')
        AND gjct.je_category_name = gjh.JE_CATEGORY
        AND gjct.LANGUAGE = 'US'
       -- AND gjl.currency_conversion_type = gdct.conversion_type(+)
        AND gjb.status = 'P'
		AND XEV.EVENT_ID(+)=gjh.LEDGER_ID --DUMMY JOIN ADDED TO MATCH THE DATA TYPE
        AND gjh.status = 'P'
        AND gjl.currency_code!= 'STAT'
        /*AND gja.je_batch_id = gjb.je_batch_id
        AND gja.action_code = 'POSTED'
        AND upper(gja.user_id) = upper(pu.username)
        AND pu.person_id = ppf.person_id (+)
        AND 'GLOBAL' = ppf.name_type (+)
        AND gjh.je_header_id = o.accrual_rev_je_header_id (+)*/
    
    
    
         AND A1.LEGAL_ENTITY_IDENTIFIER = cc.segment1
        
        AND A4.flex_value = cc.segment4
        AND A4.VALUE_CATEGORY = 'GREECE ACCOUNT VALUE SET'
		and at4.flex_value_id=a4.flex_value_id
		and at4.language='EL'
       
	   AND FLVCAT.LOOKUP_TYPE(+)='XXC_GREECE_TRASLATIONS'
	   AND FLVCAT.LOOKUP_CODE(+)=(CASE WHEN GJCT.JE_CATEGORY_NAME LIKE '30%'
                                        THEN  GJCT.USER_JE_CATEGORY_NAME
                                        ELSE GJCT.JE_CATEGORY_NAME
                                        END )
       AND FLVCAT.LANGUAGE(+)='US'
    
        and gjst.je_source_name not in ('Assets', 'Payables', 'Receivables', 'Cash Management', 'Projects', 'Project Accounting', 'Lease Accounting','Purchasing')
  
    
    AND gjl.EFFECTIVE_DATE BETWEEN nvl((select distinct START_DATE from GL_PERIODS gp where gp.period_name = :P_FROM_GL_DATE and gp.period_seT_name=gll.period_set_name
                                                                              

	),gjl.EFFECTIVE_DATE ) AND nvl((select distinct END_DATE from GL_PERIODS gp2 where gp2.period_name = :P_TO_GL_DATE and gp2.period_seT_name=gll.period_set_name),gjl.EFFECTIVE_DATE )
                              AND  
                            (CAST(cc.segment1 as numeric) IN (:P_ENTITY) OR 'All' IN ('All'||:P_ENTITY))
                            
            and (A1.name IN (:P_ENTITY_NAME) OR 'All' IN ('All'||:P_ENTITY_NAME))
            --AND UPPER(A1.DESCRIPTION)='CUSTOM ΜΟΝΟΠΡΟΣΩΠΗ Α.Ε.Β.Ε.'  
    AND gjl.EFFECTIVE_DATE BETWEEN nvl(:P_FROM_EFFECTIVE_DATE,gjl.EFFECTIVE_DATE) and  nvl(:P_TO_EFFECTIVE_DATE,gjl.EFFECTIVE_DATE)
        
       -- and trunc(sysdate) between  trunc(NVL(ppf.EFFECTIVE_START_DATE,SYSDATE)) and trunc(NVL(ppf.EFFECTIVE_END_DATE,SYSDATE))
    
    
and ((case when :P_FROM_GL_DATE  ='01-' || (select distinct substr(period_year,3,2) 
                                          from gl_periods 
										   where period_name=:P_FROM_GL_DATE
										   and period_set_name=gll.period_set_name) 
										then gjh.period_name else (select :P_FROM_GL_DATE from gl_periods where period_name=:P_FROM_GL_DATE and ADJUSTMENT_PERIOD_FLAG='N' and period_set_name=gll.period_set_name and period_name<>  '12-' || substr(period_year,3,2))  end  )    <>  'ΑΝΟΙΓ-' || (select distinct substr(period_year,3,2) 
                                                                                                                                                              from gl_periods 
								                                                                                                                               where period_name=:P_FROM_GL_DATE
		 								                                                                                                                          and period_set_name=gll.period_set_name)
		
or (case when :P_FROM_GL_DATE  ='ΑΝΟΙΓ-' || (select distinct substr(period_year,3,2) 
                                          from gl_periods 
										   where period_name=:P_FROM_GL_DATE
										   and period_set_name=gll.period_set_name) 
										then gjh.period_name  end   ) =gjh.period_name 
										
or (case when :P_FROM_GL_DATE  ='ΚΛΕΙΣ-' || (select distinct substr(period_year,3,2) 
                                          from gl_periods 
										   where period_name=:P_FROM_GL_DATE
										   and period_set_name=gll.period_set_name) 
										then gjh.period_name  end  )    <>  '12-' || (select distinct substr(period_year,3,2) 
                                                                                                                                                              from gl_periods 
								                                                                                                                               where period_name=:P_FROM_GL_DATE
		 								                                                                                                                          and period_set_name=gll.period_set_name)
																										or (case when :P_FROM_GL_DATE  ='12-' || (select distinct substr(period_year,3,2) 
                                          from gl_periods 
										   where period_name=:P_FROM_GL_DATE
										   and period_set_name=gll.period_set_name) 
										then gjh.period_name  end   ) =gjh.period_name														  										
										
										)

and ((case when :P_TO_GL_DATE  ='12-' || (select distinct substr(period_year,3,2) 
                                          from gl_periods 
										   where period_name=:P_TO_GL_DATE
										   and period_set_name=gll.period_set_name) 
										then gjh.period_name else (select :P_TO_GL_DATE from gl_periods where period_name=:P_TO_GL_DATE and ADJUSTMENT_PERIOD_FLAG='N' and period_set_name=gll.period_set_name  and period_name<>  '01-' || substr(period_year,3,2)) end  )    <>  'ΚΛΕΙΣ-' || (select distinct substr(period_year,3,2) 
                                                                                                                                                              from gl_periods 
								                                                                                                                               where period_name=:P_TO_GL_DATE
		 								                                                                                                                          and period_set_name=gll.period_set_name)
		
or (case when :P_TO_GL_DATE  ='ΚΛΕΙΣ-' || (select distinct substr(period_year,3,2) 
                                          from gl_periods 
										   where period_name=:P_TO_GL_DATE
										   and period_set_name=gll.period_set_name) 
										then gjh.period_name  end   ) =gjh.period_name 
										
or 	(case when :P_TO_GL_DATE  ='ΑΝΟΙΓ-' || (select distinct substr(period_year,3,2) 
                                          from gl_periods 
										   where period_name=:P_TO_GL_DATE
										   and period_set_name=gll.period_set_name) 
										then gjh.period_name  end  )    <>  '01-' || (select distinct substr(period_year,3,2) 
                                                                                                                                                              from gl_periods 
								                                                                                                                               where period_name=:P_TO_GL_DATE
		 								                                                                                                                          and period_set_name=gll.period_set_name)									
or (case when :P_TO_GL_DATE  ='01-' || (select distinct substr(period_year,3,2) 
                                          from gl_periods 
										   where period_name=:P_TO_GL_DATE
										   and period_set_name=gll.period_set_name) 
										then gjh.period_name  end   ) =gjh.period_name 										
										)								  
) 

order by REPORTING_SEQUENCE_OF_THE_JOURNAL asc
/*GROUP BY
BALANCING_SEGMENT
,ACCOUNT_SEGMENT
,BALANCING_SEGMENT_DESC
,ACCOUNT_SEGMENT_DESC
,GL_DATE
,period_name
--,je_batch_name
,JE_SOURCE_NAME
,GL_JE_NAME
,JOURNAL_ENTRY
,JE_HEADER_ID
,JE_CATEGORY_NAME
,LEDGER_NAME
,Reporting_sequence_of_the_Journal
,Document_Number_of_the_Transaction
,Transaction_Type
,Journal_Description*/

   
	
)

order by REPORTING_SEQUENCE_OF_THE_JOURNAL asc
:P_ENTITY :P_ENTITY_NAME :P_FROM_EFFECTIVE_DATE :P_FROM_GL_DATE :P_SUBLEDGER :P_TO_EFFECTIVE_DATE :P_TO_GL_DATE :xdo_user_name

The data-warehouse model — one fact surrounded by conformed dimensions (what you slice by) and measures (what you aggregate), expressed as dbt so it migrates with you. Grain: one row per source transaction.

GL_JE_LINESdimensionGL_JE_BATCHESdimensionGL_CODE_COMBINATIONSdimensionRA_CUSTOMER_TRX_ALLdimensionGL_JE_HEADERSfact · one row per source transactionDebit · Credit
●— fact → dimension join
ElementTypeDefinition
GL_JE_LINESdimensiondimension
GL_JE_BATCHESdimensiondimension
GL_CODE_COMBINATIONSdimensiondimension
RA_CUSTOMER_TRX_ALLdimensiondimension
Debitmeasuremeasure
Creditmeasuremeasure
Runs on your cloud warehouse — Snowflake, BigQuery, Redshift, or Synapse on AWS, Google Cloud, Azure, or any provider. Reconciled to the source control total — 0% variance by design. You own the code, the model, and the data.
How the data gets here: a BICC bulk extract of the source tables above, on the same pattern for every report. See the extraction pattern & data flow →
See the complete model
How this report's fact and dimensions fit the full picture, via conformed keys.
General Ledger data model →Enterprise model →

Every source object behind this report. Each linked table has its own page with full column descriptions, drawn from the Oracle BICC lineage and articulated for practitioners.

TableReporting columnsSubject areas
GL_JE_HEADERS342
GL_JE_LINES262
GL_JE_BATCHES142
GL_CODE_COMBINATIONS761
RA_CUSTOMER_TRX_ALL5816
Reporting columns = fields the report selects that are exposed as analytics attributes; subject areas = the OTBI subject areas the table appears in. Setup and configuration tables (master data, ledger and book setup, lookups) are referenced by the report's joins but aren't exposed as analytics columns or subject areas — that's expected, not a gap.