Upload Image in Document TAB in BP

I need to upload a  image under the document tab in BP transaction programmatically.
Can anyone suggest any Function module through which i can update the same and also delete the same if required.
What are the tables in which this data is stored. Kindly help,its urgent.Thank you in advance.

Hi Dilip,
Please go through the following code,
aqui le pasamos el guid del documento sap crm que estemos tratando
  CALL METHOD cl_crm_documents=>create_with_file
    EXPORTING
    aqui le pasamos el nombre del fichero que queremos anexar
      file_name       = filename
    'c:\' "aqui le pasamos la ruta del fichero que queremos anexar
      directory       = path
      business_object = ls_bor
    IMPORTING
      loio            = lv_loio
      phio            = lv_phio
      error           = lv_error.
Let me know if you more info on this.
Regards,
Abhijit G. Borkar

Similar Messages

  • Uploading image in document servers scripts/smartforms

    Hi,
       Can anyone of help me to upload the image(.jpg)  in doucment server. ?
    Regards,
    Ganesh .

    Steps:
    1.Go to transaction SE78 (Administration of Form Graphics). 
    2. Double-click on u201CGRAPHICSu201D node and click on u201CImport (F5)u201D to import the image. 
    3. Select the file name by using the F4 functionality available. Name your graphic and enter a short description. If you have color image, select the radio button u201CColor Bitmap imageu201D.  Click on tick mark to proceed. 
    4. The graphic is imported and is stored in u201CBusiness Document Serveru201D.  You can test this by selecting print preview.
    Regards,
    JOy.

  • Error while uploading images to SAP Mobile Documents from iPad application using ObjectiveCMIS.

    Hi,
    I am getting the error while uploading images to SAP Mobile Documents from custom iOS(iPad )application using ObjectiveCMIS library.
    My Custom method is as follows:
    - (void)createSalesOrderRouteMapImageInFolder:(NSString*)salesOrderRouteMapFolderId routeMapImageTitle:(NSString *)imageTitle routeMapContent:(NSData *)imageData
        NSInputStream *inputStream = [NSInputStream inputStreamWithData:imageData];
        NSMutableDictionary *properties = [NSMutableDictionary dictionary];
        [properties setObject:[NSString stringByAppendingFileExtension:imageTitle] forKey:@"cmis:name"];
        [properties setObject:@"cmis:document" forKey:@"cmis:objectTypeId"];
        [self.session createDocumentFromInputStream:inputStream
                                           mimeType:@"image/png"
                                         properties:properties
                                           inFolder:salesOrderRouteMapFolderId
                                      bytesExpected:[imageData length]
                                    completionBlock:^(NSString *objectId, NSError *error) {
                                        NSLog(@"Object id is %@",objectId);
                                        if(error == nil) {
                                            [inputStream close];
                                            NSLog(@"Uploading Sales order route map successfully.");
                                            [[NSNotificationCenter defaultCenter] postNotificationName:SaveOrderSuccessNotification object:nil];
                                        } else {
                                            [inputStream close];
                                            NSLog(@"Uploading sales order route map failed.");
                                            [[NSNotificationCenter defaultCenter] postNotificationName:SaveOrderFailedNotification object:error];
                                    } progressBlock:^(unsigned long long bytesUploaded, unsigned long long bytesTotal) {
                                        NSLog(@"uploading... (%llu/%llu)", bytesUploaded, bytesTotal);
    OBjectiveCMIS Method in which i am getting error during upload:
    - (void)sendAtomEntryXmlToLink:(NSString *)link
                 httpRequestMethod:(CMISHttpRequestMethod)httpRequestMethod
                        properties:(CMISProperties *)properties
                contentInputStream:(NSInputStream *)contentInputStream
                   contentMimeType:(NSString *)contentMimeType
                     bytesExpected:(unsigned long long)bytesExpected
                       cmisRequest:(CMISRequest*)request
                   completionBlock:(void (^)(CMISObjectData *objectData, NSError *error))completionBlock
                     progressBlock:(void (^)(unsigned long long bytesUploaded, unsigned long long bytesTotal))progressBlock
        // Validate param
        if (link == nil) {
            CMISLogError(@"Must provide link to send atom entry");
            if (completionBlock) {
                completionBlock(nil, [CMISErrors createCMISErrorWithCode:kCMISErrorCodeInvalidArgument detailedDescription:nil]);
            return;
        // generate start and end XML
        CMISAtomEntryWriter *writer = [[CMISAtomEntryWriter alloc] init];
        writer.cmisProperties = properties;
        writer.mimeType = contentMimeType;
        NSString *xmlStart = [writer xmlStartElement];
        NSString *xmlContentStart = [writer xmlContentStartElement];
        NSString *start = [NSString stringWithFormat:@"%@%@", xmlStart, xmlContentStart];
        NSData *startData = [NSMutableData dataWithData:[start dataUsingEncoding:NSUTF8StringEncoding]];
        NSString *xmlContentEnd = [writer xmlContentEndElement];
        NSString *xmlProperties = [writer xmlPropertiesElements];
        NSString *end = [NSString stringWithFormat:@"%@%@", xmlContentEnd, xmlProperties];
        NSData *endData = [end dataUsingEncoding:NSUTF8StringEncoding];
        // The underlying CMISHttpUploadRequest object generates the atom entry. The base64 encoded content is generated on
        // the fly to support very large files.
        [self.bindingSession.networkProvider invoke:[NSURL URLWithString:link]
                                         httpMethod:httpRequestMethod
                                            session:self.bindingSession
                                        inputStream:contentInputStream
                                            headers:[NSDictionary dictionaryWithObject:kCMISMediaTypeEntry forKey:@"Content-type"]
                                      bytesExpected:bytesExpected
                                        cmisRequest:request
                                          startData:startData
                                            endData:endData
                                  useBase64Encoding:YES
                                    completionBlock:^(CMISHttpResponse *response, NSError *error) {
                                        if (error) {
                                            CMISLogError(@"HTTP error when sending atom entry: %@", error.userInfo.description);
                                            if (completionBlock) {
                                                completionBlock(nil, error);
                                        } else if (response.statusCode == 200 || response.statusCode == 201 || response.statusCode == 204) {
                                            if (completionBlock) {
                                                NSError *parseError = nil;
                                                CMISAtomEntryParser *atomEntryParser = [[CMISAtomEntryParser alloc] initWithData:response.data];
                                                [atomEntryParser parseAndReturnError:&parseError];
                                                if (parseError == nil) {
                                                    completionBlock(atomEntryParser.objectData, nil);
                                                } else {
                                                    CMISLogError(@"Error while parsing response: %@", [parseError description]);
                                                    completionBlock(nil, [CMISErrors cmisError:parseError cmisErrorCode:kCMISErrorCodeRuntime]);
                                        } else {
                                            CMISLogError(@"Invalid http response status code when sending atom entry: %d", (int)response.statusCode);
                                            CMISLogError(@"Error content: %@", [[NSString alloc] initWithData:response.data encoding:NSUTF8StringEncoding]);
                                            if (completionBlock) {
                                                completionBlock(nil, [CMISErrors createCMISErrorWithCode:kCMISErrorCodeRuntime
                                                                                     detailedDescription:[NSString stringWithFormat:@"Failed to send atom entry: http status code %li", (long)response.statusCode]]);
                                      progressBlock:progressBlock];
    Attaching the logs:
    ERROR [CMISAtomPubBaseService sendAtomEntryXmlToLink:httpRequestMethod:properties:contentInputStream:contentMimeType:bytesExpected:cmisRequest:completionBlock:progressBlock:] HTTP error when sending atom entry: Error Domain=org.apache.chemistry.objectivecmis Code=260 "Runtime Error" UserInfo=0x156acfa0 {NSLocalizedDescription=Runtime Error, NSLocalizedFailureReason=ASJ.ejb.005044 (Failed in component: sap.com/com.sap.mcm.server.nw) Exception raised from invocation of public void com.sap.mcm.server.service.AbstractChangeLogService.updateChangeLog(java.lang.String,boolean) throws com.sap.mcm.server.api.exception.MCMException method on bean instance com.sap.mcm.server.nw.service.NwChangeLogService@4e7989f3 for bean sap.com/com.sap.mcm.server.nw*annotation|com.sap.mcm.server.nw.ejb.jar*annotation|NwChangeLogService in application sap.com/com.sap.mcm.server.nw.; nested exception is: javax.ejb.EJBTransactionRolledbackException: ASJ.ejb.005044 (Failed in component: sap.com/com.sap.mcm.server.nw) Exception raised from invocation of public com.sap.mcm.server.model.ChangeLog com.sap.mcm.server.dao.impl.ChangeLogDaoImpl.findByUserId(java.lang.String) method on bean instance com.sap.mcm.server.dao.impl.ChangeLogDaoImpl@2852b733 for bean sap.com/com.sap.mcm.server.nw*annotation|com.sap.mcm.server.nw.ejb.jar*annotation|ChangeLogDaoImpl in application sap.com/com.sap.mcm.server.nw.; nested exception is: javax.persistence.NonUniqueResultException: More than 1 objects of type ChangeLog found with userId=25f8928e-8ba0-4edd-b08e-43bf6fb78f1a; nested exception is: javax.ejb.EJBException: ASJ.ejb.005044 (Failed in component: sap.com/com.sap.mcm.server.nw) Exception raised from invocation of public com.sap.mcm.server.model.ChangeLog com.sap.mcm.server.dao.impl.ChangeLogDaoImpl.findByUserId(java.lang.String) method on bean instance com.sap.mcm.server.dao.impl.ChangeLogDaoImpl@2852b733 for bean sap.com/com.sap.mcm.server.nw*annotation|com.sap.mcm.server.nw.ejb.jar*annotation|ChangeLogDaoImpl in application sap.com/com.sap.mcm.server.nw.; nested exception is: javax.persistence.NonUniqueResultException: More than 1 objects of type ChangeLog found with userId=25f8928e-8ba0-4edd-b08e-43bf6fb78f1a}
    2015-03-12 04:08:31.634 Saudi Ceramics[4867:351095] Uploading sales order route map failed.

    Hi Sukalyan,
    Have you checked the below links?
    These will give you step by step implementation procedure.
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/a099a3bd-17ef-2b10-e6ac-9c1ea42af0e9?quicklink=index&overridelayout=true
    http://wiki.sdn.sap.com/wiki/display/WDJava/KmuploadusingWebdynproapplication
    Regards,
    Sandip

  • Upload and displaying document file and image file with oracle portal

    Dear All,
    Could anyone please tell me how to displaying document file and image file that I've stored to database (8.1.7) using oracle portal. (I use intermedia data type).
    I've tried to follow the instruction given by Oracle LiveDemo, but it came with failure. (the image or document won't show up).
    Thanks for support.
    Moza

    Please repost this question in the appropriate section of the Discussion Forum.
    This forum is for general suggestions and feedback about the OTN site. For technical question about an Oracle product,
    For customers with paid support (Metalink) please go to:
    http://www.oracle.com/support/metalink

  • Storing Uploaded Image Path into Mysql

    Hi I am developing a cms and am using the code David gives in his book PHP Solutions,  everything works fine but I can't work out how to extract the uploaded path so that it is stored in my table.
    Help would be really appreciated, I am making good progress in learning the php especially with David's books but am still struggling when it comes to having to customized the code.
    The code for the upload.php is as follows,
    <?php
    class Gp1_Upload{
      protected $_uploaded = array();
      protected $_destination;
      protected $_max = 51200;
      protected $_messages = array();
      protected $_permitted = array('image/gif',
                                    'image/jpeg',
                                    'image/pjpeg',
                                    'image/png');
      protected $_renamed = false;
      public function __construct($path) {
        if (!is_dir($path) || !is_writable($path)) {
          throw new Exception("$path must be a valid, writable directory.");
        $this->_destination = $path;
        $this->_uploaded = $_FILES;
      public function getuploadpath (){
      public function getMaxSize() {
        return number_format($this->_max/1024, 1) . 'kB';
      public function setMaxSize($num) {
        if (!is_numeric($num)) {
          throw new Exception("Maximum size must be a number.");
        $this->_max = (int) $num;
      public function move($overwrite = false) {
        $field = current($this->_uploaded);
        if (is_array($field['name'])) {
          foreach ($field['name'] as $number => $filename) {
            // process multiple upload
            $this->_renamed = false;
            $this->processFile($filename, $field['error'][$number], $field['size'][$number], $field['type'][$number], $field['tmp_name'][$number], $overwrite);   
        } else {
          $this->processFile($field['name'], $field['error'], $field['size'], $field['type'], $field['tmp_name'], $overwrite);
      public function getMessages() {
        return $this->_messages;
      protected function checkError($filename, $error) {
        switch ($error) {
          case 0:
            return true;
          case 1:
          case 2:
            $this->_messages[] = "$filename exceeds maximum size: " . $this->getMaxSize();
            return true;
          case 3:
            $this->_messages[] = "Error uploading $filename. Please try again.";
            return false;
          case 4:
            $this->_messages[] = 'No file selected.';
            return false;
          default:
            $this->_messages[] = "System error uploading $filename. Contact webmaster.";
            return false;
      protected function checkSize($filename, $size) {
        if ($size == 0) {
          return false;
        } elseif ($size > $this->_max) {
          $this->_messages[] = "$filename exceeds maximum size: " . $this->getMaxSize();
          return false;
        } else {
          return true;
      protected function checkType($filename, $type) {
        if (empty($type)) {
          return false;
        } elseif (!in_array($type, $this->_permitted)) {
          $this->_messages[] = "$filename is not a permitted type of file.";
          return false;
        } else {
          return true;
      public function addPermittedTypes($types) {
        $types = (array) $types;
        $this->isValidMime($types);
        $this->_permitted = array_merge($this->_permitted, $types);
      protected function isValidMime($types) {
        $alsoValid = array('image/tiff',
                           'application/pdf',
                           'text/plain',
                           'text/rtf');
          $valid = array_merge($this->_permitted, $alsoValid);
        foreach ($types as $type) {
          if (!in_array($type, $valid)) {
            throw new Exception("$type is not a permitted MIME type");
      protected function checkName($name, $overwrite) {
        $nospaces = str_replace(' ', '_', $name);
        if ($nospaces != $name) {
          $this->_renamed = true;
        if (!$overwrite) {
          $existing = scandir($this->_destination);
          if (in_array($nospaces, $existing)) {
            $dot = strrpos($nospaces, '.');
            if ($dot) {
              $base = substr($nospaces, 0, $dot);
              $extension = substr($nospaces, $dot);
            } else {
              $base = $nospaces;
              $extension = '';
            $i = 1;
            do {
              $nospaces = $base . '_' . $i++ . $extension;
            } while (in_array($nospaces, $existing));
            $this->_renamed = true;
        return $nospaces;
      protected function processFile($filename, $error, $size, $type, $tmp_name, $overwrite) {
        $OK = $this->checkError($filename, $error);
        if ($OK) {
          $sizeOK = $this->checkSize($filename, $size);
          $typeOK = $this->checkType($filename, $type);
          if ($sizeOK && $typeOK) {
            $name = $this->checkName($filename, $overwrite);
            $success = move_uploaded_file($tmp_name, $this->_destination . $name);
            if ($success) {
                $message = "$filename uploaded successfully";
                if ($this->_renamed) {
                  $message .= " and renamed $name";
                $this->_messages[] = $message;
            } else {
              $this->_messages[] = "Could not upload $filename";
    ?>
    The code for my form page is this
    <!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" />
    <title>Untitled Document</title>
    </head>
    <body>
    <?php
    //THE FOLLOWING CODE IS FOR THE UPLOADING OF IMAGES AND FILES
    // set the max upload size in bytes
    $max = 51200;
    if (isset ($_POST ['submit']))
                //define the path to the upload folder
                $destination = 'uploads/';
                require_once('classes/Upload.php');
                try {
                    $upload = new Gp1_Upload($destination);
                    $upload->setMaxSize($max);
                    $upload->move();
                    $result = $upload->getMessages();
                } catch (Exception $e) {
                    echo $e->getMessage();
    // END OF UPLOADING OF IMAGES AND FILES
    ?>
    <form id="newvenue" action="" method="post" enctype="multipart/form-data" >
          <?php
               // THIS CODE DISPLAYS ERROR MESSAGES FOR THE FILE UPLOADS
              if (isset($result)){
              echo '<ul>';
              foreach ($result as $message){
                  echo "<li>$message</li>";
              echo '</ul>';
           ?>
      <table id="neweventdisplay" cellpadding="5"  border="0">
        <tr>
      <td></td>
      <td><input type="hidden" name="user_id"  value="" /></td>
      </tr>
      <tr>
      <td></td>
        <td>Organisers Name</td>
        <td><input class="input80px" id="org_name" name="org_name" type="text" /> </td>
      </tr>
      <tr>
      <td></td>
      <td><label for="image">Upload image:</label></td>
      <td><p>
    <input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $max; ?>" />
    <input type="file" name="image" id="image" />
    </p></td>
    </tr>
      <tr>
      <td></td>
      <td>Details about your upload</td>
      <td><input class="input80px" id="org_uploadcapt" name="org_uploadcapt" type="text"  /></td>
    </tr>
      <tr>
      <td></td>
      <td><input type="submit" name="submit" id="submit" value="upload"></td>
      </tr>
      <tr>
      <td class="heading"> </td>
      <td></td>
      </tr>
    </table>
    </form>
    <prep>
    <?php
    if (isset ($_POST ['submit'])){
        print_r($_FILES);}
        ?>
        </prep>
    </body>
    </html>

    Hi David
    Thank you very much for your help.  I had continued to work on the code and had worked out how to input the image path into the database but it was using the original filename, so when every it is changed it did not work.  The code in my page at that point was the following,
    <?php     // 2. NEW USER REGISTRATION<br />
            include_once ("includes/form_functions.inc.php");
            $max = 100000;
            $destination = 'uploads/';
            // START FORM PROCESSING FOR A NEW REGISTRATION
            if (isset($_POST['submit'])) { // Form has been submitted.
            $errors = array();
            // perform validations on the form data
            $required_fields = array('org_name');
            $errors = array_merge($errors, check_required_fields($required_fields, $_POST));    
            $required_numberfields = array('user_id');
            $errors = array_merge($errors, check_number_fields($required_numberfields, $_POST));
            $fields_with_lengths = array('org_name' => 36, 'org_website' => 100, 'org_contact' => 40,  'org_conemail' => 80, 'org_contel' => 30);
            $errors = array_merge($errors, check_max_field_lengths($fields_with_lengths, $_POST));
            /*Here I am using trim as well as ucwords, this function converts the first letter of each work into a capital letter,  I am using this only on the
            firstname and surname to ensure that the data is how I want it as it is going  into the database,  The better the data is preformated the better the data
            swill be within the database.*/
            $org_name = trim(strtolower(mysql_prep($_POST['org_name'])));
            $org_website = trim(strtolower(mysql_prep($_POST['org_website'])));
            $org_contact = trim(strtolower (mysql_prep($_POST['org_contact'])));
            $org_conemail = trim(strtolower (mysql_prep($_POST['org_conemail'])));
            $org_contel = strtolower (mysql_prep($_POST['org_contel']));
            $userid = $_POST['user_id'];
            $org_uploadcapt = $_POST['org_uploadcapt'];
            $image = $_FILES['image'];
            /*Here is the code that takes the variable captured from the input form and matches it  up with the appropriate field in the database.  An important point with insertion is that  the variables are in the same order as the mysql field names, there will be an error if the number of variables does not match the number of field names.  Note that there is no entry for the user id as this is an auto increment file within mysql and so is not needed to be entered*/
            if ( empty($errors) ) {
                $sql = "INSERT INTO organiser
                          (org_name, org_website, org_contact, org_conemail, org_contel, user_id, org_uploadurl, org_uploadcapt)
                          VALUES
                          ('{$org_name}', '{$org_website}', '{$org_contact}', '{$org_conemail}', '{$org_contel}', '{$userid}', '{$destination}".$image['name']."', '{$org_uploadcapt}' )";
                $result = mysql_query($sql, $connection);
                if ($result) {
                    $message = "The organiser was successfully created.<br />";
                } else {
                    $message = "I am sorry but the organiser could not be added.";
                    $message .= "<br />" . mysql_error();
                } else {
                    /* this counts the number of errors and informs the user of how many fields were
                    incorrectly entered*/
                if (count($errors) == 1) {
                    $message = "There was 1 error in the form.";
                } else {
                    $message = "There were " . count($errors) . " errors in the form.";
        } else { // Form has not been submitted.
            $org_name = "";
            $org_website = "";
            $org_contact = "";
            $org_conemail = "";
            $org_contel = "";
            $userid = "";
            $org_uploadcapt = "";
    //THE FOLLOWING CODE IS FOR THE UPLOADING OF IMAGES AND FILES
    // set the max upload size in bytes
    if (isset ($_POST ['submit']))
                //define the path to the upload folder
                // Use This On The Local Hosting Machine
                //$destination = 'C:/upload_test/';
                // Use This On The Live Server
                require_once('classes/Upload.php');
                try {
                    $upload = new Gp1_Upload($destination);
                    $upload->setMaxSize($max);
                    $upload->move();
                    $result = $upload->getMessages();
                } catch (Exception $e) {
                    echo $e->getMessage();
    // END OF UPLOADING OF IMAGES AND FILES
    ?>
    <title>Horse Events</title>
    <?php include_once("includes/meta.inc.php");?>
    <?php include_once("includes/cssfavgoogle.inc.php");?>
    <link href="css/adminpanel.css" rel="stylesheet" type="text/css" />
    <style>
    input[type="number"] {
        width:40px;
    </style>
    </head>
    <body>
    <div id="wrapper">
        <div id="admincontent">
    <form id="newvenue" action="neworganiser.php" method="post" enctype="multipart/form-data" >
          <?php if (!empty ($message)) {echo "<p class=\"message\">" . $message . "</p>";} ?>
          <?php if (!empty ($errors)) {display_errors($errors); } ?>
          <?php
              // THIS CODE DISPLAYS ERROR MESSAGES FOR THE FILE UPLOADS
              if (isset($result)){
              echo '<ul>';
              foreach ($result as $message){
                  echo "<li>$message</li>";
              echo '</ul>';
           ?>
    <br />
          <table id="neweventdisplay" cellpadding="5"  border="0">
        <tr>
      <td></td>
      <td><input type="hidden" name="user_id"  value="<?php echo $url_userid ['user_id']; ?>" /></td>
      </tr>
      <tr>
      <td> <span class="compuls">*</span></td>
        <td>Organisers Name</td>
        <td><input class="input80px" id="org_name" name="org_name" type="text" />
         </td>
      </tr>
          <tr>
          <td><span class="compuls">*</span></td>
        <td>Their Website</td>
        <td><input class="input80px" id="org_website" name="org_website" type="text" /></td>
      </tr>
        <tr>
        <td><span class="compuls">*</span></td>
        <td>Organisers Contact</td>
        <td><input id="org_contact" name="org_contact" type="text" />eg: Mrs Jean Kelly</td>
      </tr>
        <tr>
        <td><span class="compuls">*</span></td>
        <td>Contact Email</td>
        <td><input class="input80px" id="org_conemail" name="org_conemail" type="text" />
          </td>
      </tr>
        <tr>
        <td><span class="compuls">*</span></td>
      <td>Contact Tel No.</td>
      <td><input id="org_contel" name="org_contel" type="text" /></td>
      </tr>
      <tr>
      <td></td>
      <td><label for="image">Upload image:</label></td>
      <td><p>
    <input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $max; ?>" />
    <input type="file" name="image" id="image" />
    </p></td>
    </tr>
      <tr>
      <td></td>
      <td>Details about your upload</td>
      <td><input class="input80px" id="org_uploadcapt" name="org_uploadcapt" type="text"  /></td>
    </tr>
      <tr>
      <td></td>
      <td><input type="submit" name="submit" id="submit" value="Add Your Organiser"></td>
      </tr>
      <tr>
      <td class="heading"> </td>
      <td></td>
      </tr>
    </table>
    <a  class="delete" href="controlpanel.php">Cancel</a>
    </form>
        </div>
    I have added the code you kindly forwarded but am getting an error,  I am still trying to learn the basics of php and am unsure of what to do next, my php Upload.php now looks like
    <?php
    class Gp1_Upload{
      protected $_uploaded = array();
      protected $_destination;
      protected $_max = 100000;
      protected $_messages = array();
      protected $_permitted = array('image/gif',
                                    'image/jpeg',
                                    'image/pjpeg',
                                    'image/png');
      protected $_renamed = false;
      protected $_filenames = array();
      public function __construct($path) {
        if (!is_dir($path) || !is_writable($path)) {
          throw new Exception("$path must be a valid, writable directory.");
        $this->_destination = $path;
        $this->_uploaded = $_FILES;
      public function getMaxSize() {
        return number_format($this->_max/100000, 1) . 'kB';
      public function setMaxSize($num) {
        if (!is_numeric($num)) {
          throw new Exception("Maximum size must be a number.");
        $this->_max = (int) $num;
      public function move($overwrite = false) {
        $field = current($this->_uploaded);
        if (is_array($field['name'])) {
          foreach ($field['name'] as $number => $filename) {
            // process multiple upload
            $this->_renamed = false;
            $this->processFile($filename, $field['error'][$number], $field['size'][$number], $field['type'][$number], $field['tmp_name'][$number], $overwrite);   
        } else {
          $this->processFile($field['name'], $field['error'], $field['size'], $field['type'], $field['tmp_name'], $overwrite);
      public function getMessages() {
        return $this->_messages;
      protected function checkError($filename, $error) {
        switch ($error) {
          case 0:
            return true;
          case 1:
          case 2:
            $this->_messages[] = "$filename exceeds maximum size: " . $this->getMaxSize();
            return true;
          case 3:
            $this->_messages[] = "Error uploading $filename. Please try again.";
            return false;
          case 4:
            $this->_messages[] = 'No file selected.';
            return false;
          default:
            $this->_messages[] = "System error uploading $filename. Contact webmaster.";
            return false;
      protected function checkSize($filename, $size) {
        if ($size == 0) {
          return false;
        } elseif ($size > $this->_max) {
          $this->_messages[] = "$filename exceeds maximum size: " . $this->getMaxSize();
          return false;
        } else {
          return true;
      protected function checkType($filename, $type) {
        if (empty($type)) {
          return false;
        } elseif (!in_array($type, $this->_permitted)) {
          $this->_messages[] = "$filename is not a permitted type of file.";
          return false;
        } else {
          return true;
      public function addPermittedTypes($types) {
        $types = (array) $types;
        $this->isValidMime($types);
        $this->_permitted = array_merge($this->_permitted, $types);
      protected function isValidMime($types) {
        $alsoValid = array('image/tiff',
                           'application/pdf',
                           'text/plain',
                           'text/rtf');
          $valid = array_merge($this->_permitted, $alsoValid);
        foreach ($types as $type) {
          if (!in_array($type, $valid)) {
            throw new Exception("$type is not a permitted MIME type");
      protected function checkName($name, $overwrite) {
        $nospaces = str_replace(' ', '_', $name);
        if ($nospaces != $name) {
          $this->_renamed = true;
        if (!$overwrite) {
          $existing = scandir($this->_destination);
          if (in_array($nospaces, $existing)) {
            $dot = strrpos($nospaces, '.');
            if ($dot) {
              $base = substr($nospaces, 0, $dot);
              $extension = substr($nospaces, $dot);
            } else {
              $base = $nospaces;
              $extension = '';
            $i = 1;
            do {
              $nospaces = $base . '_' . $i++ . $extension;
            } while (in_array($nospaces, $existing));
            $this->_renamed = true;
        return $nospaces;
      protected function processFile($filename, $error, $size, $type, $tmp_name, $overwrite) {
        $OK = $this->checkError($filename, $error);
        if ($OK) {
          $sizeOK = $this->checkSize($filename, $size);
          $typeOK = $this->checkType($filename, $type);
          if ($sizeOK && $typeOK) {
            $name = $this->checkName($filename, $overwrite);
            $success = move_uploaded_file($tmp_name, $this->_destination . $name);
            if ($success) {
                $message = "$filename uploaded successfully";
                if ($this->_renamed) {
                  $message .= " and renamed $name";
                $this->_messages[] = $message;
            } else {
              $this->_messages[] = "Could not upload $filename";
      public getFilenames() {
        return $this->_filenames;
    ?>
    The error is Parse error: syntax error, unexpected T_STRING, expecting T_VARIABLE.   
    I have not worked with oop before and have only very briefly looked at the principle was on my foundation degree.

  • File open error under document tab in tcode BP

    Hi expert
    In a report, I am reading path ,file type ,name from a text file from the presentation server. The file gives all the information related to the file uploaded on application server. File can be of any type like cfg ,doc txt, bmp .
    I have to read and link the file under document tab in BP code I am able to link but not able to open the file from the link another text format is giving dump error saying format not supporting.
    I am reading and linking in binary mode because i do not have another option as we can read the file in text and binary mode only.
    Please suggest any solution for this .
    Point will be rewarded for this.
    Prem.
    Edited by: Prem Kumar on Jan 12, 2009 2:39 PM
    Edited by: Prem Kumar on Jan 12, 2009 2:40 PM

    HI,
      Just try it simply as below.
    the possible reasons could be.
    1) file with that name is not existing in that path
    2) path name is wrong (u gave it as c:/ give it as c:\)
    3) file may be open..
    how ever just try with giving the file path and the output table and see how it works
    *-- Read the File From PC
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          FILENAME = V_FILENAME
        TABLES
          DATA_TAB = I_FILE
        EXCEPTIONS
          OTHERS   = 17.
    Thanks
    mahesh

  • Document Tab page in Product Master(commpr01)?

    Hello CRM Gurus,
    I wolud like to know in which business context the Document Tab Page used in creation of Product Master.
    I see that i can attach any Document at my wish.of formats .doc,.xls,.pdf etc.
    But why is it given.?
    If i am creating an IP(Intellectual Property say a Movie Title)
    what can i attach or upload ?what is the business requirement?
    please clarify
    Thanks
    Arshad

    Hi Arshad,
    Document Tab is nothing more then a Informaton storage Point of location.
    For Ex; Say a company for which you are Implementing Deals with Product like Boilers, Lights etc.
    IF there  are mtuliple of choices and infomation related to eachd evice they can store those information in document tab.
    Information like Pictures, Some Text Description message.
    Document tab over here is also the same as you have in Activity, Opportunity Transaction.
    And in that we call them as Long Text storage Areas, so same rule Implies for products Document Tab as well.
    Hope this helps.

  • How to display TEXT description from Documents tab of Product master in ISA

    Hi,
    We have product related PDF document attached with Product.
    I can access in CRM by Going
    Products--> Maintain Products.
    When I chose specific Product I can see Product related details.
    There are many tabs like "General", "Material", "Sales and Distributions", "Documents",  etc...
    "Documents" tab have 2 folders "Pictures" and "TEXTS".
    under "TEXT" folder we have PDF documents.
    it has short product name like "ASP009" and Description "ASP 009 Manual".
    When I click on any one I can see attached PDF document in Preview window in CRM.
    How I can access text description "ASP 009 Manual" on "ProductDetailsB2C.JSP" file.
    I want to display this "ASP 009 Manual" description on "ProductDetailsB2C.JSP".
    Is there any Standard Java class method available in ISA.
    I really appreciate any help on this and assign points to them for solution.
    Thanks in Advance.
    Ashish

    Here's the steps we use in our ProductDetailB2C.jsp (B2B uses same code in another file name I forget right now) to provide a link to our technical data sheets...this includes how to create a new document type in CRM as well as the code needed to display it on the ISA
    Step 1: Transaction OAC2, create Document Type example CRM_TECHDA
    Step 2: Transaction SPRO-> CRM -> Basic functions -> Content Management -> Define template for folders
    Step 3: Double click template PRODUCT_MATERIAL
    Step 4: Right-click Documents, Choose Create Folder
    (Make sure to input DOCUMENT TYPE(Properties TAB) = Step 1 value example CRM_TECHDA)
    Step 5: Add a new set of lines of code for each of the types of 'text' you have created to display as a link in the .jsp file(s), changing the CAPPED name to the appropriate name of your specific field below:
    <% if (currentItem.getAttribute("DOC_P_CRM_TECHDA") != null && !currentItem.getAttribute("DOC_P_CRM_TECHDA").equals("")) { %>
                   <tr>
                     <td colspan="2"><a href="<isa:imageAttribute guids="DOC_P_CRM_TECHDA,DOC_P_CRM_TECHDA" name="webCatItem" defaultImg="mimes/shared/no_pic.gif"/>" target="_new"><img src="<%=WebUtil.getMimeURL(pageContext, "b2c/mimes/images/pfeil_rechts_mit_rand_blau.gif") %>" alt="" border="0"> Technical Data Sheet</a></td>
                   </tr>
                   <% } %>
    Edited by: Mike Anecito on Jul 17, 2008 8:27 AM
    I forgot to add, that you could add the attribute information Sateesh talks about where we just use "Technical Data Sheet"
    on the third line of the code...we don't bother with the name of the file as you're needing since we had too many people
    naming them and the overall consistency was horrible.

  • Skip popup "Overwrite old version" from document tab in CRM_DNO_MONITOR

    Hi All,
    I have requirement to skip "Overwrite old version" pop in crm_dno_monitor transaction under document tab.
    Steps : Tcode CRM_DNO_MONITOR ---> Select Transaction number ---> click on change button ---> click on "Transaction Data" tab ---> Select "Document" tab ---> open any document
    When uploaded documents are edited, system asks "Overwrite old version?". There should be no question, system should always overwrite the existing version.
    Thanks,
    Amit

    Hi
    Service Desk messages in Solution Manager consist of two parts: the support message in Solution Manager, and the service process in CRM.
    You must carry out the following steps to delete the messages from the system completely:
    1. In Solution Manager
    Deletion of the message in Solution Manager involves two parts:
    a) Call transaction DNOTIFWL and set the deletion flag for the Service Desk message. The deletion flag corresponds to the system status I1076 (deletion flag).
    b) Execute the report Z_DELETE_BASIC_NOTIFICATIONS.
    If you execute the report in production mode, all messages with the status I0076 are deleted from the database. You can also execute the report in test mode. In this case, the system displays a list of messages that can be deleted.
    2. In CRM
    You cannot delete a service process in CRM. The service process must be archived.
    Call transaction SARA and select the archiving object CRM_SERORD. Archiving involves three steps:
    a) Initial run Report CRM_ARC_SERORD_CHECK
    b) Write run Report CRM_ARC_SERORD_SAVE
    c) Delete run Report CRM_ARC_SERORD_DELETE
    When the delete run has completed, the service process has been deleted from the database and is in an archive file. You can access archived documents using transaction SARE.
    Check the following notes.
    1329247
    398914
    398915
    985079
    Thread
    Re: How to delete test messages from service desk.
    Re: Delete test messages from service desk
    Hope it helps,
    Regards
    Prakhar

  • Uploaded Images

    Greetings,
    Sorry for the noobness, but when one wishes to use an image as an item in a region (contenttype->image), it says to either browse for it, or to enter it's internal filename. Is there a way of viewing these already uploaded images in some sort of graphical way to see what is already out there and possibly choose it.
    Any help or pointing in the right direction greatly appreciated.
    -- Cliff Moon
    -- UTPA Webmaster

    But it isn't doing that either. I have to get the "My Products" graphic from my Mac for each post I make.
    Ah, just discovered something. While I don't have any images in the second tab when doing a new post, if I go to Edit a post, the image is there so you can add it again.

  • Suggestion: Invert shading that reflects active document tab

    It's a pretty minor thing, but I'd suggest flipping how you distinguish between the active document tab vs the inactive ones when using the dark interface. I can get the logic of having the brightest tab representing the one you're actually working on, but for some reason I keep clicking the wrong tab when I want to switch between documents - it took me a little bit to work out why: you represent the active tool by shading it darker and recessing it slightly, so it should make sense that the active tab is also the one that is darker and appears recessed, otherwise I'm trying to hold two representations of status in my mind that are exactly oposite to each other, yet located very close to each other on the screen. And unless I'm very precisely caffeinated, I'm just not equipped to deal with that sort of contradiction.

    Contact Sheet is a welcome return. So many features can be adapted. I made this a few years ago by sizing up 40 images, and turning off titles, and ‘Flatten Layers’ when making the contact sheet. It was then fairly simple to FT each layer to give some overlap, and use Layer masks for creative affect.
    It was eventually incorperated into a poster for the organisation running the event.
    Some interesting JDIs  (thanks so much for the typed list!).
    The Eye dropper changes appeal to me, and Ctrl J now working on Groups is very welcome.  Lots more there, but what worries me is that there are apparently twice as many new JDIs in CS6 as there were in CS5, which makes me think I must be missing a lot of the CS5 JDIs.  is there a list somewhere?

  • Documents tab in finder opens 'terminal' rather than my document folders

    Hi,
    I was hoping to get some help!
    When I open my finder and select the Documents tab, instead of showing all my folders it opens something called 'terminal'.
    Also when I select the Desktop tab it opens iPhoto.
    I've tried right clicking on the tabs and selecting 'get info' and changing the 'open with' but I can't seem to select how it was originally.
    A few weeks ago I was using an external hard drive to back everything up, since then I've had this problem.
    Hope you can help!
    Thanks!

    Hi @Shootist007
    I knew PNG files were image files, that why i was confused when I saved them onto my Mac they were showing as Documents under file type. But i managed to do via Preview (opened it up in Preview then click and dragged to my document).
    Thanks for your help

  • Creating placeholders on supporting document tab

    When writing specifications, we have several documents that are required to be uploaded to the supporting documents tab. Is there a way to create a "placeholder" for the supporting docs and save it without having to upload the actual document?

    There's currently no way to do this in GSM. Thats a great use case for GSM templates though, please submit an enhancement request and we'll consider it for a future release.

  • Upload image using webdynpro abap

    Gudday,
    I have a requirement to provide three functionalities like
    1)browse 2)upload 3)review the image using webdynpro ABAP.
    I tried with functionn module 'ARCHIV_CREATE_DIALOG_META'  which uploads images..but if i try to use the samething using service call in webdynpro ..it is throwing a dump..saying...'ARCHIV ID OF CLASS BASED NOT OCCURRED'
    Please suggest me how to proceed further ....its high priority....
    Awaiting your reply.
    Thanks,
    Deepthi.

    Hello Martina,
    Could you solve this problem?
    I need to upload documents in PA30 from Web Dynpro ABAP but the called funtions are not working. Could you please explain me how you resolved this?
    Thanks you very mutch!
    Regards
    Belé

  • How to upload images

    Hi,
    In our portal service (SE80--> Internet Services) program how can I upload the image for our portal?
    Saurabh Garg

    Hi Saurabh,
    if you are trying to upload images from the web dyn pro side,
    create a Java webdyn pro application with the images.
    to place the picture in the application goto docs and settings->
    <i>C:\Documents and Settings\arun.jacob\Documents\SAP\workspace\"yourapplication name"</i>
    and once this is done. Upload the pAR file.
    and on the iView side.
    webdyn pro iView
    select J2EE->IView from pAR
    and once this is done. you can see the picture you included in the program.
    Cheers

Maybe you are looking for