Auto-Generate mail for database performace reporting.

Hello,
i have many server to keep an eye on for maintenance but, now the number for it is growing day by day. Its difficult for me to keep a watch on each in detail. So I have an idea to implement.
I want to make a script which will auto generate a mail from the server & send it to my email id with all the details of database. Basically performance related details.+
Is it possible to do so ???? I know how to send a mail with attachment, the code i will use is given below.+
please suggest me how can i attach my performance tuning queries  output & get those things in my mail on a daily basis......
thanks in advance .....
DECLARE
v_From VARCHAR2(80) := '[email protected]';
v_Recipient VARCHAR2(80) := '[email protected]';
v_Subject VARCHAR2(80) := 'test subject';
v_Mail_Host VARCHAR2(30) := 'mail.mycompany.com';
v_Mail_Conn utl_smtp.Connection;
crlf VARCHAR2(2) := chr(13)||chr(10);
BEGIN
v_Mail_Conn := utl_smtp.Open_Connection(v_Mail_Host, 25);
utl_smtp.Helo(v_Mail_Conn, v_Mail_Host);
utl_smtp.Mail(v_Mail_Conn, v_From);
utl_smtp.Rcpt(v_Mail_Conn, v_Recipient);
utl_smtp.Data(v_Mail_Conn,
'Date: ' || to_char(sysdate, 'Dy, DD Mon YYYY hh24:mi:ss') || crlf ||
'From: ' || v_From || crlf ||
'Subject: '|| v_Subject || crlf ||
'To: ' || v_Recipient || crlf ||
'MIME-Version: 1.0'|| crlf ||     -- Use MIME mail standard
'Content-Type: multipart/mixed;'|| crlf ||
' boundary="-----SECBOUND"'|| crlf ||
crlf ||
'-------SECBOUND'|| crlf ||
'Content-Type: text/plain;'|| crlf ||
'Content-Transfer_Encoding: 7bit'|| crlf ||
crlf ||
'some message text'|| crlf ||     -- Message body
'more message text'|| crlf ||
crlf ||
'-------SECBOUND'|| crlf ||
'Content-Type: text/plain;'|| crlf ||
' name="excel.csv"'|| crlf ||
'Content-Transfer_Encoding: 8bit'|| crlf ||
'Content-Disposition: attachment;'|| crlf ||
' filename="excel.csv"'|| crlf ||
crlf ||
'CSV,file,attachement'|| crlf ||     -- Content of attachment
crlf ||
'-------SECBOUND--'               -- End MIME mail
utl_smtp.Quit(v_mail_conn);
EXCEPTION
WHEN utl_smtp.Transient_Error OR utl_smtp.Permanent_Error then
raise_application_error(-20000, 'Unable to send mail: '||sqlerrm);
END;
/

I like your script idea.
You can spool output to a file and mail the file to yourself.
What OS are you running?
On linux a simple starter script would look like this:
#!/bin/bash
echo `date`
# Set the Environmental variable for TESTDB instance
. /u01/app/oracle/dba_tool/env/TESTDB.env
$ORACLE_HOME/bin/sqlplus -s system/<PASSWORD> <<EOF
@/u01/app/oracle/dba_tool/TESTDB/quickaudit
EOF
echo `date`
mailx -s "Check database on TESTDB" [email protected] < /tmp/quickaudit.lst
----------------------sample ENV file--------------------------------------
ORACLE_BASE=/u01/app/oracle
ULIMIT=unlimited
ORACLE_SID=TESTDB
export ORACLE_TERM=xterm
ORACLE_HOME=$ORACLE_BASE/product/11.2.0
ORA_NLS33=$ORACLE_HOME/ocommon/nls/admin/data
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
LIBPATH=$LD_LIBRARY_PATH:/usr/lib
TNS_ADMIN=$ORACLE_HOME/network/admin
PATH=$ORACLE_HOME/bin:$ORACLE_BASE/dba_tool/bin:/bin:/usr/bin:/usr/ccs/bin:/etc:/usr/sbin:/usr/ucb:$HOME/bin:/usr/bin/X11:/sbin:/usr/lbin:/GNU/bin/make:/u01/app/oracle/dba_tool/bin:/home/oracle/utils/SCRIPTS:/usr/local/bin:
export ORACLE_BASE ORACLE_SID ORACLE_TERM ULIMIT
export ORACLE_HOME
export LIBPATH LD_LIBRARY_PATH ORA_NLS33
export TNS_ADMIN
export PATH
--------------------Starter reporting script--------------------------------------------------
SET ECHO OFF
SET TERMOUT OFF
REM Revisions:
REM Date ID Version Description
REM -------- -- ------- ----------------------------------------------------|
REM 10/07/05 1.0 Script to check for database issues
SPOOL /tmp/quickaudit.lst
SELECT SYSDATE FROM DUAL;
SHOW USER
SET TERMOUT ON
SET VERIFY OFF
SET FEEDBACK ON
PROMPT
PROMPT Checking database name and archive mode
PROMPT
column NAME format A9
column LOG_MODE format A12
SELECT NAME,CREATED, LOG_MODE FROM V$DATABASE;
PROMPT
PROMPT ------------------------------------------------------------------------|
PROMPT
PROMPT
PROMPT Checking database versions
PROMPT
column BANNER format A64
select * from v$version;
PROMPT
PROMPT ------------------------------------------------------------------------|
PROMPT
PROMPT
PROMPT Checking control file(s)
PROMPT
column STATUS format a7
column NAME format a68
column IS_RECOVERY_DEST_FILE format a3
set linesize 110
SELECT * FROM V$CONTROLFILE;
PROMPT
PROMPT ------------------------------------------------------------------------|
PROMPT
PROMPT
PROMPT Checking redo logs and group(s)
PROMPT
column member format a70
set linesize 110
set pagesize 30
SELECT group#, member FROM v$logfile;
PROMPT
PROMPT -----------------------------------------------------------------------|
PROMPT
PROMPT
PROMPT ------------------------------------------------------------------------|
PROMPT
PROMPT
PROMPT Checking freespace by tablespace
PROMPT
column dummy noprint
column pct_used format 999.9 heading "%|Used"
column name format a16 heading "Tablespace Name"
column bytes format 9,999,999,999,999 heading "Total Bytes"
column used format 99,999,999,999 heading "Used"
column free format 999,999,999,999 heading "Free"
break on report
compute sum of bytes on report
compute sum of free on report
compute sum of used on report
set termout off
set pagesize 40
select a.tablespace_name name,
b.tablespace_name dummy,
sum(b.bytes)/count( distinct a.file_id||'.'||a.block_id ) bytes,
sum(b.bytes)/count( distinct a.file_id||'.'||a.block_id ) -
sum(a.bytes)/count( distinct b.file_id ) used,
sum(a.bytes)/count( distinct b.file_id ) free,
100 * ( (sum(b.bytes)/count( distinct a.file_id||'.'||a.block_id )) -
(sum(a.bytes)/count( distinct b.file_id ) )) /
(sum(b.bytes)/count( distinct a.file_id||'.'||a.block_id )) pct_used
from sys.dba_free_space a, sys.dba_data_files b
where a.tablespace_name = b.tablespace_name
group by a.tablespace_name, b.tablespace_name;
PROMPT
PROMPT ------------------------------------------------------------------------|
PROMPT
PROMPT
PROMPT Checking for invalid objects
PROMPT

Similar Messages

  • .Once the billing document is saved, then an auto-generated mail along with

    please provide me with solution on this real time ticket..
    Once the billing document is saved, then an auto-generated mail along with PDF copy of  invoice has to trigger to customer contact person.

    please provide me with solution on this real time ticket..
    Once the billing document is saved, then an auto-generated mail along with PDF copy of  invoice has to trigger to customer contact person.

  • Auto generate index for FK

    Where is option like 'auto generate index for FK' in DataModeler 4.0.3?

    You need to right-click on the Browser node for the Design and select Properties.
    In the Design Properties dialog you will find the Automatic Index Generation option for FKs on the Settings > DDL page.
    David

  • How to get "Synchronize with database" to compare/generate changes for database 'contexts'?

    Hi
    Using SDDM 3.3.
    How does one get to synchronise changes/differences in 'contexts' (defined in physical model - Oracle DB)?
    I have tried to synchronize both ways, i.e. model to db and db to model, but never does it show the DDL necessary to create the missing context.
    Yes, Context is selected/ticked under preferences for Oracle DB synchronization preferences.
    Thank you & Regards

    Hi Philip
    If I use the "generate DDL" option from the toolbar, it does generate DDL for the context I have in the physical model.  I can select/deselect them in the DDL Generation Options window.
    Why then would it not generate DDL when comparing the model with the database, i.e. using the "synchronise data dictionary to model" option?  It successfully generates a 'patch'/change script for tables, views, packages, etc.?
    Thank you & Regards
    PS.  I am asking for a way to get it to generate me a complete 'patch'/change script.

  • Auto-Generated Number For All Users

    We're on Lync Server 2013, running a front-end pool consisting of 3 front-end servers. Users are VoIP enabled. We're seeing some inconsistent behavior while right-clicking an user and selecting the "Call" option. Even though the respective target
    users don't have an "Other" phone number set in AD, the Lync client seems to be somehow auto-generating a normalized entry and presenting this as an "Other" entry in the contextual menu that allows calls. The entry always begins with +1
    (425). Strange enough, this is the prefix used in some sample normalization rules in a Microsoft article
    here.
    Even though Dial Plans - to my understanding - shouldn't alter this (they only apply normalization rules for manually dialed numbers only), I've searched through all the normalization rules but there's none that start with +1 (425). I've also tried running
    ABSConfig, yet this tool crashes systematically on multiple machines (the Lync servers have updates dating from less than 2 months ago).
    Also - there's no normalization .txt file created in the ABFiles in the Lync Share, as in
    this article. Taking a look in the local GalContacts.db file shows the regular phone numbers, but not this one - hinting that it's something the Lync client creates on the fly. Additionally, no Lync Address Book Web Query is visible in Fiddler when browsing
    through the users' phone numbers in the Lync client.
    Adding to the problem is that some users see the "Other" entries, while others don't - eg. user X right clicks user Z and sees a wrong "Other" entry, while user Y right clicks user Z and doesn't see any wrong entry containing "Other".
    First question is what could trigger this behavior in the client ? Secondly, has ABSConfig.exe become broken by a recent update ?

    According to the 2nd article - I've created an empty Company_Phone_Number_Normalization_Rules.txt file and placed it in the Lync file share, in order to avoid any suspicion that the built-in file might be used. I've updated the address book but unfortunately
    can't restart the FE services at this time. There's no still no change in the client.
    Yet - the problem here is the numbers shown aren't present in the files making up the Lync address book inside the local user's sip profile folder.

  • Need to auto-generate SDK for REST web service.

    My company has developed a REST API for some web services, and we'd like to provide users with a Java SDK for consuming those services.
    Our services are described by an XSD schema. On the backend, we are using JAXB to create Java classes corresponding to the schema. We create the request objects based on the parameters in the REST url, and JAXB converts our response objects from Java to XML.
    We'd like to provide our users with similar Java classes on the client side. They should be able to create the object corresponding to the request, fill in various parameters, and submit it to our web service. The SDK should automatically convert the object into a REST URL, hit the URL with a Get, read the XML response, and convert that response into Java objects.
    It seems like we should be able to auto-generate such an SDK based on our schema.
    It seems like there are several tools for doing this for SOAP web services. For example, Apache Axis has Java2WSDL and WSDL2Java.
    Can anyone recommend tools for creating client-side libraries for consuming RESTful web services? Does anyone have advice on products to avoid?

    Replying to my own post here. The WADL2Java project on java.dev seems to be more like what I need. The only user-experience I've seen on the 'net is in this forum post:
    http://forum.java.sun.com/thread.jspa?threadID=5239123&tstart=0
    Anyone else used it?

  • Creating an auto-generating menu for fluxbox

    Fluxbox is one of the best wms for linux. If there's something that could replace any desktop, with low resources consumption, still being accessible and handy, than that's Fluxbox. The thing is when you install Fluxbox for the first time you feel something is lacking. That thing is the possibility of an auto-generating menu. Of course there's
    fluxbox-generate_menu
    and other likewise possibilities  but they kinda fail in doing what they should.   I'm a bit new to programming and even fresher when it comes to scripting in linux but I've though of a script that could do just that as it follows:
    #!/bin/bash
    while true
    do
    men="ArchSoft"
    ver=$(grep "$men" ~/.fluxbox/menu | sed 's/.*(//; s/).*//' | tail -1)
    if [ $men == $ver ]
    then
    data="$(date +%Y-%m-%d\ %k:%M)"
    data2="$(grep "$data" /var/log/pacman.log | grep installed | sed "s/\[//g; s/\].*//g" | tail -1)"
    if [ "$data" == "$data2" ]
    then
    nr="$(grep "$data" /var/log/pacman.log | grep installed | wc -l)"
    int=$(seq 1 $nr)
    for i in $int
    do
    ch=$(grep "$data" /var/log/pacman.log | grep installed | sed 's/.*installed//g; s/(.*//g; s/ //g' | head -$i | tail -1)
    chr=$(grep "$ch" ~/.fluxbox/menu | sed 's/.*(//; s/).*//' | tail -1)
    chb=$(ls /usr/bin | grep "$ch" | sed "s/.*$ch.*/$ch/" | tail -1)
    la=$(ls /usr/share/icons/hicolor/48x48/apps | grep $ch | sed "s/.*$ch.*/$ch/"| tail -1)
    lb=$(ls /usr/share/pixmaps | grep $ch | sed "s/.*$ch.*/$ch/" | tail -1)
    if [ $ch == $chb ]
    then
    if [ $ch == $chr ]
    then
    echo "there's already a menu entry"
    else
    if [ $ch == $la ]
    then
    sed -i "/^\[submenu\] ($men)$/a[exec] ($ch) {$ch} </usr/share/icons/hicolor/48x48/apps/$ch.png>" ~/.fluxbox/menu
    sleep 1
    fluxbox restart
    elif [ $ch == $lb ]
    then
    sed -i "/^\[submenu\] ($men)$/a[exec] ($ch) {$ch} </usr/share/pixmaps/$ch.png>" ~/.fluxbox/menu
    sleep 1
    fluxbox restart
    fi
    fi
    fi
    done
    fi
    rdata="$(grep "$data" /var/log/pacman.log | grep removed | sed "s/\[//g; s/\].*//g" | tail -1)"
    if [ "$data" == "$rdata" ]
    then
    nrem="$(grep "$data" /var/log/pacman.log | grep removed | wc -l)"
    inrem=$(seq 1 $nrem)
    for i in $inrem
    do
    rem=$(grep "$data" /var/log/pacman.log | grep removed | sed 's/.*removed//g; s/(.*//g; s/ //g' | head -$i | tail -1)
    remr=$(grep "$rem" ~/.fluxbox/menu | sed 's/.*(//; s/).*//' | tail -1)
    if [ $rem == $remr ]
    then
    sed -i "/$rem/d" ~/.fluxbox/menu
    sleep 1
    fluxbox restart
    else
    echo "no menu entry to remove"
    fi
    done
    fi
    else
    sed -i "/^\[begin\] (Fluxbox)$/a[submenu] ($men)\n[end]" ~/.fluxbox/menu
    fi
    clear
    sleep 7
    done
    Explanation:
    I've used
    whilde true
    do
    sleep 7
    done
    to create an endless loop where "sleep" was used so it could take a break, therefore reducing hardware consumption
    men="ArchSoft"
    ver=$(grep "$men" ~/.fluxbox/menu | sed 's/.*(//; s/).*//' | tail -1)
    if [ $men == $ver ]
    then
    else
    sed -i "/^\[begin\] (Fluxbox)$/a[submenu] ($men)\n[end]" ~/.fluxbox/menu
    fi
    This checks if the submenu where everything should automatically be added as entries  are already there, if not it creates them under the beginning of fluxbox menu script with the name ArchSoft. 
    data="$(date +%Y-%m-%d\ %k:%M)"
    data2="$(grep "$data" /var/log/pacman.log | grep installed | sed "s/\[//g; s/\].*//g" | tail -1)"
    if [ "$data" == "$data2" ]
    then
    fi
    this compares the actual data from the system clock with the data of the installed apps shown in pacman .log and if it finds a similar data of the installed apps it procedes to further steps
    nr="$(grep "$data" /var/log/pacman.log | grep installed | wc -l)"
    int=$(seq 1 $nr)
    for i in $int
    do
    ch=$(grep "$data" /var/log/pacman.log | grep installed | sed 's/.*installed//g; s/(.*//g; s/ //g' | head -$i | tail -1)
    chr=$(grep "$ch" ~/.fluxbox/menu | sed 's/.*(//; s/).*//' | tail -1)
    chb=$(ls /usr/bin | grep "$ch" | sed "s/.*$ch.*/$ch/" | tail -1)
    la=$(ls /usr/share/icons/hicolor/48x48/apps | grep $ch | sed "s/.*$ch.*/$ch/"| tail -1)
    lb=$(ls /usr/share/pixmaps | grep $ch | sed "s/.*$ch.*/$ch/" | tail -1)
    if [ $ch == $chb ]
    then
    if [ $ch == $chr ]
    then
    echo "there's already a menu entry"
    else
    if [ $ch == $la ]
    then
    sed -i "/^\[submenu\] ($men)$/a[exec] ($ch) {$ch} </usr/share/icons/hicolor/48x48/apps/$ch.png>" ~/.fluxbox/menu
    sleep 1
    fluxbox restart
    elif [ $ch == $lb ]
    then
    sed -i "/^\[submenu\] ($men)$/a[exec] ($ch) {$ch} </usr/share/pixmaps/$ch.png>" ~/.fluxbox/menu
    sleep 1
    fluxbox restart
    fi
    fi
    fi
    done
    Here  because in pacman.log, the data of installed apps is shown in this manner YY-MM-DD hh:mm I had to consider using "for do", because in a minute a lot of applications can be installed using only a single "$pacman -S apps" command. Therefore I had to add somehow every app installed in a minute, separately to ~/fluxbox/menu. If the data of the installed apps in pacaman.log was show in this manner YY-MM-DD hh:mm:ss, therefore including seconds things would had been a lot more easier and precise, but I had to find a solution to that matter, and that solution was using "for do" .
    Also here it checks if the installed program shows as an executable in /usr/bin and if it has an icon in  /usr/share/icons/hicolor/48x48/apps/ or in /usr/share/pixmaps/, and only than it procedes in adding an entry to fluxbox menu for that app. This was necessary because not all programs installed, that have executables in /usr/bin are meant to be displayed as a fluxbox menu entry. Checking for an icon being a filter and at the same time something kinda useful for the overall aspect of the menu.
    rdata="$(grep "$data" /var/log/pacman.log | grep removed | sed "s/\[//g; s/\].*//g" | tail -1)"
    if [ "$data" == "$rdata" ]
    then
    nrem="$(grep "$data" /var/log/pacman.log | grep removed | wc -l)"
    inrem=$(seq 1 $nrem)
    for i in $inrem
    do
    rem=$(grep "$data" /var/log/pacman.log | grep removed | sed 's/.*removed//g; s/(.*//g; s/ //g' | head -$i | tail -1)
    remr=$(grep "$rem" ~/.fluxbox/menu | sed 's/.*(//; s/).*//' | tail -1)
    if [ $rem == $remr ]
    then
    sed -i "/$rem/d" ~/.fluxbox/menu
    sleep 1
    fluxbox restart
    else
    echo "no menu entry to remove"
    fi
    done
    fi
    This part of the script removes the data from the menu entry pretty much in the same manner it was added, so I won't give further explanations.
    The Trouble:
    Most applications are added and removed just fine in the fluxbox menu entry, but some like chromium are added more than once and after pacman -R app they aren't removed. The script has still a lot of flaws, most of them because I'm new to scripting, but if someone can improve it or give suggestions it would be highly appreciated. Also if anybody that finds the script worthy enough, wants to develop it as his own I have nothing against it, just tell what changes and improvements you have brought as I wanna learn too.
    Also my goal is to make a daemon out of it, any suggestions in this direction would be highly appreciated.
    Thanks for your time and understanding, mostly thanks to those that helped me a bit in understanding the syntax, like  @Karol & @falconindy. You rule, 'cause  you make linux  seam like one big happy family
    George
    Last edited by I'mGeorge (2011-06-20 19:43:08)

    This is an awesome idea. I've wanted to do something like this for a little while, though not in bash...
    Since I'm not great in bash, I may make one in C (for learning) or Python (ditto) and comment on your implementation.
    If I understand right, you're building a menu first, then deleting parts of it as you go. Would it not be smarter to create a function for adding entries and call it only after you've decided whether an app belongs in the menu? Something like this:
    function add_to_menu() {
    # echo whatever to the config file
    if (app is on system && has an icon somewhere in /usr/share or /opt) {
    add_to_menu(foo)
    Personally, I would approach this by using a definition or grouping list (so you can make submenus) and organize your apps that way. I'd probably use an sqlite db or an ini file or some other way to store the heirarchy, then generate the menu. It looks like you've already put a lot of effort into this, though, so I wish you luck on it!

  • Alternate way to generate ORM for database

    Hi,
    Is there an alternate way or method to generate Object Relational Mapping CFC for database that you  get in CF Builder?     The price for CF Builder to use ORM generation alone seems a bit too steep.

    Very few people here use CF.  Did you try posting in the CF Forum?
    http://forums.adobe.com/community/coldfusion
    Nancy O.

  • Database Performace Report

    Hi
    We are having many Oracle 10.2.0.3 instances on Unix and Windows .
    We donot have Enterprise Manager configured and we donot have licence for the diagnostic packs.
    Requirement : My manager wants a Graphical Report for each database intance showing its performace details . He needs the reports monthly .*
    I tried to convince him by generating AWR reports , however he said he is not satistisfied with it because its too technical . He needs something in a graphical format or a presentation format where a non technical person can easily understand some things like :
    1) When was peak load on the database
    2) Which Application was using most resources
    3) Which Table/Object was most queried
    4) Statistics in regards to Disk/Network/CPU
    Actually the report should be similar or a kind of Oracle EM dbcontrol's Persormace Tab where we can see all the graphs at any point of time .
    I have to create a dynamic report every month with the details mentioned above for any point of Time with in the last one month.
    The resulting report can be in Excel or PPT
    Any pointers or Templates to get the result is highly appreciated .
    Thanks

    Ok, I have simulated your problem and I fixed it:
    1- Download the      ojdbc14.jar file from this link: http://www.oracle.com/technetwork/database/enterprise-edition/jdbc-10201-088211.html
    2- In the run.sh file change the content like belows:
    #!/bin/ksh
    # Licensed to the GNU GENERAL PUBLIC LICENSE Version 3
    # ASH Viewer start up batch script
    # Required ENV vars:
    # JAVA_HOME - location of a JDK home dir
    export JAVA_HOME=/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64
    export CLASSPATH=/home/oracle/ashv-3.4-bin/lib
    export JAVA_EXE=$JAVA_HOME/bin/java
    $JAVA_EXE -cp /home/oracle/ashv-3.4-bin/lib  -Xmx128m  -jar ASHV.jar
    ~                                                                       Don't forget to change to your JAVA_HOME, in my case my JAVA_HOME is /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64
    3- don't forget to run the following command in order to convert the file in Linux:
    dos2unix run.sh
    4- Change the permission so the run.sh become executable
    5- Make sure the Oracle system user has the privilege to execute and access the ashv-3.4-bin folder
    6- run ./run.sh
    and you will get the graphs and the screens
    Hope it helps,
    Wissem
    Edited by: orawiss on Apr 9, 2011 3:12 PM

  • Virus in Auto generated mail sent by SAP

    Hi ,
    One of our user has received virus in sales order confirmation mail. Mail was sent directly from SAP to User.
    We are working on hardware part to check the virus but do we have anything to block virus at SAP level or in SOST , SCOT anywhere in messaging loop can we find any virus information.
    Please suggest.
    Shivam

    I would first check if the user who send that mail was indeed the SAP system - or if it was another using faking the identity to be allegedly from the SAP system.
    Markus

  • Auto generated selection screen in Modulepool program

    Hi Experts!!
    How to develop/Desing auto-generated screen for accepting values from the user as criteria for database selections while running a report.
    pls. guide me.
    Thanks in advance

    Use this - two FMS-
    here is the code -
    FORM extended_selection.
      DATA : t_dyn    LIKE rsdsfields OCCURS 0 WITH HEADER LINE.
    *Work Areas.
      DATA : wa_range  TYPE LINE OF rsds_trange,
             wa_ranget TYPE rsds_frange_t,
             wa_line   TYPE LINE OF rsds_frange_t,
             t_selopt  TYPE rsds_selopt_t.
    *Fields to be Put on the dynamic selection screen
      t_dyn-tablename = 'KNA1'.
      t_dyn-fieldname = 'KUNNR'.
      APPEND t_dyn.
      CLEAR  t_dyn.
      t_dyn-tablename = 'CEPC'.
      t_dyn-fieldname = 'PRCTR'.
      APPEND t_dyn.
      CLEAR  t_dyn.
      IF ( ( g_sel IS INITIAL ) OR ( t_ranges[] IS INITIAL ) ).
    *Initialize Free Selection Mode.
        CALL FUNCTION 'FREE_SELECTIONS_INIT'
             EXPORTING
                  kind                     = 'F'
             IMPORTING
                  selection_id             = g_sel
             TABLES
                  fields_tab               = t_dyn
             EXCEPTIONS
                  fields_incomplete        = 1
                  fields_no_join           = 2
                  field_not_found          = 3
                  no_tables                = 4
                  table_not_found          = 5
                  expression_not_supported = 6
                  incorrect_expression     = 7
                  illegal_kind             = 8
                  area_not_found           = 9
                  inconsistent_area        = 10
                  kind_f_no_fields_left    = 11
                  kind_f_no_fields         = 12
                  too_many_fields          = 13
                  dup_field                = 14
                  field_no_type            = 15
                  field_ill_type           = 16
                  dup_event_field          = 17
                  node_not_in_ldb          = 18
                  area_no_field            = 19
                  OTHERS                   = 20.
        IF sy-subrc NE 0.
          MESSAGE e717(db).
        ENDIF.
      ENDIF.
    *Dialog for Selection.
      REFRESH t_ranges.
      CALL FUNCTION 'FREE_SELECTIONS_DIALOG'
           EXPORTING
                selection_id    = g_sel
                title           = 'Extended Selection'(s12)
                as_window       = true
                start_row       = 5
                start_col       = 20
                tree_visible    = space
           IMPORTING
                field_ranges    = t_ranges
           TABLES
                fields_tab      = t_dyn
           EXCEPTIONS
                internal_error  = 1
                no_action       = 2
                selid_not_found = 3
                illegal_status  = 4
                OTHERS          = 5.
      IF sy-subrc NE 0.
        CHECK sy-subrc NE 2.
        MESSAGE e717(db).
      ENDIF.
    This will create a dynamic selection screen for you. For more information u can refer to the documentations of those function mdoules.
    Hope it solves ur prob.

  • Auto generate team matches

    Hi,
    I need to auto generate matches for football teams where the each football team is matched up with another to play a game.
    Each team places another team twice.
    So Match set 1 and Match Set 2
    Match set one is at "home" and Match set two is "away"
    I am not sure how to get this done so it will hold the information on the matches.

    Ok,
    I have this, but it only outputs 1 teams twice.
    $query_match_fixtures = "select m.match_id, m.date, m.time, m.report, t1.team_name, s1.score, t2.team_name, s2.score from matches m left join (matchscores s1 left join team t1 on t1.team_id = s1.team) on (s1.match_id = m.match_id) left join (matchscores s2 left join team t2 on t2.team_id = s2.team) on (s2.match_id = m.match_id) where s1.team <> s2.team group by match_id order by m.match_id";
    -- Table structure for table `matches`
    CREATE TABLE IF NOT EXISTS `matches` (
      `match_id` int(8) NOT NULL auto_increment,
      `date` date default NULL,
      `time` varchar(5) default NULL,
      `report` longtext,
      `referee_id` int(8) NOT NULL,
      `season_id` int(8) NOT NULL,
      `venue_id` int(8) NOT NULL,
      PRIMARY KEY  (`match_id`),
      KEY `referee_id` (`referee_id`),
      KEY `venue_id` (`venue_id`)
    ) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=15 ;
    -- Table structure for table `matchscores`
    CREATE TABLE IF NOT EXISTS `matchscores` (
      `matchscores_id` int(8) NOT NULL auto_increment,
      `match_id` int(8) NOT NULL,
      `team` int(8) NOT NULL,
      `score` int(8) default NULL,
      PRIMARY KEY  (`matchscores_id`),
      KEY `match_id` (`match_id`,`team`)
    ) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=27 ;

  • Auto generated types and ps1xml formatting files

    Hello,
    I'm using New-WebServiceProxy to work with a web service... when I call methods of the web service powershell auto generates types, for example, things like "Microsoft.PowerShell.Commands.NewWebserviceProxy.AutogeneratedTypes.WebServiceProxy1_webservices_awebservicepage_asmx.TheMethodReturnObjectType"
    1. should I just use that type name in my ps1xml formatting file? I'm wondering if that will be fragile... seems fragile like 'webServiceProxy1' for example, what if there is some scenario it uses '2'? Not sure if I can count on that being consistent?
    2. I started creating custom objects and adding my own type name to them so that type name could be used in the ps1xml file. This works fine. However so far it was for web service methods that returned single instance results.. now I hit a point where I'm
    calling a web service method that will return a collection... so I'm wondering if it would be better to just use the auto generated type name  in the ps1xml or, as I would need to do in this case, actually enter a foreach loop to create a new custom object
    for every object in the returned collection? In other words, for the web service methods I've used so far for this, I simply created my custom object and write-output... for the case of the collection, I would be new-object'ing and write-output'ing within
    that foreach loop.. wondering about performance issues, or if it's just overkill when I could just put that auto generated type name in the ps1xml file and be done with it... 
    not sure if I've asked that very clearly...
    essentially, I'm wondering if it's overkill (from a resource usage perspective) to be creating these custom objects in the case of when there will be a collection, with potentially hundreds of items, when the only reason I'm doing it is for display purposes...
    if it were not an autogenerated type I would simply use the type name in the ps1xml, I'm just not sure if I can do that in this case as I don't know if that typename will *always* be the same?
    any input would be appreciated, thanks

    Hi DJC,
    I haven't rexperienced this, however, to create a .ps1xml file, these examples may be helpful for you:
    Creating a module for powershell with a format file
    discutils / utils / DiscUtils.PowerShell / DiscUtils.Format.ps1xml
    about_Format.ps1xml
    I hope this helps.

  • Auto-generated Swing Code: jbInit()

    Hi,
    I noticed that the auto-generated code for Swing apps directly uses class member variables, which is far from ideal. For example:
    public class Screen {
        private JLabel boardingPassLabel = new JLabel();
        public void jbInit() {
            boardingPassLabel.setText("Boarding Pass");
            boardingPassLabel.setBounds(new Rectangle(170, 25, 115, 20));
            boardingPassLabel.setFont(new Font("Tahoma", 1, 12));
    }The issue is that instantiating Screen will cause a JLabel to also be instantiated. While this is fine for a single screen and a single label, if there are hundreds of screens, each with twenty labels and buttons, it quickly gets out of hand.
    It would be nice to see the following code auto-generated:
    public class Screen {
        private JLabel boardingPassLabel;
        public void jbInit() {
            JLabel boardingPassLabel = getBoardingPassLabel();
            boardingPassLabel.setText("Boarding Pass");
            boardingPassLabel.setBounds(new Rectangle(170, 25, 115, 20));
            boardingPassLabel.setFont(new Font("Tahoma", 1, 12));
        public JLabel getBoardingPassLabel() {
          if( boardingPassLabel == null ) {
            boardingPassLabel = createBoardingPassLabel();
          return boardingPassLabel;
        protected JLabel createBoardingPassLabel() {
          return new JLabel();
    }This allows subclasses to provide a different subclass of JLabel (if needed). It also means that there is little overhead to instantiating the Screen class. Thus if we had to instantiate 100 screens, each with 20+ widgets, there would be no performance hit.
    As a work-around, we can simply not instantiate the Screen classes until just before they are used. This may not work in our situation, though.
    Thoughts?
    D

    I should probably add a detail here.
    We are running the Swing app on the CrEme JVM under Windows CE on a 520 MHz hand-held device with at most 256 MB of memory. (The specs say 520 MHz; but runs slower in practice.) Thus we need a lot more control over object instantiation, as has been described.
    It would be nice to see a "use lazy initialization" checkbox for the auto-generated code. Or perhaps a "generate and use accessors" checkbox.
    Note that the following code contains a redundancy:
        private JLabel boardingPassLabel = null;The assignemnt to null is superfluous; it adds about 50 more bytes to the final class size (using Sun's javac). It can be omitted for class member variables.
    D

  • Issue in transaction code creation for sap query report .

    Hi  Gurus,
    I have a requirement to create transaction codes for sap query reports. I found two ways to create transaction code for sap query report
    1) By Generating program for sap query report and creation of transaction code for that generated Program. in tcode.
    2) By using parameter transaction options in start object of se93
    What are the difference between creation of these two ways. Please specify  the advantages and disadvantages of both methods.
    Regards,
    Suneel Kumar Uggina.

    Hi Jogeswara Rao,
    But I am getting problem while transporting form development system to  the production system. After transporting to Production system  I have used the code created in development system, but it is giving Error ' No Program Found for that Transaction Code. And  I would like to know  on what conditions should I have to  use the First one  and as well as a second one in sap query reports.
    Thank You,
    Suneel Kumar Uggina.

Maybe you are looking for

  • Invalid xml error on line 1: content is not allowed

    I am using podcaster and uploaded to my .mac account. when copying the feed and webaddress at which the podcast is on my .mac accoiunt, I get the above reply. what should I change? Mark

  • Help with flattening stamps

    I did not have any problem with Acrobat 9 in the past.  Recentlyh, Acrobat X was installed.  The only problem is flattening stamps on pdf files. I copied "flattenPages.js" from from Acrobat 9 to Acrobat X  <<<c:\Users\UserName\AppData\Roaming\Adobe\A

  • Content does not update when published

    My content is not updating when I publish updates to my app. Side loading shows the updates, but an updated published folio doesn't. On the third try, I got a blank light grey screen. I finally had to unpublish and republish the content, which is obv

  • 2012 Mac Mini has exceeded my expectations so far!

    Recently purchased 2012 i7 2.3 Mac Mini and later upgraded with 16 gb crucial RAM.  I debated for awhile between the Mini and the iMac.  While the iMac is a beautiful all in one desktop the i7 Mini actually outperforms all of the stock iMac models. 

  • Validate a screen entry through message

    Moderator message: do NOT offer points Dear experts,   I have designed one screen containing 10 entries of 10 different fields. One entry is for amount . I want that amount to be less than 1000.00 and if it is not so it should give message.    My log