Group without using code_combination_id

Hi, 1st post... been working on a query all day to pull back all balances and 3 segments of the code combination in Oracle GL. This itself is fine but the user also wants the number of journal transactions appended on the end for each the segments 1/2/4 so I join to headers and lines via code_combination_id and this is where the problem occurs... I need one line for each of the 3 segments but by joining on code combination I can't do a group by on code combination as that field in effect splits the data by all of the accounting flexfield. code is below, anyone have any ideas? Many thanks.
SELECT gcc.segment1 LEGAL_ENTITY,
  gcc.segment2 BUSINESS_UNIT,
       gcc.segment4 ACCOUNT,
  fl.description ACCOUNT_NAME,
       b.currency_code CCY1CODE,
       sum((B.BEGIN_BALANCE_DR - B.BEGIN_BALANCE_CR)+ (B.PERIOD_NET_DR - B.PERIOD_NET_CR))   CCY1GLENDBALANCE,
      -- b.begin_balance_dr,
      -- b.begin_balance_cr,
       'GBP' AS CCY2CODE,
       0 AS CCY2GLENDBALANCE,
       b.period_num Period,
       b.period_year Year,
      sum( b.period_net_dr) CCY1NETDEBITS,
       sum(b.period_net_cr) CCY1NETCREDITS
,(select count(*)
       from GL_JE_HEADERS JEH
       where je_header_id in (select je_header_id from gl_je_lines JEL where jel.code_combination_id = b.code_combination_id)
       and JEH.je_source in ('Spreadsheet', 'Manual') and jeh.period_name ='OCT-13'
       ) CCY1TRANSCOUNT
  FROM GL_Balances B, GL_Code_combinations GCC, fnd_flex_values_vl FL,
  (select gll.ledger_id, gll.name, gll.currency_code
from gl_ledgers gll, gl_ledger_set_norm_assign_v glln
where gll.ledger_id = glln.ledger_id
and glln.ledger_set_id = 2141
and glln.ledger_id != 2022) ledgers
WHERE b.code_combination_id = gcc.code_combination_id
AND PERIOD_NUM = 10
AND PERIOD_YEAR = 2013
AND GCC.SEGMENT1 = '6199'
AND GCC.segment4 = 719100
AND FL.flex_value = GCC.segment4
AND FL.flex_value_set_id = 1014890
AND GCC.SEGMENT2 in (/*1521, 1119, */ 1115)
and b.ledger_id = ledgers.ledger_id
and b.currency_code = ledgers.currency_code
--and b.code_combination_id IN (218280, 216238)
GROUP BY GCC.SEGMENT4,GCC.SEGMENT1, GCC.SEGMENT2, fl.description, b.currency_code, b.period_num, b.period_year, b.code_combination_id
order by GCC.segment2

