How to get Max and Min in one line .

Hi Guys
I know the program which I did is stupid .. I am getting the result for max and min value?
But I how can I get the value of km, h, lit in one line
Equno..max_date,min_date,min_value_km..max_value_km....min_value_h...max_value_h...min_value_l...max_value_l
with my program i am getting the vlaue of max and min value but not in one line.
the main parameter is recdu which is KM,L,H
Can anyone tell me the logic please
REPORT ZFUEL LINE-SIZE 200 LINE-COUNT 75
NO STANDARD PAGE HEADING.
TABLES : equi,
equz,
imptt,
imrg,
eqkt,
iloa.
Type Declaration
TYPES: BEGIN OF ty_data ,
equnr type equnr, " Euipment no
eqktx type eqkt-eqktx, " Equipment Text
eqfnr type iloa-eqfnr, " Equipment Sort field
idate type imrg-idate, " Measuring Date
recdu type imrg-recdu, " Unit of measuring ='KM','L','H'
recdv type imrg-recdv, " Counter reading data
END OF ty_data.
TYPES: BEGIN OF ty_final,
equnr type equnr, " Equipment no
eqktx type eqkt-eqktx, " Equipment Text
eqfnr type iloa-eqfnr, " Equipment Sort field
min_date type imrg-idate, " Min Date
min_km type p decimals 2, " Max Km
max_km type p decimals 2, " Min km
t_max_min_km type i, " Total min_km-max_km
max_date type imrg-idate, " Max Date
min_hr type imrg-recdv, " Max hr
max_hr type imrg-recdv, " Min hr
t_max_min_hr type i, " Total min_hr-max_hr
min_lit type imrg-recdv, " Max lit
max_lit type imrg-recdv, " Min lit
t_max_min_lit type i, " Total min_lit-max_lit
fuel_con type p decimals 2, " Total_hrs / t_max_min_hr
km_l type p decimals 2, " km / L
lit_per_hr type i , " fuel comsumed / t_max_min_hr
END OF ty_final.
DATA: i_data TYPE TABLE OF ty_data, " internal table
wa_data TYPE ty_data, " work area
i_final TYPE TABLE OF ty_final, " internal table
wa_final TYPE ty_final. " work area
data: begin of itab occurs 0,
num type i,
end of itab.
data: v_min_1 type i,
v_max_1 type i,
min_km like imrg-recdv,
max_km like imrg-recdv,
min_l like imrg-recdv,
max_l like imrg-recdv,
max_dt like imrg-idate,
min_dt like imrg-idate,
t_ma_mi type p decimals 2,
V1 LIKE IMRG-RECDV ,
V2 LIKE IMRG-RECDV .
SELECTION-SCREEN BEGIN OF BLOCK blk WITH FRAME.
SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
SELECT-OPTIONS: p_equnr FOR equi-equnr ,"no-extension no intervals,
p_idate FOR imrg-idate. "NO-EXTENSION NO INTERVALS OBLIGATORY,
"p_recdu FOR imrg-recdu NO-EXTENSION NO INTERVALS default 'KM' OBLIGATORY.
SELECTION-SCREEN END OF BLOCK blk1.
SELECTION-SCREEN BEGIN OF BLOCK blk2 WITH FRAME TITLE text-002.
SELECTION-SCREEN END OF BLOCK blk2.
SELECTION-SCREEN END OF BLOCK blk.
TOP-OF-PAGE.
FORMAT INTENSIFIED ON.
WRITE:/1(40) ' INVESTMENT LIMITED '.
WRITE:/50(40) ' FUEL CONSUMPTION REPORT ' CENTERED ,
2 'Page', sy-pagno.
FORMAT INTENSIFIED OFF.
WRITE:/50(40) '----
' CENTERED .
FORMAT INTENSIFIED ON.
WRITE:/2 sy-datum COLOR 3, sy-uzeit .
"WRITE:/1 S903-SPMON ."p_yearf.
ULINE.
"CENTERED.
write: /2 'Date From :'.
write: /2 'Equipment No :'.
write: /2 'Unit :'.
SKIP.
ULINE.
WRITE:/1 sy-vline,
2 'EQUIP NO', 10 sy-vline,
11 'NAME', 40 sy-vline,
41 'min date', 50 sy-vline,
51 'max date', 60 sy-vline,
61 'min km', 70 sy-vline,
71 'max km' , 80 sy-vline,
81 't_max_min_km', 90 sy-vline,
91 'min hr', 100 sy-vline,
101 'max hr', 110 sy-vline,
111 't_max_min_hr' , 120 sy-vline,
121 'min lit', 130 sy-vline,
131 'max lit', 140 sy-vline,
141 't_max_min_lit', 150 sy-vline,
151 'fuel con', 160 sy-vline,
161 'km_l', 170 sy-vline,
171 'lit_per_hr', 180 sy-vline.
FORMAT COLOR 3 ON.
ULINE.
END-OF-PAGE.
START-OF-SELECTION.
select aequnr deqktx feqfnr eidate erecdu erecdv
into table i_data
from equi AS a
inner join equz as b
on aequnr = bequnr
inner join iloa as f
on biloan = filoan
inner join imptt as c
on aobjnr = cmpobj
inner join eqkt as d
on aequnr = dequnr
inner join imrg as e
on epoint = cpoint
where a~equnr in p_equnr
and
e~idate in p_idate
and
e~recdu = 'KM'.
        SORT i_data BY equnr idate descending .
        loop at i_data into wa_data.
        max_km = wa_data-recdv.
        min_km = wa_data-recdv.
    at new equnr.
        read table i_data into wa_data index sy-tabix.
        write:/ wa_data-equnr, wa_data-eqktx ,wa_data-eqfnr ,wa_data-idate ,'MAX KM',max_km EXPONENT 0 DECIMALS 2 color 7,wa_data-recdu .
    endat.
