Displaying a zero in a field

Here is how my application works:
Essentially, I have permit numbers, most of which own tags.
I want to show a report for each permit number, which lists those tags if they exist. But if the permit does not have tags, the frame with the "Number of Tags Issued" data should report a 0, instead of not showing up at all.
In my report, I have a group based on a query that selects a COUNT of tags from the join of 2 tables. I display this count in the "Number of Tags Issued" field in a frame that is based on that group.
Problem: If the count is null, then no row will be returned by the query. Thus the label in the frame will not show up at all. But that is not what I want. I want the field in my frame to display a zero, indicating that there are no tags. I'm not sure how to do that.
Here is the SQL in my group:
SELECT COUNT (t.tag_number) Tag_Count, t.tag_status, tow.permit_number
FROM tag t, tag_owner tow
WHERE t.tag_number = tow.tag_number
AND t.order_number = tow.order_number
AND tow.tag_owner_end_date IS NULL
GROUP BY t.tag_status, tow.permit_number;
As you can see, if there simply is no Tag_Count for a given permit number, then no row will return and the frame will not even display.
Can someone show me how to handle this situation. Thanks.

Thanks for all of your suggestions. After doing some Metalink research and some trial and error, I discovered that the solution is to:
1. Create a formula column in my master query. This column is based on a function that uses a SQL query with an outer join. If the given permit has no tags, then the function returns a 0.
You were essentially on the right track regarding the outer join, but I didn't describe all of the queries in my report, so it was not possible for you to understand the data structure the report is based on, and thus you couldn't get the SQL right.
To clarify: My master query selects rows from a print_queue table, which contains one row for each report request, as well as from a table called gillnet_vessel. Thus, the formula column had to be created in that query. Notice that the formula column has to reference gillnet_vessel, since it contains the permit numbers -- the inclusion of this table is what lets me do the outer join. The function looks like this:
function CF_1Formula return Number is
-- Declare a variable to hold the tag count.
tag_count NUMBER;
BEGIN
-- Return a count of tags. If the given permit number has no tags, then return 0.
SELECT COUNT (t.tag_number)
INTO tag_count
FROM tag t, tag_owner tow, gillnet_vessel gv
WHERE t.tag_number = tow.tag_number
AND t.order_number = tow.order_number
AND gv.permit_number(+) = tow.permit_number
AND gv.permit_number = :permit_number
AND tow.tag_owner_end_date IS NULL
GROUP BY t.tag_status, tow.permit_number;
RETURN (tag_count);
EXCEPTION
WHEN NO_DATA_FOUND THEN
RETURN(0);
END;
2. Create a boilerplate text item with a format trigger that controls when it is displayed. If the formula column returned 0 then display the text item. And the text item's text is of course, '0'. Here is the function in the trigger:
function B_1FormatTrigger return boolean is
BEGIN
IF :CF_Tag_Count = 0 THEN
RETURN (TRUE);
ELSE
RETURN (FALSE);
END IF;
END;
Edited by: Prohan on Sep 15, 2009 1:05 PM

