Remove decimals when equal to 0 SAPSCRIPT

Hello all,
When printing a quantity field in a sapscript form, I would like to remove the decimals if they are all 0, but retain them if at least one is non zero.  For example:
Quantity    -   Value to print
1000.000   - 1000
1000.020   - 1000.020
1000.200   - 1000.200
1000.002   - 1000.002
I have tried many different things including formatting options C and Z (i.e. kwmeng(C)) but neither provide the correct result.  Also, kwmeng(.3) will not work because sometimes I want kwmeng(.0).  I want to avoid ABAP code in the print program and I know that it is possible because a different form in our system performs exactly this way without parsing the value into mantissa and decimal (though I cannot determine how). 
Please post any thoughts or ideas.  Thanks!

Hi,
I think that if the quantity field is linked in the DDic structure/table to a unit of measure field, which content at runtime refers to a unit with 0 decimals, then it should work exactly as you expect.
Sandra

Similar Messages

  • Removing decimals when initial

    i declared variable 'ulimit' as type p decimals 2.
    ulimit  type p decimals 2.
    now its printing as ulimit = 12.00 (when no decimals are there)
                               ulimit  = 13.76(when decimals are there)
    but when no decimals are there i should print as ulimit = 12 only (not ulimit = 12.00).Please help.
    Thanks
    K Srinivas

    Hi Srinivas,
    Here is the sample code.
    REPORT  ZCC_TEST.
    DATA: ulimit type p decimals 2 VALUE '12.09'.
    DATA: STR(10) TYPE C.
    DATA: FINAL(10) TYPE C.
    DATA: LEN TYPE I.
    DATA: LEN1 TYPE I.
    STR = ULIMIT.
    CONDENSE STR.
    IF STR CA '.'.
      LEN = SY-FDPOS.
    ENDIF.
    LEN1 = LEN + 1.
    IF STR+LEN1(2) = '00'.
    FINAL = STR+0(LEN).
    WRITE: FINAL.
    ELSE.
    WRITE: ULIMIT.
    ENDIF.
    \[removed by moderator\]
    Edited by: Jan Stallkamp on Jun 17, 2008 6:26 PM

  • How to remove Decimals in Quantity Objects in SAP BO Explorer View created on top SAP Bex Query?

    Hi,
    I created SAP BO Explorer report on top of SAP BEx Query.
    In SAP BEx Query, Decimals were hided but when i created OLAP Universe on top that SAP BEx Query and Created Index on top of Information Space in SAP BO Explorer and then created Exploration Views. But i'm getting Decimals in my Exploration Views where as SAP BEx Query in RSRT, no decimals were appearing.
    Can anyone suggest me how to remove decimals in SAP BO Exploration Views.

    Hi Ramana,
    I am not use how you connect to SAP BEx query (Via universe or BWA or HANA)
    What I could say is BWA and HANA, you cannot adjust this
    For universe, you could try in universe layer, there is note about this
    For BWA and HANA, this function might be enhanced but you 'd better raise OSS to SAP to check with them
    Best regards
    Alex yang

  • I have songs on my iPhone 6 that I can't remove and when I plug into iTunes and go to "Summary" and "On This Device" the songs don't show up but they are on my phone. How do I remove them? Not even sure how they got on actually.

    I have songs on my iPhone 6 that I can't remove and when I plug into iTunes and go to "Summary" and "On This Device" the songs don't show up but they are on my phone. How do I remove them? Not even sure how they got on actually since I have a iTouch and keep all my music there. HELP!!

    Have you tried deleting the songs from Settings?
    Settings -> General -> Usage -> Manage Storage (not the iCloud link!) -> Music and then click Edit to enable you to be able to delete.

  • I can't get my iphone to add OR remove photos when syncing

    I can't get my iphone to add OR remove photos when syncing

    darn.
    Move <G>
    seriously, keep asking. someone here will know and i'll learn something

  • Remove MC when leaving the frame

    Hi I have a frame that AS this:
    this.createEmptyMovieClip("news",1)
    news.loadMovie("news.swf")
    when i click on a btn and gets to another frame this news.swf
    file still stays on top of other elements.
    is there a way to remove it when i'm leave the current frame?
    (thanks in advance)

    heheh kglad, thanks again. that's what i thought and it's
    good to have you to back that up.
    actually i decided to load movie into a pre-created empty mc
    instead of using createEmptyMovieClip
    then the swf disappear after changing frame. guess that
    solved the problem.

  • Device removal error when flash drive is plugged in

    I have a 1GB flash drive that I have used for a while with my Windows XP desktop. I switched from a PC laptop to a Mac Book Pro running Leopard. But the Mac Book gave me the drive removal error when I tried to use the flash drive. The PC desktop worked with the drive just fine. So I backed up the flash drive and reformatted it in FAT32. Then I reloaded the files. For a short while I had no problem with the Mac Book. Now I am getting removal errors again. I have been careful not the remove the drive, either from the PC or or the Mac Book, without going through proper procedures. It does no good to "repair" the drive from the Mac Book. Any suggestions?

    Maybe:
    http://www.macobserver.com/tmo/article/usb-3.0-hard-drives-can-cause-wi-fi-inter ference
    Re: 2012 Mini Bluetooth/USB3 Interference
    http://www.intel.com/content/www/us/en/io/universal-serial-bus/usb3-frequency-in terference-paper.html
    usb 3.0 interface for 2010 Mac Pro running Yosemite?

  • Remove Line When Blank

    I set the "Remove Line When Blank" to "True" in Report
    Builder but a blank row still appears. Has anyone been to
    successfully able to get it working?

    I'm not sure I entirely understand your report format, but I
    had similar problems with my report. It seemed like the "Remove
    Line When Blank" field never worked. What I ended up doing is
    relying instead on the "Print When" field. Just about everything
    has one of these attributes, Group Headers, Detail Sections,
    Individual Elements, and so on. So I would have it print when the
    query.recordCount GT 0 or something like that. It works out really
    well, especially if you want to collapse an entire section or just
    the header. I haven't tried it with a bunch of individual elements,
    which is what you see to have in the group header, but keep the
    "Position Type" property of all the elements to float. And try
    putting some logic in the "Print When" field to suppress any blank
    lines. Let me know if that works.

  • Removing Video When Editing Sound

    Hi!
    I'm having an issue where I mis-speak, or mis-pronounce
    something. I have to say it again, but if I remove the sound, the
    rest of the audio doesn't sync up with the video. If I replace with
    silence there are long silences that I don't want. Is there any way
    I can remove video when I remove sound so it all syncs up?
    Thanks!

    Does anyone know how the labeling of AIFs work in Garageband as I cant see a pattern.
    The pattern I found seems to be like this:
    filenames of aif-files start with a prefix, which is the name of the track, as to be seen in the track head at the time when the clip was recorded. If you later change the track name it will not change the filename,
    the filenames are numbered with a chronological counter. The first clip recorded on that track is numbered "1", then "2" and so on. The number does not reflect the position on the track.
    So, for example, an audio file named "sopran#01.aif" is the first recorded audio clip on a track, that was called "sopran" when the clip was recorded.
    This is what I observed GB'11, I am not sure about previous versions of GB.
    Hope that helps
    Léonie

  • How to have a button remove itself when clicked?

    Here is my code...it should technically work, shouldn't it? Yet when you try it out and click the first button it will fail to refresh or update the frame. When I resize the frame after clicking the first button, the three buttons that were there before disappear and the new button appears. What can I do to fix this? Please help, try it out for yourself and see.
    Also, if you can explain to me, how can I center these buttons all to the right?
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class CPT extends JPanel implements ActionListener
    protected JButton AddEntryButton, ViewEntriesButton, SearchEntriesButton, AddButton;
    private final static String newline = "\n";
    public CPT ()
    super (new GridLayout (10, 10));
    AddEntryButton = new JButton ("Add Entry");
    AddEntryButton.setVerticalTextPosition (AbstractButton.TOP);
    AddEntryButton.setHorizontalTextPosition (AbstractButton.LEFT);
    AddEntryButton.setToolTipText ("Click this button to add a database entry.");
    AddEntryButton.setMnemonic (KeyEvent.VK_A);
    AddEntryButton.setActionCommand ("AddEntry");
    AddEntryButton.addActionListener (this);
    ViewEntriesButton = new JButton ("View Entries");
    ViewEntriesButton.setVerticalTextPosition (AbstractButton.CENTER);
    ViewEntriesButton.setHorizontalTextPosition (AbstractButton.LEFT);
    ViewEntriesButton.setToolTipText ("Click this button to add view all database entries.");
    ViewEntriesButton.setMnemonic (KeyEvent.VK_V);
    ViewEntriesButton.setActionCommand ("ViewEntries");
    ViewEntriesButton.addActionListener (this);
    SearchEntriesButton = new JButton ("Search Entries");
    SearchEntriesButton.setVerticalTextPosition (AbstractButton.BOTTOM);
    SearchEntriesButton.setHorizontalTextPosition (AbstractButton.LEFT);
    SearchEntriesButton.setToolTipText ("Click this button to search through all database entries.");
    SearchEntriesButton.setMnemonic (KeyEvent.VK_S);
    SearchEntriesButton.setActionCommand ("SearchEntries");
    SearchEntriesButton.addActionListener (this);
    AddButton = new JButton ("Add");
    AddButton.setVerticalTextPosition (AbstractButton.TOP);
    AddButton.setHorizontalTextPosition (AbstractButton.RIGHT);
    AddButton.setToolTipText ("Click this button to add a database entry.");
    AddButton.setMnemonic (KeyEvent.VK_A);
    AddButton.setActionCommand ("Add");
    AddButton.addActionListener (this);
    add (AddEntryButton);
    add (ViewEntriesButton);
    add (SearchEntriesButton);
    public void actionPerformed (ActionEvent e)
    if ("AddEntry".equals (e.getActionCommand ()))
    remove (AddEntryButton);
    remove (ViewEntriesButton);
    remove (SearchEntriesButton);
    add (AddButton);
    if ("ViewEntries".equals (e.getActionCommand ()))
    remove (AddEntryButton);
    remove (ViewEntriesButton);
    remove (SearchEntriesButton);
    if ("SearchEntries".equals (e.getActionCommand ()))
    remove (AddEntryButton);
    remove (ViewEntriesButton);
    remove (SearchEntriesButton);
    // Create the GUI and show it. For thread safety,
    // this method should be invoked from the
    // event-dispatching thread.
    private static void createAndShowGUI ()
    //Make sure we have nice window decorations.
    JFrame.setDefaultLookAndFeelDecorated (true);
    //Create and set up the window.
    JFrame frame = new JFrame ("Swisha Computer House");
    frame.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
    //Create and set up the content pane.
    JComponent newContentPane = new CPT ();
    newContentPane.setOpaque (true); //content panes must be opaque
    frame.setContentPane (newContentPane);
    //Display the window.
    frame.pack ();
    frame.setSize (300, 300);
    frame.setVisible (true);
    public static void main (String[] args)
    //Schedule a job for the event-dispatching thread:
    //creating and showing this application's GUI.
    javax.swing.SwingUtilities.invokeLater (new Runnable ()
    public void run ()
    createAndShowGUI ();
    }

    You should tell the container it needs to be layed out again and then request for a UI update.
    Your first clause in actionPerformed:
    if ("AddEntry".equals (e.getActionCommand ()))
      remove (AddEntryButton);
      remove (ViewEntriesButton);
      remove (SearchEntriesButton);
      add (AddButton);
    }would then be:
    if ("AddEntry".equals (e.getActionCommand ()))
      remove (AddEntryButton);
      remove (ViewEntriesButton);
      remove (SearchEntriesButton);
      add (AddButton);
      invalidate();
      updateUI();
    }The same applies for the two other clauses, resulting in:
    public void actionPerformed(ActionEvent e)
       if ("AddEntry".equals(e.getActionCommand()))
          remove(AddEntryButton);
          remove(ViewEntriesButton);
          remove(SearchEntriesButton);
          add(AddButton);
          invalidate();
          updateUI();
       if ("ViewEntries".equals(e.getActionCommand()))
          remove(AddEntryButton);
          remove(ViewEntriesButton);
          remove(SearchEntriesButton);
          invalidate();
          updateUI();
       if ("SearchEntries".equals(e.getActionCommand()))
          remove(AddEntryButton);
          remove(ViewEntriesButton);
          remove(SearchEntriesButton);
          invalidate();
          updateUI();
    }

  • If I set Firefox to refrain from loading images automatically, how can I view a single image, or a single page's images, without having to enter the site in the Exceptions list, only to go back and remove it when I'm done?

    I was hoping for a hotkey option or button on the toolbar to load images for a single page for a single session at a time. Turning off images really saves bandwidth and speeds load time on websites, but sometimes I'd like to view the images on a page, but only for this session. Is that possible, or do I have to go to the Exceptions page and allow a specific domain or page to load images and then go back and remove that domain or page when I'm done?

    *Image Block: https://addons.mozilla.org/firefox/addon/image-block/

  • How to remove decimals in ALV

    How to remove displaying decimals in ALV report(using FM) ?

    HI Sri,
       Pass the values into a variable of type i.
    data : var type i,
             var1 type f value '2.111'.
        var = var1.
    or else
    change the field catalog this way ..
    <b>lv_cat-decimals_out = '0'.</b>
    Regards,
    Santosh

  • Remove Header when running report with ALV output

    Hi,
    We are running ITS Version 6200.1022.63326.3, Build 84960 connecting to R/3 Enterprise 4.7 on 6.40 Kernel Patch 196.
    I have a situation where I run a report through ITS, starting with a selection screen, I can remove the header part of the ITS generated screen by commenting out:
    <!--
        `SAP_TemplateHeader()`
    -->
    in my template. This works great.
    Now when I run the report and the output is given in the form of an ALV grid, there is no screen to manipulate as it uses the webgui generated html due to me having set parameter:
    GENERATEDYNPRO = 1.
    When I receive the report output, the SAP  header with "Quit" and "Help" is back, due to it being driven by the standard webgui generated templates.
    I have searched on SDN and found some guidelines but no answers are answered and then the thread goes dead so I just wanted to know if someone has ever successfully removed this header.
    I have set noheaderokcode = 1 in the service file, in webgui.srvc as well as in global.srvc.
    I have also started editing the templatelibrary files but to me it is not a very clean solution.
    If someone out there has had this challenge and solved it, please advise.
    Thank you very much and regards,
    Ronald G. Meyer

    Hi,
    Thanks for the feedback.
    Does not seem like the Basis team will be patching the ITS landscape soon, so is there anyone who has more input on this?
    I have found a programmatical example in this thread:
    /thread/76409 [original link is broken]
    But none of the examples work like I expect it to.
    Just wanted to know if someone has implemented this successfully.
    Regards,
    Ronald Meyer

  • What does {tag_image_value} from webapps return when field is empty? How to use javascript to remove div when condition is met.

    Dear all,
    As stated in the question, what does {tag_image_value} from webapps return when no image has been uploaded by users. I understand that there is an OnError function that can be called if there isn't any image. However it does not do so.
    I am creating a program which will check to see if {tag_image_value} contains an image. If it does not, the error will call an external javascript to remove the div such that it removes any subsequent codes in the later parts of the codes. Below is part of the program:
    I have tried to compare the value to NULL, 0, -1 and "" using if-else functions but they do not work. The slideshow wrapper is part of the code from the following theme: 2027 E Colfax Ave Denver
    The theme will cycle through the pictures, my purpose is to remove the pictures if the images are not present.
       <!------------------------------------------------ Remove picture if not uploaded ------------------------------------------------>
    <script language="JavaScript">
    function noimg1() {
         $( "#shownpicture1" ).remove();
         return;
    function noimg2() {
         $( "#shownpicture2" ).remove();
         return;
    function noimg3() {
         $( "#shownpicture3" ).remove();
         return;
    function noimg4() {
         $( "#shownpicture4" ).remove();
         return;
    </script>
            <!------------------------------------------------ End of remove picture if not uploaded ------------------------------------------------>
    <div class="slideshow-wrapper slider">
    <div class="preloader"></div>
    <ul data-orbit="data-orbit" data-options="bullets:false;animation:fade;">
        <div style="display: block;" id="shownpicture1">
        <li class="active" style="z-index: 4; margin-left: 0%; opacity: 1;"><img alt="{tag_name_nolink}" onerror="noimg1()" src="{tag_image 1_value}" /></li>
        </div>
        <div style="display: block;" id="shownpicture2">
        <li style="z-index: 2; margin-left: 100%; opacity: 1;" class="active"><img alt="{tag_name_nolink}" onerror="noimg2()" src="{tag_image 2_value}" /></li>
        </div>
        <div style="display: block;" id="shownpicture3">
        <li style="z-index: 2; margin-left: 0%; opacity: 1;" class="active"><img alt="{tag_name_nolink}" onerror="noimg3()" src="{tag_image 3_value}" /></li>
        </div>
        <div style="display: block;" id="shownpicture4">
        <li style="z-index: 2; margin-left: 0%; opacity: 1;" class="active"><img alt="{tag_name_nolink}" onerror="noimg4()" src="{tag_image 4_value}" /></li>
        </div>
    </ul>
    </div>
    <!-- //.slideshow-wrapper -->

    When I put in the code it doesnt work. I went into the page to check and it seems that the preloader changes some elements of the code :
    <div class="slideshow-wrapper slider">
        <div class="preloader"></div>
        <div class="orbit-container">
            <ul class="orbit-slides-container" data-orbit="data-orbit" data-options="bullets:false;animation:fade;" style="height: 26px;">
                <li class="active" style="z-index: 2; margin-left: 100%; opacity: 1;">
                    <img alt="{tag_name_nolink}" onerror="noimg1()" src="">
                    </img>
                </li>
                <li class="active" style="z-index: 2; margin-left: 100%; opacity: 1;">
                    <img alt="{tag_name_nolink}" onerror="noimg2()" src=""></img>
                </li>
                <li class="active" style="z-index: 4; margin-left: 0%; opacity: 1;">
                    <img alt="{tag_name_nolink}" onerror="noimg3()" src=""></img>
                </li>
                <li class="active" style="z-index: 2; margin-left: 100%; opacity: 1;"></li>
            </ul>
            <a class="orbit-prev">
                <span></span>
            </a>
            <a class="orbit-next">
                <span></span>
            </a>
            <div class="orbit-timer paused">
                <span></span>
                <div class="orbit-progress" style="width: 0%;"></div>
            </div>
            <div class="orbit-slide-number">
                <span></span>
                 of
                <span></span>
            </div>
        </div>
    </div>
    I tried putting this into the top of my template layout before the code starts:
    <script>
    $('.slideshow-wrapper slider .orbit-container ul li img').each(function(){
    if( $(this).attr('src') == "" ){
    $(this).parent.remove();
    $('.slideshow-wrapper slider ul li img').each(function(){ 
      if( $(this).attr('src') === '' ){ 
      $(this).parent.remove(); 
    $('.slideshow-wrapper slider ul li img').each(function(){ 
      if( $(this).attr('src') == '' ){ 
      $(this).parent.remove(); 
    </script>
    All 3 variants cannot work. Is there something wrong with the way I do the scripting?

  • Need to remove password when starting computer and ECT

    I have posted a few times, but I think I only got one response, I have a few problems with this laptop Model # Satellite A135-S4527.So I'm going to list them and maybe some can help,other wise I may take a hammer to this laptop.
    1: I put a password on my computer and I need to know how to get it off .
    2: My text size keeps changing from large to very small ( I can barely read it) I have tried everything that I have read   to fix it but it doesn't help.
    3: Now my laptop has started going to lock up computer by it's self and I keep having to log in again over and over. 
    4: And for some reason I must be stupid because when I get in here, I can never find if some one answered,  I'm sure I
      have other problems but my brain just went dead, I do hope some one will be able answer these problems
    Thanksshirley53

    First off, ALWAYS provide the COMPLTETE Model Number of your system when you post.  WIthout that we are flying blind.  Also, it helps to tell us what operating system you are running.
    Number 4 is easy.  Click on your user name and it will show you every thread you have started as well as every post you have made.
    You'll need to be more specific on which password you need removed as there are several possibilities.
    You need to run chkdsk/r to clean up the hard drive.  Go to Start - All Programs - Accessories - Command Prompt and type in  chkdsk/r  then hit enter.  Type in Y when it asks if you want to run this at the next boot and then restart the computer.  This could take over an hour depending on how screwed up your hard drive has become.  These instructions are for WIndows XP.  Vista might be slightly different, but I don't have a Vista system available at the moment to check.
    I have no idea about the text size change.  I've never run into that before, but there are posts in your previous threads about this.
    If you don't post your COMPLETE model number it's very difficult to assist you. Please try to post in complete sentences with punctuation, capitals, and correct spelling. Toshiba does NOT provide any direct support in these forums. All support is User to User in their spare time.

Maybe you are looking for

  • XDP data transfer not working

    Our process involves filling out a submission form, sending the data to the approval form, and then viewing that approval form. Essentially a simple submission and approval workflow. When we export the XML of the approval form to see what data was pa

  • Airport Express that works for I while and then quits

    I have an airport express that I connect with an Ethernet wire to my wifi network base station to be able to extend the wifi to other areas of the house. It used to work perfectly and I had the green light on it for days and days on, in fact it never

  • Costing in cProjects

    Hi, I have defined the project role type and asigned cost to it.Later i hav assigned the resource to that role type. I am not able to view the cost for Proj Role type in costing tab and getting an errot that cost/revenue rate is not defined forOrg 00

  • File or assembly name xpportlet.dll, or one of its dependencies, was not found.

    I installed EDK 5.02 + Ver 2.x of .Net Controls, referencing in Web.config the following (below). I compile project no problem. I come to run from my web server, I get this error above. Why is xpportlet.dll being called? I thought this was done away

  • License of Oracle

    we creating Oracle datawarehouse through OBIEE for that we need licenses information and if link available in net