Source code for “Display All Objects” in SAP ABAP

Author posted by Santosh Karemore on Posted on under category Categories SAP and tagged as Tags , with Leave a comment on Source code for “Display All Objects” in SAP ABAP
We can find the source code for some of the Display All objects from transaction code SE38, using Utilities –> Environment Analysis.
We an also look at the object hierarchy by clicking on “Display Object List” , while looking at the source code. There are various tables that cross-reference components. These can be found by tracing a where-used, for example. If we want to reproduce these in our own SAP ABAP code, we have to spend a lot of time in debug, finding out exactly when the standard SAP code is called, and how it is called.

SAP Tips and Tricks – CCMS – COMPUTING CENTER MANAGEMENT SYSTEM MONITORING

Simple Tips and Tricks of CCMS of SAP

CCMS

  • In CCMS infrastructure , if the system identifies a problem, it should execute an auto reaction, such as informing the responsible person.
  • Completed messages alerts are no longer stored in the monitoring segment, but rather in a database table (ALALERTDB). This table should be regularly cleaned up (report RSALDBRG). The completed messages can still be displayed using the Alert History.
  • From a security point of view, it is recommended that you also define a second RFC connection between the systems, with which the analysis methods can be started in the remote system from the central monitoring system. If a problem occurs, you can therefore branch directly from the central monitor to the remote system to analyze the situation in more detail.
  • SAP recommends that, for your regular work, you create your own monitors that display precisely the cross-system or local data that you require for your work. The sets and monitors delivered by SAP cannot be changed.
  • Threshold values must be stored locally in every system. However, instead of maintaining the same threshold values in every system, SAP recommends that you maintain the values in the central monitoring system and then distribute them to the monitored SAP systems using the transport system.
  • The delivered SAP monitors should always be used only as templates. The copied monitors are then adjusted to the customer’s requirements.
  • Transfer as little data as possible by RFC
  • Before you create your own monitor, you should clarify the purpose of the monitor. The monitor should display as little data as possible in as clear a way as possible.
  • The prerequisite for transporting the threshold values to other SAP systems is that you have stored them in properties variants.
  • In the RFC connection that is used for the start of the analysis method, do not enter a user, but rather check the field Current User.
  • As a global guide value, SAP recommends 10-20 monitoring attributes for each monitored instance in the central monitor.
  • Note the naming convention that your monitor set should not begin with SAP.

Background and foreground thread in c#

Author posted by Jitendra on Posted on under category Categories c# and tagged as Tags with 1 Comment on Background and foreground thread in c#

