Sort by field help

I am selecting 3 fields from a table: DATE, Count_A, Count_B. Sample of date:
012010    1254     5487
032009    5478     5478
042009    4587     4587
012011   1111     2222The DATE column is stores as a number using MMYYYY and the others are just number fields, I need to have the results sorted so that,
the Date field comes back in an Ascending Order, where the lower month and year is first and so on, as in:
012009
022009
012010
022010
032010
012011
022011
032011
042011
probably something easy, just asking for SQL, currently I have:
select DATE, COUNT_A, COUNT_B
from TABLE;
The order by don't really order the right way, what's the best way, just working with client data the way they have it setup.

Since when do tables have 'fields'?
Sorry but your use of the incorrect term 'field' stems from 3GL concepts and is incorrect and highly annoying.
And storing date values in a varchar2 was daft in 1979, when Oracle was first released, and is still daft.
Obviously order by date won't work, and using reserved words in column names is daft too.
Sybrand Bakker
Senior Oracle DBA

Similar Messages

  • Can we sort one field based on other field in messsage mapping !!

    Hi Folks,
    I have got source xml with couple of Vendors, Vendors has got promotions on different products with different dates. If I sort date field, product quantity is not sorting. How Can I sort both fields at the same time, if I sort Promotion date field in ascending order, the product quanitity has to sort respectively?
    Any one can help in this please , any links are examples etc..
    Kind Regards
    Thanks in advance.
    San

    Hi Folks,
    I have tried with this function SortbyKey, it always throuing exception. That's the reason I came to you guys. Please have a look following mapping
    ZY2K_DATE    ----> Remove Context -->
                                           Sortbykey  -----> Condition etc.,
    ZA02_QTY   -----> Remove Context -->
    if I try to see display queue on Sortbykey  I am getting ' Exception'
    Exception:[com.sap.aii.mappingtool.tf7.FunctionException: Queues have different lengths in function sortByKey] in class com.sap.aii.mappingtool.flib7.NodeFunctions method sortByKey[[Ljava.lang.String;@5be18f1d, [Ljava.lang.String;@357ae80b, SortComparator.CASE_SENSITIVE, SortOrder.ASCENDING, com.sap.aii.mappingtool.tf7.rt.ResultListImpl@1818459b,
    Source
    <ROOT>
    ...<OUTPUT>          - - - -       0..unbound
    .......<Group_LIN>    - - -        0..unbound
    ..........<Group_ZA>  - - -       0..unbound      
    ..............<D02_ZA>  - - -        0..unbound
    ..................<ZA01>QD</ZA01>
    ..................<ZA02>35.0</ZA02>
    ..................<ZA03>CT</ZA03>
    ..................<Z_Y2K_DATE>20100723</Z_Y2K_DATE>
    ..............</D02_ZA>
    ...........</Group_ZA>
    ........</Group_Lin>
    ....</OUTPUT>
    Target
    ProductDemandInfluencingEventNotification  0..unbound
    ...ProductDemandInfluencingEvent                 1..1
    .......Item                                                           1..unbound
    ..........OrderForecastTimeSeries                     0..1
    ..............Item                                                    1..unbound
    .................ValidityPeriod                                  1..1
    ......................StartDateTime                             0..1
    ......................EndDateTime                               0..1
    .................Quantity                                           1..1
    the above D02_ZA tag sometimes comes more than one QD with different dates. Same dates has to go under one tag with respective quantities!! This is the situation, can any solve this please?
    The target tag "ProductDemandInfluencingEventNotification" will generate based on number of promotions on particular date. Ex: if one vendor has 'n' number products promotions on 3 different dates, 3 "ProductDemandinfluenceevennotifications" has to generate, that three promotion dates and quantities has to respectively.
    That ZA02 (Qty) value has to go Quantity target field.
    Kind Regards
    San

  • Is there a way to sort button field names?

    In the Button Options dialog box, in the Behaviors tab: Behavior is Show/Hide fields. I cannot figure out ID's method of organization of organizing the field names. Sometimes, the new fields go at the top. Sometimes they go at the bottom... It doesn't appear to be alphabetical, numerical, or chronological. Help!
    There also doesn't appear to be any way to sort these field names. My document has about a hundred fields so far, with a couple hundred more to go. Is there any way to sort these names so they are easy to wade through?
    If sorting via script is not an option, maybe someone could help me understand the rationale (if there is any) to ID's way of listing field names.
    Thanks!

    When you say field, do you mean specifically a form field, such as a text field? Or is the information regular text on the page?

  • Sorting on Field Symbols

    Hi,
      I have created ztable and table maintenance generator for the same.  So its already generated code like
    PROCESS BEFORE OUTPUT.
      MODULE LISTE_INITIALISIEREN.
      LOOP AT EXTRACT WITH CONTROL
       TCTRL_YS014 CURSOR NEXTLINE.
        MODULE LISTE_SHOW_LISTE.
      ENDLOOP.  etc....
    Here EXTRACT Is a internal table of type ANY... Now i am getting records sorted by key fields of Z-table.
    But I need Sort by some other fields.. So i am trying to sort EXTRACT but not able to...
    Can anybody helpme on this..
    Rayudu

    Hi rayudu,
             this process may help u.Please check.
    FIELD-GROUPS: HEADER, ORDER, PRODUCT.
    use insert statement to add the field to teh field-group which u want
    to sort.
    use extract statement to populate u r field-group.
    And sort by field.
    Thanks,
    Vamsi

  • Issue on sorting the fields in ALV Grid

    I have created a report in ALV Grid I have sorted the fields using slis_sortinfo_alv to avoid the duplicates . I could display the output in sorted fashion, but when I export it to a file it is displaying in the same fashion as it is in the database that is in the allowing duplicates.. I cant use DELETE ADJACENT DUPLICATES as it will delete the adjacent records . i need help from you guys please help me...

    Hi,
    As you have data in your internal table that is to be displayed in the alv grid display.
    So, instead you can sort the internal table on that field and then can delete the duplicate records comparing that very field.
    Use code:-
    sort <itab> by <field_name>. "to sort
    delete adjacent duplicates from <itab> comparing <field_name>. "to delete duplicate entries
    This will delete all the duplicates records for the column.
    Now you can use this internal table to display the data in the ALV grid.
    Or if you dont wish to delete the data from the initial internal table, then you can use a temporary internal table of same structure and use:-
    it_temp = itab.
    sort it_temp by <field_name>. "to sort
    delete adjacent duplicates from it_temp comparing <field_name>. "to delete duplicate entries
    Now you can use this internal table to be displayed as alv output.
    Hope this helps you.
    Thanks & Regards,
    Tarun

  • Not able to find values in LOV of field "Help Desk" of Global contract

    Not able to find values in LOV of field "Help Desk" of Global contract defaults.
    This value should be coming from resource setup.
    Resource is already created.

    Issue resolved:
    The resource should ahve valid Email id in HR People setup

  • Accessing Field Help from item on different Page

    I manually created a tabular form used for posting and I wanted to implement the field help for the column headers. I have a seperate maintenance form that already has the appropriate help text stored for each item. I want to have my tabular form popup help get the help text from the other form. I looked at the code from the other form and it was doing this for the field:
    javascript:popupFieldHelp('25020711860698767','439667227918056')
    So I went into the Report attributes section of my tabular form and entered this:
    <a href = "javascript:popupFieldHelp('25020711860698767','439667227918056')"> Security Type </a>
    It seems to work perfectly, but I just want to make sure this is the best way to do this. Are the arguments sent to popupFieldHelp unique for every item in an application?

    Sorry. Had to change the href so you could see what I typed:
    <-a href = "javascript:popupFieldHelp('25020711860698767','439667227918056')">Security Type<-/a>

  • "Sort Album" field

    Does the iPod classic use the sort album field so it will display albums in non alpha order like iTunes can, the 5.5G ipod ignores them, hoping the classic will not
    Flubster

    The short answer is no, not really. The much longer answer is contained in the thread below at iLounge. You should pay particular attention to posts by brendan99.
    iPod Classic - What's up with compilations?
    http://forums.ilounge.com/showthread.php?t=204937

  • Hot key(Ctrl+F1) for More field help not working

    Hi all,
    I am facing a strange problem. When I have run my WD application there will be some UI elements on the browser say one Input field. If I want to check the More information about this input field, I have to make a right mouse click on it and the More field help appears. By this I am getting the technical information about the UI element.
    The Hot key to do this is Ctrl+F1. It's not working with in my server, it's just open the Internet explorer Help. Although I am able to use this Hot key in an other server to find the More field help.
    Can anyone suggest me why I am not able to get the More field info from the Hot key Ctrl+F1 in my server. Is there any setting which needs to be made in my server.
    I have also tried out to check the HandleHotKeys property of the ROOTUIELEMENTCONTAINER in my view but it's not working for me as well.
    Please suggest what will be the reason.
    Thanks
    Sanket sethi.

    Your right, I was thinking the opposite - that it wasn't working in 7.0.
    Perhaps this change is becuase F1 now launches the Help Center as of 7.01 and higher.
    I'm not sure there is a hot key associated with the more field help any longer.  I checked the javaScript and F1 is tied to the "help" event (the help center).  Alt, Shift or Ctrl - F1 are all routed back to the browser help functionality (bHelp). See this screenshot:
    http://farm2.static.flickr.com/1382/4606421952_5824ee1507_o.png

  • Right Click- More Field Help- Technical Help = No help available

    Hi,
    I want to right click on a WDA, click on More Field Help then click on technical help to see what the underlying WD components, views etc.... are. But when I right clcik and then click More Field Help all I get is No Help Available. I have not touch the application parameter WDHIDEMOREFIELDHELPASDEFAULT. Nor do I see it on the parameters tab. So there must be something somewhere that is turing it off. Even stranger is there are to WDA's for this component. One works and one doesn't. Wonder if it is getting set on fly in the code.
    Anyone seen this kind of behavior and could shed some light?
    Thanks!

    Hi  Jennifer ,
    To get the more field help you need to have SAP_ALL profile  to your user id  .
    there is no separate setting or config .
    Thanks & Regards
    Pradeep Kumar Dondeti

  • Sort String Field Mandatory in Production Order Components Screen

    Hi Gurus,
    Am currently working on ECC 6.0 environment.
    When I try to assign a batch to the components of the production order, the 'Sort String' is a mandatory field.
    Can you please suggest from where is this mandatory field is picked? Is it possible to populate the field automatically? Or how to make the 'Sort String' field not mandatory?
    In order type parameters (OPL8), standard parameters for display profiles are maintained.
    Have also tried to maintain user parameters like F1F, S3F and S5F without success.
    Your guidance please.
    Thanks in advance.
    The above mentioned problem does not occur if I try to create production order without reference of planned order using T Code CO01. This problem occurs only when I am converting planned order to production order.
    Note that have tried maintaining sort string in the BoM. The sort string gets picked up when am creating manual production orders. Not copied when converting planned orders to production orders.
    Tarang
    Edited by: Tarang Machhar on Sep 28, 2010 7:23 PM
    Edited by: Tarang Machhar on Sep 28, 2010 7:28 PM

    Hi Tarang,
    I think there is a transaction/screen variant maintained for that. Ask your ABAP team member to debug and check if there is any coding done to make it mandatory. There is no customizing for this one. There must be some code written to make it mandatory.
    But you are correct, if you maintain the sort string in BOM, it gets copied on to the planned order, the reservation and the production order as well.
    Regards,
    Pradeep.

  • To hide some headings in top of page during sorting of fields...

    dear experts,
    I have a report in which i am fetching multiple company codes in report and in o/p they are displayed according to company codes, but during sorting of any field in list i want to hide some of the headings in top of page...for any of the radio buttons the headings which i want to hide are...
    1) company code
    2) opening balance and
    3) closing balance
    please help...my code is as follows...
    TYPE-POOLS:slis.
    TABLES:bkpf,bseg,kna1,bsid.
    TYPES:BEGIN OF ty_bsad,
    bukrs TYPE bsad-bukrs,
    gjahr TYPE bsad-gjahr,
    kunnr TYPE bsad-kunnr,
    belnr TYPE bsad-belnr,
    budat TYPE bsad-budat,
    xblnr TYPE bsad-xblnr,
    bldat TYPE bsad-bldat,
    augdt TYPE bsad-augdt,
    dmbtr type bsad-dmbtr,
    END OF ty_bsad.
    TYPES:BEGIN OF ty_kna1,
    kunnr TYPE kna1-kunnr,
    name1 TYPE kna1-name1,
    city  TYPE kna1-ort01,
    END OF ty_kna1.
    TYPES:BEGIN OF ty_knb1,
    kunnr TYPE knb1-kunnr,
    bukrs TYPE knb1-bukrs,
    vzskz TYPE knb1-vzskz,
    END OF ty_knb1.
    TYPES:BEGIN OF ty_bkpf,
    bukrs TYPE bkpf-bukrs,
    gjahr TYPE bkpf-gjahr,
    hwaer TYPE bkpf-hwaer,
    kursf TYPE bkpf-kursf,
    bktxt TYPE bkpf-bktxt,
    belnr TYPE bkpf-belnr,
    budat TYPE bkpf-budat,
    xblnr TYPE bkpf-xblnr,
    bldat TYPE bkpf-bldat,
    waers TYPE bkpf-waers,
    END OF ty_bkpf.
    TYPES:BEGIN OF ty_bsid,
    bukrs TYPE bsid-bukrs,
    gjahr TYPE bsid-gjahr,
    kunnr TYPE bsid-kunnr,
    belnr TYPE bsid-belnr,
    budat TYPE bsid-budat,
    xblnr TYPE bsid-xblnr,
    bldat TYPE bsid-bldat,
    augdt TYPE bsid-augdt,
    dmbtr type bsid-dmbtr,
    END OF ty_bsid.
    TYPES:BEGIN OF ty_bseg,
    bukrs TYPE bseg-bukrs,
    gjahr TYPE bseg-gjahr,
    belnr TYPE bseg-belnr,
    kunnr TYPE bseg-kunnr,
    werks TYPE bseg-werks,
    umskz TYPE bseg-umskz,
    zuonr TYPE bseg-zuonr,
    dmbtr TYPE bseg-dmbtr,
    zbd1t TYPE bseg-zbd1t,
    sgtxt TYPE bseg-sgtxt,
    shkzg TYPE bseg-shkzg,
    zterm TYPE bseg-zterm,
    zfbdt TYPE bseg-zfbdt,
    END OF ty_bseg.
    TYPES:BEGIN OF ty_open,
    bukrs TYPE bsid-bukrs,
    shkzg TYPE bsid-shkzg,
    dmbtr TYPE bsid-dmbtr,
    umskz TYPE bsid-umskz,
    END OF ty_open.
    **Main internal Table
    **For both open & cleared Customer
    DATA:BEGIN OF it_main_all OCCURS 0,
    bukrs TYPE bsad-bukrs,
    gjahr TYPE bsad-gjahr,
    kunnr TYPE bsad-kunnr,
    belnr TYPE bsad-belnr,
    budat TYPE bsad-budat,
    xblnr TYPE bsad-xblnr,
    bldat TYPE bsad-bldat,
    augdt TYPE bsad-augdt,
    dmbtr type bsad-dmbtr,
    hwaer TYPE bkpf-hwaer,
    kursf TYPE bkpf-kursf,
    bktxt TYPE bkpf-bktxt,
    name TYPE kna1-name1,
    city TYPE kna1-ort01,
    vzskz TYPE knb1-vzskz,
    lights TYPE c,
    END OF it_main_all.
    **For Opening balance
    DATA:BEGIN OF it_main_open1 OCCURS 0,
    bukrs TYPE bsid-bukrs,
    opening TYPE p DECIMALS 2,
    END OF it_main_open1.
    **Internal tables
    DATA : t_bsad TYPE STANDARD TABLE OF ty_bsad,
    w_bsad TYPE ty_bsad,
    t_bkpf TYPE STANDARD TABLE OF ty_bkpf,
    w_bkpf TYPE ty_bkpf,
    t_kna1 TYPE STANDARD TABLE OF ty_kna1,
    w_kna1 TYPE ty_kna1,
    t_knb1 TYPE STANDARD TABLE OF ty_knb1,
    w_knb1 TYPE ty_knb1,
    t_bsid TYPE STANDARD TABLE OF ty_bsid,
    w_bsid TYPE ty_bsid,
    t_bseg TYPE STANDARD TABLE OF ty_bseg,
    w_bseg TYPE ty_bseg,
    t_open TYPE STANDARD TABLE OF ty_open,
    w_open TYPE ty_open.
    **ALV display variables
    DATA:fieldcatalog TYPE slis_t_fieldcat_alv WITH HEADER LINE,
    gd_layout TYPE slis_layout_alv,
    gt_events TYPE slis_t_event,
    gt_list_top_of_page TYPE slis_t_listheader,
    heading TYPE slis_t_listheader,
    g_save(1) TYPE c,
    g_exit(1) TYPE c,
    g_variant TYPE disvariant,
    gx_variant TYPE disvariant,
    it_sort TYPE slis_t_sortinfo_alv,
    x_sort TYPE slis_sortinfo_alv.
    **Selection Screens
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS:s_bukrs FOR bkpf-bukrs OBLIGATORY,
    s_gjahr FOR bkpf-gjahr OBLIGATORY NO-EXTENSION NO INTERVALS,
    s_kunnr FOR bseg-kunnr OBLIGATORY NO-EXTENSION NO INTERVALS,
    s_name1 FOR kna1-name1 NO-EXTENSION NO INTERVALS,
    s_date FOR bkpf-budat OBLIGATORY,
    s_umskz FOR bsid-umskz.
    SELECTION-SCREEN END OF BLOCK b1.
    SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-003.
    PARAMETERS:xnorm AS CHECKBOX DEFAULT 'X',
    xshbv AS CHECKBOX.
    SELECTION-SCREEN END OF BLOCK b3.
    DATA:golive TYPE d VALUE '20080401',
    date TYPE d,
    date1 TYPE d,
    closing TYPE p DECIMALS 2 VALUE 0,
    opening TYPE p DECIMALS 2 VALUE 0.
    **Start Of Selection
    START-OF-SELECTION.
    PERFORM get_data.
    PERFORM events.
    PERFORM f_layout.
    PERFORM display.
    FORM get_data .
    **Open Customers master data
    SELECT
    bukrs gjahr kunnr belnr budat xblnr bldat augdt dmbtr
    FROM bsid
    INTO TABLE t_bsid
    WHERE bukrs IN s_bukrs
    AND gjahr IN s_gjahr
    AND kunnr IN s_kunnr
    AND budat IN s_date
    AND umskz IN s_umskz.
    **Clear Customers master data
    SELECT
    bukrs gjahr kunnr belnr budat xblnr bldat augdt dmbtr
    FROM bsad
    INTO TABLE t_bsad
    WHERE bukrs IN s_bukrs
    AND gjahr IN s_gjahr
    AND kunnr IN s_kunnr
    AND budat IN s_date
    AND umskz IN s_umskz.
    ****Open Customers data
    IF NOT t_bsid[] IS INITIAL.
    SORT t_bsid BY bukrs bldat.
    SELECT
    bukrs gjahr hwaer kursf bktxt belnr
    FROM bkpf
    INTO CORRESPONDING FIELDS OF TABLE t_bkpf
    FOR ALL ENTRIES IN t_bsid
    WHERE bukrs = t_bsid-bukrs
    AND gjahr = t_bsid-gjahr
    AND belnr = t_bsid-belnr.
    SORT t_bkpf.
    SELECT
    kunnr name1 ort01
    FROM kna1
    INTO TABLE t_kna1
    FOR ALL ENTRIES IN t_bsid
    WHERE kunnr = t_bsid-kunnr
    AND name1 IN s_name1.
    SORT t_kna1.
    SELECT
    kunnr bukrs vzskz
    FROM knb1
    INTO TABLE t_knb1
    FOR ALL ENTRIES IN t_bsid
    WHERE kunnr = t_bsid-kunnr
    AND bukrs = t_bsid-bukrs.
    SORT t_knb1.
    LOOP AT t_bsid INTO w_bsid.
    it_main_all-bukrs = w_bsid-bukrs.
    it_main_all-kunnr = w_bsid-kunnr.
    it_main_all-gjahr = w_bsid-gjahr.
    it_main_all-belnr = w_bsid-belnr.
    it_main_all-budat = w_bsid-budat.
    it_main_all-xblnr = w_bsid-xblnr.
    it_main_all-bldat = w_bsid-bldat.
    READ TABLE t_bkpf INTO w_bkpf WITH KEY bukrs = w_bsid-bukrs gjahr = w_bsid-gjahr belnr = w_bsid-belnr BINARY SEARCH.
    IF sy-subrc EQ 0.
    it_main_all-hwaer = w_bkpf-hwaer.
    it_main_all-kursf = w_bkpf-kursf.
    it_main_all-bktxt = w_bkpf-bktxt.
    ENDIF.
    READ TABLE t_kna1 INTO w_kna1 WITH KEY kunnr = w_bsid-kunnr BINARY SEARCH.
    IF sy-subrc EQ 0.
    it_main_all-name = w_kna1-name1.
    it_main_all-city = w_kna1-city.
    ENDIF.
    READ TABLE t_knb1 INTO w_knb1 WITH KEY kunnr = w_bsid-kunnr BINARY SEARCH.
    IF sy-subrc EQ 0.
    it_main_all-vzskz = w_knb1-vzskz.
    ENDIF.
    it_main_all-lights = '1'.
    APPEND it_main_all.
    CLEAR it_main_all.
    CLEAR : w_bsid, w_bkpf, w_kna1, w_knb1.
    ENDLOOP .
    ENDIF.
    **Clear customers data
    IF NOT t_bsad[] IS INITIAL.
    SORT t_bsad BY bukrs bldat.
    SELECT
    bukrs gjahr hwaer kursf bktxt belnr
    FROM bkpf
    INTO CORRESPONDING FIELDS OF TABLE t_bkpf
    FOR ALL ENTRIES IN t_bsad
    WHERE bukrs = t_bsad-bukrs
    AND gjahr = t_bsad-gjahr
    AND belnr = t_bsad-belnr.
    SORT t_bkpf.
    SELECT
    kunnr name1 ort01
    FROM kna1
    INTO TABLE t_kna1
    FOR ALL ENTRIES IN t_bsad
    WHERE kunnr = t_bsad-kunnr
    AND name1 IN s_name1.
    SORT t_kna1.
    SELECT
    kunnr bukrs vzskz
    FROM knb1
    INTO TABLE t_knb1
    FOR ALL ENTRIES IN t_bsad
    WHERE kunnr = t_bsad-kunnr
    AND bukrs = t_bsad-bukrs.
    SORT t_knb1.
    LOOP AT t_bsad INTO w_bsad.
    it_main_all-bukrs = w_bsad-bukrs.
    it_main_all-gjahr = w_bsad-gjahr.
    it_main_all-kunnr = w_bsad-kunnr.
    it_main_all-belnr = w_bsad-belnr.
    it_main_all-budat = w_bsad-budat.
    it_main_all-xblnr = w_bsad-xblnr.
    it_main_all-bldat = w_bsad-bldat.
    READ TABLE t_bkpf INTO w_bkpf WITH KEY bukrs = w_bsad-bukrs gjahr = w_bsad-gjahr belnr = w_bsad-belnr BINARY SEARCH.
    IF sy-subrc EQ 0.
    it_main_all-hwaer = w_bkpf-hwaer.
    it_main_all-kursf = w_bkpf-kursf.
    it_main_all-bktxt = w_bkpf-bktxt.
    ENDIF.
    READ TABLE t_kna1 INTO w_kna1 WITH KEY kunnr = w_bsad-kunnr BINARY SEARCH.
    IF sy-subrc EQ 0.
    it_main_all-name = w_kna1-name1.
    it_main_all-city = w_kna1-city.
    ENDIF.
    READ TABLE t_knb1 INTO w_knb1 WITH KEY kunnr = w_bsad-kunnr BINARY SEARCH.
    IF sy-subrc EQ 0.
    it_main_all-vzskz = w_knb1-vzskz.
    ENDIF.
    it_main_all-lights = '3'.
    APPEND it_main_all.
    CLEAR : w_bsad, w_bkpf, w_kna1, w_knb1.
    ENDLOOP .
    ENDIF.
    ENDFORM.                    " get_data
    *&      Form  events
    FORM events .
    DATA : l_i_event TYPE slis_alv_event.
    l_i_event-name = 'TOP_OF_PAGE' .
    l_i_event-form = 'TOP2' .
    APPEND l_i_event TO gt_events .
    CLEAR l_i_event .
    ENDFORM.                    " events
    *&      Form  f_layout
    FORM f_layout .
    CLEAR gd_layout.
    gd_layout-detail_popup = 'X'.
    gd_layout-zebra = 'X'.
    gd_layout-no_vline = ' '.
    gd_layout-lights_fieldname = 'LIGHTS'.
    gd_layout-colwidth_optimize = 'X'.
    ENDFORM.                    " f_layout
    *&      Form  display
    FORM display .
    fieldcatalog-fieldname = 'BUKRS'.
    fieldcatalog-tabname = 'IT_MAIN_ALL'.
    fieldcatalog-seltext_m = 'Company Code'.
    APPEND fieldcatalog TO fieldcatalog.
    CLEAR fieldcatalog.
    fieldcatalog-fieldname = 'GJAHR'.
    fieldcatalog-tabname = 'IT_MAIN_ALL'.
    fieldcatalog-seltext_m = 'Fiscal year'.
    APPEND fieldcatalog TO fieldcatalog.
    CLEAR fieldcatalog.
    fieldcatalog-fieldname = 'BELNR'.
    fieldcatalog-tabname = 'IT_MAIN_ALL'.
    fieldcatalog-seltext_m = 'Doc No.'.
    APPEND fieldcatalog TO fieldcatalog.
    CLEAR fieldcatalog.
    fieldcatalog-fieldname = 'BLDAT'.
    fieldcatalog-tabname = 'IT_MAIN_ALL'.
    fieldcatalog-seltext_m = 'Doc Date'.
    APPEND fieldcatalog TO fieldcatalog.
    CLEAR fieldcatalog.
    fieldcatalog-fieldname = 'BUDAT'.
    fieldcatalog-tabname = 'IT_MAIN_ALL'.
    fieldcatalog-seltext_m = 'Posting date'.
    APPEND fieldcatalog TO fieldcatalog.
    CLEAR fieldcatalog.
    fieldcatalog-fieldname = 'DMBTR'.
    fieldcatalog-tabname = 'IT_MAIN_ALL'.
    fieldcatalog-seltext_m = 'Amt in local cur.'.
    fieldcatalog-do_sum = 'X'.
    fieldcatalog-just = 'R'.
    APPEND fieldcatalog TO fieldcatalog.
    CLEAR fieldcatalog.
    **For Subtotal of fields
    x_sort-fieldname = 'BUKRS' .
    x_sort-group     = '*'.
    x_sort-subtot    = 'X'.
    APPEND x_sort TO it_sort.
    CLEAR x_sort .
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
    i_callback_program      = sy-repid
    is_layout               = gd_layout
    it_fieldcat             = fieldcatalog[]
    it_sort                 = it_sort
    i_default               = 'X'
    it_events               = gt_events[]
    TABLES
    t_outtab                = it_main_all
    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.
    *&      Form  top_of_page
    FORM top_of_page.
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
    i_logo             = 'RUCHI_LOGO'
    it_list_commentary = heading[].
    ENDFORM.
    *&      Form  opening
    FORM opening USING p_bukrs TYPE bsid-bukrs.
    DATA : opdate TYPE d.
    IF s_date-low < golive.
    opening = 0.
    ELSE.
    opdate = s_date-low - 1.
    SELECT
    bukrs shkzg dmbtr umskz
    FROM bsid
    INTO TABLE t_open
    WHERE bukrs IN s_bukrs
    AND kunnr IN s_kunnr
    AND gjahr IN s_gjahr
    AND budat <= opdate.
    LOOP AT t_open INTO w_open.
    IF w_open-shkzg = 'S'.
    opening = opening + w_open-dmbtr.
    ELSEIF w_open-shkzg = 'H'.
    w_open-dmbtr = w_open-dmbtr * ( -1 ).
    opening = opening + w_open-dmbtr .
    ENDIF.
    CLEAR : w_open.
    ENDLOOP.
    SELECT
    bukrs shkzg dmbtr umskz
    FROM bsad
    INTO TABLE t_open
    WHERE bukrs IN s_bukrs
    AND kunnr IN s_kunnr
    AND gjahr IN s_gjahr
    AND budat <= opdate.
    LOOP AT t_open INTO w_open.
    IF w_open-shkzg = 'S'.
    opening = opening + w_open-dmbtr.
    ELSEIF w_open-shkzg = 'H'.
    w_open-dmbtr = w_open-dmbtr * ( -1 ).
    opening = opening + w_open-dmbtr.
    ENDIF.
    CLEAR w_open.
    ENDLOOP.
    ENDIF.
    ENDFORM.
    *&      Form  top2
    FORM top2 .
    date  = s_date-low.
    date1 = s_date-high.
    WRITE : / 'CUSTOMER LEDGER FOR ALL ITEMS' COLOR 7.
    WRITE : / 'Customer Code:', it_main_all-kunnr.
    WRITE : / 'Customer Name:', it_main_all-name.
    WRITE : / 'Customer City:', it_main_all-city.
    ON CHANGE OF it_main_all-bukrs.
    WRITE : / 'Company Code:' COLOR 3 , it_main_all-bukrs COLOR 3.
    PERFORM opening USING it_main_all-bukrs.
    PERFORM closing USING it_main_all-bukrs.
    WRITE : / 'Opening Balance : Rs.' , opening .
    WRITE : / 'Closing Balance : Rs.' , closing .
    ENDON.
    CLEAR : closing, opening.
    IF date1 IS INITIAL.
    WRITE : / 'Date:', date DD/MM/YYYY.
    ELSE.
    WRITE : / 'Date:' , date DD/MM/YYYY, ' to ', date1 DD/MM/YYYY.
    ENDIF.
    ENDFORM.
    *&Form  closing
    FORM closing USING c_bukrs TYPE bsid-bukrs.
    LOOP AT it_main_all WHERE bukrs = c_bukrs.
    closing = closing + it_main_all-dmbtr.
    ENDLOOP .
    closing = closing + opening .
    ENDFORM.
    Edited by: Vishu on Apr 20, 2009 9:32 AM

    it can be done with the help of a system code 'sy-xcode'. it is initialised the time list is sorted so just keeping a check point, we can solve this problem.
    Vishu Khandelwal

  • Reg the Sort Key field in Vendor Master Record

    Hi MM Gurus,
    I have the requirement of displaying the Purchase Order number & Line Item number in the Accounting document of the Goods Receipt. i.e., in the "Assignment" field.
    I have made the necessary configuration in FS00 for the specific GL account & also specified 014 code in the corresponding Vendor master record.
    However, once I post the GR document, and checked the "Assignment" field, it displays only the Purchase Order number and not the Line item number.
    Kindly help me on this.
    Best Regards
    Sudhi

    Have you posted the above document after set 014 in FS00 ?
    Can you test the same in your practice client.
    Check the document for more details Sort Key Functionalities and the wiki content How to update Assignment field in FBL*N report - ERP Financials - SCN Wiki
    (Note: The changes of FS00 as 014 will not effect old documents)

  • Sorting a field in mapping based on another

    Hi,
    I have a strucutre like the following...
    SOURCE
    <node>
        <aa>B_test</aa>
        <bb>iu</bb>
        <cc></cc>
    </node>
    <node>
        <aa>A_test2</aa>
        <bb>NO</bb>
        <cc>resource</cc>
    </node>
    <node>
        <aa>C_test3</aa>
        <bb>No</bb>
        <cc>resource</cc>
    </node>
    after mapping, my message is like this......
    TARGET
    <node>
        <aa>A_test2</aa>
        <bb>NO</bb>
      *bold*   <cc>NIMOY</cc>
    </node>
    <node>
        <aa>B_test</aa>
        <bb>iu</bb>
        *bold* <cc>resource</cc>
    </node>
    <node>
        <aa>C_test3</aa>
        <bb>No</bb>
        <cc>resource</cc>
    </node>
    but it should be like this
    <node>
        <aa>A_test2</aa>
        <bb>NO</bb>
    *bold*     <cc>resource</cc>
    </node>
    <node>
        <aa>B_test</aa>
        <bb>iu</bb>
    *bold*     <cc>NIMOY</cc>
    </node>
    <node>
        <aa>C_test3</aa>
        <bb>No</bb>
        <cc>resource</cc>
    </node>
    I have to check <bb> for the value "iu". This is no problem. If it contains "iu" then map the constant NIMOY to <cc>. Then sort the <node> element in ascending order based on <aa>. The problem is that I cannot get <cc> to sort. It just stays in the same order. I've been trying to use combinations of SortByKey and FormatByExample.  The fields <aa> and <bb> will sort but not <cc>.Any ideas??

    Damien,
    I hope the below logic helps, if not reply back.
    Mapping
    http://www.flickr.com/photos/8764045@N06/2267740258/sizes/o/
    http://www.flickr.com/photos/8764045@N06/2267740260/sizes/o/
    http://www.flickr.com/photos/8764045@N06/2267740262/sizes/o/
    http://www.flickr.com/photos/8764045@N06/2267740266/sizes/o/
    Results
    http://www.flickr.com/photos/8764045@N06/2267740270/sizes/o/
    raj.

  • How to sort the fields in ABAP query.

    Hi all
    I am not able to drag the fields in Sort tool box.
    Please help me how to add the fields in Sort tool bar.
    Regards
    Gangi

    In SQ01, when we are creating a query, we can define the default sort sequence & Totals also.
    This can be done when defining the basic list.

Maybe you are looking for

  • Can't connect to password protected wifi with the correct password.

    So, here's the deal. I have a program on my Mac called Self Control. It's a program that allows you to block all access to either the entire internet or a select amount of websites that you choose from, for a specific time. I had it going today, and

  • Remote VPN logIn using Mac

    I was looking for a software package for my MacBook Pro capable of remotely logging into a Windows XP system (place of work)to check email and access to server directories while traveling. I'm the one step child (artist) in the org with a Mac and the

  • Help! My time machine backed up to an older date from 6 months ago

    So i was backing up all my photos using time machine to a LACIE external hard drive and under Time Machine Preferences i clicked back up and it seemed to revert back to an older backup in May 2010 losing all photos and changes from May - Oct 2010. Ca

  • File transfer settings not working

    Hello,   I am trying to figure out why I am not able to transfer certain files even after allowing them via the management shell and/or the Lync admin console. I keep getting the error that "We can't transfer this type of file because it can contain

  • CUP 5.3 Password-Self-Service SP9

    Hello all, since CUP 5.3 SP09, the Password-Self-Service has complety changed. You need to Login to the System before you can reset the password. The Authentication System is linked to the UME, which is connected to an SAP-System where all approvers