at end of equnr.
        read table i_data into wa_data index sy-tabix.
        write:/ wa_data-equnr, wa_data-eqktx ,wa_data-eqfnr ,wa_data-idate ,'MIN KM', min_km EXPONENT 0 DECIMALS 2 color 7, wa_data-recdu .
endat.
at end of equnr.
write: / '----
write: /50(80) 'Subtotal' COLOR 4 .
write:/ '----
endat.
endloop.
select aequnr deqktx feqfnr eidate erecdu erecdv
into table i_data
from equi AS a
inner join equz as b
on aequnr = bequnr
inner join iloa as f
on biloan = filoan
inner join imptt as c
on aobjnr = cmpobj
inner join eqkt as d
on aequnr = dequnr
inner join imrg as e
on epoint = cpoint
where a~equnr in p_equnr
and
e~idate in p_idate
and
e~recdu = 'L'.
        SORT i_data BY equnr idate descending .
        loop at i_data into wa_data.
        max_km = wa_data-recdv.
        min_km = wa_data-recdv.
    at new equnr.
        read table i_data into wa_data index sy-tabix.
        write:/ wa_data-equnr, wa_data-eqktx ,wa_data-eqfnr ,wa_data-idate ,'MAX LIT',max_km EXPONENT 0 DECIMALS 2 color 7,wa_data-recdu .
    endat.
at end of equnr.
        read table i_data into wa_data index sy-tabix.
        write:/ wa_data-equnr, wa_data-eqktx ,wa_data-eqfnr ,wa_data-idate ,'MIN LIT', min_km EXPONENT 0 DECIMALS 2 color 7, wa_data-recdu .
