Skip to Content

Minute Range

Hi all,

My problem is, i have calculated time in minutes i have to show output in terms of minute range. The minute range is defined in the selection screen by the user.

Eg If user has defined in selection screen the minute range as 10.

Now if the calculated minutes i have is 5 min then output = show range as 0-10

if i have 13 min then output = shoe range as 10-20 and so on.

Similarly if User enters 5 in selection screen, then

3 min output = show range as 0-5

13 min ouput = show range as 10-15 and so on.

Is there any FM which could help me, or nay other possible way.

Please help me out. Points will be rewarded.

Thanks

Vijay

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Posted on Jan 20, 2008 at 01:08 PM

    Hi vijay,

    no idea if there is a standard function but such a function module is written quite fast. Here an example. You have to adapt the data types perhaps if you have greater value ranges.

    FUNCTION zrwe_range.

    *"----


    ""Local Interface:

    *" IMPORTING

    *" REFERENCE(IV_VALUE) TYPE I

    *" REFERENCE(IV_RANGE) TYPE I

    *" EXPORTING

    *" REFERENCE(EV_RANGE) TYPE CHAR10

    *"----


    • local data definition

    DATA:

    lv_segment TYPE i,

    lv_start TYPE i,

    lv_end TYPE i,

    lv_char_buff1 TYPE char4,

    lv_char_buff2 TYPE char4,

    lv_range TYPE char10.

    • clear the exporting parameter

    CLEAR:

    ev_range.

    • get the segment the value is in

    lv_segment = ( iv_value DIV iv_range ) + 1.

    • get the start

    lv_start = ( lv_segment - 1 ) * iv_range.

    • get the end

    lv_end = ( lv_segment ) * iv_range.

    • build the result

    WRITE lv_start TO lv_char_buff1.

    WRITE lv_end TO lv_char_buff2.

    CONDENSE lv_char_buff1.

    CONDENSE lv_char_buff2.

    CONCATENATE

    lv_char_buff1

    '-'

    lv_char_buff2

    INTO

    ev_range.

    ENDFUNCTION.

    To sum up several entries just call such a function module in a loop and collect them into a table.

    Best regards

    Roman Weise

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.