Powershell Coding vs C# Coding

Hey all,
I opened this thread to have a real discussion on coding. I myself use Powershell for everything, I love it and I think it can be used for nearly everything that C# can be used for (please correct me if i'm wrong). Though,
I find myself compelled to learning an establish, low level language such as C#. With the very limited time I have put into learning some C# I found the structure and even the way some of the .NET usage is nearly identical to Powershell (or the other way around).
I started to wonder what the true differences between Powershell and C# were and from what I can tell, they are both very similar. Can anyone educate me on the limitations of Powershell opposed to the C# language and if Powershell can be used the same way
as a compiled language?
Thank you

Well first of all I'll point out I'm SysAdmin, not a developer, so while I use PowerShell quite a bit, I'm only seen a little C# code and never even tried to learn it.
To my mind there are major differences between the two languages. In general terms they're aimed at completely different groups of people, with PowerShell aimed more at the sysadmins and C# aimed at full on developers. In a way you can think of PowerShell
as a modern replacement for cmd prompts and batchscripts, used for running commands, creating automation scripts etc.
At its core, PowerShell allows a user with not much programming knowledge to easily create scripts to automate jobs, with all PowerShell cmdlets using a simple <verb>-<noun> naming structure, like get-stuff, select-stuff etc, which I find
makes the learning curve for finding new commands very easy (If I've found that select-stuff gets what I need, if I need to delete it then it'll likely be remove-stuff that I'm looking for).
In addition to the built in cmdlets, PowerShell can also call .Net (which it's built on), COM and WMI resources, which allows those who know about those things to extend the available functionality, but I'd argue that this is a bonus rather than the
core purpose.
PowerShell was built such that 3rd parties can create modules containing additional cmdlets, which allows other companies to make their software capable of being administered via PowerShell as well, rather than just MS apps (don't know if any have though).
It also allows other companies to write additional functionality for PowerShell, by using .Net calls and wrapping them into importable cmdlets so they're easier to use.
There are definitely things that you can do in C# which either can't be done in PowerShell, or at least can't easily be done. For instance try creating a 3+ dimensional array in PowerShell (I assume C# can).
As I understand it, C# is also a compiled language, while PowerShell is an interpreted one, so technically the former is supposed to be quicker (though possibly less so with newer PS versions).
I guess it comes down to, if you're administering a server then you probably want PowerShell, but if you're programming a full on application with controls, security, OOP, performance concerns etc then C# is more useful. And of course, for web programming,
you can program ASP .Net using C# but you can't use PowerShell.

Similar Messages

  • Powershell Coding - Path and Variable Issues

    Hello, I am working with a powershell program to copy a file off of my flash drive and into the startup file of what ever user is logged onto that computer. 
    My code is
    powershell -command { }; $a=[Environment]::UserName ; $c='E:\Other\Programs\program2.bat' ; $b='C:/Users/$a/AppData/Roaming/Microsoft/Windows/Start Menu/Programs/Startup' ; copy $c $b ; start-sleep 30
     It just uses the $a instead of the variable name...  if I change it to " " it says that the path cannot be found a cmd or operable program. and it stops at Windows/Start 
    can anyone help me out with this?
    For anyone wondering why I am using powershell -command  instead of ISE is because I am running it from a .bat file because the execution policy is set to restricted AND CANNOT BE CHANGED.

    Try
    $b="\"C:/Users/$a/AppData/Roaming/Microsoft/Windows/Start Menu/Programs/Startup\"";
    You must use double quotes for Powershell to use the value of $a - See:
    https://technet.microsoft.com/en-us/library/hh847740.aspx
    and you need an extra set of quotes escaped with a backslash to cope with the space in "Start Menu" - See:
    http://www.tinyint.com/index.php/2011/04/20/escaping-quotes-in-powershell-exe-command-via-command-prompt/
    In future (or if this is not working for you) please direct questions about Powershell to this forum
    https://social.technet.microsoft.com/Forums/scriptcenter/en-US/home?forum=ITCG

  • What am I missing exactly?

    Hello everyone, so I have coded this a couple of different ways and I am looking for the most efficient way of doing this (I'm new to PS so please bear with my incompetence -- I am going through PS training so one day I will be answering questions rather
    than asking them :) )
    Essentially I need to be able to recurse a directory and log all files to a txt document when matched against an array. My code currently looks like this, however, it's not returning any results:
    $audioFileExtensions = @(".aac",".aif",".aiff",".asf",".asx",".au",".avi",".flac",".m3u",".m4a",".mid",".midi",".mov",".mp1",".mp2",".mp3",".mp4",".mpa",".mpe",".mpeg2",".mpeg3",".mpg",".ogg",".qt",".qtw",".ram",".rm",".mi",".mvb",".snd",".swf",".vob",".wav",".wax",".wma",".wmv",".wvx")
    Get-ChildItem -Path \\MHT-FS1\UserHomeDrives -Recurse | Where-Object {$_.Extension -contains $audioFileExtensions} | Select-Object FullName > C:\audioFileResults.txt
    I've also created a forEach statement and although this works, it seems to be very inefficient and slow as it is looping through each item in the array and performing the recursive GCI method. 
    How would I best write this code to produce the results I am looking for in the most efficient manner?
    Thanks in advance!
    Cheers,
    G-

    Listen,
    Your question tells everyone you are ignorant in PowerShell, because the solution is quite simple.
    You declare yourself completely ignorant in REGEX, even though you suggest me to look into his REGEX example - don't you think you're to naive and stupid suggesting something you don't understand?
    Look at his REGEX example: it's an abusive use of REGEX, because it' unnecessary! PowerShell will automatically convert it back to
    string! 
    And you dare to suggest me code from this rubbishell coder, after I posted almost 20 reasons why his code is rubbishel!
    You should just shut your mouth up and cross your hands to not expose your low IQ and retarded mental maturity, thinking you are someone capable of suggesting anything to anyone (let alone about REGEX that I know more you and him together).
    The fact that you posted in favor of him and against me, just shows you are one more idiot joining the rubbishell coders brotherhood!
    Next time you think to advise someone, ask your parents first, or your brothers, sisters, husbands and wifes, and they'll tell you: '' hey little kid, it's not your business, so keep your huge curvy S out of this. ''
    I suppose if I had the attitude you have I wouldn't have any friends; I say that because I've trolled your posts just because I was curious if you were really so cynical and as it turns out, you seem to make more enemies than friends. I'm really not
    too sure why you feel it necessary to teach in such a mean-spirited way. Seriously, man, you're a smart dude act like one. Calling people idiots, stupid, ignorant (although I understand the English meaning of ignorant, it's not something you call people) and
    the like... you will go no where in life no matter how smart you think you are. When you start putting yourself above others by degrading them, the only thing you are doing is putting yourself beneath them and you lose effectiveness with those you are trying
    to teach. Once you lose effectiveness, you've lost communication. Once you've lost communication no one wants or has the desire to listen to you or your way of doing things any longer.
    You can call me anything you want, I do not know you and I will not lose any sleep over your comments. I only wish I could get through to you so that maybe you can succeed in building relationships rather than destroying them. You may be smart, however, that
    smart brain does not match your nasty behavior towards others. You may want to think about building your interpersonal skills rather than your PowerShell/coding skills; I can guarantee your personal skills will get you much further than your coding skills.
    You're behavior seems to match that of a school yard bully and no one likes a bully.
    Think about it. Think why are people so against me? What am I saying that offends them? How can I get people to like me and how can I spread my knowledge in a more effective way? How do I win friends and influence people? There's a book authored by
    Dale Carnegie titled exactly that: "How to Win Friends and Influence People", perhaps you could take some time to read it and learn from it just as you read and learn from the help files associated with your preferred coding language.
    Just a suggestion from one human to another and in no way insulting. You'll make the forums a much more pleasant place to come ask for help and learn from others -- such as yourself.
    And last but not least... You were not born into PowerShell or coding, you began as a clean slate -- nothing on it, therefore, you had to learn through experience. Give people a break by easing up on them, no one knows as much as we all do. "Who am
    I to tell you anything?" you once asked... well, I am someone, probably the only one here, that has your best interest in mind. Be kind to people.

  • Adobe Bridge CS6, Output to HTML Gallery coding issue.

    Adobe Bridge CS6, Output to HTML Gallery coding issue.
    I have created the html, JavaScript, css file using the output function in Bridge CS6, which nicely generates the coding, pages, folders and files. I can edit the html files such as gallery title, name, etc., in Dreamweaver CS6 just fine and preview them in a selected browser (both chrome and IE) and everything works fine.
    When I ftp upload the files and directories into my hosting account (Go Daddy), the images do not show up. The file table appears but the thumbs images does not appear and when selected to preview the larger image, it does not appear either. I have not altered the file structure at all. Go Daddy says it is a coding issue, but I cannot fine any errors.
    Have you seen this issue before? All Adobe help research have failed. Any suggestions??

    Have you asked on Go Daddy site for help in uploading Adobe Bridge script?  Just to say it is coding is not helpful. 

  • Adobe Cloud: coding auf unterster Ebene

    Ich bin jetzt 52 Jahre Alt und benutze Adobe Produkte in meinem Job und Alltag seit den Anfängen von Windows resp. Apple! Dies teils weil die Produkte gut waren oder meistens weil Adobe alles andere aufgekauft hat (siehe Makromedia)
    Ich kann behaupten dass Ich als Firmenchef, Designer, Grafiker und was noch Alles 1000de von Euro resp Dollar in den letzten 10-20 Jahren an Adobe abgedrückt habe (rechnet man die Firmen mit die Adobe alle inzwischen aufgekauft hatt)
    Ich hab jetzt ein Cloud Abbo auf meinen Namen laufen, mehrer Suits Nenn ich mein eigen und in dem Gymnasium wo Ich arbeite 100te von Adobe Lizensen eingeführt.
    Das was Adobe sich in letzter Zeit auf coding Ebene leistet, Hauptsächlich der "Adobe Application Manager" zeugt von einem Dilettantismus, einem Unvermögen Sauber zu programmieren wie es auf Ebene solch einer grossen Firma, Marketleader noch NIE gegeben hat!
    Ich habe die ganze Suite mehrmals komplett von meinem System genommen, das System läuft sauber und stabil. Sobald Ich die einzelnen Elemente "Photoshop, Dreamweaver usw über den Manager installiere crasht regelmässig mein System oder wird extrem langsam!
    Ich erinnere nur an den offenen Brief von Steve Jobs (nein, Ich bin kein Apple Jünger) an Adobe vor ein paar Jahren. Ich zahle eine Monatliche Gebühr und muss arbeiten um meine Familie zu ernähren, ADOBE!

    Ja, wissen wir doch. Schön, dass wir mal drüber gesprochen haben.
    Mylenium

  • How to get the table name in the trigger definition without hard coding.

    CREATE  TRIGGER db.mytablename
    AFTER UPDATE,INSERT
    AS
        INSERT INTO table1(col1)
        SELECT InsRec.col1   
        FROM
        INSERTED Ins
       --Below i am calling one sp for which i have to pass the table name
       EXEC myspname 'tablename'
      In the above trigger,presently i am hard coding the tablename
      but is it possible to get the table name dynamically on which the trigger is defined in order to avoid hard coding the table name

    I really liked your audit table concept.  You inspired me to modify it so that, the entire recordset gets captured and added a couple of other fields.  Wanted to share my end result.
    USE [YourDB]
    GO
    /****** Object: Trigger [dbo].[iudt_AutoAuditChanges] Script Date: 10/18/2013 12:49:55 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    ALTER TRIGGER [dbo].[iudt_AutoAuditChanges]
    ON [dbo].[YourTable]
    AFTER INSERT,DELETE,UPDATE
    AS
    BEGIN
    SET NOCOUNT ON;
    Declare @v_AuditID bigint
    IF OBJECT_ID('dbo.AutoAudit','U') IS NULL BEGIN
    CREATE TABLE [dbo].[AutoAudit]
    ( [AuditID] bigint identity,
    [AuditDate] DateTime,
    [AuditUserName] varchar(128),
    [TableName] varchar(128) NULL,
    [OldContent] XML NULL,
    [NewContent] XML NULL
    ALTER TABLE dbo.AutoAudit ADD CONSTRAINT
    PK_AutoAudit PRIMARY KEY CLUSTERED
    [AuditID]
    ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    CREATE NONCLUSTERED INDEX [idx_AutoAudit_TableName_AuditDate] ON [dbo].[AutoAudit]
    ( [TableName] ASC,
    [AuditDate] ASC
    )WITH (STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    END
    Select * Into #AuditDeleted from deleted
    Select * Into #AuditInserted from inserted
    While (Select COUNT(*) from #AuditDeleted) > 0 OR (Select COUNT(*) from #AuditInserted) > 0
    Begin
    INSERT INTO [dbo].[AutoAudit]
    ( [AuditDate], [AuditUserName], [TableName], [OldContent], [NewContent])
    SELECT
    GETDATE(),
    SUSER_NAME(),
    [TableName]=object_name([parent_obj]),
    [OldContent]=CAST((SELECT TOP 1 * FROM #AuditDeleted D FOR XML RAW) AS XML),
    [NewContent]=CAST((SELECT TOP 1 * FROM #AuditInserted I FOR XML RAW) AS XML)
    FROM sysobjects
    WHERE
    [xtype] = 'tr'
    and [name] = OBJECT_NAME(@@PROCID)
    Set @v_AuditID = SCOPE_IDENTITY()
    Delete from AutoAudit
    Where AuditID = @v_AuditID
    AND Convert(varchar(max),oldContent) = Convert(varchar(max),NewContent)
    Delete top(1) from #AuditDeleted
    Delete top(1) from #AuditInserted
    End
    END

  • How to create sap directories in application server by coding.

    Hi Experts,
    Please tell me how to create a sap directory via coding in application server.
    Please tell me step by step n send the code also.I have tried alot using FM  'SXPG_COMMAND_EXECUTE' but i dont know how to use it n wht are d parameters i need to pass.
    Also, i found that we need to create a external command in SM69 to pass in this FM...i dont know how to create this.
    Please help me out.

    Hi friend,
    1. Goto to Transaction SM69.
    2. Click on F5.
    3. Click on F6.
    4. Enter a name in Command Name box          ex: z_com
    5. Enter a os command in Operating system command box.     ex: mkdir (creating a directory)
    6. Give location in application server in Parameters for operating system command box   ex: /C dir
    7. Click Save.
    Goto SE 38 and develop a report using FM 'SXPG_COMMAND_EXECUTE' .
    Ex:
    REPORT  zawi_demodownload                       .
    data: g_out like BTCXPM occurs 0,
            z_com type SXPGCOLIST-NAME  value 'mkdir'.
    CALL FUNCTION 'SXPG_COMMAND_EXECUTE'
      EXPORTING
        commandname                         = z_com
      TABLES
        exec_protocol                       = g_out
      EXCEPTIONS
       NO_PERMISSION                       = 1
       COMMAND_NOT_FOUND                   = 2
       PARAMETERS_TOO_LONG                 = 3
       SECURITY_RISK                       = 4
       WRONG_CHECK_CALL_INTERFACE          = 5
       PROGRAM_START_ERROR                 = 6
       PROGRAM_TERMINATION_ERROR           = 7
       X_ERROR                             = 8
       PARAMETER_EXPECTED                  = 9
       TOO_MANY_PARAMETERS                 = 10
       ILLEGAL_COMMAND                     = 11
       WRONG_ASYNCHRONOUS_PARAMETERS       = 12
       CANT_ENQ_TBTCO_ENTRY                = 13
       JOBCOUNT_GENERATION_ERROR           = 14
       OTHERS                              = 15.
    IF sy-subrc = 0.
    ENDIF.
    Thanks.......

  • Coding Confusion: Links linking to wrong...links

    Hi everyone,
    I'm writing some code in Flash MX 2004 and everything works fine except for the last button (4DSystemsProducts). According to the coding if none of the drop down buttons work it should go to products.php, but for some reason it goes to 4DSystemsProducts.php. All of the other menus are coded the same way and work fine, if I take out that button it works fine, or if I take out button 7 and switch 4DSystems to button 7 everything works.
    Here is the code to clear up this explanation.
    [CODE]
    function getActiveSub()
        if (_ymouse >= 38 && _ymouse < 58)
            return (activeButton.btnSub1);
        else if (_ymouse >= 58 && _ymouse < 78)
            return (activeButton.btnSub2);
        else if (_ymouse >= 78 && _ymouse < 98)
            return (activeButton.btnSub3);
        else if (_ymouse >= 98 && _ymouse < 118)
            return (activeButton.btnSub4);
        else if (_ymouse >= 118 && _ymouse < 138)
            return (activeButton.btnSub5);
        else if (_ymouse >= 138 && _ymouse < 158)
            return (activeButton.btnSub6);
        else if (_ymouse >= 158 && _ymouse < 178)
            return (activeButton.btnSub7);
        else if (_ymouse >= 178 && _ymouse < 198)
         return (activeButton.btnSub8);
        else
            return (null);
        } // end else if
    } // End of the function
    var activeButton;
    var activeSub;
    btnProducts.onRollOver = function ()
        btnProducts.gotoAndPlay("drop down");
        activeButton = btnProducts;
        activeSub = null;
    btnProducts.onRollOut = btnProducts.onReleaseOutside = function ()
        btnProducts.gotoAndPlay("drop up");
        activeButton = null;
        if (activeSub != null)
            activeSub.gotoAndPlay("stoparrow");
        } // end if
        activeSub = null;
    btnProducts.onRelease = function ()
        if (activeSub == btnProducts.btnSub1)
            getURL("products.php");
        else if (activeSub == btnProducts.btnSub2)
            getURL("newreleases.php");
        else if (activeSub == btnProducts.btnSub3)
            getURL("controlgrips.php");
        else if (activeSub == btnProducts.btnSub4)
            getURL("joysticks.php");
        else if (activeSub == btnProducts.btnSub5)
            getURL("controlboxes.php");
        else if (activeSub == btnProducts.btnSub6)
            getURL("electronics.php");
        else if (activeSub == btnProducts.btnSub7)
            getURL("accessories.php");
        else if (activeSub == btnProducts.btnSub8)
            getURL("4DSystemsProducts.php");
        else
            getURL("products.php");
        } // end else if
    [/CODE]

    That was just an exerpt.  I thought it would be all you need.  Here's the entire thing (attached).
    EDIT.  Apparently I can't attach the fla, just the swf.  Hope it helps.

  • Contact form-checkbox PHP coding doesnt work

    I am a beginner to web page design so i would be grateful if you can explain to me what PHP coding i would need for 'Checkbox' and where to place it in the PHP coding below. I can submit the form to my email with all the headings and the filled in forms with checkbox Yes or No.
    Only problem i have is that part of the check box info appear right at the top of the email message rather than the 'Name', 'Tel', 'Email' etc..Another half of the checkbox appear where it suppose to be wih double heading as shown below. I would also like to remove the <br> from the email message. Can you also tell me how to change the colour for heading so its clear.
    I have marked the checkbox code in BLUE for both HTML and PHP coding below. Sorry for the long coding. Look forward to hearing from someone. Much appreciated.
    Message delivered to the email address as received:
    Rear ground extension: Yes
    Two-storey rear extension: Yes
    Two-storey side extension: No
    Loft: Yes
    New Build: Yes
    Other: Yes
    Name: Test<br>
    Email: [email protected]<br>
    Contact No: 87576as<br>
    Address1: addy1<br>
    Address2: addy2<br>
    Town: town<br>
    County: county<br>
    Postcode: post<br>
    Property Type: Cottage<br>
    Property Area: None<br>
    Message:<br>
    test msg
    My HTML coding for the form:
    <div class="contactForm">
          <form id="form1" name="form1" method="post" action="test2.php">
            <fieldset>
              <legend><strong>Personal Information</strong></legend>
              <table width="690" border="0">
                <tr>
                  <td width="340"><p>
                <label for="name" class="contactLable">Name:</label>
                <input name="name" type="text" id="name" tabindex="10" size="30" />
              </p></td>
                  <td width="340"><p>
                <label for="contact_number" class="contactLable">Contact No:</label>
                <input name="contact_number" type="text" id="contact_number" tabindex="20" size="30" />
              </p></td>
                </tr>
              </table>
              <table width="690" border="0">
                <tr>
                  <td><p>
                <span id="sprytextfield1">
                <label for="email" class="contactLable">Email:</label>
                <input name="email" type="text" id="email" tabindex="30" size="30" />
              <span class="textfieldRequiredMsg">A value is required.</span><span class="textfieldInvalidFormatMsg">Invalid format.</span></span> </p></td>
                </tr>
              </table>
            </fieldset>
            <fieldset>
              <legend><strong>Project Information</strong></legend>
              <p><table width="690" border="0">
      <tr>
        <td width="340"><p>
                <label for="address1" class="contactLable">Address 1:</label>
                <input name="address1" type="text" id="address1" tabindex="40" size="30" />
              </p></td>
        <td width="340"> <p>
                <label for="address2" class="contactLable">Address 2:</label>
                <input name="address2" type="text" id="address2" tabindex="50" size="30" />
              </p></td>
      </tr>
      <tr>
        <td><p>
                <label for="town" class="contactLable">Town:</label>
                <input name="town" type="text" id="town" tabindex="60" size="30" />
              </p></td>
        <td><p>
                <label for="county" class="contactLable">County:</label>
                <input name="county" type="text" id="county" tabindex="70" size="30" />
              </p></td>
      </tr>
      <tr>
        <td><p>
                <label for="postcode" class="contactLable">Post Code:</label>
                <input name="postcode" type="text" id="postcode" tabindex="80" size="10" />
              </p></td>
        <td> </td>
      </tr>
      <tr>
        <td><p>
                <label for="propertyType" class="contactLable">Property Type:</label>
                <select name="propertyType" id="propertyType" tabindex="90">
                  <option>Please select</option>
                  <option>Detached</option>
                  <option>Semi-Detached</option>
                  <option>End of Terrace</option>
                  <option>Mid-Terrace</option>
                  <option>Flat</option>
                  <option>Bungalow</option>
                  <option>Cottage</option>
                  <option>Other</option>
                </select>
              </p></td>
        <td><p>
                <label for="propertyArea" class="contactLable">Property Area:</label>
                <select name="propertyArea" id="propertyArea" tabindex="100">
                  <option>Please select</option>
                  <option>None</option>
                  <option>Listed Building</option>
                  <option>Conservation Area</option>
                </select>
              </p></td>
      </tr>
    </table>
    </p>
           </fieldset><fieldset><legend><strong>Project Type</strong></legend>
              <table width="690">
                <tr>
                  <td width="338"><label>
                    <input name="rearExt" type="checkbox" class="contactCheckbox" id="CheckboxGroup1_0" tabindex="110" value="rearExt"/>
                  Rear ground extension</label></td>
                  <td width="340"><input name="sideExt" type="checkbox" class="contactCheckbox" id="CheckboxGroup1_1" tabindex="120" value="sideExt"/>
    Side ground extension</td>
                </tr>
                <tr>
                  <td><input name="twoStoreyRear" type="checkbox" class="contactCheckbox" id="twoStoreyRear" tabindex="130" value="twoStoreyRear"/>
    Two-storey rear extension</td>
                  <td><input name="twoStoreySide" type="checkbox" class="contactCheckbox" id="twoStoreySide" tabindex="140" value="twoStoreySide"/>
    Two-storey side extension</td>
                </tr>
                <tr>
                  <td><input name="loft" type="checkbox" class="contactCheckbox" id="loft" tabindex="150" value="loft"/>
    Loft conversion </td>
                  <td><input name="newBuild" type="checkbox" class="contactCheckbox" id="newBuild" tabindex="160" value="newBuild"/>
    New build </td>
                </tr>
                <tr>
                  <td><input name="flat" type="checkbox" class="contactCheckbox" id="flat" tabindex="170" value="flat"/>
    Flat conversion</td>
                  <td><input name="other" type="checkbox" class="contactCheckbox" id="other" tabindex="180" value="other"/>
    Other conversion</td>
                </tr>
              </table>
            </fieldset>
            <fieldset><legend><strong>Message</strong></legend>
              <p>
                <label for="message" class="contactLable">Your Message or Comments:</label>
                <textarea name="message" id="message" cols="45" rows="5" tabindex="190"></textarea>
              </p>
            </fieldset>
            <br />
            <input type="submit" name="Sumbit" id="Sumbit" value="Submit" tabindex="200" />
          </form>
        </div>
    PHP Coding to send to my email:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <META HTTP-EQUIV="refresh" content="0;URL=thankyou.html">
    <title>Email Form</title>
    </head>
    <body>
    <?php
      $name=addslashes($_POST['name']);
      $contact_number=addslashes($_POST['contact_number']);
      $email=addslashes($_POST['email']);
      $address1=addslashes($_POST['address1']);
      $address2=addslashes($_POST['address2']);
      $town=addslashes($_POST['town']);
      $county=addslashes($_POST['county']);
      $postcode=addslashes($_POST['postcode']);
      $propertyType=addslashes($_POST['propertyType']);
      $propertyArea=addslashes($_POST['propertyArea']);
      $rearExt=($_POST['rearExt'])?"Rear ground extension: Yes":"Rear ground extension: No";
      $sideExt=($_POST['sideExt'])?"Side ground extension: Yes":"Side ground extension: No";
      $twoStoreyRear=($_POST['twoStoreyRear'])?"Two-storey rear extension: Yes":"Two-storey rear extension: No";
      $twoStoreySide=($_POST['twoStoreySide'])?"Two-storey side extension: Yes":"Two-storey side extension: No";
      $loft=($_POST['loft'])?"Loft: Yes":"Loft: No";
      $newBuild=($_POST['newBuild'])?"New Build: Yes":"New Build: No";
      $flat=($_POST['flat'])?"Flat: Yes":"Flat: No";
      $other=($_POST['other'])?"Other: Yes":"Other: No";
      $msg.="\n$rearExt\n$wsideExt\n$twoStoreyRear\n$twoStoreySide\n$loft\n$newBuild\n$wflat\n$ other";
      $message=addslashes($_POST['message']);
    // you can specify which email you want your contact form to be emailed to here
      $toemail = "[email protected]";
      $subject = "From Website Test";
      $headers = "MIME-Version: 1.0\n"
                ."From: \"".$name."\" <".$email.">\n"
                ."Content-type: text/html; charset=iso-8859-1\n";
      $body = "Name: ".$name."<br>\n"
                ."Email: ".$email."<br>\n"
                ."Contact No: ".$contact_number."<br>\n"
                ."Address1: ".$address1."<br>\n"
                ."Address2: ".$address2."<br>\n"
                ."Town: ".$town."<br>\n"
                ."County: ".$county."<br>\n"
                ."Postcode: ".$postcode."<br>\n"
                ."Property Type: ".$propertyType."<br>\n"
                ."Property Area: ".$propertyArea."<br>\n"
                ."Rear ground extension: ".$rearExt."<br>\n"
                ."Side ground extension: ".$sideExt."<br>\n"
                ."Two-storey rear extension: ".$twoStoreyRear."<br>\n"
                ."Two-storey side extension: ".$twoStoreySide."<br>\n"
                ."Loft conversion: ".$loft."<br>\n"
                ."New build: ".$newBuild."<br>\n"
                ."Flat: ".$flat."<br>\n"
                ."Other: ".$other."<br>\n"
                ."Message:<br>\n"
                .$message;
      if (!ereg("^[a-zA-Z0-9_]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$", $email))
        echo "That is not a valid email address.  Please return to the"
               ." previous page and try again.";
        exit;
        mail($toemail, $subject, $body, $msg, $headers);
        echo "Thanks for submitting your comments";
    ?>
    </body>
    </html>

    Dear David
    Thank you so much for the clear explanation. I have been using Lynda.com Dreamweaver CS5 tutorial. I found the coding for checkbox through search and added to the coding from Lynda.com tutorial.
    I made few changes to the coding by removing:
    $msg = "$rearExt<br>\r\n$sideExt<br>\r\n$twoStoreyRear<br>\r\n
              $twoStoreySide<br>\r\n$loft<br>\r\n$newBuild<br>\r\n$flat<br>\r\n$other\r\n";
    as the email message shows the results from the checkbox twice.
    I also removed the <br> from:
    $body = "Name: $name<br>\r\n
              Email: $email<br>\r\n
              Contact No: $contact_number<br>\r\n
             Other: $other\r\n
              Message:\r\n
                $message";
    I have add the result and the PHP coding you have helped to fixed for anyone needing a working PHP code containing Text Fields, Drop Down List, Checkbox and Text Area. Many thanks for all your help. If you have a coding to change the heading text colour I very much appericate it.
    Message sent to email:
              From: Name test <[email protected]>
                 Content-type: text/html; charset=iso-8859-1
    Name: Name test
              Email: [email protected]
                      Contact No: 0123456789
                      Address1: addy1
                      Address2: addy2
                      Town: T
                      County: C
                      Postcode: P/C
                      Property Type: End of Terrace
                      Property Area: Listed Building
                      Rear ground extension: Rear ground extension: No
                     Side ground extension: Side ground extension: No
                     Two-storey rear extension: Two-storey rear extension: Yes
                     Two-storey side extension: Two-storey side extension: No
                     Loft conversion: Loft conversion: No
                     New build: New Build: No
                     Flat: Flat: Yes
                     Other: Other: No
             Message:
               Test message
    PHP coding for customer contact page:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <META HTTP-EQUIV="refresh" content="0;URL=thankyou.html">
    <title>Email Form</title>
    </head>
    <body>
    <?php
      $name=$_POST['name'];
      $contact_number=$_POST['contact_number'];
      $email=$_POST['email'];
      $address1=$_POST['address1'];
      $address2=$_POST['address2'];
      $town=$_POST['town'];
      $county=$_POST['county'];
      $postcode=$_POST['postcode'];
      $propertyType=$_POST['propertyType'];
      $propertyArea=$_POST['propertyArea'];
      $rearExt= isset($_POST['rearExt'])?"Rear ground extension: Yes":"Rear ground extension: No";
      $sideExt= isset($_POST['sideExt'])?"Side ground extension: Yes":"Side ground extension: No";
      $twoStoreyRear= isset($_POST['twoStoreyRear'])?"Two-storey rear extension: Yes":"Two-storey rear extension: No";
      $twoStoreySide= isset($_POST['twoStoreySide'])?"Two-storey side extension: Yes":"Two-storey side extension: No";
      $loft= isset($_POST['loft'])?"Loft conversion: Yes":"Loft conversion: No";
      $newBuild= isset($_POST['newBuild'])?"New Build: Yes":"New Build: No";
      $flat= isset($_POST['flat'])?"Flat: Yes":"Flat: No";
      $other= isset($_POST['other'])?"Other: Yes":"Other: No";
      $message=$_POST['message'];
    // you can specify which email you want your contact form to be emailed to here
      $toemail = "[email protected]";
      $subject = "From Website Test";
      $headers = "MIME-Version: 1.0\r\n
                 From: $name <".$email.">\r\n
                 Content-type: text/html; charset=iso-8859-1";
      $body = "Name: $name\r\n
              Email: $email\r\n
              Contact No: $contact_number\r\n
              Address1: $address1\r\n
              Address2: $address2\r\n
              Town: $town\r\n
              County: $county\r\n
              Postcode: $postcode\r\n
              Property Type: $propertyType\r\n
              Property Area: $propertyArea\r\n
              Rear ground extension: $rearExt\r\n
              Side ground extension: $sideExt\r\n
              Two-storey rear extension: $twoStoreyRear\r\n
              Two-storey side extension: $twoStoreySide\r\n
              Loft conversion: $loft\r\n
              New build: $newBuild\r\n
              Flat: $flat\r\n
              Other: $other\r\n
              Message:\r\n
                $message";
      if (!ereg("^[a-zA-Z0-9_]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$", $email))
        echo "That is not a valid email address.  Please return to the"
               ." previous page and try again.";
        exit;
        mail($toemail, $subject, $body, $headers);
        echo "Thanks for submitting your message";
    ?>
    </body>
    </html>

  • Coded UI Text not adding correctly to textbox

    This error results when I try to do record/playback in Coded UI Test to add a # to phone # textbox.
    Can anyone please explain what I should do to resolve?
    Microsoft.VisualStudio.TestTools.UITest.Extension.PlaybackFailureException: Cannot perform 'SetProperty of Text with value "3125551212"' on the control. Additional Details:
    TechnologyName: 'Web'
    ControlType: 'Edit'
    TagName: 'INPUT'
    Id: 'corpForm_txtPhoneCorp_I'
    Name: 'corpForm$txtPhoneCorp'
    ---> System.Runtime.InteropServices.COMException: Exception from HRESULT: 0xF004F006
    Result StackTrace:
    at Microsoft.VisualStudio.TestTools.UITest.Playback.Engine.IScreenElement.SetValueAsEditBox(String bstrNewValue, Int32 nSetValueAsEditBoxFlag)
    at Microsoft.VisualStudio.TestTools.UITest.Playback.ScreenElement.SetValueAsEditBox(String value, Boolean isEncoded, Int32 flag)
    at Microsoft.VisualStudio.TestTools.UITest.Playback.ScreenElement.SetValueAsEditBox(String value, Boolean isEncoded)
    at Microsoft.VisualStudio.TestTools.UITesting.TechnologyElementPropertyProvider.SetValueAsEditBox(UITestControl uiControl, String value, Boolean isEncoded, Boolean useCopyPaste)
    at Microsoft.VisualStudio.TestTools.UITesting.HtmlPropertyProvider.SetPropertyValue(UITestControl uiControl, String propertyName, Object value)
    at Microsoft.VisualStudio.TestTools.UITesting.UITestPropertyProvider.SetPropertyValueWrapper(UITestControl uiControl, String propertyName, Object value)
    at Microsoft.VisualStudio.TestTools.UITesting.UITestControl.SetPropertyValue(String propertyName, Object propertyValue)
    --- End of inner exception stack trace ---
    at Microsoft.VisualStudio.TestTools.UITesting.Playback.MapAndThrowComException(COMException innerException, IPlaybackContext context)
    at Microsoft.VisualStudio.TestTools.UITesting.Playback.MapAndThrowException(Exception exception, IPlaybackContext context)
    at Microsoft.VisualStudio.TestTools.UITesting.Playback.MapAndThrowException(Exception exception, String actionName, UITestControl uiControl)
    at Microsoft.VisualStudio.TestTools.UITesting.Playback.MapAndThrowException(Exception exception, String actionName, Object parameterValue, UITestControl uiControl)
    at Microsoft.VisualStudio.TestTools.UITesting.UITestControl.SetPropertyValue(String propertyName, Object propertyValue)
    at Microsoft.VisualStudio.TestTools.UITesting.UITestControl.SetPropertyPrivate(String propertyName, Object value)
    at Microsoft.VisualStudio.TestTools.UITesting.UITestControl.<>c__DisplayClass3e.<SetProperty>b__3d()
    at Microsoft.VisualStudio.TestTools.UITesting.CodedUITestMethodInvoker.InvokeMethod[T](Func`1 function, UITestControl control, Boolean firePlaybackErrorEvent, Boolean logAsAction)
    at Microsoft.VisualStudio.TestTools.UITesting.UITestControl.SetProperty(String propertyName, Object value)
    at Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlEdit.set_Text(String value)

    Hi QAcodedui,
    Based on your issue, you mean that when you record the textbox UI action with input a phone number text value in the textbox control and then you playback this textbox UI action, it failed for coded UI test, am I right?
    If yes, I tried to add a simple textbox control in a windows form app and then I record the textbox UI action using coded UI test builder. I found that I can playback this textbox UI action successfully for coded UI test.
    So if you are handing code for this textbox UI action in coded UI test, I suggest you could try to use the coded UI test builder to record and playback this textbox UI action check this issue again.
    In addition, I suggest you could try to add the DrawHighlight method check whether the textbox control is found correctly.
    If you are able to see cursor is highlight in the txt field it means controls is identified without error. Then I suggest you could try to add the following code for the textbox control.
    For example, you can add the SendKeysAsScanCode method or the SkipSetPropertyVerification method check this issue.
    (1) Playback.PlaybackSettings.SendKeysAsScanCode = true; Keyboard.SendKeysDelay = 10;
    (2) Playback.PlaybackSettings.SkipSetPropertyVerification = true;
    Or you can try to add more searchproperties for this textbox control and then check this issue.
    Refernece:
    http://blogs.msdn.com/b/tapas_sahoos_blog/archive/2011/11/07/troubleshooting-record-and-playback-issues-in-coded-ui-test.aspx
    Best Regards,
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How to set/get the values thru Wedbynpro coding for User mapping fields

    Hi All
    In system object we have the user mapping fields like District,city,plant,Salesmanager.
    now we want to set/get the values of these usermapping fields of system object thru webdynpro coding...
    if anybody have sample codes of the same then it would be great help to me
    Thanks in advance
    Thanks
    Trisha Rani

    Hi Kavitha
    Thanks for your reply
    My requirement is exactly as follows.
    1) i have created one portal system object in system administration and also i created usermapping fields in the system object from the usermanagement  in system object.
    i created the user mapping fields like Plant,SalesManager,District etc.
    i also created the system alias name for the same system object
    2)  Now i came to persoanlize link and mapped the system object to the portal user.
    while mapping to the system object we need to enter Mapping userId, Password , once we enter these values and we can also enter the values of usermapping fields which we defined while creating the system object ( for example District,Salesmanager,Plant etc)
    once we enter all the values and click on save then these usermapping  values to be mapped to the portal user.
    3) Now my requirement is , i  want to control the usermapping field values thru webdynpro coding for setting/getting the values.
    I need sample code of the same.
    Please let me know if u need more details on the same.
    Thanks
    Trisha Rani

  • Not able to spy objects in ie9 using coded UI Test Builder Spy, giving exception -Interface not registered(Exception from HRESULT:0X....

    Not able to spy objects in ie9 using coded UI Test Builder Spy, giving exception - "Interface not registered(Exception from HRESULT:0X...."
    I am not able to capture any objects of my web application using coded ui recorder. Even though it is a simple html page, coded ui is showing a message  -"Interface not registered(Exception from HRESULT:0X...."
    Please give me solution , why this is hapening. I am having problem with object identification. Even I am not able to identify any object in google.com.
    swapnanil sengupta

    TechnologyName is displaying as "MSAA" . But my application is a Webapplication.If I try to spy the google .com's search field then also TechnologyName is displaying as "MSAA". Is it any configuration issue of vsts codedui.
    swapnanil sengupta

  • How do I share a color-coded Outlook calendar with others in my office that they can see the colors too?

    How do I share a color-coded Outlook calendar with others in my office that they can see the colors too?

    Hi,
    How do you color code the calendar items? From conditional formatting or from categories?
    Please make sure the user has been given reviewer or higher calendar permission to view items colors in Outlook. About how to share calendar in Outlook, please refer to:
    http://office.microsoft.com/en-001/outlook-help/share-an-outlook-calendar-with-other-people-HA010354420.aspx
    Regards,
    Winnie Liang
    TechNet Community Support

  • 2007 Macbook Pro suddenly coding over files, pictures, deleting itunes and iphoto albums, after it had been dropped in late november 2010. Apple specialists say they cannot find anything wrong. HELP!

    I have a Macbook Pro, the last generation, not the most recent one. It fell about 2 feet in late November 2010 and had the screen and logicboard replaced right after. A day or two after that, I started to notice that my word documents, pictures files, pdf files, itunes library and iphoto library were coded over and deleted out of nowhere. When I click on it, it says it is not a compatible format or cannot be read, etc. However, this doesn't happen all the time and not with every file. I could open a new word document and begin it today, and tomorrow it will not be retreavable, but I have a document on my desktop that has been there since January and can still be opened, so this happens without warning.
    I have taken it in to the Genius Bar at my local Apple store several times with this problem, and they say they cannot see anything wrong with my computer. On my most recent visit, the lady told me to buy an external hardrive, transfer everything onto it, then do a complete clean out of my computer and reboot it I guess. If it doesn't continue, then that might have been the problem, but if it does continue, then it is obviously not that. I am really confused and I don't know if I should trust that this is the problem or just go ahead and buy a new computer all together. I don't have applecare anymore.
    Help me!!! I am desperate.

    Does your MBP still have its original hard drive? If so, it may have started to go south. The average useful life of a notebook drive is 3-5 years, and if yours is the original, it would be about 4 years old. The drop could also have affected it.
    It might be worth booting from your install disc and repairing your boot disk. It sounds like you could have some directory issues. Repair until there is nothing left to repair. If Disk Utility cannot repair the drive, you will need a stronger utility like Disk Warrior or possibly a new drive.
    It also sounds like you may have some software corruption, which can happen if you have hard drive problems. Have you tried reinstalling the OS? You would want to make a backup first on an external drive and then use the archive and install feature and then update the OS.
    You might want to download and run SMART Utility:
    http://www.volitans-software.com/smart_utility.php
    You can download the demo and run it several times for free. SMART Utility seems to be somewhat more critical than Disk Utility, and may be able to detect impending drive failure sooner.
    If the drive checks out OK, then you can follow the advice you got from the genius and make a clone of your boot drive using Super Duper or carbon Copy Cloner on the external drive. You could boot from the clone you made and see how your Mac does when booted from a different drive. If all is good, you can reformat the internal drive and clone back to it.
    If all you need is a replacement hard drive, then your Mac is likely worth fixing. I too have a 2007 MBP, and I replaced my hard drive right after Applecare expired, as the drive started to fail a week after Applecare ran out. I put in a Western Digital 500 GB 7200 RPM Scorpio Black, and have been running on it ever since. I have also upped my RAM to 6 GB and my OS to Lion. Not all the features of Lion work on a 2007 MBP--the trackpad does not support Gestures, and AirDrop is not supported. Even so, I expect this Mac to last me a few more years.
    iFixit has instructions for replacing the hard drive, and OWC has both good RAM and kits for hard drive replacements. My gut feeling is that your hard drive is behind the weird symptoms you are experiencing.
    If you are ready for a new computer, by all means get one--there are some great choices. However, you should be able to fix your old Mac for not very much money and get some more use out of it.
    Good luck!

  • Performance Issue in ABAP part as suggested by SE30 for the below coding

    Dear Abapers,
    The below coding was done by my seniors and having performance issue i.e in SE30 the abap part is consuming 98% of time.
    Pl. help us to solve this situation.
    With best regards,
    S. Arunachalam.
    the code is:
    REPORT ZOBJLIST LINE-SIZE 320 NO STANDARD PAGE HEADING. "280 to 320
    TABLES: MARA, MAKT, A916, KONP, MVKE, ZSAI_PARAM.
    Input parameters *****************************************************
    DATA IT_MARA LIKE MARA OCCURS 0 WITH HEADER LINE.
    DATA T_CLASS LIKE SCLASS OCCURS 0 WITH HEADER LINE.
    DATA T_CLOBJDAT LIKE CLOBJDAT OCCURS 0 WITH HEADER LINE.
    DATA FLG_COLOR TYPE C.
    DATA WRK_CLASS LIKE KLAH-CLASS.
    DATA WRK_PERCENT TYPE I. " Progress percentage
    DATA WRK_LINES LIKE SY-TABIX. " To store the no. of lines in int.table
    DATA WRK_PROGRESSTEXT(72) . " Progress indicator text
    DATA : BEGIN OF IT_MATNR OCCURS 0,
    MATNR LIKE MARA-MATNR,
    MAKTX LIKE MAKT-MAKTX,
    BISMT LIKE MARA-BISMT, "Thanikai-17.05.2002
    END OF IT_MATNR.
    DATA : BEGIN OF IT_HEADER OCCURS 0,
    MATNR LIKE MARA-MATNR,
    MAKTX LIKE MAKT-MAKTX,
    CLART LIKE SCLASS-KLART,
    CLASS LIKE SCLASS-CLASS,
    BISMT LIKE MARA-BISMT, "Thanikai-17.05.2002
    SCMNG(4) TYPE I, "Thanikai-03.10.2002
    END OF IT_HEADER.
    DATA : BEGIN OF IT_DETAILS OCCURS 0,
    MATNR LIKE MARA-MATNR,
    ZAEHL LIKE CLOBJDAT-ZAEHL,
    ATNAM LIKE CLOBJDAT-ATNAM,
    AUSP1 LIKE CLOBJDAT-AUSP1,
    END OF IT_DETAILS.
    DATA : BEGIN OF IT_DETAILS1 OCCURS 0,
    MATNR LIKE MARA-MATNR,
    ATNAM LIKE CLOBJDAT-ATNAM,
    ZAEHL LIKE CLOBJDAT-ZAEHL,
    END OF IT_DETAILS1.
    DATA: IT_DETAILS2 LIKE IT_DETAILS1 OCCURS 0 WITH HEADER LINE.
    DATA TMP_MATNR LIKE AUSP-OBJEK.
    DATA WRK_FIELD(25).
    DATA WRK_TABNAME(40). " Name of the int.table from wrk_fldname
    DATA WRK_FIELDNAME(40). " Name of the fld name from wrk_fldname
    DATA WRK_FLDNAME(40).
    DATA T_CLOBJDAT_LINES LIKE SY-TABIX.
    DATA WRK_LINES1 LIKE SY-TABIX.
    DATA WRK_FIRST_TIME.
    DATA TMP_STR.
    DATA WRK_AUSP1 LIKE CLOBJDAT-AUSP1.
    DATA: WRK_KBETR LIKE KONP-KBETR. "Thanikai-03.10.2002
    SELECTION-SCREEN BEGIN OF BLOCK B3 WITH FRAME TITLE TEXT-003.
    *PARAMETERS:
    SELECT-OPTIONS:
    P_MATKL FOR MARA-MATKL DEFAULT 'DIAL' OBLIGATORY NO INTERVALS.
    SELECT-OPTIONS : S_MATNR FOR MARA-MATNR MATCHCODE OBJECT MAT1.
    SELECTION-SCREEN END OF BLOCK B3.
    SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-002.
    PARAMETERS: P_CLASS LIKE KLAH-CLASS,
    P_KLART LIKE KLAH-KLART DEFAULT '001' OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK B2.
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
    PARAMETERS : REQ RADIOBUTTON GROUP RGRP ,
    NREQ RADIOBUTTON GROUP RGRP .
    SELECTION-SCREEN END OF BLOCK B1.
    AT SELECTION-SCREEN.
    IF NOT P_CLASS IS INITIAL.
    WRK_CLASS = P_CLASS.
    ELSE.
    WRK_CLASS = SPACE.
    ENDIF.
    TOP-OF-PAGE.
    IF SY-BATCH NE 'X'.
    PERFORM PRINT_TOP.
    ENDIF.
    START-OF-SELECTION.
    SET PF-STATUS '9000'.
    SELECT * INTO TABLE IT_MARA
    FROM MARA CLIENT SPECIFIED
    WHERE MANDT = SY-MANDT
    AND MATKL IN P_MATKL
    AND MATNR IN S_MATNR.
    DESCRIBE TABLE IT_MARA LINES WRK_LINES.
    MOVE 'Selecting Material Description' TO WRK_PROGRESSTEXT.
    PERFORM SAPGUI USING WRK_PERCENT WRK_PROGRESSTEXT.
    LOOP AT IT_MARA.
    SELECT SINGLE * FROM MAKT CLIENT SPECIFIED
    WHERE MANDT = SY-MANDT
    AND MATNR = IT_MARA-MATNR
    AND SPRAS = 'E'.
    IF SY-SUBRC = 0.
    IT_MATNR-MATNR = IT_MARA-MATNR.
    IT_MATNR-MAKTX = MAKT-MAKTX.
    IT_MATNR-BISMT = IT_MARA-BISMT. "Thanikai-17.05.2002
    ENDIF.
    APPEND IT_MATNR.
    CLEAR IT_MATNR.
    ENDLOOP.
    CLEAR WRK_LINES.
    DESCRIBE TABLE IT_MATNR LINES WRK_LINES.
    MOVE 'Selecting Class / characteristics for the Material'
    TO WRK_PROGRESSTEXT.
    PERFORM SAPGUI USING WRK_PERCENT WRK_PROGRESSTEXT.
    LOOP AT IT_MATNR.
    CLEAR: TMP_MATNR, T_CLASS, T_CLOBJDAT. "Thanikai-26.08.2002
    REFRESH: T_CLASS, T_CLOBJDAT. "Thanikai-26.08.2002
    TMP_MATNR = IT_MATNR-MATNR.
    CALL FUNCTION 'CLAF_CLASSIFICATION_OF_OBJECTS'
    EXPORTING
    CLASS = WRK_CLASS
    CLASSTEXT = 'X'
    CLASSTYPE = '001'
    CLINT = ' '
    FEATURES = 'X'
    LANGUAGE = SY-LANGU
    OBJECT = TMP_MATNR
    OBJECTTABLE = 'MARA'
    KEY_DATE = SY-DATUM
    INITIAL_CHARACT = 'X'
    NO_VALUE_DESCRIPT = 'X'
    CHANGE_SERVICE_CLF = 'X'
    INHERITED_CHAR = ' '
    TABLES
    T_CLASS = T_CLASS
    T_OBJECTDATA = T_CLOBJDAT
    EXCEPTIONS
    NO_CLASSIFICATION = 1
    NO_CLASSTYPES = 2
    INVALID_CLASS_TYPE = 3
    OTHERS = 4.
    IF SY-SUBRC = 0.
    READ TABLE T_CLASS INDEX 1.
    IT_HEADER-MATNR = IT_MATNR-MATNR.
    IT_HEADER-MAKTX = IT_MATNR-MAKTX.
    IT_HEADER-BISMT = IT_MATNR-BISMT."Thanikai-17.05.2002
    IT_HEADER-CLART = T_CLASS-KLART.
    IT_HEADER-CLASS = T_CLASS-CLASS.
    PERFORM PKG_DLVY_UNIT.
    APPEND IT_HEADER.
    CLEAR: IT_HEADER.
    Code Start by Thanikai on 16.08.2002
    LOOP AT T_CLOBJDAT.
    IT_DETAILS-MATNR = IT_MATNR-MATNR.
    IT_DETAILS-ZAEHL = T_CLOBJDAT-ZAEHL.
    IT_DETAILS-ATNAM = T_CLOBJDAT-ATNAM.
    IT_DETAILS-AUSP1 = T_CLOBJDAT-AUSP1.
    APPEND IT_DETAILS.
    ENDLOOP.
    CLEAR: IT_DETAILS.
    LOOP AT T_CLOBJDAT.
    IT_DETAILS1-MATNR = IT_MATNR-MATNR.
    IT_DETAILS1-ATNAM = T_CLOBJDAT-ATNAM.
    IT_DETAILS1-ZAEHL = T_CLOBJDAT-ZAEHL.
    APPEND IT_DETAILS1.
    ENDLOOP.
    CLEAR: IT_DETAILS1.
    DESCRIBE TABLE IT_DETAILS1 LINES T_CLOBJDAT_LINES.
    IF WRK_FIRST_TIME NE 'X'.
    WRK_LINES1 = T_CLOBJDAT_LINES.
    WRK_FIRST_TIME = 'X'.
    IT_DETAILS2[] = IT_DETAILS1[].
    ELSE.
    IF T_CLOBJDAT_LINES GT WRK_LINES1.
    WRK_LINES1 = T_CLOBJDAT_LINES.
    IT_DETAILS2[] = IT_DETAILS1[].
    ENDIF.
    ENDIF.
    CLEAR: T_CLOBJDAT_LINES.
    CLEAR: IT_DETAILS1. REFRESH: IT_DETAILS1.
    ENDIF.
    Code end by Thanikai on 16.08.2002
    ENDLOOP.
    CLEAR: WRK_LINES1, WRK_FIRST_TIME.
    Print Details *********************************
    PERFORM PRINT_DETAILS.
    AT USER-COMMAND.
    GET CURSOR FIELD WRK_FIELD.
    SPLIT WRK_FIELD AT '-' INTO WRK_TABNAME WRK_FLDNAME.
    IF NOT WRK_FLDNAME IS INITIAL.
    CASE SY-UCOMM.
    WHEN 'SORA'.
    IF SY-LSIND > 0.
    SY-LSIND = SY-LSIND - 1. "To print in the same window
    ENDIF.
    PERFORM PRINT_REPORT_ASCENDING.
    WHEN 'SORD'.
    IF SY-LSIND > 0.
    SY-LSIND = SY-LSIND - 1. "To print in the same window
    ENDIF.
    PERFORM PRINT_REPORT_DESCENDING.
    ENDCASE.
    ELSE.
    MESSAGE S000(38) WITH 'Selete Material Number / Description'.
    ENDIF.
    *& Form SAPGUI
    text
    -->P_WRK_PERCENT text *
    -->P_WRK_PROGRESSTEXT text *
    FORM SAPGUI USING P_WRK_PERCENT
    P_WRK_PROGRESSTEXT.
    CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
    EXPORTING
    PERCENTAGE = WRK_PERCENT
    TEXT = WRK_PROGRESSTEXT
    EXCEPTIONS
    OTHERS = 1.
    ENDFORM. " SAPGUI
    *& Form PRINT_REPORT_ASCENDING
    text
    --> p1 text
    <-- p2 text
    FORM PRINT_REPORT_ASCENDING.
    IF WRK_TABNAME = 'IT_HEADER'.
    SORT IT_HEADER BY (WRK_FLDNAME).
    PERFORM PRINT_TOP.
    PERFORM PRINT_DETAILS.
    ENDIF.
    ENDFORM. " PRINT_REPORT_ASCENDING
    *& Form PRINT_DETAILS
    text
    --> p1 text
    <-- p2 text
    WRK_AUSP1 width chged below from (7)to(9) by Nagaraj/MKRK 24.11.05
    FORM PRINT_DETAILS.
    SORT IT_HEADER BY MATNR.
    IF SY-BATCH EQ 'X'.
    PERFORM PRINT_TOP.
    ENDIF.
    IF REQ = 'X'.
    LOOP AT IT_HEADER.
    IF FLG_COLOR = 'X'.
    FORMAT COLOR COL_NORMAL INTENSIFIED ON.
    CLEAR FLG_COLOR.
    ELSE.
    FORMAT COLOR COL_NORMAL INTENSIFIED OFF.
    FLG_COLOR = 'X'.
    ENDIF.
    WRITE :/ SY-VLINE NO-GAP,
    (18) IT_HEADER-MATNR COLOR COL_KEY NO-GAP,
    SY-VLINE NO-GAP,
    (40) IT_HEADER-MAKTX NO-GAP,
    SY-VLINE NO-GAP,
    (18) IT_HEADER-BISMT NO-GAP, "Thanikai-17.05.2002
    SY-VLINE NO-GAP.
    Code started by Thanikai on 16.08.2002
    LOOP AT IT_DETAILS2.
    CLEAR: TMP_STR, WRK_AUSP1.
    IF IT_DETAILS2-ATNAM EQ 'CALIBRE'.
    LOOP AT IT_DETAILS WHERE MATNR = IT_HEADER-MATNR
    AND ATNAM = IT_DETAILS2-ATNAM
    AND ZAEHL = IT_DETAILS2-ZAEHL.
    TMP_STR = 'X'.
    WRK_AUSP1 = IT_DETAILS-AUSP1.
    EXIT.
    ENDLOOP.
    IF TMP_STR EQ 'X'.
    WRITE : (9)WRK_AUSP1 NO-GAP, SY-VLINE NO-GAP.
    ELSE.
    WRITE : ' ', SY-VLINE NO-GAP.
    ENDIF.
    ELSE.
    LOOP AT IT_DETAILS WHERE MATNR = IT_HEADER-MATNR
    AND ATNAM = IT_DETAILS2-ATNAM.
    TMP_STR = 'X'.
    WRK_AUSP1 = IT_DETAILS-AUSP1.
    EXIT.
    ENDLOOP.
    IF TMP_STR EQ 'X'.
    WRITE : (9)WRK_AUSP1 NO-GAP, SY-VLINE NO-GAP.
    ELSE.
    WRITE : ' ', SY-VLINE NO-GAP.
    ENDIF.
    ENDIF.
    ENDLOOP.
    WRITE : (8) IT_HEADER-SCMNG NO-GAP, SY-VLINE NO-GAP.
    IF SY-LINNO > 25.
    IF SY-BATCH EQ 'X'.
    NEW-PAGE.
    PERFORM PRINT_TOP.
    ENDIF.
    ENDIF.
    Code end by Thanikai on 16.08.2002..
    ENDLOOP.
    ELSEIF NREQ = 'X'.
    LOOP AT IT_HEADER.
    IF FLG_COLOR = 'X'.
    FORMAT COLOR COL_NORMAL INTENSIFIED ON.
    CLEAR FLG_COLOR.
    ELSE.
    FORMAT COLOR COL_NORMAL INTENSIFIED OFF.
    FLG_COLOR = 'X'.
    ENDIF.
    WRITE :/ SY-VLINE NO-GAP,
    (18) IT_HEADER-MATNR COLOR COL_KEY NO-GAP,
    SY-VLINE NO-GAP,
    (18) IT_HEADER-BISMT NO-GAP, "Thanikai-17.05.2002
    SY-VLINE NO-GAP.
    Code started by Thanikai on 16.08.2002
    LOOP AT IT_DETAILS2.
    CLEAR: TMP_STR, WRK_AUSP1.
    IF IT_DETAILS2-ATNAM EQ 'CALIBRE'.
    LOOP AT IT_DETAILS WHERE MATNR = IT_HEADER-MATNR
    AND ATNAM = IT_DETAILS2-ATNAM
    AND ZAEHL = IT_DETAILS2-ZAEHL.
    TMP_STR = 'X'.
    WRK_AUSP1 = IT_DETAILS-AUSP1.
    EXIT.
    ENDLOOP.
    IF TMP_STR EQ 'X'.
    WRITE : (9)WRK_AUSP1 NO-GAP, SY-VLINE NO-GAP.
    ELSE.
    WRITE : ' ', SY-VLINE NO-GAP.
    ENDIF.
    ELSE.
    LOOP AT IT_DETAILS WHERE MATNR = IT_HEADER-MATNR
    AND ATNAM = IT_DETAILS2-ATNAM.
    TMP_STR = 'X'.
    WRK_AUSP1 = IT_DETAILS-AUSP1.
    EXIT.
    ENDLOOP.
    IF TMP_STR EQ 'X'.
    WRITE : (9)WRK_AUSP1 NO-GAP, SY-VLINE NO-GAP.
    ELSE.
    WRITE : ' ', SY-VLINE NO-GAP.
    ENDIF.
    ENDIF.
    ENDLOOP.
    WRITE : (8) IT_HEADER-SCMNG NO-GAP, SY-VLINE NO-GAP.
    IF SY-LINNO > 25.
    IF SY-BATCH EQ 'X'.
    NEW-PAGE.
    PERFORM PRINT_TOP.
    ENDIF.
    ENDIF.
    Code end by Thanikai on 16.08.2002
    ENDLOOP.
    ENDIF.
    ULINE.
    ENDFORM. " PRINT_DETAILS
    *& Form PRINT_REPORT_DESCENDING
    text
    --> p1 text
    <-- p2 text
    FORM PRINT_REPORT_DESCENDING.
    IF WRK_TABNAME = 'IT_HEADER'.
    SORT IT_HEADER BY (WRK_FLDNAME) DESCENDING.
    PERFORM PRINT_TOP.
    PERFORM PRINT_DETAILS.
    ENDIF.
    ENDFORM. " PRINT_REPORT_DESCENDING
    *& Form PRINT_TOP
    text
    --> p1 text
    <-- p2 text
    IT_DETAILS2-ATNAM width chged below from 7 to 9. Nagaraj/MKRK 24.11.05
    FORM PRINT_TOP.
    FORMAT COLOR COL_HEADING INTENSIFIED OFF.
    ULINE.
    IF REQ = 'X'.
    READ TABLE IT_HEADER INDEX 1.
    WRITE :/ SY-VLINE NO-GAP,(17) 'Material No' ,SY-VLINE NO-GAP.
    SET LEFT SCROLL-BOUNDARY.
    WRITE :(39) ' Material Description', SY-VLINE NO-GAP,
    (17) ' Old Matl. Number', SY-VLINE NO-GAP. "Thanikai-17.05.2002
    Comments made by Thanikai on 16.08.2002
    LOOP AT IT_DETAILS WHERE MATNR = IT_HEADER-MATNR.
    LOOP AT IT_DETAILS2.
    WRITE : (9) IT_DETAILS1-ATNAM NO-GAP,SY-VLINE NO-GAP.
    WRITE : (9) IT_DETAILS2-ATNAM NO-GAP,SY-VLINE NO-GAP.
    ENDLOOP.
    WRITE : (8) 'Pkg.Unit' NO-GAP, SY-VLINE NO-GAP.
    ELSEIF NREQ = 'X'.
    READ TABLE IT_HEADER INDEX 1.
    WRITE :/ SY-VLINE NO-GAP, (17) 'Material No' ,SY-VLINE NO-GAP,
    (17) ' Old Matl. Number', SY-VLINE NO-GAP. "Thanikai-17.05.2002
    Comments made by Thanikai on 16.08.2002
    LOOP AT IT_DETAILS WHERE MATNR = IT_HEADER-MATNR.
    LOOP AT IT_DETAILS2.
    WRITE : (9) IT_DETAILS-ATNAM NO-GAP,SY-VLINE NO-GAP.
    WRITE : (9) IT_DETAILS2-ATNAM NO-GAP,SY-VLINE NO-GAP.
    ENDLOOP.
    WRITE : (8) 'Pkg.Unit' NO-GAP, SY-VLINE NO-GAP.
    ENDIF.
    ULINE.
    FORMAT RESET.
    ENDFORM. " PRINT_TOP
    *& Form PKG_DLVY_UNIT
    text
    --> p1 text
    <-- p2 text
    FORM PKG_DLVY_UNIT.
    SELECT SINGLE KONP~KBETR INTO WRK_KBETR
    FROM ( A916 INNER JOIN KONP
    ON KONP~MANDT = SY-MANDT
    AND KONPKNUMH = A916KNUMH
    AND KONP~KOPOS = '01' ) CLIENT SPECIFIED
    WHERE A916~MANDT = SY-MANDT
    AND A916~KAPPL = 'V'
    AND A916~KSCHL = 'PR00'
    AND A916~VKORG = 'WTCH'
    AND A916~VTWEG = '01'
    AND A916~SPART = '01'
    AND A916~MATNR = IT_MATNR-MATNR
    AND A916~DATBI >= SY-DATUM
    AND A916~DATAB <= SY-DATUM.
    IF SY-SUBRC EQ 0.
    SELECT SINGLE * FROM ZSAI_PARAM CLIENT SPECIFIED
    WHERE MANDT = SY-MANDT
    AND PMFID = 'ZPKG_PRICE'
    AND PMVL1 = '01'.
    IF SY-SUBRC EQ 0.
    IF WRK_KBETR BETWEEN 1 AND ZSAI_PARAM-PMVL2.
    SELECT SINGLE * FROM MVKE CLIENT SPECIFIED
    WHERE MANDT = SY-MANDT
    AND MATNR = IT_MATNR-MATNR
    AND VKORG = 'WTCH'
    AND VTWEG = '01'.
    IF SY-SUBRC EQ 0.
    IF MVKE-SCMNG GE 1.
    IT_HEADER-SCMNG = MVKE-SCMNG.
    ELSE.
    In the absence of delivery unit for a material,
    delivery unit is considered as one.
    IT_HEADER-SCMNG = 1.
    ENDIF.
    ELSE.
    IT_HEADER-SCMNG = 1.
    ENDIF.
    ELSE.
    If the price for a material is either below 1 or above 2499, then
    the delivery unit is considered as one.
    IT_HEADER-SCMNG = 1.
    ENDIF.
    ELSE.
    IT_HEADER-SCMNG = 1.
    ENDIF.
    ELSE.
    In the absence of price for a material, delivery unit is
    considered as one.
    IT_HEADER-SCMNG = 1.
    ENDIF.
    CLEAR: WRK_KBETR.
    ENDFORM. " PKG_DLVY_UNIT

    The first point would be to change the following:
    LOOP AT IT_MARA.
    SELECT SINGLE * FROM MAKT CLIENT SPECIFIED
    WHERE MANDT = SY-MANDT
    AND MATNR = IT_MARA-MATNR
    AND SPRAS = 'E'.
    IF SY-SUBRC = 0.
    IT_MATNR-MATNR = IT_MARA-MATNR.
    IT_MATNR-MAKTX = MAKT-MAKTX.
    IT_MATNR-BISMT = IT_MARA-BISMT. "Thanikai-17.05.2002
    ENDIF.
    APPEND IT_MATNR.
    CLEAR IT_MATNR.
    ENDLOOP.
    I would sort IT_MARA by matnr then select for all entries into new table IT_matnr and only read when you are actuallygoing to use it for your final table.
    This however will not make much difference to your problem. I suggest you put more of the code into subroutines and look at the se30 output as tyo which subroutines are actually taking most of the time. Please post the results and the subroutines which take the longest.

Maybe you are looking for