Take a look at the FAQ or wherever those rules are stated or get an idea from reading other threads.
with testdata as (
select 1 first_column, 'A' second_column from dual
union all
expected output is
Col1, Col2
A, 1

Similar Messages

  • Remove Excess group dynamically in crystal 10 without using ReportAppServer

    In Crystal report XI I've used follwing code to remove excess group dynamically from aspx page:
                //Remove of Excess Group
                MaxGrpInReport = 9;
               for (int iCount = MaxGrpInReport; iCount >= objShowReport.TotalGroupNo + 1; iCount--)
                    customerReport.ReportClientDocument.DataDefController.GroupController.Remove(customerReport.ReportClientDocument.DataDefinition.Groups[iCount - 1]);
                customerReport.Refresh();
    But when I'm using crystal 10 (Including with Visual Studio 2010) it is getting error. Because "DataDefController.GroupController" is a server component . I'm not using any ReportAppServer. So how can I remove excess group without using ReportAppServer?
    Edited by: sujoyd on Mar 7, 2011 5:11 AM
    Edited by: sujoyd on Mar 7, 2011 5:12 AM
    Edited by: sujoyd on Mar 7, 2011 5:13 AM

    Hello,
    Crystal 10 is included with VS 2005 and VS 2008. there is no CR runtime included with VS 2010. You can download it from our support site.
    CR 10.2 or 10.5 is not supported in VS 2010.
    See this link to get the downloads: SAP Crystal Reports, developer version for Microsoft Visual Studio: Updates & Runtime Downloads [original link is broken]
    Thank you
    Don

  • Why asm startwith with + sign? what happen add file in asm tablespace without using + sign,please explain with error no.

    Hi folks,
    I have one query why asm startwith with + sign? what happen add datafile file in table space,or add disk in disk group  without using + sign ,please explain with error no.

    hello,
    + sign is to indicate the diskgroup you intended to place datafile. this apply to all database files.
    without + sign,will be place in ORACLE_HOME/dbs directory. there will be NO error.
    see example here: without using +
    SQL> create tablespace test45 datafile 'temdg' size 10m;
    Tablespace created.
    SQL> select name from v$datafile;
    NAME
    /u01/app/oracle/product/11.2.0/dbhome_1/dbs/temdg
    7 rows selected.
    second example: with using + sign to specify diskgroup
    SQL> create tablespace test55 datafile '+temdg' size 10m;
    Tablespace created.
    SQL> select name from v$datafile;
    NAME
    /u01/app/oracle/product/11.2.0/dbhome_1/dbs/temdg
    +TEMDG/orcl/datafile/test55.261.844200359
    8 rows selected.
    HTH
    Tobi
    Tobi's Oracle DBA & UNIX Blog

  • Not able to set security group without mail enabled as site collection admin using powershell in sharepoint online site - office 365

    not able to set security group without mail enabled as site collection admin using powershell in sharepoint online site - office 365?
    Any idea?

    after few days test in my lab, I can see that only email enabled group can be added as site collection admin using POWERSHELL.
    hope this helps who stuck like me!! :-)

  • How to write a SQL Query without using group by clause

    Hi,
    Can anyone help me to find out if there is a approach to build a SQL Query without using group by clause.
    Please site an example if is it so,
    Regards

    I hope this example could illuminate danepc on is problem.
    CREATE or replace TYPE MY_ARRAY AS TABLE OF INTEGER
    CREATE OR REPLACE FUNCTION GET_ARR return my_array
    as
         arr my_array;
    begin
         arr := my_array();
         for i in 1..10 loop
              arr.extend;
              arr(i) := i mod 7;
         end loop;
         return arr;
    end;
    select column_value
    from table(get_arr)
    order by column_value;
    select column_value,count(*) occurences
    from table(get_arr)
    group by column_value
    order by column_value;And the output should be something like this:
    SQL> CREATE or replace TYPE MY_ARRAY AS TABLE OF INTEGER
      2  /
    Tipo creato.
    SQL>
    SQL> CREATE OR REPLACE FUNCTION GET_ARR return my_array
      2  as
      3   arr my_array;
      4  begin
      5   arr := my_array();
      6   for i in 1..10 loop
      7    arr.extend;
      8    arr(i) := i mod 7;
      9   end loop;
    10   return arr;
    11  end;
    12  /
    Funzione creata.
    SQL>
    SQL>
    SQL> select column_value
      2  from table(get_arr)
      3  order by column_value;
    COLUMN_VALUE
               0
               1
               1
               2
               2
               3
               3
               4
               5
               6
    Selezionate 10 righe.
    SQL>
    SQL> select column_value,count(*) occurences
      2  from table(get_arr)
      3  group by column_value
      4  order by column_value;
    COLUMN_VALUE OCCURENCES
               0          1
               1          2
               2          2
               3          2
               4          1
               5          1
               6          1
    Selezionate 7 righe.
    SQL> Bye Alessandro

  • Single step workflow with multiple approvers (without using a group)

    Hi,
    is it possible to have a single step workflow with multiple approvers without using a group? This is for a contract document.
    i want to add a number of users based on particular logic. The approvers are random and do not belong to any particular group.
    DO let me know if it is possible or if any of you have done that.
    thanks in advance.
    regards,
    rubio

    Hi Rubio,
    I believe the behavior would be, if individual users are added as approvers then the system would require each approver to approve the document. However, if you use the user group, you could set the role so that it would be either ALL or ANY.
    Regards,
    Vikram

  • How can I publish an App to a selceted group of people without using the Adobe Contetn Viewer?

    How can I publish an App to a selected group of people ( not via App Store) without using the Adobe Content Viewer?
    The App was developed with InDesign 6.0

    You'd have to sign up for an Apple Developer account and then gather all the UDID's (Apple limits this to only 100 devices) that you want your app to be installed on. Create your mobile provisioning profiles to include these ID's and then you could use TestFlight to push out your app and monitor who has installed it. Of course Testflight is intended for monitoring your apps performance but I'm sure you can get away with it if you use it to push you app. One thing to keep in mind is the mobile provisoning profiles are only valid for 1 year. Hope this helps.

  • Can u write the following query without using group by clause

    select sp.sid, p.pid, p.name from product p, supp_prod sp
    where sp.pid= p.pid and
    sp.sid = ( select sid from supp_prod group by sid
    having count(*) =(select count(*) from product));
    thru this, we retrieving all the products delivered by the supplier.
    Can you write the following query without using the group by clause

      select sp.sid, p.pid, p.name
        from product p, supp_prod sp
       where sp.pid= p.pid the above query will still retrieve all the products supplied by the supplier. sub-query is not necessary.
    maybe if you can post some sample data and output will help us understand what you want to achieve.

  • Need to take rownum highest value without using grouping functions

    Hi
    I want to display highest value in the rownum column and customer details without using grouping functions like max or count
    this below query gives me all rownum values and customer details
    SELECT ROWNUM ROWNUM_1, CUSTOMER_NO, CUSTOMER_NAME, CUSTOMER_DOJ, CUSTOMER_MOBILENO FROM CUSTOMER;
    can any one help me.

    The above query won't work as it's missing "from" cluase in the inner select statement.
    And even if corrected it willl print rownum values thrice: value "1",max_rownum, max_rownum followed by customer details.
    Below is the simple query to retrieve max row_num along with the corresponding customer details.
    select * from (SELECT ROWNUM ROWNUM_1, CUSTOMER_NO, CUSTOMER_NAME, CUSTOMER_DOJ, CUSTOMER_MOBILENO FROM CUSTOMER order by rownum_1 desc) where rownum<=1 ;

  • Is it possible to group multiple columns individually without using union?

    Hi, if I have a table with a numebr of columns I want to group eg gender, nationality, age and I want to produce a summary such like:
    Group Count
    Male 10
    Female 23
    British 19
    Irish 14
    18 10
    etc.
    Or even better:
    Group Count
    Gender-Male 10
    Gender-Female 23
    Nationaility-British 19
    Nationality-Irish 14
    Age-18 10
    Is this possible without using loads of unions? I just want to do this in the best, most efficient way as the table involved has >100 million rows.
    Many thanks
    Jen :)

    May be this
    --Test data
    with t
    as
    select 'M' gender, 'INDIAN'  nationality, 25 age from dual union all
    select 'M' gender, 'INDIAN'  nationality, 25 age from dual union all
    select 'M' gender, 'INDIAN'  nationality, 30 age from dual union all
    select 'M' gender, 'IRISH'   nationality, 30 age from dual union all
    select 'M' gender, 'IRISH'   nationality, 40 age from dual union all
    select 'F' gender, 'IRISH'   nationality, 40 age from dual union all
    select 'F' gender, 'BRITISH' nationality, 50 age from dual union all
    select 'F' gender, 'BRITISH' nationality, 50 age from dual union all
    select 'F' gender, 'BRITISH' nationality, 45 age from dual union all
    select 'F' gender, 'BRITISH' nationality, 45 age from dual
    --Test Data Ends
    -- Main Query
    select decode(no, 1, 'Gender-', 2, 'Nationality-', 3, 'Age-') || decode(no, 1, gender, 2, nationality, 3, to_char(age)) val,
           count(*) cnt
      from t
    cross join (select level no from dual connect by level <= 3)
    group by no, decode(no, 1, gender, 2, nationality, 3, to_char(age))
    order by no;
    VAL                                                  CNT
    Gender-F                                               5
    Gender-M                                               5
    Nationality-BRITISH                                    4
    Nationality-INDIAN                                     3
    Nationality-IRISH                                      3
    Age-25                                                 2
    Age-30                                                 2
    Age-40                                                 2
    Age-45                                                 2
    Age-50                                                 2
    10 rows selected

  • Merging multiple rows without using max group by

    Hi guys,
    Is there any better way to convert
    with
    test as
    select '001' as id, 'Apple' as name, 'A' as segment1,null as segment2,null as segment3 from dual union all
    select '001' as id, 'Apple' as name,null as segment1, 'P' as segment2,null as segment3 from dual union all
    select '001' as id, 'Apple' as name,null as segment1,null as segment2, 'L' as segment3 from dual
    select * from test
    to
    select '001' as id, 'Apple' as name, 'A' as segment1,'P' as segment2,'L' as segment3 from dual
    without using max and group by?
    There are about 5 million records and using max group by is slowing it down by a lot.
    It is needed to be done by SQL.
    Thank You

    with
    test as
    select '001' as id, 'Apple' as name, 'A' as segment1,null as segment2,null as segment3 from dual union all
    select '001' as id, 'Apple' as name,null as segment1, 'P' as segment2,null as segment3 from dual union all
    select '001' as id, 'Apple' as name,null as segment1,null as segment2, 'L' as segment3 from dual
    select distinct id, name
    , last_value(segment1 ignore nulls) over (partition by id, name order by segment1) as seg1
    , last_value(segment2 ignore nulls) over (partition by id, name order by segment2) as seg2
    , last_value(segment3 ignore nulls) over (partition by id, name order by segment3) as seg3
    from test
    ;No max or group by, but not necessarily any faster. If you post your actual query, some sample data with expected results, and the additional information requested in the following posts, then someone may be able to provide better suggestions.
    When your query takes too long
    When your query takes too long ...
    How to Post a SQL statement tuning request
    HOW TO: Post a SQL statement tuning request - template posting
    Regards,
    Bob

  • Help needed Displaying ALV  Secondary list without using oops concept

    Hi Experts
    Help needed Displaying ALV  Secondary list without using oops concept.
    its urgent
    regds
    rajasekhar

    hi chk this code
    ******************TABLES DECLARATION*****************
    TABLES : VBAP,MARA.
    *****************TYPE POOLS**************************
    TYPE-POOLS : SLIS.
    ****************INTERNAL TABLES**********************
    DATA : BEGIN OF IT_VBAP OCCURS 0,
    VBELN LIKE VBAP-VBELN, "SALES DOCUMENT
    POSNR LIKE VBAP-POSNR, "SALES DOCUMENT ITEM
    MATNR LIKE VBAP-MATNR, "MATERIAL NUMBER
    END OF IT_VBAP.
    ****************TEMPORARY VARIABLES******************
    DATA : V_VBELN LIKE VBAP-VBELN."SALES DOCUMENT
    DATA : V_MTART LIKE MARA-MTART. "MATERIAL TYPE
    *****************FIELD CATALOG***********************
    DATA : IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
           WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
    ****************LAYOUT*******************************
    DATA : WA_LAYOUT TYPE SLIS_LAYOUT_ALV.
    ***************VARIANT*******************************
    DATA : G_VARIANT LIKE DISVARIANT.
    ****************SAVE*********************************
    DATA : G_SAVE(1) TYPE C.
    *****************EVENTS******************************
    DATA : XS_EVENTS TYPE SLIS_ALV_EVENT,
           G_EVENTS TYPE SLIS_T_EVENT.
    ******************PF STATUS**************************
    DATA : PF_STATUS TYPE SLIS_FORMNAME VALUE 'SET_PF_STATUS'.
    ******************USER COMMAND************************
    DATA : USER_COMMAND TYPE SLIS_FORMNAME VALUE 'SET_USER_COMMAND',
           R_UCOMM LIKE SY-UCOMM.
    ****************SELECTION SCREEN************************
    SELECT-OPTIONS : S_VBELN FOR VBAP-VBELN.
    ***************AT SELECTION SCREEN*********************
    AT SELECTION-SCREEN.
      PERFORM VALIDATE.
    **************START-OF-SELECTION**************************
    START-OF-SELECTION.
      PERFORM GET_DETAILS.
      PERFORM FIELDCAT.
      PERFORM LAYOUT.
      PERFORM VARIANT.
      PERFORM SAVE.
      PERFORM EVENTS.
      PERFORM ALV_DISPLAY.
    *********************FORMS*******************************************
    *&      Form  validate
          text
    -->  p1        text
    <--  p2        text
    FORM VALIDATE .
      SELECT SINGLE VBELN
                    FROM VBAP
                    INTO V_VBELN
                    WHERE VBELN IN S_VBELN.
      IF SY-SUBRC <> 0.
        MESSAGE E000 WITH 'enter valid vbeln'.
      ENDIF.
    ENDFORM.                    " validate
    *&      Form  get_details
          text
    -->  p1        text
    <--  p2        text
    FORM GET_DETAILS .
      SELECT VBELN
             POSNR
             MATNR
             FROM VBAP
             INTO TABLE IT_VBAP
             WHERE VBELN IN S_VBELN.
      IF SY-SUBRC <> 0.
        MESSAGE E000 WITH 'no details found'.
      ENDIF.
    ENDFORM.                    " get_details
    *&      Form  fieldcat
          text
    -->  p1        text
    <--  p2        text
    FORM FIELDCAT .
      WA_FIELDCAT-TABNAME = 'IT_VBAP'.
      WA_FIELDCAT-FIELDNAME = 'VBELN'.
      WA_FIELDCAT-OUTPUTLEN = 10.
      WA_FIELDCAT-SELTEXT_L = 'SALES DOC'.
      APPEND WA_FIELDCAT TO IT_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-TABNAME = 'IT_VBAP'.
      WA_FIELDCAT-FIELDNAME = 'POSNR'.
      WA_FIELDCAT-OUTPUTLEN = 6.
      WA_FIELDCAT-SELTEXT_L = 'ITEM'.
      APPEND WA_FIELDCAT TO IT_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-TABNAME = 'IT_VBAP'.
      WA_FIELDCAT-FIELDNAME = 'MATNR'.
      WA_FIELDCAT-OUTPUTLEN = 18.
      WA_FIELDCAT-SELTEXT_L = 'MATERIAL NO'.
      APPEND WA_FIELDCAT TO IT_FIELDCAT.
      CLEAR WA_FIELDCAT.
    ENDFORM.                    " fieldcat
    *&      Form  LAYOUT
          text
    -->  p1        text
    <--  p2        text
    FORM LAYOUT .
      WA_LAYOUT-ZEBRA = 'X'.
    ENDFORM.                    " LAYOUT
    *&      Form  VARIANT
          text
    -->  p1        text
    <--  p2        text
    FORM VARIANT .
      CLEAR G_VARIANT.
      G_VARIANT-REPORT = SY-REPID.
    ENDFORM.                    " VARIANT
    *&      Form  SAVE
          text
    -->  p1        text
    <--  p2        text
    FORM SAVE .
      CLEAR G_SAVE.
      G_SAVE = 'A'.
    ENDFORM.                    " SAVE
    *&      Form  EVENTS
          text
    -->  p1        text
    <--  p2        text
    FORM EVENTS .
      CLEAR XS_EVENTS.
      XS_EVENTS-NAME = SLIS_EV_TOP_OF_PAGE.
      XS_EVENTS-FORM = 'TOP_OF_PAGE'.
      APPEND XS_EVENTS TO G_EVENTS.
    ENDFORM.                    " EVENTS
    *&      Form  TOP_OF_PAGE
          text
    FORM TOP_OF_PAGE.
      WRITE :/ ' INTELLI GROUP'.
    ENDFORM.                    "TOP_OF_PAGE
    *&      Form  ALV_DISPLAY
          text
    -->  p1        text
    <--  p2        text
    FORM ALV_DISPLAY .
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
       EXPORTING
      I_INTERFACE_CHECK              = ' '
      I_BYPASSING_BUFFER             =
      I_BUFFER_ACTIVE                = ' '
         I_CALLBACK_PROGRAM             = SY-REPID
         I_CALLBACK_PF_STATUS_SET       = PF_STATUS
         I_CALLBACK_USER_COMMAND        = USER_COMMAND
      I_STRUCTURE_NAME               =
         IS_LAYOUT                      = WA_LAYOUT
         IT_FIELDCAT                    = IT_FIELDCAT
      IT_EXCLUDING                   =
      IT_SPECIAL_GROUPS              =
      IT_SORT                        =
      IT_FILTER                      =
      IS_SEL_HIDE                    =
      I_DEFAULT                      = 'X'
         I_SAVE                         = G_SAVE
         IS_VARIANT                     = G_VARIANT
         IT_EVENTS                      = G_EVENTS
      IT_EVENT_EXIT                  =
      IS_PRINT                       =
      IS_REPREP_ID                   =
      I_SCREEN_START_COLUMN          = 0
      I_SCREEN_START_LINE            = 0
      I_SCREEN_END_COLUMN            = 0
      I_SCREEN_END_LINE              = 0
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER        =
      ES_EXIT_CAUSED_BY_USER         =
        TABLES
          T_OUTTAB                       = IT_VBAP
       EXCEPTIONS
         PROGRAM_ERROR                  = 1
         OTHERS                         = 2
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    " ALV_DISPLAY
    *&      Form  SET_PF_STATUS
          text
    FORM SET_PF_STATUS USING EXTAB TYPE SLIS_T_EXTAB.
      SET PF-STATUS 'Z50651_PFSTATUS' EXCLUDING EXTAB.
    ENDFORM.                    "SET_PF_STATUS
    *&      Form  SET_USER_COMMAND
          text
    FORM SET_USER_COMMAND USING R_UCOMM
                                RS_SELFIELD TYPE SLIS_SELFIELD.
      CASE R_UCOMM.
        WHEN 'DC'.
          READ TABLE IT_VBAP INDEX RS_SELFIELD-TABINDEX.
          IF SY-SUBRC = 0.
            SELECT SINGLE MTART
                          FROM MARA
                          INTO V_MTART
                          WHERE MATNR = IT_VBAP-MATNR.
            IF SY-SUBRC <> 0.
       MESSAGE E000 WITH 'NO MATERIAL DESCRIPTION FOR SELECTED MATERIAL NO'.
            ELSE.
              WRITE :/ 'MATERIAL NO :',IT_VBAP-MATNR.
              WRITE :/ 'MATERIAL TYPE :' , V_MTART.
            ENDIF.
          ENDIF.
        WHEN 'BACK'.
          LEAVE TO SCREEN 0.
        WHEN 'EXIT'.
          LEAVE TO SCREEN 0.
        WHEN 'CLOSE'.
          CALL TRANSACTION 'SE38'.
      ENDCASE.
    REPORT  Z_ALV_INTERACTIVE  MESSAGE-ID ZMSG_50651
                                    LINE-SIZE 100
                                    LINE-COUNT 60
                                    NO STANDARD PAGE HEADING.
    ******************TABLES DECLARATION*****************
    TABLES : VBAP,MARA.
    *****************TYPE POOLS**************************
    TYPE-POOLS : SLIS.
    ****************INTERNAL TABLES**********************
    DATA : BEGIN OF IT_VBAP OCCURS 0,
    VBELN LIKE VBAP-VBELN, "SALES DOCUMENT
    POSNR LIKE VBAP-POSNR, "SALES DOCUMENT ITEM
    MATNR LIKE VBAP-MATNR, "MATERIAL NUMBER
    END OF IT_VBAP.
    ****************TEMPORARY VARIABLES******************
    DATA : V_VBELN LIKE VBAP-VBELN."SALES DOCUMENT
    DATA : V_MTART LIKE MARA-MTART. "MATERIAL TYPE
    *****************FIELD CATALOG***********************
    DATA : IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
           WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
    ****************LAYOUT*******************************
    DATA : WA_LAYOUT TYPE SLIS_LAYOUT_ALV.
    ***************VARIANT*******************************
    DATA : G_VARIANT LIKE DISVARIANT.
    ****************SAVE*********************************
    DATA : G_SAVE(1) TYPE C.
    *****************EVENTS******************************
    DATA : XS_EVENTS TYPE SLIS_ALV_EVENT,
           G_EVENTS TYPE SLIS_T_EVENT.
    ******************PF STATUS**************************
    DATA : PF_STATUS TYPE SLIS_FORMNAME VALUE 'SET_PF_STATUS'.
    ******************USER COMMAND************************
    DATA : USER_COMMAND TYPE SLIS_FORMNAME VALUE 'SET_USER_COMMAND',
           R_UCOMM LIKE SY-UCOMM.
    ****************SELECTION SCREEN************************
    SELECT-OPTIONS : S_VBELN FOR VBAP-VBELN.
    ***************AT SELECTION SCREEN*********************
    AT SELECTION-SCREEN.
      PERFORM VALIDATE.
    **************START-OF-SELECTION**************************
    START-OF-SELECTION.
      PERFORM GET_DETAILS.
      PERFORM FIELDCAT.
      PERFORM LAYOUT.
      PERFORM VARIANT.
      PERFORM SAVE.
      PERFORM EVENTS.
      PERFORM ALV_DISPLAY.
    *********************FORMS*******************************************
    *&      Form  validate
          text
    -->  p1        text
    <--  p2        text
    FORM VALIDATE .
      SELECT SINGLE VBELN
                    FROM VBAP
                    INTO V_VBELN
                    WHERE VBELN IN S_VBELN.
      IF SY-SUBRC <> 0.
        MESSAGE E000 WITH 'enter valid vbeln'.
      ENDIF.
    ENDFORM.                    " validate
    *&      Form  get_details
          text
    -->  p1        text
    <--  p2        text
    FORM GET_DETAILS .
      SELECT VBELN
             POSNR
             MATNR
             FROM VBAP
             INTO TABLE IT_VBAP
             WHERE VBELN IN S_VBELN.
      IF SY-SUBRC <> 0.
        MESSAGE E000 WITH 'no details found'.
      ENDIF.
    ENDFORM.                    " get_details
    *&      Form  fieldcat
          text
    -->  p1        text
    <--  p2        text
    FORM FIELDCAT .
      WA_FIELDCAT-TABNAME = 'IT_VBAP'.
      WA_FIELDCAT-FIELDNAME = 'VBELN'.
      WA_FIELDCAT-OUTPUTLEN = 10.
      WA_FIELDCAT-SELTEXT_L = 'SALES DOC'.
      APPEND WA_FIELDCAT TO IT_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-TABNAME = 'IT_VBAP'.
      WA_FIELDCAT-FIELDNAME = 'POSNR'.
      WA_FIELDCAT-OUTPUTLEN = 6.
      WA_FIELDCAT-SELTEXT_L = 'ITEM'.
      APPEND WA_FIELDCAT TO IT_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-TABNAME = 'IT_VBAP'.
      WA_FIELDCAT-FIELDNAME = 'MATNR'.
      WA_FIELDCAT-OUTPUTLEN = 18.
      WA_FIELDCAT-SELTEXT_L = 'MATERIAL NO'.
      APPEND WA_FIELDCAT TO IT_FIELDCAT.
      CLEAR WA_FIELDCAT.
    ENDFORM.                    " fieldcat
    *&      Form  LAYOUT
          text
    -->  p1        text
    <--  p2        text
    FORM LAYOUT .
      WA_LAYOUT-ZEBRA = 'X'.
    ENDFORM.                    " LAYOUT
    *&      Form  VARIANT
          text
    -->  p1        text
    <--  p2        text
    FORM VARIANT .
      CLEAR G_VARIANT.
      G_VARIANT-REPORT = SY-REPID.
    ENDFORM.                    " VARIANT
    *&      Form  SAVE
          text
    -->  p1        text
    <--  p2        text
    FORM SAVE .
      CLEAR G_SAVE.
      G_SAVE = 'A'.
    ENDFORM.                    " SAVE
    *&      Form  EVENTS
          text
    -->  p1        text
    <--  p2        text
    FORM EVENTS .
      CLEAR XS_EVENTS.
      XS_EVENTS-NAME = SLIS_EV_TOP_OF_PAGE.
      XS_EVENTS-FORM = 'TOP_OF_PAGE'.
      APPEND XS_EVENTS TO G_EVENTS.
    ENDFORM.                    " EVENTS
    *&      Form  TOP_OF_PAGE
          text
    FORM TOP_OF_PAGE.
      WRITE :/ ' INTELLI GROUP'.
    ENDFORM.                    "TOP_OF_PAGE
    *&      Form  ALV_DISPLAY
          text
    -->  p1        text
    <--  p2        text
    FORM ALV_DISPLAY .
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
       EXPORTING
      I_INTERFACE_CHECK              = ' '
      I_BYPASSING_BUFFER             =
      I_BUFFER_ACTIVE                = ' '
         I_CALLBACK_PROGRAM             = SY-REPID
       I_CALLBACK_PF_STATUS_SET         = PF_STATUS
         I_CALLBACK_USER_COMMAND        = USER_COMMAND
      I_STRUCTURE_NAME               =
         IS_LAYOUT                      = WA_LAYOUT
         IT_FIELDCAT                    = IT_FIELDCAT
      IT_EXCLUDING                   =
      IT_SPECIAL_GROUPS              =
      IT_SORT                        =
      IT_FILTER                      =
      IS_SEL_HIDE                    =
      I_DEFAULT                      = 'X'
         I_SAVE                         = G_SAVE
        IS_VARIANT                      = G_VARIANT
         IT_EVENTS                      = G_EVENTS
      IT_EVENT_EXIT                  =
      IS_PRINT                       =
      IS_REPREP_ID                   =
      I_SCREEN_START_COLUMN          = 0
      I_SCREEN_START_LINE            = 0
      I_SCREEN_END_COLUMN            = 0
      I_SCREEN_END_LINE              = 0
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER        =
      ES_EXIT_CAUSED_BY_USER         =
        TABLES
          T_OUTTAB                       = IT_VBAP
       EXCEPTIONS
         PROGRAM_ERROR                  = 1
         OTHERS                         = 2
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    " ALV_DISPLAY
    *&      Form  SET_PF_STATUS
          text
    FORM SET_PF_STATUS USING EXTAB TYPE SLIS_T_EXTAB.
      SET PF-STATUS 'STANDARD' EXCLUDING EXTAB.
    ENDFORM.                    "SET_PF_STATUS
    *&      Form  SET_USER_COMMAND
          text
    FORM SET_USER_COMMAND USING R_UCOMM
                                RS_SELFIELD TYPE SLIS_SELFIELD.
      CASE R_UCOMM.
        WHEN 'DC'.
          READ TABLE IT_VBAP INDEX RS_SELFIELD-TABINDEX.
          IF SY-SUBRC = 0.
            SELECT SINGLE MTART
                          FROM MARA
                          INTO V_MTART
                          WHERE MATNR = IT_VBAP-MATNR.
            IF SY-SUBRC <> 0.
       MESSAGE E000 WITH 'NO MATERIAL DESCRIPTION FOR SELECTED MATERIAL NO'.
            ELSE.
              WRITE :/ 'MATERIAL NO :',IT_VBAP-MATNR.
              WRITE :/ 'MATERIAL TYPE :' , V_MTART.
      SUBMIT SLIS_DUMMY WITH P_MATNR EQ IT_VBAP-MATNR
                        WITH P_MTART EQ V_MTART.
            ENDIF.
          ENDIF.
        WHEN 'BACK'.
          LEAVE TO SCREEN 0.
        WHEN 'EXIT'.
          LEAVE TO SCREEN 0.
        WHEN 'CLOSE'.
          CALL TRANSACTION 'SE38'.
      ENDCASE.
    plz reward if useful

  • Unable to display data no entry in the table without using Model clause

    Hi,
    I've an urgent requirement described below :
    The previously posted Question has been answerted using Model Clause:
    Is there any way out to solve it without using Model clause:
    I've a table named as "sale" consisting of three columns : empno, sale_amt and sale_date.
    (Please ref. The table script with data as given below)
    Now if I execute the query :
    "select trunc(sale_date) sale_date, sum(sale_amt) total_sale from sale group by trunc(sale_date) order by 1"
    then it displays the data for the dates of which there is an entry in that table. But it does not display data for the
    date of which there is no entry in that table.
    If you run the Table script with data in your schema, then u'll see that there is no entry for 28th. Nov. 2009 in
    sale table. Now the above query displays data for rest of the dates as its are in sale table except for 28th. Nov. 2009.
    But I need its presence in the query output with a value of "sale_date" as "28th. Nov. 2009" and that of "total_sale" as
    "0".
    Is there any means to get the result as I require?
    Please help ASAP.
    Thanks in advance.
    Create table script with data:
    CREATE TABLE SALE
    EMPNO NUMBER,
    SALE_AMT NUMBER,
    SALE_DATE DATE
    SET DEFINE OFF;
    Insert into SALE
    (EMPNO, SALE_AMT, SALE_DATE)
    Values
    (100, 1000, TO_DATE('12/01/2009 10:20:10', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into SALE
    (EMPNO, SALE_AMT, SALE_DATE)
    Values
    (100, 1000, TO_DATE('11/30/2009 10:21:04', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into SALE
    (EMPNO, SALE_AMT, SALE_DATE)
    Values
    (100, 1000, TO_DATE('11/29/2009 10:21:05', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into SALE
    (EMPNO, SALE_AMT, SALE_DATE)
    Values
    (100, 1000, TO_DATE('11/26/2009 10:21:06', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into SALE
    (EMPNO, SALE_AMT, SALE_DATE)
    Values
    (100, 1000, TO_DATE('11/25/2009 10:21:07', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into SALE
    (EMPNO, SALE_AMT, SALE_DATE)
    Values
    (200, 5000, TO_DATE('11/27/2009 10:23:06', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into SALE
    (EMPNO, SALE_AMT, SALE_DATE)
    Values
    (200, 4000, TO_DATE('11/29/2009 10:23:08', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into SALE
    (EMPNO, SALE_AMT, SALE_DATE)
    Values
    (200, 3000, TO_DATE('11/24/2009 10:23:09', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into SALE
    (EMPNO, SALE_AMT, SALE_DATE)
    Values
    (200, 2000, TO_DATE('11/30/2009 10:23:10', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into SALE
    (EMPNO, SALE_AMT, SALE_DATE)
    Values
    (300, 7000, TO_DATE('11/24/2009 10:24:19', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into SALE
    (EMPNO, SALE_AMT, SALE_DATE)
    Values
    (300, 5000, TO_DATE('11/25/2009 10:24:20', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into SALE
    (EMPNO, SALE_AMT, SALE_DATE)
    Values
    (300, 3000, TO_DATE('11/27/2009 10:24:21', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into SALE
    (EMPNO, SALE_AMT, SALE_DATE)
    Values
    (300, 2000, TO_DATE('11/29/2009 10:24:22', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into SALE
    (EMPNO, SALE_AMT, SALE_DATE)
    Values
    (300, 1000, TO_DATE('11/30/2009 10:24:22', 'MM/DD/YYYY HH24:MI:SS'));
    COMMIT;
    Any help will be needful for me
    Regards,

    select sale_date,sum(sale_amt) total_sale
    from
    select empno,0 sale_amt,(sale_date + ao.rn) sale_date
    from
    select empno,sale_amt,sale_date ,(t.nxt_dt - t.sale_date) diff
    from
    select empno
    ,sale_amt,trunc(sale_date) sale_date
    ,trunc(nvl(lead(sale_date) over (partition by 1 order by sale_date),sale_date)) nxt_dt
    from sale
    ) t
    where (t.nxt_dt - t.sale_date) >1
    ) rec,(select rownum rn from user_objects where rownum<=200) ao
    where ao.rn <=(rec.diff-1)
    union all
    select empno,sale_amt,trunc(sale_date) sale_date
    from sale
    group by sale_date
    order by 1;
    ~~~~Guess this will serve the purpose...
    Cheers Arpan

  • How can I fix this select without using subquery?

    Hi guys is there any way to do the where below (in bold) without using an aggregate query before?
    select
    SUM(NET_AMOUNT)
    as net,
    SUM(TAX_AMOUNT)
    as tax,
    SUM(NET_AMOUNT)+
    SUM(TAX_AMOUNT)
    as total from ledger left join alloc on ledger.trxid=alloc.trxid where
     (SUM(NET_AMOUNT)+
    SUM(TAX_AMOUNT))
    > allocated
    net and tax are in the ledger and allocated is in the alloc table. Sometimes the total of the amount (net+tax) is greater than the allocated so I need to retrieve all the rows where allocated is null or  tot is greater than allocated.
    It's possible without CTE?
    Thanks

    Resolved.
    SUM(NET_AMOUNT)
    as net,
    SUM(TAX_AMOUNT)
    as tax,
    SUM(NET_AMOUNT)+
    SUM(TAX_AMOUNT)
    as total from ledger left join alloc on ledger.trxid=alloc.trxid ....group by....
    having ((SUM(NET_AMOUNT)+
    SUM(TAX_AMOUNT))
    > allocated)
    Sometimes I need to post the issue in the forum just to remember how do the things.
    Thanks and sorry

  • Is it possible to display unrelated info without using a subreport?

    Hi,
    I'm trying to create a report that displays 2 different sets of information without using a subreport. 
    The first section of info (the part I'm having trouble with) is simple displaying the info in the db.  It is just the differnt security settings of the system.
    The second section of info is each users info and their personal security settings.  This part is not a problem and displays correctly.
    How can I get the first section to be displayed at the top of the report without it affecting the second section which uses the group header and details portion of the report?  When I try and put it in the Page header it throws off the second section and causes the information in the details to be repeated multiple times.
    Is it possible to do this without a subreport?  I'm using Crystal Reports 2008.
    Thanks Mike
    Edited by: Mike Swift on Aug 21, 2008 5:35 PM

    Mike
    Have you tried selecting the "Select Distinct Records" box in report options.
    Maybe this has nothing to do with your problem but I thought I would throw that out.
    Good luck

Maybe you are looking for

  • HT204053 How can I change my iCloud email?

    Someone set up my iCloud email and put their name but now I want to change it to where it say my name.

  • Hierarchy question -- Can I insert more than one in a query?

    I have query where Iu2019m measuring sales across 5 divisions.  Sales are in the columns and the divisions are in the rows.  In the rows, I created a structure with 5 selections for each division.  Within each division, I need to insert a different h

  • Albums Not Displaying & Playing - FIX IT!!!

    I know this has been a topic of discussion before but it seems not to be fixed. My Nano displays an album by track and will NOT play a whole album no matter what I do in iTunes or on the Nano. I've tried the "Rs" but all I feel are GRRRRRS! All the l

  • ABAP dump is coimg in PA

    HI Experts, ABAP dump is coming when i click on profitabiliy segemny in accounting document. And dump says:Profitabilty segment "xxxxxxx" does not exist in operating conern "xxxx" the system tried to find characteristics from the segment table "CE410

  • Stopped playing quicktime movies

    Out of the blue it seems I can't play any quicktime movies. QT opens but no pic or sound. mpeg movies play fine in qt. I have qt pro, latest updates on a macbook pro w/ leopard. Get an error message directing me to 3rd party updates. Any ideas Thanks