endat.
at end of equnr.
write: / '----
write: /50(80) 'Subtotal' COLOR 4 .
write:/ '----
endat.ENDLOOP.
select aequnr deqktx feqfnr eidate erecdu erecdv
into table i_data
from equi AS a
inner join equz as b
on aequnr = bequnr
inner join iloa as f
on biloan = filoan
inner join imptt as c
on aobjnr = cmpobj
inner join eqkt as d
on aequnr = dequnr
inner join imrg as e
on epoint = cpoint
where a~equnr in p_equnr
and
e~idate in p_idate
and
e~recdu = 'H'.
        SORT i_data BY equnr idate descending .
        loop at i_data into wa_data.
        max_km = wa_data-recdv.
        min_km = wa_data-recdv.
    at new equnr.
        read table i_data into wa_data index sy-tabix.
        write:/ wa_data-equnr, wa_data-eqktx ,wa_data-eqfnr ,wa_data-idate ,'MAX H',max_km EXPONENT 0 DECIMALS 2 color 7,wa_data-recdu .
    endat.
at end of equnr.
        read table i_data into wa_data index sy-tabix.
        write:/ wa_data-equnr, wa_data-eqktx ,wa_data-eqfnr ,wa_data-idate ,'MIN H', min_h EXPONENT 0 DECIMALS 2 color 7, wa_data-recdu .
endat.
at end of equnr.
write: / '----
write: /50(80) 'Subtotal' COLOR 4 .
write:/ '----
endat.
endloop.

Hi Guys
How can I split the max and min value with if condition for KM L AND H as below
I am getting the km value correctly but rest fields for L and H (lit and hours) it is not ?
Please comment.
*APPEND wa_data to i_data.
        SORT i_data BY equnr idate descending .
        loop at i_data into wa_data.
        if wa_data-recdu = 'KM'.
        max_km = wa_data-recdv.
        min_km = wa_data-recdv.
        endif.
        if wa_data-recdu ='H'.
        max_h = wa_data-recdv.
        min_h = wa_data-recdv.
        endif.
        if wa_data-recdu ='L'.
        max_l = wa_data-recdv.
        min_l = wa_data-recdv.
       endif.
    at new equnr.
        read table i_data into wa_data index sy-tabix.
        write:/ wa_data-equnr, wa_data-eqktx ,wa_data-eqfnr ,wa_data-idate ,
        'Min KM',min_km EXPONENT 0 DECIMALS 2 color 7 ,
         'Min H',min_h EXPONENT 0 DECIMALS 2 color 7 ,
          'Min L',min_l EXPONENT 0 DECIMALS 2 color 7.
    endat.
at end of equnr.
        read table i_data into wa_data index sy-tabix.
        write:/ wa_data-equnr, wa_data-eqktx ,wa_data-eqfnr ,wa_data-idate ,
        'Max KM', max_km EXPONENT 0 DECIMALS 2 color 7,
        'Max H', max_h EXPONENT 0 DECIMALS 2 color 7,
        'Max L', max_l EXPONENT 0 DECIMALS 2 color 7.
endat.
regards
Piroz