Similar Messages

  • F8as2-displaying leading zeros in a dynamic text field

    F8as2-
    Background:
    Currently I have to use two different text fields to display 10000 due to the different font sizes.
    The 10 is a larger font and the 000 is a smaller font.  When I assign '0 'to the dynamic text fields of the smaller font I get just that a '0' not a '000' which is what I want.
    Question:
    Is there an easy way to display leading zeros in a dynamic text field?  Or can a dynamic text field have different character positions displayed in different font sizes?  or both?
    Thanks for the help.

    F8as2-
    Thanks for the reply kglad.
    Are for saying the best way to display numerically calculated numbers that need leading zeros and or different font sizes is to convert them to a string for display purposes with textFormatting??

  • How can i avoid leading zeros for a field in smartform?

    how can i avoid leading zeros for a field in smartform?

    Hi,
    Using the Symbols.
    &symbol(Z)&  Omit Leading Zeros  &symbol(S)&  Omit Leading Sign 
    &symbol(<)&  Display Leading Sign to the Left 
    &symbol(>)&  Display Leading Sign to the Right 
    &symbol(C)&  Compress Spaces 
    &symbol(.N)&  Display upto N decimal places 
    &symbol(T)&  Omit thousands separator 
    &symbol(R)&  Right justified 
    &symbol(I)&  Suppress output of the initial value 
    Regards,
    Shiva Kumar

  • Display Leading Zeros in bex query

    Hi,
    I am new to BI and need to display leading zeros in bex report.
    There is an info-object billing number which is of type CHAR. The values, 00001 - 00010 has been given in the CSV file.
    when i generate the same in IP, the leading zeros are mentioned, but the same is not appearing in the bex query.
    I have tried ALPHA conversion but this has no affect on the output.
    How to achieve the same??
    thanks in advance for the answers

    Hi,
    To answer your question in detail, there is a  conversion routine at infoobject level( Tab- general ), that determines how the values are displayed in the front end. For ex, alpha conversion routine takes away the leading zeros when you display the value in query. ( 0001 displayed as 1 )
    Assuming this is custom infoobject, I would suggest you to remove the conversion routine from the infoobject. This will help you in displaying leading zeros in the report.
    However, you have to ensure that all the values loaded for this infoobject is properly alpha converted ( packed with leading zeros ) by adding a field routine in the transformation. This will avoid same values getting stored with different internal formats like 01,001 etc.
    Hope this explains.
    Thanks.

  • How to add leading zeros to kunnr field

    Hi All,
    I need to add leading zeros to KUNNR field runtime.
    i.e for some customer it is displaying '2001084606'
    some customer's it si displaying '10434'.
    I want add leading zeros when customer length is
    not equal to ten '10'.
    plz kind let me know this is urgent.
    Regards
    Bhaskar

    Hi there,,
    Kunnr is using a dataelement with Char 10.
    You can do in this fashion to resolve your issue.
    len = strlen (itab-kunnr).
    len is having the lenght of the customer number.
    if len < 10..
       while len < 10.
          concatenate '0'  itab-kunnr into temp_text.
          add 1 to len.
       endwhile.
    endif.
    now finally you can assign temp_text to your itab-kunnr.
    hope this way you can resolve your issue.
    if found helpful,, don't forget to reward points.
    Thanks-
    Rahul.

  • Display leading zeros in OLE

    Hi Friends,
    When I am writing report in OLE( excel ), some of the fields which are having leading zeros automatically deleted . It shoud not happen . I have to display leading zeros also.
    Please tell me which class and method to do this ...
    Thanks ,
    Varma

    Use OLE itself to set the formatting of the cell (or column itself) to character type
    * character type for columns
    data: h_columns        TYPE ole2_object,
          h_cell           TYPE ole2_object.
    CALL METHOD OF excel 'Columns' = h_columns
      EXPORTING
        #1 = 'F:K'.
    set property of h_columns 'NumberFormat' = '@'.
    CALL METHOD OF excel 'Cells' = h_cell
      EXPORTING
        #1 = 14
        #2 = 7.
    SET PROPERTY OF h_cell 'Value' = '0001'.

  • How can we remove the following zeros from quantity field ?

    Hi All.
    how can we remove the following zeros from quantity field while populating ALV by using FM REUSE_ALV_GRID_DISPLAY ?
    eg:getting output zqty = 2.000
    but i need           zqty = 2.
    help me to reslove this issue.
    Regards.
    jay

    Hi,
      While populating the field catlog do the following thing to   avoid zeros.
      wa_fieldcat-tabname = 'I_OUTPUT'.    " Curr
      wa_fieldcat-fieldname = 'FWAER'.
      wa_fieldcat-seltext_l = text-023.
      wa_fieldcat-no_zero = 'X'.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR  wa_fieldcat.
    Thanks,
    Khushbu.

  • Master-detail: detail field not displayed after changed by master field

    I want to use the Depends on item with Clear/refresh value functionality in a master detail situation. Within the same group it is no problem to use the setter method of a field to change a second field and then displaying this new value. But in the detail group, I can not select items from the master group as a depends on item.
    In the setter of the master field, the value in a field for each row in the detail (table layout) is updated. The only problem is that this updated value is not displayed, the old value doesn't change. When saving the changes, the displayed value is committed to the database. When de updated field is not displayed at all, the correct value is saved, so I know the detail field is updated.
    How can I make sure the displayed value in the detail is displayed after changeing a master field? I already gave the detail field the correct partial trigger.

    Wouter,
    I guese you don;t see the changed value when you display the detail item because after the depends on item update changed the detail item, JSF procesing continues and the detail table changes are sent to the server which will override again the detail item attriibute, resetting it to the old, still displayed value.
    So, the trick is to get PPR working. Make sure the partialTYriggers property of the detail item is set to the value of the id property of the master item. If it still doesn't work, try setting the partial triggers property on the table, instead of the individual item.
    Steven Davelaar,
    JHeadstart team

  • How to display F4 values in one field based on other field selection

    Hi All,
    How to hide a UI element (i.e Link to action) highlited for Normal User and display the same to super user.
    Component Name : /SAPSRM/WDC_DODC_SC_GAF_C
    2.Can i know how to display  the entries in supplier field based on Product category selection.
    Right now all the entries are getting displayed in the supplier field.
    I want to display only entries based on Product category.
    Search Help Name : BBP_BUPA_CLL_PARTNER
    Component Name : /SAPSRM/WDC_DODC_SC_I_LIM
    How to enhance the web dynpro component with the filtered values.
    Regards,
    Krish.

    Hi Ashvin,
                 Thanks for the document. In the search help there is a standard FM which is getting executed.
    Can i enhance that FM or should i copy and edit.
    BBP_F4IF_SHLP_EXIT_CLL_PARTNER
    If i creata a Z FM and make changes how to pass that values to my standard Component View UI Element.
    If not then suggest me some alternative.
    Regards,
    Krish

  • Display values of a single field in a multiple rows in a table region

    Hi Tech-Gurus,
    I want to display values of a single field ( which is in a table region) in multiple rows and also need to restrict the values from decimal number. If i click save, then it will throw exception "Decimal not allowed".
    xxxxxx
    yyyyyy
    Reg.No
    1234
    5678
    7654
    I need to display the values of REG.NO in different rows like,
    1234
    5678
    7654
    and also need to validate as well against Decimal values.
    Please help me with the code how i will iterate ?

    Hi,
    I am assuming you are talking about displaying substrings from the Reg No in different rows. For this you would need to write a query which identifies the substrings and creates a separate row for each (ensure you choose values for all other columns in the table row). Kindly let me know if the understanding is incorrect.
    To validate against decimal value you can use the java code by checking the difference of the number and the number on which modulus has been applied. Hope that helps.
    Regards
    Sumit

  • Want to display a space after last field in the output txt file

    hi
    I want to display a space after last field in the output txt file which is generaed by my program on utility server the last field lengyt we have defined is four and in database it is of three characters and requirement is to disppaly the last fourth field as space in the output file w hich is not shown as the txt file automatically gets closed at the third place as it is the last field in the record and ind atabase records are of therss char only but user wants to display this fourth position in the notepad output file as space ( which is last field in the output file)
    eg
    name house  street country
    record output coming in file
    ram   h3      street3  thn      now this thn which is last field the notepad get closed at thn only
    i want to display one space in last field for the whole of output file
    ie ram      h3   street3  thn(space)
        sham   h4  street4   sgp(space)  so on......
    we need to show this space in the output file as blank
    regards
    Arora

    hi Atish
    i am using
    loop at gt_sagadr_outtab into wa_sagadr_outtab
    move wa_sagadr_outtab-country to wa_sagadr_text+223(226).
    endloop
    in this last field ie country i need to display the last 226 as blank as only country key is two char in database so the last space is not shown
    i am not unsing the fM as tolb by  you
    and afterwards
    i am usning
    Concatenate 'Sagadr_' sy-datum sy-uzeit '.dat' into gv_filename_sagadr.
    CALL FUNCTION 'FILE_GET_NAME'
      EXPORTING
      CLIENT                        = SY-MANDT
        LOGICAL_FILENAME              = gc_lfile
        OPERATING_SYSTEM              = SY-OPSYS
        PARAMETER_1                   = gc_param1
        PARAMETER_2                   = gc_send
        PARAMETER_3                   = gv_filename_sagadr
      USE_PRESENTATION_SERVER       = ' '
      WITH_FILE_EXTENSION           = ' '
      USE_BUFFER                    = ' '
      ELEMINATE_BLANKS              = 'X'
      IMPORTING
      EMERGENCY_FLAG                =
      FILE_FORMAT                   =
        FILE_NAME                     =  gv_filepath_sagadr
    EXCEPTIONS
      FILE_NOT_FOUND                = 1
      OTHERS                        = 2
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    and lastly
    open dataset gv_filepath_sagadr for output in text mode encoding default.
        if sy-subrc eq 0.
         loop at gt_sagadr_text into wa_sagadr_text.
         transfer wa_sagadr_text to gv_filepath_sagadr.
         endloop.
        endif.
       close dataset gv_filepath_sagadr.
        if sy-subrc = 0.
        message S002 with gv_filepath_sagadr. "Files & created on Application server
        endif.
    SO NOT SURE WHERE TO USE THE CODE AND HOW

  • Displaying images in dynamic text fields

    Hi, I am having some difficulty getting my images to display
    in a dynamic text field. The images are linked from a txt file with
    the <img src=""> tag however they are not showing up in the
    text area. The rest of the html are rendering fine except the image
    tag. My example online is here:
    www.supernaturalmedia.com.
    Here is the code I used in Flash:
    var style_sheet = new TextField.StyleSheet();
    var css_url = "global.css";
    style_sheet.load(css_url);
    news.StyleSheet = style_sheet;
    loadVariables("projects_news.txt", this.news);
    My css styles also isn't loadin so i temporarily am using
    html styles for formatting. I'd like to get the css to work as
    well.
    My movie is published as Flash Player 6, AS 2.0.
    I'd appreciate any helpful advice.
    Thanks,
    Stanton

    1. don't assign the stylesheet property of your textfield
    until loading of global.css is complete. ie, use the onLoad handler
    for stylesheets.
    2. you have movieclip images that are linked for export and
    you're using their linkage id in src property of the img
    tag?

  • Material workbench displays a zero quantity

    Dear All,
    When I did a Miscellaneous Issue of an item, it was still showing onhand quantity
    Item Available is 1 No
    Did Miscellaneous Issue: 1 No
    Not available in the Transactions Temp (pending Transactions)
    but now in the Material Workbench the item is displayed with zero onhand
    that means the item is showing but the quantity is mentioned as zero
    when i checked the backend, i can see there are 2 records in the mtl_onhand_quantities,
    1 record created while doing a Miscellaneous Receipt with transaction quantity as 1
    and the 2nd record of the Miscellaneous issue with transaction quantity as -1
    (Normally when there is no Onhand of an item there will not be any records available in the mtl_onhand_quantities. why this kind of strange thing is occuring. WHy in the back end two records and in the front end it displays with zero value in the material workbench.
    please shower some light into this issue
    many thanks in advance
    best regards,

    Here is the query
    select msi.segment1,msi.organization_id,sum(nvl(transaction_quantity,0)) from mtl_system_items_b msi,mtl_onhand_quantities moq
    where moq.inventory_item_id (+) = msi.inventory_item_id
    and moq.organization_id (+) = msi.organization_id
    and msi.organization_id = &org_id
    and exists (select 1 from mtl_material_transactions mmt
    where mmt.organization_id = msi.organization_id and mmt.inventory_item_id = msi.inventory_item_id
    and mmt.transaction_quantity !=0 )
    group by msi.segment1,msi.organization_id,moq.subinventory_code
    having sum(nvl(transaction_quantity,0)) = 0
    Check the explain plan and cost before running the query
    The exists clause restricts the records only to those items that had some transactions
    Hope this helps
    Sandeep Gandhi

  • Only zeros in ALEAUD field E1ADHDR / E1STATE / DOCNUM

    Hi,
    i m working with a scenario SAP ECC 7.0 -> IDoc -> PI -> IDoc -> R/3 4.6c
    I m sending a purchase order (ORDERS.ORDERS05) from SAP ECC and i want to receive an acknowledgment from R/3. Unfortunately there are only zeros in the field E1ADHDR / E1STATE / DOCNUM, this leads to the error "ALEAUDIT IDoc cannot find request IDoc in Integration Server" on PI.
    Does anybody know what to do in the R/3 system to send the original IDoc number in E1STATE / DOCNUM?
    Regards,
    Udo

    Hi Alexander did you get to solve the problem with the empty DOCNUM field in ALEAUD?
    In your first post you stated that you were dealing with an IDoc-to-File scenario but then you mention that JDBC adapter doesn't support acknowledgements. I found that a bit confusing.
    I managed to get system acknowledgements from File adapter but the ALEAUD idoc received by R3 is missing some fields (like DOCNUM and STATXT) in E1STATE segment.
    Can somebody enlight me with this problem without posting any link (i have already visited all of them without an answer to my question).
    Thanks in advance,
    Nicolá

  • How to display icon symbols for a field in se38 program

    HI
    IAM VIJAY. PLS GIVE ME THE SOLUTION .
    how to display icon symbols for a field in se38 program.
    WITH REGARDS.
    VIJAY.

    Hi
    you cab use INCLUDE <ICON> and use standard icons provided by sap.
    Sample code:
    WRITE /20(2) ICON_DATE AS ICON.
    WRITE /20(2) ICON_TIME AS ICON.
    WRITE /20(2) ICON_ADDRESS AS ICON.
    Thanks!!

Maybe you are looking for