How to Determine Length of variable up to period (.)

I have  a variable called my_var  in an ABAP and it is passed many #’s  and they may or may not have some text following these #’s --- these #’s can have a  Length of up to 13 and will always have 3 Decimal Places.  I need to find a way to return the length of the # up to the decimal place.
The # is always first in this variable, it will always have a .000 and it may or may not have text following it.  The only way I can think of doing this is to
loop through the my_var one character at a time to find the decimal place and to determine the length.    Does anyone have any other ideas?
Examples:
my_var = “22.000 ABC”  would return the length of 2
my_var = “0.000            this is more text” would return the length of 1
my_var = “1200000.00”  would return the length of 7
my_var = 87098.000” would return a length of 5
my_var = “987.000    this is text again” would return a lenth of 3
Message was edited by: Manish Kumar : Basic programming. Answer can be easily found by searching. Thread locked.

Hi ,
try this
data : var1 type char20 value '222.000ABC'.
data : part1 type char10,
        part2 type char10.
data : lv_int type i.
split var1 at '.' into part1 part2.
lv_int = strlen( part1 ).
write : 'length of Interger Before decimal',lv_int.
Regards
pavan

Similar Messages

  • How to  Create  a selection variable for Fiscal period/year range

    How to  Create  a selection variable for Fiscal period/year range. The idea is to filter the query results using a fiscal period/year range user input rather than a full fiscal year input.

    Hi Priya,
    Open the query in a query designer -> in the left hand side you would find the fiscal year period under the time dimension -> right click -> create variable -> create the variable.
    The better option would be use any of the SAP provided variable. You would find them under the Fiscal year period in the left hand side in the query designer.
    Bye
    Dinesh

  • How to determine the contract header's valid period...

    1. How to determine the service contract header's start date, end date, when related muliple items with different start date and end date?
    i.e., what is the different between the header's valid period and item valid period?
    For example:
    Sold to A has 5 items, which has different contract line item start date and end date, e.g.,
    item 2: 2010.9-2011.9
    item 3: 2011.4-2012.4
    As for combined the all item bolonged to sold to A to one contract, so the item should have different contract start date and end date.
    However, how to determine the contract header's start date and end date?
    2. Another question is: When process service contract data migration from legance to CRM, how to design the above scenario logic?
    Thanks in advance,

    Sent again, to wait the answer....

  • How to create a 0FISCPER variable for [last period of current year]

    Hello,
    Can anybody tell me how to create a (exit) variable for the last period of the current year, based on 0FISCPER ?
    Based on a single value, user entry variable based on 0FISCPER.
    I did not find any standard (business content) variables for this.
    Can anybody tell me whether the following alternative works:
    variable 0P_BA102 (last period pervious year) with offset of +12 
    Kind regards.

    Hi,
    It should work.
    You can refer to the following link:
    http://help.sap.com/saphelp_sm32/helpdata/en/3f/89533e5ff4d064e10000000a114084/content.htm
    Regards,
    Amit

  • How to determine length of table row in sql 2005

    How, other than by doing the addition on my own, can I detemrine the length of a row in a table?
    TIA,
    barkingdog

    EDM,
    Is this still an issue?
    Thank you!
    Ed Price, Power BI & SQL Server Customer Program Manager (Blog,
    Small Basic,
    Wiki Ninjas,
    Wiki)
    Answer an interesting question?
    Create a wiki article about it!

  • How to Determine Quarter based on Fiscal Posting Period

    Hi All,
    Could you please help me on this issue.
    I have a select option SO_PRD FOR S630-SPBUP. I know the logic to determine the fiscal period by using the FM DATE_TO_PERIOD_CONVERT.
    Now I will fetch the data from following tables EINE, EINA,S630, T009, A017,  EQUP.
    After the fetching my internal tables will be having data on of them is PRICE. Now I want to display the price for each period which I can do easily.  But there is another requirement where I need to calculate the average price for the quarter. For example if I enter 01/2009 to 02/2009. This belongs to 1st quarter and I need to fetch all the data from table based on the periods entered in the selection screen. SO I got the values for 01 & 02. But during quarter price it should also include 03/2009. Is there any FM available to determine the quarter periods based on the fiscal epriod. I do not want to do hard coding for this and system should automatically determine the quarters based on the dates entered in the selection screen.
    Thanks & Regards,
    Nagaraj Kalbavi

    Hi ,
    Check this FM
    TSTR_PERIODS_QUARTERS
    Regards,
    Pankaj

  • How many characters length an ODI variable can hold

    Hi,
    I just want to know how much data length an variable can hold, I have a string of 4000 characters. Can variable can hold the output of this much length.
    Thanks

    No, its 250 characters in 11g

  • Determine length of string without function module

    hai experts,
    i need to know how to determine length of string without function module strlen'
    regards,
    karthik

    Please SEARCH in SCN before posting.

  • How to determine the length of variable based on the character contents

    Hi Experts,
    I need to determine the length of variable based on the character contents I am looking for.
    Example;
        lv = 'FENCE - Construction bond'
    Where I need to know the exact field length of 'FENCE -'.
    It's possible that variable will have different values in different lengths.
    Thanks.
    Kath

    Kathy Amion  ,
    hello Will you please elaborate ...!
    The suggestion for your proble as i understood it is you will have to split the string at seperator '-' in two say variable name and conten. and then  you will calculate the length of the VARIable name by using string function.

  • How to determine the length of a curved path in illustrator CS2

    how to determine the length of a curved path in illustrator CS2?

    bornfree,
    The free Patharea/Pathlength Filters from Telegraphics is your friend (the former gives you both area and length, both in different units):
    Telegraphics - Free plugins for Photoshop & Illustrator...and other software

  • How to determine the maximum allowable length of a filename for Window ?

    Hi all,
    Could I know how to determine the allowable file length (the length of the absolute path) for a file in Window environment?
    Due to some reason, I generated a zip file with a very long filename ( > 170) and put in a folder(the length of the folder path around 90). The length of the absolute path is around 260.
    I used FileOutputStream with the ZipOutputStream to write out the zip file. Everything is working fine while i generating the zip file.
    However, while i try to extract some files from the zip file i just created, i encountered the error
    java.util.zip.ZipException The filename is too long.
    I am using the class ZipFile to extract the files from the zip file like the following
    String absPath = "A very long filepath which exceed 260";
    ZipFile zipF = new ZipFile(absPath);  //<-- here is the root causeIs it possible to pre-determine the maximum allowable filepath length prior i generate the zip file ? This is weird since i got no error while i created the zip file, but have problem in extracting the zip file ......
    Thanks

    Assuming you could determine the max, what would you do about it? I'd say you should just assume it will be successful, but accommodate (handle) the possible exception gracefully. Either way you're going to have to handle it as an "exception", whether you "catch" an actual "Exception" object and deal with that, or manually deal with the length exceeding the max.

  • How to Create a Text Variable

    Hi Experts...
    Can you please explain me how to create a Text variable...
    In my Cube i had 3 different date fields....
    and as per my requirment i need to create a rolling report for which will display data for 6 months rolling.
    As the date field which i need to use is not mapped to Time Char's (Cal Year,Cal Month...etc)
    For that reason i created below customer exit variable and used offset variables to achieve the rolling 6 months report
    Code used for Customer Exit VAriable:
    WHEN 'ZC_Cmonth1'. " Current Cal Month Car Expiry
    IF i_step = 2.
          CLEAR l_s_range.
    determine date
        LV_SYDAT     =  SY-DATUM.
        LV_YEAR_ACT  =  SY-DATUM+0(4).
        LV_MONTH_ACT =  SY-DATUM+4(2).
    Set begin date of intervall
    CONCATENATE LV_YEAR_ACT LV_MONTH_ACT '01' INTO LV_DATE_LOW.
    Set end date of intervall
    CONCATENATE LV_YEAR_ACT LV_MONTH_ACT '31' INTO LV_DATE_HIGH.
    Fill ranges-tab with: include all values between beginning of year
    and actual date
      CLEAR E_T_RANGE.
      CLEAR L_S_RANGE.
      L_S_RANGE-SIGN = 'I'.
      L_S_RANGE-OPT  = 'BT'.
      L_S_RANGE-LOW  = LV_DATE_LOW.
      L_S_RANGE-HIGH = LV_DATE_HIGH.
      APPEND L_S_RANGE TO E_T_RANGE.
    ENDIF.
    Now i need to create TEXT VARIABLE that will display the Month Name in the column name
    Please update in detail step how to create a Text Variable

    In your specific requirement select the which ever the keyfigure you want  to analyse, go to edit mode of keyfigure propeties there select the newvariable type and create the Text variable by maintaining the proper offset start and length and also maintain the in whcih format u want see the month name in column headers. Maintain the Text format or key format. it totally depends on u r requirement.
    Hope it will help ful for u.
    Bye,
    Chandu.

  • How do I create a variable video delay of a live stream...

    I have a live video feed from my webcam in my Flash Application. I have a second video window next to it that I want to place a variable delayed video of the live stream. Therefore, I need to save the video stream in memory/disk and create this variable delay, say 5-60 seconds. As well as, continue to capture the live stream. The camera I am using suppots H.264 encoding.
    How do I create a variable length queue or buffer to hold the video stream coming into the flash application. Do I create a memory variable or write this to disk ? I have been looking over the ActionScript 3.0 documentation and I can not figure out how to code this either way ( as a memory variable or write to disk queue ).
    I want to be able to change the delay, view the delay stream in slow motion and scrub through the delayed stream.
    I would like to do this with out having to use Flash Media Server.
    Thanks,
    Bob

    I am sure it is practically impossible to accomplish that on the client side. Although theoretically it is conceivable to use NetStream.appendBytes() but it requires an extremely complex implementation.
    I suggest you look into FMS DVR capacities:
    http://help.adobe.com/en_US/flashmediaserver/devguide/WS236AE81A-5319-4327-9E44-310A93CA09 C6Dev.html

  • How to create a global variable in forms 6i

    How to create a global variable in forms 6i

    :GLOBAL.my_var := 15; Well, this statement is not correct! Global variables
    stores a character string of up to 255 characters in
    length. Thus, valid statement for Khurram example
    is:
    :GLOBAL.my_var := TO_CHAR(15);
    or
    :GLOBAL.my_var := '15';
    But numeric values are implicitly converted by oracle so there's nothing in fact wrong with the statement...
    :GLOBAL.my_var := 15;
    ;)

  • How to determine cursorline in table control

    Hi,
    Every time an entry is inserted in the table control i need to put the cursorline in the next line.
    It is ok while you are using the initial lines of the table control but when you use the scroll it is gone.
    The complet scenario is:
    - my table control is created with 5 lines.
    - Every time the user inserts a line, a new line is created (so you will have always 5 lines behind to complete)
    - when the 5th line is inserted, if you want to fill the 6tn you have to use the scroll
    - In this moment is when i dont know how to determine the cursorline. It will be different depending how much de the scroll is moved. Maybe the correct cursorline is 5, or 3 or 2... Do you know how i can determine it? Is it possible?
    Maybe the way would be to move the table control (scroll) one position and always cursorline would be 5, but i dont know if it possible neither.
    Thank you,
    Manel

    Sorry misunderstood the question.
    You will have to use the variable topline from the tablecontrol.
    Edited by: Pedro Guarita on Feb 10, 2010 5:25 PM

Maybe you are looking for

  • (SERVICE ENTRY SHEET) ML81N

    Hi all, while entering service entery sheet in Quantity i want after dicimal four digit means ( 0.0012),but its not taking more that three digits. i mgetting error- Input must be in the format .__.___.__~,___V Message no. 00088 System Response The en

  • Can't change home directory location on 10.6.8 server

    After setting up 10.6.8 server. We want the location of the home dir to be in a sub folder in the User folder on the servers HD. The problem is any shared folder we set up the client computers get the message that the home dir can not be found. The o

  • Motion not exporting transparency....

    after exporting text project from MOTION 2 to FCP HD 5.1.2.my backgrounds are not transparent--even though i exported the files from motion with transparency on--yesterday's project DID export transparency--after second try--is this a corrupt file is

  • Spras for header text...

    hi all, in billing header text, default value for spras is "DE". i'm changing it as "EN" for each bill while billing. i want to set this default as "EN". how can i do this?

  • 10.5.6 and Terminal and X11

    Installed 10.5.6 today and found a few quirks, especially with Terminal and X11. Anyone else run into this yet? 1. Terminal default login shell is now tcsh instead of bash. Need to go to preferences and select /bin/bash. 2. I am having problems launc