How can i calculate the lengh of text field of workarea at runtime

hi .
we tried below code but it is always showing entire lenght of field , not the lenght of text field 
DESCRIBE FIELD wa_itab_raw-txt LENGTH len.    
IF len GE 139 AND wa_itab_raw-txt+39(1) = 'R'.
   wa_itab_retro = wa_itab_raw.                
   APPEND wa_itab_retro TO itab_retro.         
ELSE.                                         
   wa_itab_sbi = wa_itab_raw.                  
   APPEND wa_itab_sbi TO itab_sbi.   
kindly help me
correct answers will be awarded <= read the rules [here!|https://www.sdn.sap.com/irj/sdn/wiki?path=/display/home/rulesofEngagement]
Edited by: Julius Bussche on Jul 28, 2008 6:37 PM

Hi,
try this
DATA lv_length TYPE i.
lv_length = STRLEN(wa_itab_raw-txt).
Regards Rudi

Similar Messages

  • Text on path: How can I calculate the text length?

    Hi
    I have a text on path (spline item). Now I need the length of this text and the length of the spline item.
    I try to calculate the text length using IWaxLine::GetWidth(), but this is always 0.
    - How can I calculate the length of this text?
    - How can I calculate the length of the spline item?
    Thanks
    Hans

    It would be interesting if you could describe the purpose of your "length", but I don't have an answer anyway. Would the bounding box be sufficient?
    Considering that TOP may be combined with arbitrary spline paths, this could become an exercise in higher math. I haven't yet encountered a function that returns the mathematical length of such a spline.
    Otherwise it could be solved if you iterate and sum up the relevant points of the bounding box (ascender, descender, baseline?) of individual glyphs.
    Be warned that the whole TOP looks alien, as if it were a transplant from a different program. Experience also shows that documented and actually used interfaces / commands are completely different animals ...
    Dirk

  • How can I calculate the request time ?

    Hello,
    How can I calculate the total consume time in each request ?
    For example, I want to start calculating the time when I click on a Link or a button and the end time when it completed load the page !
    Eric

    You could use a filter like this one:
    import java.io.*;
    import java.net.*;
    import java.util.*;
    import java.text.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import javax.servlet.Filter;
    import javax.servlet.FilterChain;
    import javax.servlet.FilterConfig;
    import javax.servlet.ServletContext;
    import javax.servlet.ServletException;
    import javax.servlet.ServletRequest;
    import javax.servlet.ServletResponse;
    public class TimeFilter implements Filter {
        // The filter configuration object we are associated with.  If
        // this value is null, this filter instance is not currently
        // configured.
        private FilterConfig filterConfig = null;
        private static final boolean debug = false;
        private long start = 0;
        private long end = 0;
        public TimeFilter() {
        private void doBeforeProcessing(ServletRequest request, ServletResponse response)
        throws IOException, ServletException {
            if (debug) log("CalendarFilter:DoBeforeProcessing");
            System.out.print("In Filter  ");
            this.start = System.currentTimeMillis();
            System.out.println((new java.util.Date()).toString() +
                               " start request ");
        private void doAfterProcessing(ServletRequest request, ServletResponse response)
        throws IOException, ServletException {
            if (debug) log("TimeFilter:DoAfterProcessing");
            System.out.println("Completion Time = " + (System.currentTimeMillis() - start));
         * @param request The servlet request we are processing
         * @param result The servlet response we are creating
         * @param chain The filter chain we are processing
         * @exception IOException if an input/output error occurs
         * @exception ServletException if a servlet error occurs
        public void doFilter(ServletRequest request, ServletResponse response,
        FilterChain chain)
        throws IOException, ServletException {
            if (debug) log("TimeFilter:doFilter()");
            doBeforeProcessing(request, response);
            Throwable problem = null;
            try {
                chain.doFilter(request, response);
            catch(Throwable t) {
                problem = t;
                t.printStackTrace();
            doAfterProcessing(request, response);
            // If there was a problem, we want to rethrow it if it is
            // a known type, otherwise log it.
            if (problem != null) {
                if (problem instanceof ServletException) throw (ServletException)problem;
                if (problem instanceof IOException) throw (IOException)problem;
                sendProcessingError(problem, response);
         * Return the filter configuration object for this filter.
        public FilterConfig getFilterConfig() {
            return (this.filterConfig);
         * Set the filter configuration object for this filter.
         * @param filterConfig The filter configuration object
        public void setFilterConfig(FilterConfig filterConfig) {
            this.filterConfig = filterConfig;
         * Destroy method for this filter
        public void destroy() {
         * Init method for this filter
        public void init(FilterConfig filterConfig) {
            this.filterConfig = filterConfig;
            if (filterConfig != null) {
                if (debug) {
                    log("TimeFilter:Initializing filter");
         * Return a String representation of this object.
        public String toString() {
            if (filterConfig == null) return ("TimeFilter()");
            StringBuffer sb = new StringBuffer("TimeFilter(");
            sb.append(filterConfig);
            sb.append(")");
            return (sb.toString());
        private void sendProcessingError(Throwable t, ServletResponse response) {
            String stackTrace = getStackTrace(t);
            if(stackTrace != null && !stackTrace.equals("")) {
                try {
                    response.setContentType("text/html");
                    PrintStream ps = new PrintStream(response.getOutputStream());
                    PrintWriter pw = new PrintWriter(ps);
                    pw.print("<html>\n<head>\n</head>\n<body>\n"); //NOI18N
                    // PENDING! Localize this for next official release
                    pw.print("<h1>The resource did not process correctly</h1>\n<pre>\n");
                    pw.print(stackTrace);
                    pw.print("</pre></body>\n</html>"); //NOI18N
                    pw.close();
                    ps.close();
                    response.getOutputStream().close();;
                catch(Exception ex){ }
            else {
                try {
                    PrintStream ps = new PrintStream(response.getOutputStream());
                    t.printStackTrace(ps);
                    ps.close();
                    response.getOutputStream().close();;
                catch(Exception ex){ }
        public static String getStackTrace(Throwable t) {
            String stackTrace = null;
            try {
                StringWriter sw = new StringWriter();
                PrintWriter pw = new PrintWriter(sw);
                t.printStackTrace(pw);
                pw.close();
                sw.close();
                stackTrace = sw.getBuffer().toString();
            catch(Exception ex) {}
            return stackTrace;
        public void log(String msg) {
            filterConfig.getServletContext().log(msg);
    }and in the web.xml :
       <filter>
            <filter-name>TimeFilter</filter-name>
            <filter-class>
                com.filter.TimeFilter
            </filter>
        <filter-mapping>
            <filter-name>TimeFilter</filter-name>
            <url-pattern>/services/*</url-pattern>
        </filter-mapping > 

  • How can i  change the column label text in a alv table display

    how can i change the column label text in a alv table display??
    A similar kinda of question was posted previuosly where the requirement was the label text was needed and following below code was given as solution :
    <i>*  declare column, settings, header object
    DATA: lr_column TYPE REF TO cl_salv_wd_column.
    DATA: lr_column_settings TYPE REF TO if_salv_wd_column_settings.
    DATA: lr_column_header type ref to CL_SALV_WD_COLUMN_HEADER.
    get column by specifying column name.
    lr_column = lr_column_settings->get_column( 'COLUMN_NAME1' ).
    set Header Text as null
    lr_column_header = lr_column->get_header( ).
    lr_column_header->set_text( ' ' ).</i>
    My specific requirement is i have an input field on the screen and i want reflect that value as the column label for one of the column in the alv table. I have used he above code with slight modification in the MODIFYVIEW method of the view since it is a process after input. The component gets activated without any errors but while run time i get an error stating
    <i>"The following error text was processed in the system CDV : Access via 'NULL' object reference not possible."</i>
    i have checked in debugging and the error occured at the statement :
    <i>lr_column = lr_column_settings->get_column( 'CURRENT_YEAR' ).</i>Please can you provide me an alternative for my requirement or correct me if i have done it wrong.
    Thanks,
    Suri

    I found it myself how to do it. The error says that it is not able to find the reference object i.e  it is asking us to refer to the table. The following piece of code will solve this problem. Have to implement this in WDDOMODIFYVIEW method of the view. This thing works comrades enjoy...
      DATA : lr_cmp_usage TYPE REF TO if_wd_component_usage,
             lr_if_controller  TYPE REF TO iwci_salv_wd_table,
             lr_cmdl   TYPE REF TO cl_salv_wd_config_table,
             lr_col    TYPE REF TO cl_salv_wd_column.
      DATA : node_year  TYPE REF TO if_wd_context_node,
             elem_year  TYPE REF TO if_wd_context_element,
             stru_year  TYPE if_alv_layout=>element_importing,
             item_year  LIKE stru_year-i_current_year,
             lf_string    TYPE char(x),
      DATA: lr_column TYPE REF TO cl_salv_wd_column.
      DATA: lr_column_header TYPE REF TO cl_salv_wd_column_header.
      DATA: lr_column_settings TYPE REF TO if_salv_wd_column_settings.
    Get the entered value from the input field of the screen
    node_year  = wd_context->get_child_node( name = 'IMPORTING_NODE' ).
    elem_year  = node_year->get_element( ).
      elem_year->get_attribute(
       EXPORTING
        name = 'IMPORT_NODE-PARAMETER'
       IMPORTING
        value = L_IMPORT_PARAM ).
      WRITE L_IMPORT_PARAM TO lf_string.
    Get the reference of the table
      lr_cmp_usage  =  wd_this->wd_cpuse_alv( ).
      IF lr_cmp_usage->has_active_component( ) IS INITIAL.
        lr_cmp_usage->create_component( ).
      ENDIF.
      lr_if_controller  = wd_this->wd_cpifc_alv( ).
      lr_column_settings = lr_if_controller->get_model( ).
    get column by specifying column name.
      IF lr_column_settings IS BOUND.
        lr_column = lr_column_settings->get_column( 'COLUMN_NAME').
    set Header Text as null
        lr_column_header = lr_column->get_header( ).
        lr_column_header->set_text( lf_string ).
    endif.

  • How can i change the sequence of text element in standard driver program ?

    Hi,
    can u tell me how can i change the sequence of text element in standard  sapscript driver program.. without making a zcopy of standard driver program.
    My problem is when MEDRUCK form is getting printed for PO print , header text is coming before item. But the requirement is to come it after item.So how cani do that without making the zcopy of  SAPLMEDRUCK program..Is there any enhancement point in SAPLMEDRUCK driver program..where i can put my customise code for changing the sequence of text element ?

    Hi,
        Just copy the MEDRUCK to ZMEDRUCK. No need to copy the driver program.
    1) SE71Menu > Utilities > COpy from Client
    MEDRUCK ->>Client 000
    New formname ZMEDRUCK
    2) Now open the ZMEDRUCK in DE language in SE71
    3) Menu > Utilities > Convert original Language
    Change DE  to EN, save and activate
    4) Now open the ZMEDRUCK in EN language
    5) Goto Pagewindows > Main window,
    Look for the HEADER text Text element, copy the whole code under this Text element just after the ITEM text Text element, and comment the HEADER text above.
    Now the Header text Text element will be below ITEM text only. This will full fill your requirment.
    Now goto NACE transaction and add the copied ZMEDRUCK to the EF application.
    Regards
    Bala Krishna

  • How can i calculate the average in java

    how can i calculate the avergae mark out of two marks for instance in like exam mark out
    of two other ones
    thanks for considering this message

    Average or Mean:
    sum_of_N/N
    Here N is the number of marks.
    sum_of_N is the total sum of n(all marks added together)
    public int average(int[] marks) {
    int sum;
    sum = 0;
    for(int i=0;i < marks.length;i++) {
    sum=marks[i]+sum; // keep adding to the total
    return average = sum/marks.length;
    // warning- using an int here can be a pitfall(we could have a decimal outcome).
    }

  • How can I calculate the waveform integral in a defined time interval?

    Hi:
    I need your help. How can I calculate the waveform integral in a defined time interval? For example: from "0" to "2pi"?!
    Thanks.

    Hello Clecio,
    You might want to try the Integral x(t) VI.  The documentation for this VI notes:
    Performs the discrete integration of the sampled signal X. Integral x(t) calculates a definite integral. The value of the output array at any value x is the area under the curve of the input array between 0 and x.
    You would pass the samples of the waveform that fall between your particular window, then pass 1/number of samples for the d(t) parameter.
    Hope that helps.
    Wendy L
    LabWindows/CVI Developer Newsletter - ni.com/cvinews

  • How can I calculate the total time in java?

    Hello!
    I need to calculate the total time!
    For example I have start time:
              Format formatter1;
              Date date1 = new Date();
              formatter1 = new SimpleDateFormat("hh:mm:ss");
              String startTime = formatter1.format(date1);
              //startTime = "14:20:40";
    And I have finish time:
              Format formatter2;
              Date date2 = new Date();
              formatter2 = new SimpleDateFormat("hh:mm:ss");
              String finishTime = formatter2.format(date2);
              //finishTime = "08:30:55";
    So, after manually calculating, I get total time: "18:10:15"
    How can I calculate the total time in java? (Using formatter1 and formatter2 I suppose)
    What I need is to print "total 18:10:15"
    Thanks!

    800512 wrote:
    I did the following but, I think something is wrong here:
    I defined before: Date date1 = new Date(); Date date2 = new Date();
    And it should be exactly 5 seconds between them.
    I found delta between date1 and date2:
    Format formatter = new SimpleDateFormat("HH:mm:ss");
              long timeInMilliFromStart = date1.getTime() - date2.getTime() ;
              Date date3 = new Date(timeInMilliFromStart);
              String timeInSecFromStart = formatter.format(date3);
    and I get always
    //timeInSecFromStart = 02:00:05
    But it should be exactly 00:00:05.
    What can be a problem?Because, like I said, a Date measure an instant in time, not a duration. So when you have 5000 ms, and you turn that into a Date, that means 5 sec. after the epoch, which works out to 1/1/1970 00:00:05.000 GMT.
    As I mentioned, if you're not currently in GMT, then you have to set the TZ of the DateFormat to GMT. Right now, it's showing you the time in your TZ. If you included the date in your SimpleDateFormat, you'd see either 1/1/1970 or 12/31/1969, depending on which TZ you're in.
    Bottom line: You're trying to use these classes in a way they're not meant for, and while you can get the results you want for a limited set of inputs if you understand what these classes do and how to work with that, it's a brittle approach and comes with all kinds of caveats.

  • How can I erase the residual background text and images from the backside of a scanned page?

    How can I erase the residual background text and images from the backside of a scanned page?
    Also, I wanted to know what each subscriptions included as far as my question above is concerned?
    I am trying to edit a scanned page (pdf file) by changing some words and erasing the background from the page that is showing through it since the paper is so thin and want to know which subscription to buy in order to complete these tasks?

    This cannot be done in Reader. I think you will need software like Photoshop. You may be able to get buy with Photoshop Elements, but I haven't used recent versions of that software. Using either software this will not be an automated task.

  • How can I get the previous record's field value in a VO

    Hi I would like to know how can I get the previous record's field value in a VO
    For example : I have a VO porequisitionlinesvoimpl, and it contains 5 records (porequisitionlinesvoimpl.getRowCount() = 5). How can I search all records in the VO and get the field (attribute3) for all records?
    Many thanks anyone can help
    Lawrence

    Hi ,
    U can loop through the VO to get the value of attribute3,
    need to extend the controller ,use below code
    OAViewObject vo = (OAViewObject)oawebbean.getApplicationModule (VO1);
    OARow row = null;
    int fetchedRowCount = vo.getFetchedRowCount();
    RowSetIterator Iter = vo.createRowSetIterator("Iter");
    if (fetchedRowCount > 0)
    Iter .setRangeStart(0);
    Iter .setRangeSize(fetchedRowCount);
    for (int i = 0; i < fetchedRowCount; i++)
    row = (OARow)Iter .getRowAtRangeIndex(i);
    String value = (String)row.getAttribute("Atrribute3");
    Thanks
    Pratap

  • How can i update the ADRT table REMARK field

    How can i update the ADRT table REMARK field
    by using only function modules or BAPI's not by direct update's
    please help me
    i need it urgently

    Hi,
    you can try this code:
        SELECT SINGLE * FROM KNA1 WHERE KUNNR = wa_kunnr.
        IF sy-subrc = 0.
          CLEAR adrct.
          SELECT SINGLE * FROM adrct WHERE addrnumber = kna1-adrnr.
          IF sy-subrc = 0.
            adrct-remark = wa_remark.
            MODIFY adrct.
          ENDIF.
        ENDIF
    best regards,
    Thangesh

  • How can I set the different boolean text in the button array?

    I created the OK boolean button array. How can I change the boolean text of each button to be different at run-time? I changed one, but the others are changed also.

    > Thank you for your help
    > Unfortunately I'm a beginner of this software. Please you
    > explain me more details.
    Select the control using the positioning tool and choose
    Customize... from the Edit menu or choose it by popping up
    on/right clicking on the control and selecting Advanced>>
    Customize...
    This will open the control up in a new window -- the control
    editor window. This window allows for lots of additional
    control modifications and allows for them to be saved into
    typedefs to promote reuse and make things more consistent.
    Once in the control editor, popup on the button and select
    the menu item near the bottom Multiple Text Strings.
    Close the editor window and the first dialog will ask if
    you would like to save the change
    d file. Choose No, and a
    second dialog will ask if you would like to Replace the
    Original Control. Choose Yes.
    At this point the Button will support multiple text labels.
    To edit the True string, make the Boolean True and use the
    Labeling tool to edit the string that is visible. To edit
    the False string, make the Boolean False and use the labeling
    tool to edit that string too.
    Greg McKaskle

  • How can I calculate the characters with spaces in a document on pages

    I'm currently using pages to write my personal statement up on, although i need to keep my characters including spaces under 4000 characters and also have no more than 47 lines. I've found how to do a word count and find how many charcaters I've used, but i can't see anywhere the information that I actually need to find! Someone please help, thankyou

    How can you calculate the number of lines if you don't know how many characters there are to a line?
    This is 2013. We are using word processors with real fonts, not terminals or teletypers or typewriters.
    If you must have 47 lines then shrink the point size of the font until it fits.
    Peter

  • How can I calculate the value of the cell, which depends on other rows?

    Hi, all!
    I have an application with table. In this table i have calculate some fields, that doesn't exists in data class and depends on other row values, e.g. current row number, or sum of previous rows. How can i calculate this values in TableView?
    The problem is that I have no information about the current row number in the cell value factory.
    Example:
    public class Transaction {
         public String getName();
         public BigInteger getAmount();
    } // There is no getter for "Balance"
    Result table should be something like this:
    Name
    Amount
    Balance
    transaction1
    300
    300
    transaction2
    200
    500
    transaction3
    500
    1000
    Also, after sorting by "Amount", "Balance" should be recalculated:
    Name
    Amount
    Balance
    transaction3
    500
    500
    transaction1
    300
    800
    transaction2
    200
    1000

    Strings can be converted to numbers by various parse methods. For instance Strings can be converted to double via Double.parseDouble(myString).
    That being said, it appears that your textfield will contain numbers and operators, and so these operators will need to be parsed too. I would advise you to search on the terms Java infix postfix.

  • How can i calculate the percentile rank?

    How can I calculate where in percentile terms a single value falls within a array of many values?
    In excel it is:
    5
    10
    12
    11
    26
    18
    14
    11
    16
    19
    =PERCENTRANK(A1:A10,10) = 0.111
    Thanks!

    Average or Mean:
    sum_of_N/N
    Here N is the number of marks.
    sum_of_N is the total sum of n(all marks added together)
    public int average(int[] marks) {
    int sum;
    sum = 0;
    for(int i=0;i < marks.length;i++) {
    sum=marks[i]+sum; // keep adding to the total
    return average = sum/marks.length;
    // warning- using an int here can be a pitfall(we could have a decimal outcome).
    }

Maybe you are looking for