Example of Threading in C#. Includes Foreground and Background Threading.

  • Foreground threads have the ability to prevent the current application from terminating. The CLR will not shut down an application (which is to say, unload the hosting AppDomain) until all foreground threads have ended.
  • Background threads (sometimes called daemon threads) are viewed by the CLR as expendable paths of execution that can be ignored at any point in time (even if they are currently laboring over some unit of work). Thus, if all foreground threads have terminated, any and all background threads are automatically killed when the application domain unloads.
  • It is important to note that foreground and background threads are not synonymous with primary and worker threads. By default, every thread you create via the Thread.Start() method is automatically a foreground thread. Again, this means that the AppDomain will not unload until all threads of execution have completed their units of work. In most cases, this is exactly the behavior you require.

    Example:

    Thread Foreground Background
    Threading in CSharp
    
    using System;
    using System.Collections.Generic;
    using System.Text;
    using System.Threading;
    namespace TestThread
    {
    class Program
    {
    static void Main(string[] args)
    {
    Program obj = new Program();
    obj.printInfo();
    //Create object of parameterized thread, so that you can pass parameter to any thread
    ParameterizedThreadStart pst = new ParameterizedThreadStart(obj.function1);
    //Bydefault threads are Foreground Thread
    Thread t1 = new Thread(pst);
    //Set Thread Name
    t1.Name = "Thread1";
    //Passs Parameter to thread
    t1.Start(true);
    //Create object of ThreadStart, it does not have any parameter
    ThreadStart ts = new ThreadStart(obj.function2);
    Thread t2 = new Thread(ts);
    t2.Name = "Thread2";
    //Make it Background Thread
    t2.IsBackground = true;
    //Run the thread
    t2.Start();
    Console.ReadKey();
    }
    public void function1(object val)
    {
    for (int i = 0; i < 5; i++)
    {
    Console.WriteLine("This is parameterized function1 by {0} and Value passed is {1} ", Thread.CurrentThread.Name, val);
    }
    }
    public void function2()
    {
    for (int i = 0; i < 5; i++)
    {
    Console.WriteLine("This is function2 by : " + Thread.CurrentThread.Name);
    }
    }
    public void printInfo()
    {
    System.Text.StringBuilder sb = new StringBuilder();
    sb.Append("*******************************************************n");
    sb.Append("            read Demo by ShivaSoft                     n");
    sb.Append("*******************************************************n");
    System.Console.WriteLine(sb);
    }
    }
    }
    
    

    Add FeedBurner in Blog and Enable Subscribe by email

    Author posted by Jitendra on Posted on under category Categories Tech Tips and tagged as Tags , , with Leave a comment on Add FeedBurner in Blog and Enable Subscribe by email

    Explains that how to use Google Feedburner for RSS in Blog and how to enable the Email Subscription

    To add the Feedburner in you blog, follow below steps:

    Get the RSS Feed path of your blog and go to :

    http://feedburner.google.com/fb/a/myfeeds

    then enter the path in Textbox displayed:

    Add Blog URL for RSS in FeedBurner

    After that follow the onscreen steps.

    And that all, you have done it.

    Add option to add by Email

    As shown in below image:

    Enable Subscribe by email in Feedburner

    GO to Publicize and select Email subscription,

    it will provide you one code, copy and paste that in you blog and the component is ready to use.

    Output will look like:

    Subscribe By Email Feedburner

    Tracing ASP.NET Website

    Author posted by Jitendra on Posted on under category Categories ASP.NET and tagged as Tags , , with 1 Comment on Tracing ASP.NET Website

    Demonstrates that how to Trace ASP.NET web applications

    In ASP.NET there two types of Tracing

    • Application Level
    • Page Level

    Page level Tracing takes the precedence over the Application Level tracing.

    Lets start with creating new website.

    In web.config add following entries to enable Application level tracing below System.web element.

    <system.web>
    <trace
    pageOutput="true"
    enabled="true"
    requestLimit="10"
    localOnly="false"
    mostRecent="true"
    traceMode="SortByTime"
    />
    </system.web>
    

    where:

    pageOutput=”true” – add the tracing information at the bottom of the ASPX page.

    localOnly=”false” – tracing will be available to any web page.

    requestLimit=”10″ – How many request should be saved on the server.

    mostRecent=”true” – whether or not display the recent tracing information if the request reach at the limit.

    After adding above tag in web.config, the output of ASP.NET page will look like:

    ASP.NET Tracing Output

    Here you can see much of informations displayed like SessionId, Request Status, Controls available on that page,  All the events of the page with start and end time etc and thus you can figure out the performance of your web application.

    No Trace for a particular Page

    Create a web page and in aspx file and at header write the tag Trace=”false”

    Create few controls like link button and view the page in browser. You will see that the page is displayed with no tracing information, although its turned ON in web.config but page level tracing has the precedence over application level tracing.

    Writing Custom Trace Information

    Now on the click event of Link buttons write the custom trace information.

    protected void lblwriteMessage_Click(object sender, EventArgs e)
    {
    	Trace.Write("Custome Message", "Write Link Button clicked");
    }
    protected void lblwarnMessage_Click(object sender, EventArgs e)
    {
    	Trace.Warn("Custome Message", "Warn Link Button clicked");
    }
    

    when you will click on the WriteLink button, below output will be seen.

    ASP.NET Trace
    ASP.NET Trace

    and when you will click on warn button, the message will be displayed in Red color. so it is suggested to display the the important trace message as a warn.

    ASP.NET Trace
    ASP.NET Trace

    Page.Trace Vs System.Diagnostics.Trace

    Create a new class file and write a static function which will write the Trace Message. You will notice that Trace object is not available by default like ASPX page instead you will need to import the package “System.Diagnostics”.

    So, there is lot difference in System.Diagnostic.Trace and Page.Trace.

    Trace from Diagnostics display the trace information in output window of Visual studio whereas the Trace from page displays the Trace information in ASPX Page.

    Integrate System.Diagnostics with ASPX Page (Routing all Trace information to web page)

    We will need to add the listener in web.config file to route all the tracing information to the single web page.

    To integrate the System.Diagnostics Trace with ASPX page, write below line of code in web.config.

    <system.diagnostics>
      <trace>
        <listeners>
           <add name="WebPageTraceListener"
                type="System.Web.WebPageTraceListener, System.Web, Version=2.0.3600.0, Culture=neutral,
    PublicKeyToken=b03f5f7f11d50a3a"/>
        </listeners>
      </trace>
    </system.diagnostics>
    

    The output will look like below image:
    ASP.NET Tracing Application Level
    trace.axd file

    This file contains all the information about the tracing of the application.

    To view the trace information just write the file name and you will get page which will look like below snap.

    path structure : http://<servername>/webapp/trace.axd

    Application Trace in ASP.NET
    Application Trace in ASP.NET

    Creating Custom Trace Listeners

    Database trace listener

    .NET has provided us the flexibility of writing our own Trace Listeners in the form of the TraceListener class. Every Trace Listener is inherited from this class; therefore, in order to implement your own Trace Listener, you must inherit your Trace Listener class from this class.

    TraceListener class has many virtual and abstract methods; at the very least, each inheritor of this class must implement the Write and WriteLine methods; other important methods are Fail, Close, and Flush. Inheritors are not supposed to implement these methods but it is a good idea to implement these methods. Descriptions of these methods are given in the beginning of the article.

    Method Name Result
    Fail Outputs the specified text with the Call Stack.
    Write Outputs the specified text.
    WriteLine Outputs the specified text and a carriage return.
    Flush Flushes the output buffer to the target media.
    Close Closes the output stream in order to not receive the tracing/debugging output.

    Write and WriteLine methods are overloaded; following is a list of all the overloaded version of the Write method:

    • public override void Write(string message)
    • public override void Write(object o)
    • public override void Write(string message, string category)
    • public override void Write(object o, string category)

    For this article, I have created a Trace Listener, DatabaseTraceListener, which actually stores trace and debug messages into a database.

    add below code in Web.config which stores the connection string information.

    <appSettings></pre>
    <pre><add key="ConnectionString" value="Data Source=.SQLExpress;Integrated Security=True;User Instance=True;
    AttachDBFilename=|DataDirectory|TraceDB.mdf" /></pre>
    <pre><add key="MaximumRequests" value="2" /></pre>
    <pre></appSettings>
    

    The structure of Table is:

  • TraceDateTime column stores the date and time of the trace message
  • TraceCategory column stores the actual category of the trace message
  • TraceDescription column stores the trace message
  • StackTrace column contains the stack trace
  • DetailedErrorDescription column contains the detailed error message which will be passed in second parameter of the Fail method.
  • create below stored procedure in SQLExpress

    Stored Procedure ASP.NET Tracing
    Now create a class named “DatabaseTraceListener” which inherit the abstract class “TraceListener”. You can check the code snippets in Source code of this article.

    if you want to implement your own Trace Listener, simply derive your listener class from TraceListener class, implement at least the Write and WriteLine methods and you are done.
    In our Example, Flush and Close methods simply save all the cached messages into the database.

    Saving Trace information in File

    We can also save the trace information in log files.

    To save the trace information in File, simply add the following entry in web.config

    <add name="myListener"
    type="System.Diagnostics.TextWriterTraceListener"
    initializeData="TextWriterOutput.log" />
    

    How to Host S-Control in Visualforce Page

    Author posted by Jitendra on Posted on under category Categories Salesforce and tagged as Tags , , with 2 Comments on How to Host S-Control in Visualforce Page

    Explains that How to Host S-Control in Visualforce Page

    In order to host your s-control in your Visual Force Pages you need to the the following steps:

    1. Create a new VF page or go to your existing VF page editor
    2. Pick your S-Control API name and have it ready.
    3. Within the Page block or where you find suitable add an apex:scontrol tab as follows:
    Visual force page in Salesforce.com
    <apex:scontrol controlName="Google_Map" width="-100"height="415"> </apex:scontrol>
    

    How to create S-Control in Salesforce

    Author posted by Jitendra on Posted on under category Categories Salesforce and tagged as Tags with 7 Comments on How to create S-Control in Salesforce

    Explains that how to create a S-Control in Salesforce.com

    To demonstrate this, lets consider an example of Google Map.

    Lets create a S-Control for the Google Map.

    Now let’s first create a new S-Control:

    1. Click on “Setup” which is located on the top right corner of the force.com page.
    2. Expand “Develop” item and click on “S-Controls”
    3. Hit “New Custom S-Control”
    4. Provide a Label “Google Map” and a description is you wished to
    5. The Type should be HTML since we want to create a HTML, Google API mash up
    6. Now it is time to enter the code for the S-Control
    S-Control in Salesforce.com
    <html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml">
    <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <title>Google Maps JavaScript API Example: Advanced Directions</title>
    <link href="/dCSS/Theme2/default/common.css" type="text/css" media="handheld,print,projection,screen,tty,tv"
    rel="stylesheet">
    <link href="/dCSS/Theme2/default/custom.css" type="text/css" media="handheld,print,projection,screen,tty,tv"
    rel="stylesheet">
    
    <script src=" http://maps.google.com/?file=api&amp;v=2.x&amp;key={YOUR KEY}"
    type="text/javascript"></script>
    
    <script src="/js/functions.js" type="text/javascript"></script>
    
    <script type="text/javascript" src="/soap/ajax/13.0/connection.js"></script>
    
    <style type="text/css">
    body {
    font-family: Verdana, Arial, sans serif;
    font-size: 11px;
    margin: 2px;
    }
    table.directions th {
    background-color:#EEEEEE;
    }
    
    img {
    color: #000000;
    }
    </style>
    
    <script type="text/javascript">
    
    var map;
    var gdir;
    var geocoder = null;
    var addressMarker;
    var dirFrom = '{!$Request.from}';
    var dirTo = '{!$Request.to}';
    var mapLocale = ""
    var SControlID = '{!$Request.lid}';
    var SFrameIC = '{!$Request.ic}';
    
    
    function initValues()
    {
    mapLocale = "en_US";
    
    setInputFields(dirFrom,dirTo);
    }
    
    function setInputFields(from, to)
    {
    window.document.getElementById("fromAddress").value = from;
    window.document.getElementById("toAddress").value = to;
    }
    
    
    function initialize()
    {
    initValues();
    
    if (GBrowserIsCompatible()) {
    map = new GMap2(document.getElementById("map_canvas"));
    map.addControl(new GSmallMapControl());
    map.addControl(new GMapTypeControl());
    gdir = new GDirections(map, document.getElementById("directions"));
    GEvent.addListener(gdir, "load", onGDirectionsLoad);
    GEvent.addListener(gdir, "error", handleErrors);
    
    setDirections(dirFrom, dirTo, mapLocale);
    }
    }
    
    function setDirections(fromAddress, toAddress, locale) {
    if ((fromAddress) && (toAddress))
    gdir.load("from: " + fromAddress + " to: " + toAddress,
    { "locale": locale });
    }
    
    function handleErrors()
    {
    if (gdir.getStatus().code == G_GEO_UNKNOWN_ADDRESS)
    alert("No corresponding geographic location could be found for one of the specified addresses. This may be due to the fact that the address is relatively new, or it may be incorrect.nError code: " + gdir.getStatus().code);
    else if (gdir.getStatus().code == G_GEO_SERVER_ERROR)
    alert("A geocoding or directions request could not be successfully processed, yet the exact reason for the failure is not known.n Error code: " + gdir.getStatus().code);
    
    else if (gdir.getStatus().code == G_GEO_MISSING_QUERY)
    alert("The HTTP q parameter was either missing or had no value. For geocoder requests, this means that an empty address was specified as input. For directions requests, this means that no query was specified in the input.n Error code: " + gdir.getStatus().code);
    
    // else if (gdir.getStatus().code == G_UNAVAILABLE_ADDRESS) <--- Doc bug... this is either not defined, or Doc is wrong
    // alert("The geocode for the given address or the route for the given directions query cannot be returned due to legal or contractual reasons.n Error code: " + gdir.getStatus().code);
    
    else if (gdir.getStatus().code == G_GEO_BAD_KEY)
    alert("The given key is either invalid or does not match the domain for which it was given. n Error code: " + gdir.getStatus().code);
    
    else if (gdir.getStatus().code == G_GEO_BAD_REQUEST)
    alert("A directions request could not be successfully parsed.n Error code: " + gdir.getStatus().code);
    
    else alert("An unknown error occurred.");
    
    }
    
    function onGDirectionsLoad(){
    // Use this function to access information about the latest load()
    // results.
    
    // e.g.
    // document.getElementById("getStatus").innerHTML = gdir.getStatus().code;
    // and yada yada yada...
    }
    </script>
    
    </head>
    <body onload="initialize()" onunload="GUnload()">
    <div style="background-color: #CCCCCC">
    <form action="#" onsubmit="setDirections(this.from.value, this.to.value, this.locale.value); return false">
    <table>
    <tr>
    <th align="right">
    From:&nbsp;</th>
    <td>
    <input type="text" size="25" id="fromAddress" name="from" value="" /></td>
    <th align="right">
    &nbsp;&nbsp;To:&nbsp;</th>
    <td align="right">
    <input type="text" size="25" id="toAddress" name="to" value="" /></td>
    <th align="right">
    Language:&nbsp;</th>
    <th align="right">
    <select id="locale" name="locale">
    <option value="en" selected="selected">English</option>
    <option value="fr">French</option>
    <option value="de">German</option>
    <option value="ja">Japanese</option>
    <option value="es">Spanish</option>
    </select>
    </th>
    <td>
    <input name="submit" type="submit" value="Get Directions!" /></td>
    </tr>
    </table>
    </form>
    </div>
    <div style="border-width: 1px; border-color: #000000; border-style: solid;">
    <div style="overflow: auto; width: 99.5%; height: 380px">
    <table class="directions" style="width: 100%; height: 100%">
    <tr>
    <td valign="top" style="width: 275px;">
    <div id="directions" style="width: 275px; background-color: #ffffff;">
    </div>
    </td>
    <td valign="top">
    <div id="map_canvas" style="width: 100%; height: 375px; background-color: #ffffff;">
    </div>
    </td>
    </tr>
    </table>
    </div>
    </div>
    </body>
    </html>
    

    Difference between Sandbox and developer edition in Salesforce

    Author posted by Jitendra on Posted on under category Categories Salesforce and tagged as Tags with 12 Comments on Difference between Sandbox and developer edition in Salesforce

    Explains the basic difference in Sandbox and developer edition of Salesforce

    A test environment for salesforce.com is crucial to change control. Salesforce.com provides the tools needed to test anything in a test environment before you implement it in your live instance. You can either test in a Sandbox environment or in a Developer environment. What is the difference? I will share what I know…

    Sandbox

    The salesforce.com Sandbox environment is an exact copy of your salesforce.com instance. You can copy your live instance to a sandbox environment (but you have to perform manually from sandbox to developer edition) where you can test any changes, implementations, AppExchange apps or updates. It can also be your hands-on training environment without risking your live data.

    You can either copy your configuration and data into a sandbox environment or just the configuration. It acts exactly like your live instance, but be careful if you have workflow rules or automations because they will work in the sandbox as well.

    I know that this sounds wonderful and if you don’t have it, you are dying to know how to get it. The problem is the cost. If you are on Unlimited Edition, then cost is not a problem because it comes included. But for Enterprise, Professional or Group Editions, you have to pay… and the price is hefty; anywhere between 25k-50k per year. For a lot of companies, that is more than they are paying for their live salesforce.com instance. So how do you test salesforce.com without Sandbox?  It is always suggested to develop application in sandbox instance then go for LIVE.

    Developer Edition

    Developer Edition was an edition created for development of integrations and apps, specifically for the AppExchange. It is also a great tool for testing/training in salesforce.com. What makes this a great tool is the fact that it is free. Anyone can get a Developer Edition of salesforce.com. It is a standard Enterprise Edition with very limited storage space. You cannot copy your configuration or data onto the Developer Edition, but you can customize it to match your instance’s look and feel. Once it is customized, you can use it for training, testing or anything else you want. It takes a little bit of work, but you can make it act and feel just like your live instance. The work is well worth it for the free price.

    To get a copy of Developer Edition for yourself or your company go here. Play around with it. Get apps from the AppExchange. Do anything and everything that you have been scared to do your live system. If you come up with a clever way of using the system, post it on AppExchange and share your knowledge.

    Create Cron job to run PHP Script in Cpanel

    Author posted by Jitendra on Posted on under category Categories Linux and tagged as Tags , , with 1 Comment on Create Cron job to run PHP Script in Cpanel

    Hi All,

    Today i just want to share that how to create  a cron job in Cpanel to run the PHP script.

    I hope everyone knows that what is Cron job : it is the task schedule in Linux which will run on predefined time interval. its same concept like schedule tasks in Windows OS.

    To create the cron job, open the Cpanel and select “cron jobs”.

    Select Cron job in Cpanel

    You can see that in drop down list there are lots of common schedules of crone job, you can select it, or create your own schedules.

    Common settings in Cpanel

    In Command text box, write the PHP program path and file to be executed like:

    /usr/local/bin/php -q /home/<username>/script.php


    to find the path to php,
    log on to the server with SSH, then run this command:
    “”””””””””””-
    which php
    or
    whereis php
    “”””””””””””””-
    This will give you the path to the php executable, probably:
    /usr/local/bin/php

    Applying the Support Packs in SAP System

    Author posted by Santosh Karemore on Posted on under category Categories SAP and tagged as Tags with 1 Comment on Applying the Support Packs in SAP System

    SUPPORT PACKS:-  Support Packs provides enhanced functionality, Bug fixes, changes to the existing Data Dictionary Elements, Repository objects like programs, reports, transactions etc.  Support Packs are of various types. Few of them are:

     Basis Support Packages (SAP KB 62050)

    ABAP Support Packages (SAP KA 62050)

    Application Support Packages (SAP KH 47050)

    HR Support Packages (SAP KE 47050)

    Prerequisites:

    1. SPAU and SPDD list should be checked before start of support package application.

    2. Objects in repair state needs to be released. 

    3. It is recommended that latest SPAM/ SAINT version should be applied before starting and Support Package application.

    4. Enough space to hold the support packs in “EPS” in directory USR/SAP/TRANS/EPS/IN. There should be no aborted packages from previous support pack or Plug In applied.

    5.  Support Packages should be applied in the sequence of number of support packs.

    6. Technical & functional consultants need to be informed while applying support packages.

    7. Schedule downtime and inform the users.

    8. Go through composite note thoroughly before applying support packs. If the support pack is  greater than 10MB then uncar the file using command SAPCAR – XVF .sar. When we uncar, two files are generated with extensions .ATT&  .PAT

    EXECUTING SUPPORT PACKS

    1. Go to transaction code Spam

    2. Load Packages from the presentation server/Application server

    3. Display all the new support patches to be applied

    4. Select the support package to be applied

    5. Import the Queue Support Package starts upgrading the system and it goes into various phases like TP connect to DB, DDIC import, DDIC Activation. These phases can be found in Table PAT01.  While applying support packages its stops to run SPAU/SPDD.

     SPAU: This is the transaction to update repository objects like programs, reports, transactions, function modules while applying support packs. This is the phase where functional consultant’s assistance is required.

    SPDD: This is the transaction which is used to update Data Dictionary Elements while applying support packages. This is the phases where functional consultant’s assistance is required.

    Note:  If the objects are changed earlier with the help of SAP notes, now these notes are part of the support packs which are modifying the system. In this scenario each and every object which were modified earlier with the help of Note are popped up on the screen whether to keep the original or change to newer version.