Check space in the end to display warning message.

I am currently working on validations on functional locations in the EDIT MASK. the code is already written for validations on to check for space in the beginning of the each level in the edit mask. however user requirement is that the program should produce warning messages for spaces regardless of where they appear in the Edit Mask. we have not validated to check for space at the end of each level.
I have checked with condense ,shift string right deleting trailing spaces however I am not able to check for space at the end of levels.
when i debugged the program the level8 length shows as 2 even though there is only one char in the level8. i
could you please suggest any possible solution or any keywords that would help. you can go through the below code which is already written for checking space in the begining.
here l_level1
Level 8 errors
    l_length = STRLEN( l_level8 ).
IF ( l_level8 = space AND l_dash_count > 6 ) OR
         l_dash_count > 7 OR
         l_length > 4.
      lt_mask_err-error = '8E'.
      APPEND lt_mask_err.
      l_errlvl8 = c_y.
    ENDIF.
Level 8 Warning
    IF rb_bdc <> c_on AND p_warn = c_on AND
    ( l_level8 <> space AND l_level8+0(1) = space ).
      lt_mask_err-error = '8W'.
      APPEND lt_mask_err.
    ENDIF.
i have added this code to display warning message using shift.
    l_lev8 = l_level8.                                                
    shift l_lev8 right.                                             
    l_length = STRLEN( l_lev8 ).                                    
    IF rb_bdc <> c_on AND p_warn = c_on AND                       
    ( l_lev8 <> space AND l_lev8+0(1) = space ).                    
      lt_mask_err-error = '1W'.                                     
      APPEND lt_mask_err.                                          
    ENDIF.

You can use REGEX for string parsing, it is really handy. If you would like to test it out check out program "demo_regex_toy".
Trailing space:
FIND REGEX '[ ]+$' IN lv_text.
leading space
FIND REGEX '^[ ]+' IN lv_text.
Any space
FIND ALL OCCURRENCES OF REGEX '[ ]+' IN lv_text.