Similar Messages

  • How to get max and min salary in a table

    How to get max and min salary in a table

    SQL> select max(sal),min(sal) from emp;
      MAX(SAL)   MIN(SAL)
          5512        800
    SQL>

  • How to get max and min of a varchar2

    there is a column clothes_size in table_1 where i need to get the max and min..how can i get the actual max and min if its datatype is varchar2(50) and not number..how can i do this so that once i have 2 or more clothes_size values returned i will only get the smallest or the largest. i assigned number values on each field and whats next??? any suggestion?
    clothes_size
    XS                1
    S                2
    M                3
    L                4
    XL                5
    XXL                6

    Examples of this approach:
    select min(cloth_size_2) min_size
         , max(cloth_size_2) max_size
      from (select case when cloth_size = 'XS' then 1
                        when cloth_size = 'S' then 2
                        when cloth_size = 'M' then 3
                        when cloth_size = 'L' then 4
                        when cloth_size = 'XL' then 5
                        when cloth_size = 'XXL' then 6
                   end as cloth_size_2
              from your_table);
    <br>
    select min(cloth_size_2) min_size
         , max(cloth_size_2) max_size
      from (select decode(cloth_size
                         , 'XS', 1
                         , 'S', 2
                         , 'M', 3
                         , 'L', 4
                         , 'XL', 5
                         , 'XXL', 6) cloth_size_2
              from your_table);

  • How to get Max and Min value entered in a DOS console?

    Hi there? I wanted to get the Maximum and Minimum value that I entered in a console and displays it. This is using the java.lang.Math class and using it's method max and main. please help. thanks - new to java

    Sounds like you need very basic advice: Start with the tutorials: http://java.sun.com/docs/books/tutorial/index.html
    And if the algorithm is the problem:
    - Make two variables that hold the current maximum and minimum value
    - whenever a value is entered, compare it with the minimum, if it is smaller, set the minimum to that value
    - ditto with maximum
    at the end the two variables contain the maximum and minimum values.

  • Get max and min values from waveform chart

    Hi all
    Ive got a waveform chart and want to display the max and min value for the graph. How do i get the respective values?? Im using LabView 8.2
    holla
    Attachments:
    Untitled 231_LV80.vi ‏23 KB

    Thanks Mike

  • How to get system and boot on one volume - currently on 2 volumes

    I have ended up with 2 hard drives one of which has Windows 7 on one partition and the other one has 2 volumes each with Windows 8.1 installed.  This 8.1 drive has one volume (D) marked as Active, Boot and the other volume (C) marked as System.  
    I want to make the C volume Active System and Boot and have the D volume for storage only.    I need to make this change without losing data on either volume.   Can this be done, if so which of the many partition operations is the appropriate
    one.  Would a free download such as EasUS be able to do it?

    I have ended up with 2 hard drives one of which has Windows 7 on one partition and the other one has 2 volumes each with Windows 8.1 installed.  This 8.1 drive has one volume (D) marked as Active, Boot and the other volume (C) marked as System.
      I want to make the C volume Active System and Boot and have the D volume for storage only.    I need to make this change without losing data on either volume.   Can this be done, if so which of the many partition operations is the appropriate
    one.  Would a free download such as EasUS be able to do it?
    Sorry error in original description - Volume C is Boot and volume D is Active System.

  • How to get audio and video in one file

    hi...I am "premiere beginner user" and I have a simple question , I think..:)...Every time when I am trying to export media out from my premiere (using media encoder) I get video file and some audio files, but what I need is only ONE file, that contains both (audio and video)..for example , I have edited film in hd quality and I want it to export, I choose h.264 format(make some settings,pal,audio quality...) and when it´s "all done", only "result" I get is one video file and two audio files and they are not together :).....so please help mme anyone..ok and as you can see I am not from english speaking country, so sorry for my english...thanks for help....

    There is no indication that something is out-of-sync or the ability to move/slip into sync like in FCE/FCP.
    To the best of my knowledge, using match frame and overwriting the video with video+audio (or attaching it as a connected clip if you don't want to overwrite the video, which might have effects applied) is the best way to do this.
    You can use the blade tool first in the timeline to get just the section you want to get back into sync. Make cuts so that you have a single clip that needs the audio resynced, select it, and use shift-F to select the original synced clip in the Event Browser. Make sure your play head is at the beginning of this video clip in the timeline. Press option-2, then 'q', and now you have the audio back in your timeline, synced with the video.  Delete the old, no-longer-synced audio and you should be set.

  • Line Profile Max and Mins

    Hi,
    I am trying to store the max and mins from a line profile that I generated from a picture into a spread sheet and also calculate the average max and min.  It seems like it should be a simple thing to do, but I can't seem to find an easy way to do it. 
    I just thought I would try to see if someone has done this before and can enlighten me!
    Thanks
    I am attaching a Line Profile Sample file is you want to use it to try your idea out.

    Hi BlueEyes76,
    What version of LabVIEW are you trying to do this in?
    In most versions of LabVIEW, if you go to Help->Find Examples and search "spreadsheet" you will see a number of VIs that read/write data from spreadsheet files.  Of particular interest may be the "Using Spreadsheet Format.vi".
    As for calculating max and min, there is a VI "Array Max and Min" in the Programming->Arrays function palette that will allow you to input an array of numbers and output the max and min.
    Please let me know if I can be of further assistance.
    Eric V
    National Instruments
    Applications Engineer
    Certified LabVIEW Associate Developer
    "I'm a Ramblin' Wreck from Georgia Tech and a helluva (NI Applications) Engineer!"

  • How to use select max and min query..

    hi gurus,
    we have got a custom report for develoment.
    the report has to fetch the max and min salarys department wise....
    how to pick up max & min sal ansal from table pa0008.

    Hi,
    Try the following
    select max(sal)
               min(sal)
               from <database table>
               into <internal table>
               group by department
               where <where condition>.
    Here we assume that sal is the field holding the salary and department is the name of the field in the database table. Where condition is optional.
    Hope this helps.
    Regards,
    Sachin

  • How can i write max and min data online during acquisition

    Hello,
    I am not keen with programming and your help will be greatly appreciated.
    I make temperature acquisition from an IR camera and I record online 38 different spots at a frequency of 10 samples/min.
    I also record two temperatures from thermocouples at the same sampling rate.
    I would like to make the acquisition during 5 sec every 20 sec and extract the max and min temperature from the thermocouples and write these values in a text file like show below :
    Temp_max 5 sec 22.1
    Temp_min 5 sec 2.1
    Temp_max 10 sec 42.1
    Temp_min 10 sec 4.1
    Temp_max 15 sec 82.1
    Temp_min 15 sec 6.1
    I also would like to make the same with two or three different spots of the IR camera. I think that if I have a good solution for the thermocouple, I can make it for the camera.
    I use LabView 8.2 with NIDaqmx acquisition.
    Thank you in advance

    Hello Evrem,
    Thank you for your advice. In fact, I have already attended to the training course you mentioned. I should think about going to the module Basic II. I do not have problem to connect/pilot various type of instruments but I am not very efficient with loop and arrays !
    I am fine with the data acquisition and the timing and I can sort data during 5 sec with "Array max & min". Then, I can display all data. What I have problem to do is to extract the max & min from the array, keep these 2 values for being writtten in a file at the end of my loop and start again during the next 5-sec cycle. At present, I only have the last max & min results from the last acquisition !
    Any example of how recording max & min online during 5-sec cycle acquisition will be welcome.
    Best regards,
    Labdummy

  • Thread use to find max and min in an array of objects??

    Hello everyone,
    I need to find the min and max int value in a array of Objects.
    This has to be done using threads--like divide the entire array into 10 or so blocks and find the local min and max in each block., Each block is run on a thread and finally comparing them to find the global max and min.How should I do this? I am new to Java programming and in particular to threads.
    Thanks for your time and patience in answering this newbie question.
    JP

    Hi,
    if i understand your problem, you have a big array with a lot of int values and you need to create a few arrays with a part of the big one in each, next each in a thread find the max and the min, next return the max and the min of each thread and compare these max and min to obtain the globals max and min?
    In that case you can create a class in which is your big array. you create a second class implementing Runnable, in its creator you put the instance of the
    first class and 2 int which are the beginning and the ending index. in this class add a method run in this method you create a loop to compare the current value to the max and min values, and you replace if you need to do. In the first class you put the main where you create a few instance of the second class in a thread :
         private Thread threadName = new Thread(new SecondClass(this, start, end));
    Next you start all these thread:
    threadName.start();
    At the end of the run method of the second class you have to write your result in the max and min fields of the first class(int type, you have to create it)
    Write it only if it's necessary (if the current max is > than the already existing max).
    I think it's complete!
    Sorry if it's not really easy to understand, I'm french, but you can answer if you have more questions.
    S�bastien

  • Cursor help and Max and min help

    hello I have a couple of simple questions on cursors.  I am gathering data from an oscilloscope to determine amplitude.  I would like to set a cursor for a reference point.  however, when I set the cursor to the specific number BEFORE the sweep takes place, the cursor gets erased and I have to reset it after.  Also, my x-axis goes from 0-240.  is their anyway to get a high precision?  When I input (154) for the position, it rounds up to 160 and its essential for me to keep as much precision as possible.  I attaching some pictures. 
    Another problem I am having is I want to gather the position where the max point is.  I need this position to subtract it from a reference point so I can determine how far I am from the desired reference point.  I am currently using the express VI statistics. 
    Attachments:
    Max and Min.JPG ‏162 KB
    Cursor Help.JPG ‏82 KB

    At the risk of sounding like a grumpy old man.
    Post you code please-  You have a lot of issues with your coding style and it might take a bit of work to help you out.  I'm not sure from your pictures where your question is pointing.
    Also please post .png files they are prefered on this forum.  And what LabVIEW version are you using?
    Jeff

  • How can I see if my program is for more than one user? We think we have bought in design for more users, but can not find out how to get in for more than one?

    How can I see if my program is for more than one user? We think we have bought in design for more users, but can not find out how to get in for more than one?

    If you bought a CC for team, you can log in at http://adobe.com and insert the e-mail that you gave at the moment at the purchase and than you can manage and see you product/plan/team.
    If I was not clear you can use the following link to help you solving your issue:
    Creative Cloud Help | Manage your Creative Cloud for teams membership
    If your not clear about this situation, contact with an agent of Adobe, by chat or phone. Use the following link to see the type of support you have on this matter:
    http://adobe.com/getsupport
    I think this will help you.
    Regards

  • Displaying actual Max and Min in the report header problem...

    Hi guys,
    I have the following problem.
    1. I have a multi select prompt where you pick 2 years.
    2. I have the following columns. Year, Month, Exp, calc YEAR (max), calc year (min)
    3. I need to get the max and min month across all rows. So far I've tried MAX, MIN, RMAX, and RMIN without success. However, it's not picking them along all rows. For example,
    2001 1 100050 2001 2001
    2002 1 244005 2002 2002
    I'm sure this has to do something with my aggregation in the calculated column, but not quite sure where exactly.

    do max(max(year)) and min(min(year))
    :)

  • How to get tools and other bars back in view after deleting show-bar?

    How to get tools and other bars back in view after deleting show-bar?

    Hello Jouko.
    You can go into View > Toolbars and select the ones you want to see. If you can't see the menu bar you can simply tab ALT on your keyboard (I think F10 works too) to show it.

Maybe you are looking for

  • Java console not working

    Hi I'm using fire fox 4.0. when I click on the Java console nothing happens

  • Sapscript converted to PDF throug spool and sent via email

    Hello gurus, i have the following code for the requeriment and when trying to open file through transaction SOST, the system says that the file is corrupted. What am I doing wrong please? Help is very appreciated!!!!     CALL FUNCTION 'CONVERT_OTFSPO

  • How do I get the numbers to appear for links on a web page

    This is an accessibility feature I once had and now can't remember how to do it. It allowed me to enter a number rather than clicking on a link

  • Green screen with sound for .mov format

    To correct the green screen by going to control panel (expanded view): QuickTime advanced: Direct X: I unchecked boxes: Direct Draw Acceleraton - Direct Draw on secondary monitor - and Direct 3D video acceleration. No more green screen but will this

  • Using ADF Faces Skins

    I'm looking for a reference on deploying Skins with ADF Faces. The published howto on OTN is'nt very helpful because the sample code link is broken (See my previous post). The JDeveloper help files are somewhat helpful but I'm looking for a working e