Query for Code combinations

select code.code_combination_id CCIDs,
code.segment1||'*'||
code.segment2||'*'||
code.segment3||'*'||
code.segment4||'*'||
code.segment5 Segments
from (
select
cc.CODE_COMBINATION_ID
from
gl_je_headers jh,
gl_je_lines jl,
gl_code_combinations cc,
(select period_name
from gl_periods
where period_set_name ='xxx Calendar'
and to_date(period_name,'Mon-YY') between add_months(sysdate,(&1*-1)-1) and sysdate) p
where cc.CODE_COMBINATION_ID = jl.CODE_COMBINATION_ID
and jl.je_header_id=jh.je_header_id
and jl.set_of_books_id=jh.set_of_books_id
and jl.period_name=jh.period_name
and jl.set_of_books_id=111
and cc.ENABLED_FLAG = 'Y'
and cc.END_DATE_ACTIVE is null
and jl.period_name = p.period_name
group by cc.CODE_COMBINATION_ID
having
sum(nvl(jl.entered_dr,0))=0
and sum(nvl(jl.entered_cr,0))=0
and sum(nvl(jl.accounted_dr,0))=0
and sum(nvl(jl.accounted_cr,0))=0
order by cc.CODE_COMBINATION_ID) vcomb,
gl_code_combinations code
Where code.code_combination_id=vcomb.code_combination_id
UNION
select null
This query must look at balances as well as Net amount like zero balance in current period for both functional and transactional currency
I need activity for last 6 months based on user parameter
if there is no activity in last few months and balances and Net are equal to zero I need to disable ccid
Can anyone help me im modifying the query to get desired results.
Kiran

Hi Kiran.
Instead of summing journals, I think you should look at GL_BALANCES tables where journal amounts are already computed in the functional currency, in spite they come from functional or foreign currencies.
Octavio