Similar Messages

  • How to pad spaces at the end of a string

    Hi All,
    I am new to ABAP and need help to achieve this functionality
       I have to build a string with fixed lenth . my input string
      is always lesser than equal to X . I need to calculate and
       add that many spaces at the end of the input string .
      I tried to do this and getting the following error
        please help on this :
      if strlen( t_resultc ) < 525.
      RFILL(t_resultc,' ',525)
      endif.
      Error : Comma without preceding colon(after RFILL(T_RESULTC ?)
    Q: Can I use RFILL with out Select statement in a ABAP program
    Thanks & Regards
      KLK

    Hi,
    Try the following code but kindly make a note..
    Note:-USE quote like this  ` `, Instead of normal single quotes ‘ ’
    WHILE strlen( T_RESULTC ) < 525.            “Check the length   
       CONCATENATE  T_RESULTC ` ` INTO T_RESULTC. ”Add spaces at the end   
    ENDWHILE.
    Hope this helps,
    Andrew

  • Preserve a single space at the end of line using spool command

    Hi,
    Can you please help me to write the result of an sql query into a file with the last column of the row ending with a single space?
    For example:
    COL1DATA|COL2DATA|COL3DATA<space1>
    As mentioned in the example the col3 value in the file should end with a single space. And there should not be any delimiters at the end of the row.
    I tried with set trimspool on/off. But, it didn't work. When I say trimspool on - it is trimming all the trailing spaces.
    When I say trimspool off - it is retaining all the trailing spaces to the size of the line.
    But, I do not wish to modify the file through shell commands once it is written thru spool. I mean I do not wish to append spaces to the end of a line using shell script or any other method.
    I do not wish to use other methods like UTL_FILE also.
    Please help me how to do it using spool command?
    Thank you.
    Ramana

    My requirement is that all the trailing spaces should be truncated except the last one in the row.Why?
    As you have discovered a single column in sqlplus, is always a fixed length regardless of the size of the data, if the length of the data varies the output is padded to the maximum or line size with spaces. The trim and trimpsool commands are there to remove all the spaces from the end of a line if there are any. There are no commands to trim all the spaces except one, or even to trim all the spaces except two, or three even.
    If you want such custom processing you should post process the file in the OS using sed, awk or perl or something designed for such things.

  • How to add spaces at the end of record

    Hi Friends,
    i am creating a file which contains more than 100 records.
    In ABAP i have internal table with on field(135) type c.
    some time record have length 120, somtime 130 its vary on each record.
    but i would like to add space at the end of each record till 135 length.
    Can you please help me how to add speace at the end of record.
    regards
    Malik

    So why did you said that in your first posting? My glass sphere is out for cleaning...
    Instead of type c use strings and add spaces until they have the appropriate length.
    loop at outtab assigning <pout>.
      while strlen( <pout>-val ) < 135.
        concatenate <pout>-val `` into <pout>-val.
      endwhile.
    endloop.

  • Blank spaces at the end of an IDoc text field get lost when posted to R/3

    Hi Guys,
    I am facing the following issue:
    In an XML file-to-Idoc scenario, there are spaces at the end of a text field in the inbound XML file, which I can see when I open the inbound file with a text editor like notepad, and they are kept after XI mapping is executed (I can see them in message mapping simulator). However, it seems that these spaces get lost once the IDoc is posted to SAP R/3 and they are not visible on SAP R/3 side.
    Do you have any idea ? Thanks.
    Best Regards,
    Evaggelos Gkatzios

    That means SAP is removing the spaces from IDoc fields, where you spaces are not allowed. Does it create any problem?
    Thanks,
    Nabendu.

  • Space at the end of a word

    Hello,
    Is there a way to recognize space sign at the end of a sentence?
    The meaning of that is that there is a word that somebody typed at the end of the sentence
    and after that pushed the space bar . When looking at the text inside the sap system the text looks fine,
    but when transferring to excel the text doesnt equal because the space at the end of the sentence.
    Please advise
    Yifat

    Do you want to handle that space or just use the text value?
    If you just want to use the text value (i.e 1word - space)...u simply say CONDENSE <UR TEXT VARIABLE>.
    Else the other option is: Find the string length and then handle it the way u want.
    Or if u r sure that every word has that extra space, and u dont want that u can even use SHIFT RIGHT BY 1 PLACE in thet text variable.
    Hope this helps.
    Thanks
    Kiran

  • Adding space at the end of a ritchEditableText  line

    Hi!
    I found an interesting behaviour in my application.  I have a RichEditableText component with a fixed width . If I add text till almost the end of the line and then  insert spaces, the cursor get's stuck at the end of the line. My surprise was on retreiving the text from that line in the code, where all that spaces existed even if they were not visible in the app. So on screen you see let's say 3 spaces, but then you save the text you can get 10. If you keep inserting any letter the cursor will move itself to the next line, but this does not seem to be the case of " "(space).
    I tested it useing the following code. I'm useing 4.1 sdk.
    <s:RichEditableText id="richTxt"  width="100" height="500" change="richTxt_changeHandler(event)" />
    protected function richTxt_changeHandler(event:TextOperationEvent):void
                    var noOfLines:int = richTxt.textFlow.flowComposer.numLines;             
                    for (var i:int = 0; i < noOfLines; i++)
                        var startIndex:int = richTxt.textFlow.flowComposer.getLineAt(i).absoluteStart;
                        var seqLength:int = richTxt.textFlow.flowComposer.getLineAt(i).textLength-1;
                        var textLine:String = richTxt.text.substr(startIndex, seqLength);
    I try to set clipAndEnableScrolling=true; for richTxt but this thid not change anything.
    How can I retrieve only the visible text( with the corect number of spaces at the end of the line) from the RET in order to save it ?
    Thanks !

    Do you want to handle that space or just use the text value?
    If you just want to use the text value (i.e 1word - space)...u simply say CONDENSE <UR TEXT VARIABLE>.
    Else the other option is: Find the string length and then handle it the way u want.
    Or if u r sure that every word has that extra space, and u dont want that u can even use SHIFT RIGHT BY 1 PLACE in thet text variable.
    Hope this helps.
    Thanks
    Kiran

  • May I run "shrink DB/truncate free space from the end of file" at PROD?

    We have a SAP/MSS production system.
    The disk is full.
    We want to truncate the log file by:
    "shrink DB/truncate free space from the end of file"
    on the log file.
    How risk is it? Can we do it during production is running?
    Thanks! Points!

    Backup the log file (to save the data and keep a consistent backup) Then shrink the file. Its normal for the log not to shrink down to the size you want. Do not shrink past 1GB.
    DO NOT TRUNCATE - you are losing/dropping data and recovery will only be possible to the last on-line, or on-line plus last log/s.
    You can avoid a full log file by setting a 9002 trap - this will trigger a backup (like oraarch when you back up based on % full). Else you need to change the frequency of the backups for the logs to ensure the system never fills ups.
    You can Also add a second log file on a separate F/S if this occurs regular - which it shouldn't if you have a correct backup strategy.

  • How can i display warning messages in user exit EXIT_SAPLMGMU_001 (MM02)

    Hi all,
    while modifying the material master using MM02, i have added new conditions to display messages in user exit EXIT_SPALMGMU_001.
    But using this user exit i am not able to display warning messages.
    Can you please help me with this?
    Sample code which i have included in exit :
    SELECT SINGLE mstav FROM mara
    INTO w_mstav
    WHERE matnr = wmara-matnr.
    IF wmara-mstav NE w_mstav.
    IF wmara-mstdv NE sy-datum.
    wmara-mstdv = sy-datum.
    MESSAGE w177(z03_mm) WITH text-s04 text-s21.
    ENDIF.
    ENDIF.
    Thank you all in advance.

    As written in the SAP documentation of the Enhancement , you can only raise error message using a
    MESSAGE .. RAISING APPLICATION_ERROR.
    You could manage the "warning" yourself, sending an error first time and keeping a trace of the check in some STATICS variable, and not raising the error again if data input remains unchanged between two call of the include.
    <i>----
    EXIT_SAPLMGMU_001
    Where Is the Customer Exit - EXIT_SAPLMGMU_001 called?
    The customer exit is in function module MATERIAL_UPDATE_ALL. The
    function module checks the data for errors (logical relationships,
    foreign keys, fixed domain values, and so on) when the material master
    is updated.
    Use
    o New fields
    You can make checks possible for new fields of your own. These
    checks must be identical to the checks that you carry out for your
    new fields in online maintenance.
    o Existing fields
    For existing fields, you can extend and intensify the checks.
    You can also change data for descriptions and general material data
    (MARA). For example, the descriptions can be generated from attributes
    of the material.
    Limitations
    You cannot bypass existing checks.
    Interface to Application
    The respective data of the current logical transaction is contained in
    the structures, for example, in structure WMARA for MARA. Nonrelevant
    structures are transferred with their initial values.
    General material data that can be changed (CMARA) has the structure
    MARU. This MARA view contains fewer internal fields than MARA itself. If
    WMARA is filled, CMARA is also filled when accessed.
    The customer exit contains the exception APPLICATION_ERROR for your
    self-defined error situations.
    Using the language element MESSAGE .. RAISING APPLICATION_ERROR, you can
    terminate the current (logical) transaction and display your message in
    the log. </i>
    Regards

  • Problem with displaying warning message in exit EXIT_SAPMM06E_012

    Hi,
    I need in EXIT_SAPMM06E_012 exit display warning message.
    I've created klass Y0108MM_Z1 and message 000 in it.
    When i display as error message -> message e000(Y0108MM_Z1).
    everything is fine.
    but when use message w000(Y0108MM_Z1) it doesn't apear.
    Please help it is very important for me.
    Regards,
    Greg.
    Message was edited by:
            Grzegorz Skibinski

    Hi,
    I think message will appear.
    For testing please do from the main screen press Alt+F12 > options> options tab --> check " dialog box at warning message " and test your scenrio.
    Here warning message appear in a dialog box.

  • Display warning message

    Hi guys,
    I need some help with the "displaying warning message" in labview 2010 SP1 base development system. My requirement is, I would like to display a warning message (text alert) when the RPM of the pump falls below 10000 rpm. In this case I am measuring the current, voltage and rpm of a pump. Please let me know how I can get this done. I have attached the main vi and the 2 sub-vi for reference. Also let me know how I can set sound alerts in addition to text alerts when the pump RPM falls below 10000 rpm. Thanks for your help.
    Raj
    Attachments:
    Current_Voltage_RPM-_continuous_sampling_count iterations.vi ‏116 KB
    Current_Voltage_RPM-_sub_VI-1.vi ‏18 KB
    Current_Voltage_RPM-_sub_VI-2.vi ‏17 KB

    Hi Rajesh,
      If you want to display a warning text alert ,then you can just create a text on front panel and using VI properties ,can make it as a text alert.For sound alert use sound functions .Please have a look at the attached vi.Run this vi and  click visible button ,you can find an alert text with some sound.Modify your logic accordingly.
    Regards,
    SrikrishnaNF
    Attachments:
    CheckThisVi.vi ‏18 KB

  • How to display warning message box with yes and no buttons

    Hi,
    I am writing the code to delete emp details from database.
    I want to display warning message with yes and no buttons after clicking the delete button in the same page, if yes is clicked, i want to invoke delete() method in AM.
    Is it possible, if yes pls suggest me how to do it.
    Thanks
    Message was edited by:
    user536125

    This is being discussed in
    warning message(dialog page) to be displayed in the same page
    Thanks
    Tapash

  • Display Warnning message before delete row

    i have a table and i added a column and but in it a button that perform delete action
    when i press the button a row is deleted but i want to display warning message before deleting for example
    "are you sure you want to delete this row ?" Yes or No
    If press yes the row will be deleted else no action is taken
    how can i do this ?

    You can use clientListener to do this.
    <af:commandImageLink text="Submit" id="cil1" partialSubmit="true" >
    <af:clientListener type="action" method="customConfirm"/>
    </af:commandImageLink>
    <af:resource type="javascript">
    customConfirm = function(event) {
    var answer = confirm('Are you sure you want to delete this row?');
    try
    if (!answer) {
    var component = AdfPage.PAGE.findComponentByAbsoluteId("cil1");
    ..... your action here.....
    catch(e) {
    alert(e)
    </af:resource>
    But if there is a event or event listener on the commandimagelink then it will always be called. To avoid that you could remove the actionlistener and add serverlistener and call it through the javascript function. See the "Web User Interface Developer's Guide for Oracle Application
    Development Framework" for more info.

  • I am trying to restore my calendar from my Time Machine backup. I can get through the process, but at the end I get a message that Calendars cannot be amended as it is required by OS 10. There is no facility to authorise a change. How do I get round this

    I am trying to restore my Calendar from my Time Machine back up. I can get through the process but at the end I get a message that Calendars cannot be removed or amended as it is required by OS10, there does not appear to be any option to authorise the backup or change. How can I get round this roadblock?

    I am trying to restore my Calendar from my Time Machine back up. I can get through the process but at the end I get a message that Calendars cannot be removed or amended as it is required by OS10, there does not appear to be any option to authorise the backup or change. How can I get round this roadblock?

  • Olympus xz-1 camera when connected to ipad2 with supplied ubs cable into apple usb to 30pin adapter it prompts the ipad to display a message like " this device draws too much power to charge" and then i can go no further!

    olympus xz-1 camera when connected to ipad2 with supplied usb cable into apple usb to 30pin adapter it prompts the ipad to display a message like " this device draws too much power to charge" and then i can go no further! if i take the  card from the camera and put it into the card to 30pin adapter and plug that into the ipad no problems. if i connect the camera with supplied usb cable to desktop imac , no problems. if i connect my olympus slr to the ipad using its usb cable into the apple usb to 30pin , no problem .  very frustrating , i don't want to always have to take the card out of the camera to down load photos to the ipad2,IDEAS?

    I'd ask that on the iPad forum.
    https://discussions.apple.com/community/ipad

Maybe you are looking for

  • Why is it that when I add a new bookmark, it replaces one of my old ones?

    I have a good number of bookmarks in Firefox. I want to add more, but each time I add a new one, it replaces the last bookmark I added with the new one. That old bookmark is then gone from my list. Also, normally when I hit "bookmark this page," the

  • External mail configuration from SBWP

    Hi I need the steps to configuration of sending mails to external users (xxx.gmail.com)  from SAP system using t-code SBWP. Anyone please give me some steps to configure this. Thanks & Regards, Pradeep

  • New emails appear then disappear

    I've had 2 emails pop up as notifications and by the time I open mail to read them they have disappeared. They aren't in junk or deleted.

  • ORA-13285 again

    Why would this query result in this error? Usually it occurs when the coordinate systems for the two tables are different, but in this case there is only one spatial table, which I'm looking for overlaps within where both features meet certain criter

  • Function Module in Central Address Management

    Hi,         Is there any function module which updates a filed in ADRC based on the customer number( KNA1) and again i need to update Email information in ADC6.        Actually i am creating a sales order and need to update Customer master.