Similar Messages

  • Query for getting combination of data

    hi all,
    i am using db10g.
    i have a table of fields a_company,a_code,a_name,a_port,a_t_port,a_rate,a_volume
    i have a records like
    MM,AA,A-NAME,EFG,EFGH,100,20
    MM,AA,A-NAME,EFG,EFGH,200,10
    MM,BB,B-NAME,HIJ,HIJK,100,20
    MM,BB,B-NAME,HIJ,HIJK,200,30
    MM,CC,C-NAME,DEF,DEFG,500,20i have to select all columns but the fields if below below combination repeates(having more than 1 combination)
    a_company,a_code,a_port,a_t_port
    how can form a query?
    in other words i am expecting the result like below among above said input.
    MM,AA,A-NAME,EFG,EFGH,100,20
    MM,AA,A-NAME,EFG,EFGH,200,10
    MM,BB,B-NAME,HIJ,HIJK,100,20
    MM,BB,B-NAME,HIJ,HIJK,200,30Thanks..

    With only one table scan:
    SQL> create table a_table (a_company,a_code,a_name,a_port,a_t_port,a_rate,a_volume)
      2  as
      3  select 'MM','AA','A-NAME','EFG','EFGH',100,20 from dual union all
      4  select 'MM','AA','A-NAME','EFG','EFGH',200,10 from dual union all
      5  select 'MM','BB','B-NAME','HIJ','HIJK',100,20 from dual union all
      6  select 'MM','BB','B-NAME','HIJ','HIJK',200,30 from dual union all
      7  select 'MM','CC','C-NAME','DEF','DEFG',500,20 from dual
      8  /
    Table created.
    SQL> exec dbms_stats.gather_table_stats(user,'a_table')
    PL/SQL procedure successfully completed.
    SQL> set autotrace on explain
    SQL> select a_company
      2       , a_code
      3       , a_name
      4       , a_port
      5       , a_t_port
      6       , a_rate
      7       , a_volume
      8    from ( select a.a_company
      9                , a.a_code
    10                , a.a_name
    11                , a.a_port
    12                , a.a_t_port
    13                , a.a_rate
    14                , a.a_volume
    15                , count(*) over (partition by a_company,a_code,a_port,a_t_port) cnt
    16             from a_table a
    17         )
    18   where cnt > 1
    19  /
    A_ A_ A_NAME A_P A_T_     A_RATE   A_VOLUME
    MM AA A-NAME EFG EFGH        100         20
    MM AA A-NAME EFG EFGH        200         10
    MM BB B-NAME HIJ HIJK        100         20
    MM BB B-NAME HIJ HIJK        200         30
    4 rows selected.
    Execution Plan
       0      SELECT STATEMENT Optimizer=CHOOSE (Cost=4 Card=5 Bytes=330)
       1    0   VIEW (Cost=4 Card=5 Bytes=330)
       2    1     WINDOW (SORT) (Cost=4 Card=5 Bytes=140)
       3    2       TABLE ACCESS (FULL) OF 'A_TABLE' (Cost=2 Card=5 Bytes=140)Regards,
    Rob.

  • Code Combinations for Segment Hierarchies

    Dear Members,
    I have one question on Hierarchies in GL Accounting Flex fields. I read the documentation on Flexfield hierarchies, in which its said that generally hierarchies are used for only GL accounting flexfields.
    Suppose One of the Accounting Flexfield Segment Value hierarchy structure is like this :
    1000
    _________|_______
    100 200 300
    ____|____ ____|______
    101 102 301 302 303
    _______|______
    303A 303B 303C
    __|__
    303BB
    This hierarchy is not coming properly when i post it so i am explaining it in detail here :
    Parent Child
    1000 ---> 100 200 300
    100 ----> 101 102
    300 ---> 301 302 303
    303 ---> 301A 303B 303C
    303B --> 303BB
    Here 1000 is the parent which has childs and they inturn have childs. This is used maily for reporting purpose in GL. I do not understand how a code combination is generated for the above structure in gl_code_combination table.
    Suppose we have 5 segments in our accounting flexfield structure
    ex: seg1,seg2,seg3,seg4,seg5 and 1000 in the above mentioned structure is seg3.
    how does a combination is generated if we want the information pertaining to 303BB which is the leaf node value in the hierarchy.
    seg1.seg2.seg3.seg4.seg5 --> how does this change if we have hierarchies.
    It would be great if you can help me out in this.
    Thanks
    Sandeep
    Message was edited by:
    user340
    Message was edited by:
    user340
    Message was edited by:
    user340

    Hi :
    1000 is a parent ---> 100 200 300 are chid
    100 is a parent ----> 101 102 are chid
    300 is a parent ---> 301 302 303 are chid
    303 is a parent ---> 301A 303B 303C are chid
    303B is a parent --> 303BB
    Here 1000 is the parent which has childs and they inturn have childs. This is used maily for reporting purpose in GL. I do not understand how a code combination is generated for the above structure in gl_code_combination table.
    seg1,seg2,seg3,seg4,seg5 and 1000 in the above mentioned structure is seg3.
    a combination is generated for every single combination oif child values (child valued should be posting allowed = yes meanwhile parent values should be posting allowed = no) for every segment
    so at the end the combination is created whenever you use child value for every single segment
    if you have rollup groups associated to the parent values, you can define summary accounts and balances are going to be automatically updated for parent values so even you can query onbalances on parent values
    I hope this gives you some light

  • Return Code - Query for Multiple Rows as XML

    Hi,
    I'm executing an MSSQL stored procedure through the "Query for Multiple Rows as XML" activity in LiveCycle ES. I do this through a call statement such as this:
    { call MyStoredProc(?) }
    This works great, the stored procedure always returns a record set (with or without records). I use this activity rather than "Call Stored Procedure" because I can transform the record set into XML right away within this activity. Unfortunately any exception arising from invoking this stored procedure cannot be handled within the workflow as this activity does not have an exception handler (lightning bolt). In an attempt to handle at least some exceptions we have decided to use try/catches within the stored procedures and return different error codes. Now the problem I am faced with is that there is no way to retrieve the returned code within any of the SQL activities. We don't want to have to write an execute script for each of these SQL calls. Is there any way to do this? Seems like I'm 95% there.
    Thanks
    Nic

    Thanks for the offer, unfortunately we would need something certified by Adobe.
    Nic

  • Can we combine Query for cancelled requisitions and query for internal requisitions without internal sales order into a single query

    Hi All,
    Greetings.
    I have two queries namely,
    1.Query for cancelled requisitions and
    2.Query for Internal Requisitions without Internal Sales Orders.
    I was on a task to combine those two queries..
    Can we do that? if so, please help me do that..
    Thanks in Advance,
    Bhaskar.

    Hi All,
    Greetings.
    I have two queries namely,
    1.Query for cancelled requisitions and
    2.Query for Internal Requisitions without Internal Sales Orders.
    I was on a task to combine those two queries..
    Can we do that? if so, please help me do that..
    Thanks in Advance,
    Bhaskar.

  • Access Sequence for Plant/Tax code Combination  for JTAX

    Dear All
    i want to create a new access sequence for "Plant/Tax code" Combination.
    Please let me know the process for the same
    Regards
    Amey

    Hi,
    Goto- M/05.
    Create the condition table by selecting the fields Plant & Tax code.
    Assign this condition table in the Access sequence JTAX as per ur requirement.
    Create condition records (FV11) by choosing the requirec access sequence.
    Regards,
    Satpal

  • In a query, for the selection field 'KNB1-ZWELS' a match-code isn't availab

    Hi All,
    Creating a query, for the selection field 'KNB1-ZWELS' a match-code isn't available.
    Could anyone tell me the reason?
    Thanks
    Gandalf

    Hi,
    Match Code Object is not available for the field ZWELS. If required, You need to contact a Developer for creating one .

  • Query for Cost Code in oracle HRMS

    Hello Exports,
    i am new in oacle hrms,
    So Can you please tell how to fetch cost code in oracle hrms r12 ( i need sql query for cost code )
    Thanks

    try the following (assignment costing as at today):
    select ppx.full_name
    ,ppx.employee_number
    ,pax.assignment_number
    ,pax.primary_flag
    ,pcax.proportion
    ,pcak.segment1
    ,pcak.segment2
    ,pcak.segment3
    ,pcak.segment4
    from per_assignments_x pax
    ,per_people_x ppx
    ,pay_cost_allocations_x pcax
    ,pay_cost_allocation_keyflex pcak
    where ppx.person_id = pax.person_id
    and pax.assignment_id = pcax.assignment_id
    and pcak.cost_allocation_keyflex_id = pcax.cost_allocation_keyflex_id

  • Error:APP-FND-00906: You can only query existing flexfield code combination

    Hi,
    when i am querying the particluar account combination under Budget Journals (Navigation: GL responsibility> Budgets > Enter > Journals) window the following message is displaying by the system
    APP-FND-00906: You can only query existing flexfield code combinations. You entered query criteria in your flexfield that does not identify an existing code combination. Therefore, your query will not return any rows.
    Enter a valid code combination, or enter only the flexfield segment values you know, or do not enter any values in the flexfield.
    Note: We are using the 11.5.10.2 version.
    Can any one why this error message is displaying by the system.
    Regards,
    Kevin.

    Kevin,
    Review the following documents, and see if it helps.
    Note: 365406.1 - GLXIQACC Account Inquiry Is Failing With APP-FND-00906 Can Only Query Existing Flexfield Code Combination
    https://metalink2.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=365406.1
    Note: 272773.1 - APP-FND-00906 - You Can Query Only Existing Flexfield Combinations on the Enter Budgets form
    https://metalink2.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=272773.1
    Note: 199674.1 - 11i - GLXIQBUD - Unable To Inquire Budget Account In The Budget Inquiry Form
    https://metalink2.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=199674.1
    Regards,
    Hussein

  • Customer Conversion-"Incorrect Code combination id for Receivable account"

    Hello experts!!
    I have created the customer conversion program the customers.
    All customers are getting loaded into the base table properly as expected . But for few customer it is throwing the below error:
    "Incorrect Code combination id for Receivable account"
    I have checked all the setups related things upto my knowledge everything is perfect.
    Could anyone help me out what would be the cause and how can i fix this error.
    Waiting for your valueable reply..
    Thanks,
    Thiru.

    As per the message, identify one of the failed records and retrieve the code combination used. From there you can validate that a) the id exists for the LE on the gl code combinations table and b) that it passes whatever cross validation rules are enabled for the organization.

  • Validation table for region/sales district/postal code combination

    Hi Folks,
    Is there any validation table for region/sales district/postal code combination? As I am looking for some standard functionality where a user if puts a wrong zip code/ postal code for a specifc city or country while creation of customer master then system should not allow and throws any kind of error or warning message.
    Please let me know if there is somethiong like this.
    I have some failt idea that we have something in standard SAP where we get a pop warning where postal code-country and postal code-city combination does not exist.
    Please let me know the transcation code and table name for that.
    Thanks and cheers,
    Sandy

    Hello,
    I'm not aware of any settings for this which include sales district.  For the rest a few spots to look at:
    -SAP NetWeaver>General Settings-->Set Country-Specific Checks (some controls for postal code per country)
    -SAP NetWeaver>General Settings-->Set Country-Insert Regions (country to region ties)
    ---Flexible Real Estate Management >Address Management>Regional Structure/City File-->Cities (have not worked with this area but you'll see several nodes for dealing with cities here).
    Hope this helps.

  • MDX query for parent-child combination display

    Hi guys..
    I am really new to the Essbase technology.
    Could you please help me out with this one:
    is it possible to extract the data(for example the metadata of a outline)..eg:-
    The outline structure is as follows :
    A1
    A11
    A12
    A2
    A21
    A22
    I want a MDX query to display it as :
    A1 A11
    A1 A12
    A2 A21
    A2 A22
    I have tried various ways but couldnt come up with a query for this.
    Thanks in advance for all your help.

    Unfortunately MDX cannot do this. If you think about what you are asking for, you are essentially saying that you want to see members of the same dimension on different axis. Multi-dimensional queries can't do that (think about trying to do it with addin).
    A further limiation is that MDX is not robust enough to allow you to work the results into a single axis using a concatenation function because while there is a string-to-member function, there is no member-to-string function and concat requires a string as input.
    Other approaches would require MDX to support joins or subqueries, which it does not.
    As others have mentioned, to do what you want to do, you need outline extractor or something like that.
    *Fun fact - if you have OBIEE 11g, it can do reporting in Essbase with hierarchy members in hierarchy format or column format, which will give you the results you need.  That alone is good reason to start using OBIEE.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Oracle query for getting discrepancy equip codes

    I need help in getting a query for discrepancy equip_code
    select distinct eq.dept_id,eq.drive_id,equip_code,eq.qc_subtype_id,staff_id
    from qc_equipment_used eq, qc_daily qc
    where eq.drive_id = qc.drive_id
    and trunc(eq.create_time) = '06-aug-2012'
    and out_of_service = 'N'
    and eq.qc_subtype_id in (1026,1012)
    and eq.drive_id = 'DRV2016637'
    DEPT_ID|DRIVE_ID|EQUIP_CODE|QC_SUBTYPE_ID|STAFF_ID
    95|DRV2016637|HEMORYA121|1012|0011
    95|DRV2016637|HEMORYA121|1026|0011
    95|DRV2016637|HEMORYA148|1012|0011
    I need help in getting a query to show the user that
    95|DRV2016637|HEMORYA148|1012|0011
    was qc'd in the morning but not in the evening for 1026

    You still refuse to read {message:id=9360002} and follow the Forum Etiquette?
    How sad for you, since less volunteers will help you.

  • To get code combination in transaction screen -AR

    hi all
    i am using r12
    in AR super user -transactions-in the transactions screen -when it is queried say 10000086 in the field Number
    when distributions tab is clicked we get to see a field named GL account eg 701-100001-1000-0101-1220001-000000-0000-0000
    when i see record history for Transactions screen it says RA_CUSTOMER_TRX_PARTIAL_V
    when i see record  history for gl account   RA_CUST_TRX_LINE_GL_DIST_V  but i don't see the code combinations
    how to join RA_CUSTOMER_TRX_PARTIAL_V and RA_CUST_TRX_LINE_GL_DIST_V
    i did join with customer_trx_id but it gives more number of rows
    kindly guide
    thanking in advance

    Do you want sql script to find GL Code Combinations for a AR transaction?
    If yes, following is the query.
    select rcta.trx_number, gcck.concatenated_segments
    from ra_customer_trx_all rcta, ra_customer_trx_lines_all rctla, RA_CUST_TRX_LINE_GL_DIST rctlgd, gl_code_combinations_kfv gcck
    where rcta.trx_number = '<Give your AR Invoice>'
    and rcta.customer_trx_id = rctla.customer_trx_id
    and rctla.customer_trx_line_id = rctlgd.customer_trx_line_id
    and rctlgd.code_combination_id = gcck.code_combination_id;
    If you are looking for something else, please be clear
    Regards,
    Srini

  • Can any one send select query for this?

    Hi,
    can any one plese send select query for the following query.please send as early as possible.
    Loop through the I_BSID internal table to fill records in I_OUTPUT.Combine data from I_BSID, I_KNKK, I_KNKK_KNKLI, I_KNA1 and I_KNVV into I_OUTPUT based on the linking conditions .Field Description Source are
    I_OUTPUT-BUKRS     Company code     I_BSID-BUKRS
    I_OUTPUT-KUNNR     Customer number     I_BSID-KUNNR
    I_OUTPUT-NAME1     Customer Name     I_KNA1-NAME1
    I_OUTPUT-KNKLI     Credit account     I_KNKK-KNKLI
    I_OUTPUT-KDGRP     Customer Group     I_KNKK-KDGRP
    I_OUTPUT-KLIMK     Credit Limit     I_KNKK_KNKLI-KLIMK
    I_OUTPUT-KVGR1     Business Unit     I_KNVV-KVGR1
    I_OUTPUT-REBZG     Invoice Number     I_BSID-REBZG
    I_OUTPUT-BLDAT     Invoice Date     I_BSID-BLDAT
    I_OUTPUT-WAERS     Document Currency     I_BSID-WAERS
    I_OUTPUT-DUE_DATE     Due Date     Based on below
    Calculation
      Get the Payment terms days combining I_BSID and I_T052 based on the linking conditions mentioned above.    Note : a) Baseline Date : If baseline date I_BSID-ZFBDT is blank , use the Document Date.b) Payment Term Days :If I_BSID-ZBD3T is not blank, take this as Payment Term Days for Due date calculation.
                       If I_BSID-ZBD3T is Blank, then get payment term days from I_T052 based on I_BSID-ZTERM. If there are more than one record in I_T052 for the given Payment term, get the day part from baseline date and select the first record where the day limit I_T052-ZTAGG is greater than the day part.If I_BSID-ZBD3T is blank and I_BSID-ZTERM is also blank, then take Y000 (Due Immediately) as Payment term and proceed with the above logic. Set the payment term field blank while printing.
    Calculate Due date : For Debits, Determine Due Date = Baseline Date + Payment term Days(not discount days)                                                          For  Credits  Due date = Baseline date.Then, move the amount I_BSID-DMBTR to respective buckets (Not yet Due, Current Due, Past due 1-30, Past Due 31-60 etc.)  Based on the due date.
    Thanks&Regards,
    praveen kumar.A

    HI,
    To get Open Items you can use Function module:
    data:i_items TYPE STANDARD TABLE OF rfpos.
    CALL FUNCTION 'CUSTOMER_OPEN_ITEMS'
    EXPORTING
    bukrs = p_bukrs
    kunnr = wa_customer-kunnr
    TABLES
    t_postab = i_items
    EXCEPTIONS
    no_open_items = 1
    OTHERS = 2.
    Table I_items will have all the open items for that Customer in the given company code.
    Well for Clear Items: Try
    GET_CLEARED_ITEMS or FMITPOFM_CLEARED_ITEMS_GET.
    Hope it helps.
    Manish

Maybe you are looking for