New Text File Action Does Not Output Correctly (Corrupts)

I posted this in here by accident. I reposted it in the 10.5 Automator forum...
I have a simple automator script that uses "Get Specified Text" that contains some arbitrary shell script text, and I pass that to "New Text File" which has the location selected from a variable called "Temporary path" of value "/tmp". The output of 'New Text File" will not contain the text I specified. Here are steps to recreate:
New automator script
Get specified text action with the following text:
#!/bin/sh
cd "`dirname \"$0\"`"
if [ true ]; then
echo 1
fi
New variable called "Temporary path" with the value "/tmp"
New text file action
--- Save as: test.txt
--- Where: "Temporary path" (drag Temporary path to the drop down box)
--- Replace existing file: checked
I run the script. New text file result shows "/private/tmp/test.txt". Then from the "Terminal" I try to view it ("cat /tmp/test.txt") and the contents are:
if [ true ]; then\"`"
fi echo 1
So the specified text was corrupted. If I create the new file in Desktop or Documents (tried those) it works correctly. What is so special about /tmp? Is there a reason why this shouldn't work?
Regards,
John
Message was edited by: techiejohn

Alas, my example does work... In hopes of narrowing the problem I tried to narrow the text.
Anyway below is the full "script" that I'm trying to write to the file that does not work, although if you copy it from here directly, it does work. So to reproduce, I can copy it from here to TextWrangler (that will fix the extra blank lines) then from TextWranger to Automator and the issues remains. The result of "Get specified text" looks correct, but the output still is not.
<pre>
#!/bin/bash
cd "`dirname \"$0\"`"
clear
\# display output from a previous run
if \[ -e "$0".txt \]; then
cat "$0".txt
/bin/echo -n "Run again? "
read run
if \[ "$run" = "n" -o "$run" = "N" -o "$run" = "no" -o "$run" = "No" -o "$run" = "NO" \]; then
run=""
else
run="Yes"
fi
else
run="Yes"
fi
if \[ "$run" \]; then
date
echo "Running unison for $USER..."
if \[ -e "/Users/$USER" -a -e "/Volumes/$USER" \]; then
/opt/local/bin/unison \
"/Users/$USER" "/Volumes/$USER" \
-auto \
-rsrc false \
-terse \
-logfile /dev/null \
-ignore "Name .DS_Store" \
-ignore "Name .Spotlight*" \
-path "Desktop" \
-path "Documents" \
-path "Downloads" \
"$@"
exit=$?
case "$exit" in
0) echo "Successful synchronization; everything is up-to-date now.";;
1) echo "Some files were skipped, but all file transfers were successful.";;
2) echo "Non-fatal failures occurred during file transfer.";;
3) echo "A fatal error occurred, or the execution was interrupted.";;
esac
else
echo "/Users/$USER or /Volumes/$USER does not exist."
exit=255
fi
else
exit=0
fi
\# wait for error acknowledgement
if \[ "$TERM" -a "$TERM" != "dumb" -a "$exit" -gt 0 \]; then
/bin/echo -n "Error #$exit; press enter or return to continue: "
read
fi
\# close the terminal window
termpid=`/opt/local/bin/pstree -p $PPID | grep Terminal.app | grep -v grep | awk '{print $2}'`
if \[ "$termpid" \]; then
kill "$termpid"
fi
exit $exit
</pre>

Similar Messages

  • Is it possible to import a Fixed Text file that does not have a header?

    I'm trying to import a Fixed Text file through Import Manager, but the text file I am receiving does not have a header on it (the first row is valid data). When I try importing this, Import Manager uses the first row of data as the headings. Is there any way to turn this off and tell Import Manager there is no header data in the file?
    Thanks!

    Hi Ryan ,ur requirement can be met only when u import the file as ODBC .for this follow the below steps.
    1)Go to control panel,in ur settings,select administrative tools
    2) In that select DATA SOURCE(ODBC ).
    3)Go to SYSTEM DSN tab select tab .
    4)Select ur file type MICROSOFT TEST DRIVER (.txt,.csv)
    5)Double click on "Import DSN" and in the blank give the name of DATA SOURCE NAME any name u want to give.
    6)Uncheck the use current directory box and select the directory ur file is it will automatically show ur source file select it and click ok.
    7) Now when u import ur file as ODBC give the name of ur DATA source name which u have given and it will show ur file in the source preview itself .
    In  this way u can import ur file as ODBC.
    Hope this may help u.
    Regards
    Ankit

  • The new firefox 4 upgrade does not work correctly, how can I downloand 3.6?

    I just upgrade to the latest version of firefox browser for my desktop (version 4). It is not working correctly, it is slow and crashes. I want to download the older version I was using (3.6?)

    Please [http://www.mozilla.com/en-US/firefox/all.html Click Here] to Download Firefox 3.6.

  • Numbers on new retina macbook pro does not work correctly??

    Hi. When I run Numbers on my new Macbook Pro Retina, the interface and all the text looked really blocky and low resolution. I read that there was an easy fix to this by un-ticked the box that says "open in low resolution" in get info. I did this and it looks much much better the only problem is the cell selector square (cursor) is not lined up with the cells on the screen. My guess is that it is because the cursor or cell selector is at a different resolution to the screen. Can anyone please help with this issue or know if there is an update for this coming soon?
    Thanks!

    No, your right, it doesnt exactly fill you with confidence having parted with the large sum of cash for this machine. Having done a bit of sniffing around about this issue, I have discovered that apparently apple are launching iworks x at the end of July. Hopefully the new version will fix it. Another annoying thing is that office for mac is really bad visually aswell and you cant stop it from running in low resolution mode! Needs sorting as I use spreadsheets alot.

  • I just updated to 8.3 and now i cant add events to my calendar  an the red icon saying howmany new texts I have does not work. Anyone having same issue?

    Anyone having same issue. It is annoying not knowing when I have a new text

    Upgrade to Snow Leopard - it's compatible with the latest version of iTunes, and still supports PowerPC applications.
    $19.99 - http://store.apple.com/us/product/MC573Z/A/mac-os-x-106-snow-leopard
    Snow Leopard is required if you wanted to upgrade to Lion, anyway, which you may want to in the future if the latest version of iTunes no longer supports Snow Leopard.

  • How can I add a "Create New Text File" contextual menu?

    Hi,
    I'd like to add a "Create New Text File" contextual item. I found the "new text file" action in Automator, but I don't really know where to go from there... I want it to work on the desktop and in finder...
    Thanks

    See:
    Mac OS X Automation,
    Automated Workflow Tips,
    Introduction to Automator tutorial, and
    a four-parter on Automation in Snow Leopard by Sal Saghoian:
    Snow Leopard Services,
    Services for iPhoto,
    Safari and WebKit integration, and
    Installing and using services.
    Finally, 
    Developing AppleScript Applications and
    Apple's Automator Developer Documentation

  • Automator New Text File Trouble

    Pumping text into the New Text File action produces a file with unreadable characters (looks Chinese).
    Interestingly, pumping into New TextEdit Document works just fine.
    I don't believe it's related to any TextEdit encoding setting (I'm using the defaults.)
    I've found others on Google with the same problem, but no resolution.
    Any ideas?
    Eric
    Mac Pro   Mac OS X (10.4.8)  

    I did some research on the issue (Google). Others also have the same problem. It appears to only be a problem on Intel platforms. I tried your clipboard idea. The resulting text file is still unreadable, but the contents of the clipboard are just fine, so the problem is definitely in the New Text File action.
    The Intel theory is supported by the fact that when I run Automator under Rosetta the problem isn't there.
    Eric

  • Acrobat/Indesign does not export correct into the selected output intention (eci_iso_coated_v2_300)

    I use the CS6 suite with Acrobat XI at windows platform.
    When I want to save a file from InDesign as .pdf with output intention eci_iso_coated_v2_300 the result is a .pdf with more than 300% ink coverage.
    I tried to transform the result in Acrobat XI into this standard output intention, but also the result has more than 300 % ink coverage.
    What is the reason of this bug?
    Before with Acrobat X this worked without problems

    Hi Rob,
    I was told the new way to work would be to draw files via Bridge direct into the InDesign file
    and I thought automatically the color would not be changed.
    my colourmanagement setting in bridge for the whole CS6 was  ECI isocoated_V2_300
    The Illustrator file was saved without color profile.
    In this test file I used 3 kinds of black: background of pirate in cmyk 79,34 / 72,78 / 59,38 / 79,88 = ink coverage 291 %
    DÜSSELPIRATEN in “black” (if you would convert this in the file with the cmyk button it would be the same ink-percentage as before
    “e.V.” was set to 100 % k
    I set the preferences for Acrobat from InDesign CS6 as pdf X4 with profile eci isocoatedV2_300 in three ways:
    no color conversion
    convert to profile
    convert to profile keeping existing values
    in all tree files the pirates background has 322 % ink coverage instead of 291 %
    Why does Acrobat convert “black” in the wrong way?  If I click in Illustrator on the 4c button to convert the “black” into 4c it is 291% ink
    Acrobat should come to the same result with all profiles: iso coated V2 and iso coated V2_300
    The same happens also by saving as .pdf X3 or .X1
    The minimum what I expect is, that Acrobat reduces ink coverage for black to 300 %
    I also made test with the new ECI profiles for laminated prints from 2012.
    And with newspaper profiles
    In this case the ink coverage comes below 300 %, but only when I choose convert to profile.
    And then the 100 % k converts to cmyk, what I don’t want to have with text.
    Is there no way to reduce ink coverage below a special percentage without changing Text 100% k
    And is there a bug in Acrobat XI with the ECI IsoCoated_V2_300 Profile? For there is no color reduction below 300 % in all conversion settings.
    I can’t test this with Acrobat X or IX, for my computers with this software don’t run with CS6 64 bit.
    enclosed you find my files
    Kind regards
    Lutz Hanbueckers
    Hanbueckers Werbung GmbH
    Brandsackerstr. 5
    40764 Langenfeld
    P.O. Box 40 02 01
    40242 Düsseldorf
    Tel. +49 02173 1 09 44 - 0
    Fax +49 02173 1 09 44 - 10
    [email protected] <mailto:[email protected]>
    www.hanbueckers.de
    Visit our site
    Steady attractive offers!!!
    HR Düsseldorf B 26 480
    owner Manager: Lutz Hanbueckers
    Von: Rob Day [email protected]
    Gesendet: Samstag, 2. März 2013 04:26
    An: Hanbueckers Werbung
    Betreff: acrobat/Indesign does not export correct into the selected output intention (eci_iso_coated_v2_300)
    Re: acrobat/Indesign does not export correct into the selected output intention (eci_iso_coated_v2_300)
    created by Rob Day <http://forums.adobe.com/people/rob+day> in InDesign - View the full discussion <http://forums.adobe.com/message/5115613#5115613

  • PrintWriter does not send correct text over HTTP

    Hello All,
    I need information to resolve a problem I am having with PrintWriter and sending text using HTTP.
    I am developing a client/server system. A client will be used to connect to a Tini (a Dallas Semiconductor designed embedded system). Currently, to understand HTTP operation, I wrote a server that resides on the tini that listens for a connection attempt and when one is made prints the HTTP message in Dallas' JavaKit application window. The resultant Tini display includes some hardcoded tini text (italics only in (b) and (c) below) along with that received from the client app (italic bold in (b) and (c) below).
    I have also written some test client side code (see (a) below) in Sun's Java Studio Creator that sends a couple of lines of text so that I could see what my client app would actually send. I tried a few different ways of creating a PrintWriter object as shown in the code at (a) below just to see if it was a character set problem.
    The problem is that I get two different results under the following conditions:
    [Condition 1]: Entering "HTTP://tini" in the browser and pressing Enter. See result (b) below. This is correct and shows what the browser sends to the tini. The tini outputs the text immediately after pressing Enter.
    [Condition 2]: Running my client code in the browser. See result (c) below. This is incorrect and sends just a bunch of "y"s with umlauts as the message. The tini immediately outputs text up to the "cnt=0" line and then can take up to a couple of minutes to complete the message.
    1. Can anyone tell me why the client sends those "�" instead of the strings I encoded for all character sets?
    2. Why does the client code takes so long to complete after the initial transmission?
    3. Can anyone provide me with links to information that explains this behavior? I searched Sun and the forum but found nothing.
    (a) Here is the current test client side code that sends a couple of strings to the tini:
        public String button3_action() {
            // TODO This should send the tini a request for its IP address
            String protocol = "HTTP";
            String host = "tini";
            try{
                 URL tiniURL = new URL("http://tini");
                 URLConnection tiniConnection = tiniURL.openConnection();
                 tiniConnection.setDoOutput(true);
         //     Comment out one then the other to see if there is a difference in result (there is not!)
         //        PrintWriter tiniout =  new PrintWriter(new OutputStreamWriter(tiniConnection.getOutputStream(), "UTF-16"));
         //        PrintWriter tiniout =  new PrintWriter(new OutputStreamWriter(tiniConnection.getOutputStream(), "UTF-8"));
         //        PrintWriter tiniout =  new PrintWriter(new OutputStreamWriter(tiniConnection.getOutputStream(), "ISO-8859-1"));
         //        PrintWriter tiniout =  new PrintWriter(tiniConnection.getOutputStream());
                 PrintWriter tiniout =  new PrintWriter(new OutputStreamWriter(tiniConnection.getOutputStream()));
                 tiniout.println("GET / HTTP / 1.1\r\n");
                 tiniout.flush();
                 tiniout.println("IPaddress?");
                 tiniout.flush();
                 tiniout.close();
            catch(MalformedURLException e){
                e.printStackTrace();
            catch(IOException e){
                e.printStackTrace();
            return null;
    (b) Result displayed in JavaKit from Condition 1:
    just starting
    Waiting for a connection attempt
    Start thread
    Thread's run() method entered!
    Try to create a new StringBuffer
    StringBuffer created
    Read the buffer in this loop cnt =0
    Read the buffer in this loop cnt =1
    Read the buffer in this loop cnt =394
    Read the buffer in this loop cnt =395
    Out of loop.
    Now print HTTP message.
    GET / HTTP/1.1
    Host: tini
    User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.2) Gecko/20040804 Netscape/7.2 (ax)
    Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8 ,image/png,*/*;q=0.5
    Accept-Language: en-us,en;q=0.5
    Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
    Keep-Alive: 300
    Connection: keep-alive
    "v"is at position390
    "e"is at position391
    "is at position392
    ""is at position393 "
    "is at position394
    java.lang.StringIndexOutOfBoundsException: String index out of range: 395
    No other stack trace info available.
    (c) Result displayed in JavaKit from Condition 2:
    just starting
    Waiting for a connection attempt
    Start thread
    Thread's run() method entered!
    Try to create a new StringBuffer
    StringBuffer created
    Read the buffer in this loop cnt =0
    Read the buffer in this loop cnt =1
    Out of loop.
    Now print HTTP message.
    ���������������������������������������������������������������������������� �������������������������������������������������������������������������������� �������������������������������������������������������������������������������� �������������������������������������������������������������������������������� �������������������������������������������������������������������������������
    "�"is at position390
    "�"is at position391
    "�"is at position392
    "�"is at position393
    "�"is at position394
    java.lang.StringIndexOutOfBoundsException: String index out of range: 395
    No other stack trace info available

    This is to anyone that is having trouble sending data via a stream using a browser client. I found the answer after many different searches on the Sun site in a bug report: Bug ID: 4192018.
    The problem arises from the way the API actually uses outputstreams. It appears that you must add an InputStreamReader to actually flush the OutputStreamWriter buffer. After reading this bug report I added
    (tiniConnection.getOutputStream(), "ISO-8859-1"));
            OutputStreamWriter tiniout =  new OutputStreamWriter(tiniConnection.getOutputStream(), "ISO-8859-1");
            InputStreamReader tiniIn =  new InputStreamReader(tiniConnection.getInputStream(), "ISO-8859-1");
            tiniout.write("GET/HTTP/1.1\r\n");
            tiniout.flush();
            //This is necessary to actually send data.
            tiniIn.read();
            tiniout.write("IPaddress?");
            tiniout.flush();
            //This is necessary to actually send data.
            tiniIn.read();
            tiniout.close();
            catch (MalformedURLException e){
                e.printStackTrace();
            catch (IOException e){
                e.printStackTrace();
            }NOTE: The preliminary program still does not perform correctly but it does send data that is displayed in tini's JavaKit window. At least I can continue to verify how the browser sends data.
    I hope this helps someone.

  • Bapi_document_create2 does not work correctly with attached file.

    Hi all.
    I hava a problem with bapi. I programmed below.
            ls_docdata-documenttype = 'BBS'.
            ls_docdata-description  = 'JJW test'.
            ls_file-documenttype = 'BBS'.
            ls_file-ORIGINALTYPE = 1.
            ls_file-storagecategory = 'ZSTW_KPRO'.
            ls_file-wsapplication = 'TXT'.
            ls_file-docfile = entity_filename.
            append ls_file to lt_files.
            CALL FUNCTION 'BAPI_DOCUMENT_CREATE2'
              EXPORTING
                documentdata       = ls_docdata
                PF_FTP_DEST = 'SAPFTP'
                PF_HTTP_DEST = 'SAPHTTP'
              IMPORTING
                documenttype               =      lv_documenttype
                documentnumber           =     lv_documentnumber
                documentpart                =     lv_documentpart
                documentversion           =     lv_documentversion
                return                           =     ls_return
              tables
                documentfiles     = lt_files.
            call function 'BAPI_TRANSACTION_COMMIT'.
    If I don't attach the file, DIR is created but if attach some files, it does not work. What should I do??
    regards.

    Hi,
    You can use the below to attach the file from BSP to SAP. But it doesnt use the BAPI - 'BAPI_DOCUMENT_CREATE2'. It works perfectly for me. Let me know if you have any questions.
    Note: This code put the file into SAP Directory "/userapps/master_data/" as well as it upload the file into Transaction WTY since i am using Business object:BUS2222. You may need to modify the Business object if you ahve the one, otherwise you can just put it into SAP DIR.
    FUNCTION ZATTACH_CREATE.
    *"*"Update function module:
    *"*"Local interface:
    *"  IMPORTING
    *"     VALUE(FILE) TYPE  SAPB-SAPFILES
    *"     VALUE(STR_FILE_CONTENT) TYPE  XSTRING
    *"     VALUE(OBJECT_KEY) TYPE  BAPIBDS01-OBJKEY
      DATA: LOGICAL_SYSTEM TYPE BAPIBDS01-LOG_SYSTEM,
            CLASSNAME TYPE  BAPIBDS01-CLASSNAME,
            CLASSTYPE TYPE  BAPIBDS01-CLASSTYPE.
      DATA:  IT_FILES TYPE TABLE OF  BAPIFILES,
            IT_SIGNATURE TYPE TABLE OF  BAPISIGNAT,
       FILES TYPE  BAPIFILES,
      SIGNATURE TYPE   BAPISIGNAT.
      DATA: I_TOADD TYPE TOADD,
            FILENAME_ALL TYPE SAPB-SAPFILES,
            FILE_PATH TYPE SAPB-SAPFILES,
            FILE_PATH_MEMORY(250) TYPE C,  " path für SAP memory
            FILE_PATH_LENGTH TYPE I,       " length of the file_path
           FILE_CONTENT_LENGTH TYPE I,       " length of the file_CONTENT
           FILE_NAME TYPE SAPB-SAPFILES,
            FILE_EXTENSION TYPE TOADD-DOC_TYPE.     " file-extension.
      DATA: I_FILE_CONTENT TYPE TABLE OF BAPICONTEN.
      DATA: WA_FILE_CONTENT TYPE  BAPICONTEN,
       STRING_CONTENT TYPE STRING,
       STRING_CONTENT1 TYPE STRING.
      DATA:
       I_FILES TYPE TABLE OF BAPIFILES ,
            I_SIGNATURE TYPE TABLE OF BAPISIGNAT ,
            I_COMPONENTS TYPE TABLE OF BAPICOMPON ,
           COMPONENTS TYPE BAPICOMPON ,
            I_PROPERTIES TYPE TABLE OF SDOKPROPTY ,
            I_PROPERTIES2 TYPE TABLE OF BAPIPROPER ,
            I_PROPERTIES_DEL TYPE TABLE OF BAPIDPROPT ,
           MIMETYPE TYPE TOADD-MIMETYPE,
      COMPID TYPE BAPICOMPON-COMP_ID,  " compid for popup
            COMPID_FLAG(1) TYPE C,           " compid can't be changed
            MODIFY_FLAG(1) TYPE C,           " document is modified
            ATTRI_FLAG(1) TYPE C,            " attri can't be changed
            TITLE_FLAG(1) TYPE C,            " titel of the popup
            CANCEL_FLAG(1) TYPE C,           " cancel button Yes/No
            BUTTON_TEXT(10) TYPE C,
            INFO_TEXT(100) TYPE C,
      VERSION_NR TYPE BDN_CON-DOC_VER_NO,     " version_nr for popup
            VERSION_LANGU2 TYPE T002T-SPTXT, " language field in POPUP
            VERSION_LANGU TYPE BDN_CON-LANGU," SPRAS language field
            TITLE_TEXT(100) TYPE C,          " title of the popup
            DESCRIPTION TYPE BDN_CON-DESCRIPT.      " descr. for popup
    *FILENAME_ALL = fileUpload_event->file_name.
    * Transfering into SAP File server.
      FILE_CONTENT_LENGTH = XSTRLEN( STR_FILE_CONTENT ).
      FILENAME_ALL = FILE .
      STRING_CONTENT = STR_FILE_CONTENT.
      DATA: OUT_LINES TYPE TABLE OF XSTRING.
      CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
        EXPORTING
          BUFFER                = STR_FILE_CONTENT
    *   APPEND_TO_TABLE       = ' '
    * IMPORTING
    *   OUTPUT_LENGTH         =
        TABLES
          BINARY_TAB            = I_FILE_CONTENT.
      DELETE DATASET '/userapps/master_data/claim1.txt'.
      OPEN DATASET '/userapps/master_data/claim1.txt' FOR APPENDING
        IN TEXT MODE ENCODING DEFAULT.
    *  LOOP AT I_FILE_CONTENT INTO WA_FILE_CONTENT.
    *    TRANSFER STR_FILE_CONTENT TO '/userapps/master_data/claim1.txt'.
      TRANSFER STRING_CONTENT TO '/userapps/master_data/claim1.txt'.
    *  ENDLOOP.
      CLOSE DATASET '/userapps/master_data/claim1.txt'.
      OPEN DATASET '/userapps/master_data/claim1.txt' FOR INPUT
           IN TEXT MODE ENCODING DEFAULT.
      READ DATASET '/userapps/master_data/claim1.txt'  into STRING_CONTENT1.
    * -- split filename                                                 -- *
        DATA: LENGTH TYPE I.
      DATA: PATH2(1200).  " LIKE sapb-sapfiles.
      DATA: L_FILE(1200),
            L_DIR(1200),
            L_DELIMITER        TYPE C,
            L_OFFSET           TYPE I,
            L_BYTES            TYPE I,
            L_DELIMITER_OFFSET TYPE I,
            L_DELIMITER_BYTES  TYPE I,
            L_CHAR             TYPE C,
            L_PREVIOUS_CHAR    TYPE C,
            L_LAST_CHAR        TYPE C.
      PATH2 = FILENAME_ALL.
      LENGTH = STRLEN( PATH2 ).
      L_OFFSET = 0.
      WHILE L_OFFSET < LENGTH.
        L_LAST_CHAR = L_CHAR. "remember last character
        L_BYTES = CHARLEN( PATH2+L_OFFSET ).
        L_CHAR = PATH2+L_OFFSET(L_BYTES). "get current character
        IF L_CHAR = '/' OR L_CHAR = '' OR L_CHAR = ':'.
          IF L_DELIMITER IS INITIAL OR L_DELIMITER = ':'.
            "Typically we deal with absolute paths, so the first
            "delimiter is best. This allows for UNIX paths with
            "'' in the directory or file name
            L_DELIMITER = L_CHAR.
          ENDIF.
          IF L_CHAR = L_DELIMITER.
            L_DELIMITER_OFFSET = L_OFFSET.
            L_DELIMITER_BYTES = L_BYTES.
            "remember character in front of delimiter:
            L_PREVIOUS_CHAR = L_LAST_CHAR.
          ENDIF.
        ENDIF.
        L_OFFSET = L_OFFSET + L_BYTES.
      ENDWHILE.
      IF NOT L_DELIMITER IS INITIAL.
        L_OFFSET = L_DELIMITER_OFFSET + L_DELIMITER_BYTES.
        L_FILE = PATH2+L_OFFSET.
        IF L_PREVIOUS_CHAR = ':' OR L_DELIMITER = ':'.
          "path ends with or after drive identifer, include the delimiter
          L_DIR = PATH2(L_OFFSET).
        ELSEIF NOT L_DELIMITER_OFFSET IS INITIAL.
          "do not include a trailing delimiter for compatibility reasons
          L_DIR = PATH2(L_DELIMITER_OFFSET).
        ELSE.
          CLEAR L_DIR.
        ENDIF.
      ELSE.
        L_DIR = SPACE.
        L_FILE = PATH2.
      ENDIF.
      FILE_PATH = L_DIR.
      FILE_NAME = L_FILE.
    * -- set new file_path to SAP memory                                -- *
      FILE_PATH_LENGTH = STRLEN( FILE_PATH ).
      IF FILE_PATH <> SPACE AND FILE_PATH_LENGTH < 250.
        FILE_PATH_MEMORY = FILE_PATH.
        SET PARAMETER ID 'OAP' FIELD FILE_PATH_MEMORY.
      ELSE.
        FILE_PATH_MEMORY = SPACE.
        SET PARAMETER ID 'OAP' FIELD FILE_PATH_MEMORY.
      ENDIF.
    * -- data declaration ------------------------------------------------ *
      DATA:
            SINGLE_C TYPE C.
      CLEAR: SINGLE_C.
      LENGTH = STRLEN( FILE_NAME ).
      IF LENGTH > 0.
        WHILE LENGTH > 0.
          SINGLE_C = FILE_NAME+LENGTH(1).
          IF SINGLE_C CO '.'.
            LENGTH = LENGTH + 1.
            EXIT.
          ELSE.
            LENGTH = LENGTH - 1.
          ENDIF.
        ENDWHILE.
        IF LENGTH > 0.
          FILE_EXTENSION = FILE_NAME+LENGTH.
        ELSE.
          FILE_EXTENSION = SPACE.
        ENDIF.
      ELSE.
        FILE_EXTENSION = SPACE.
      ENDIF.
      IF FILE_EXTENSION <> SPACE.
        SET LOCALE LANGUAGE SY-LANGU.
        TRANSLATE FILE_EXTENSION TO UPPER CASE.              "#EC TRANSLANG
        SET LOCALE LANGUAGE SPACE.
      ENDIF.
    * TR001++
      DATA: I_TOADV TYPE TABLE OF TOADV.
      DATA: WA_TOADV TYPE TOADV.
      DATA: OBJECT TYPE SAEOBJART.
      SELECT * FROM TOADV INTO CORRESPONDING FIELDS OF TABLE
              I_TOADV WHERE STANDARD = 'X'.
      DELETE I_TOADV WHERE AR_OBJECT CS 'BDS' OR AR_OBJECT CS 'ZSEST'.
      READ TABLE I_TOADV INTO WA_TOADV WITH KEY DOC_TYPE = FILE_EXTENSION.
    * -- get name and description for the document                      -- *
      CLEAR: COMPID,
             DESCRIPTION,
             VERSION_NR,
             MODIFY_FLAG,
             COMPID_FLAG,
             ATTRI_FLAG,
             TITLE_FLAG.
      COMPID_FLAG    = ' '.              " -> compid can't be changed
      MODIFY_FLAG    = 'S'.              " -> popup in save modus
      ATTRI_FLAG     = 'X'.              " -> attri's can be changed
      COMPID         = FILE_NAME.
      VERSION_NR     = '00000001'.
      VERSION_LANGU2 = SY-LANGU.
      TITLE_FLAG     = '1'.              " -> BDN
    * -- get the mimetype of the docuclass                              -- *
    *PERFORM MIMETYPE_GET(OAALL) USING FILE_EXTENSION
    *                            CHANGING I_TOADD.
      DATA: I_DOCUMENTCLASS TYPE TOADD-DOC_TYPE.
      MOVE FILE_EXTENSION TO I_DOCUMENTCLASS.
      SET LOCALE LANGUAGE SY-LANGU.
      TRANSLATE I_DOCUMENTCLASS TO UPPER CASE.               "#EC TRANSLANG
      SET LOCALE LANGUAGE SPACE.
      SELECT SINGLE * FROM TOADD INTO I_TOADD WHERE
                                 DOC_TYPE EQ I_DOCUMENTCLASS.
      IF SY-SUBRC NE 0.                    " nothing found -> default!
        I_TOADD-DOC_TYPE = I_DOCUMENTCLASS.
        I_TOADD-MIMETYPE = 'application/x-docType'.             "#EC NOTEXT
      ENDIF.
      MOVE I_TOADD-MIMETYPE TO MIMETYPE.
    * -- fill file and signature structure                              -- *
      CLEAR: I_FILES, I_SIGNATURE.
      REFRESH : I_FILES, I_SIGNATURE.
      DESCRIPTION = FILE_NAME.
      FILES-DOC_COUNT = 1.
      FILES-DIRECTORY = FILE_PATH.
      FILES-FILENAME  = FILE_NAME.
      FILES-MIMETYPE  = MIMETYPE.
      APPEND FILES TO I_FILES.
    * -- fill components and signature structure                        -- *
      COMPONENTS-DOC_COUNT  = 1.
      COMPONENTS-COMP_COUNT = 1.
      COMPONENTS-MIMETYPE   = MIMETYPE.
      COMPONENTS-COMP_ID         = FILE_NAME.
      APPEND COMPONENTS TO I_COMPONENTS.
      SIGNATURE-DOC_COUNT  = 1.
      SIGNATURE-PROP_NAME  = 'BDS_DOCUMENTCLASS'.
      SIGNATURE-PROP_VALUE = FILE_EXTENSION.
      APPEND SIGNATURE TO I_SIGNATURE.
      SIGNATURE-PROP_NAME = 'BDS_CONTREP'.
    *IF BDS_DOCTYPE_LIST-CONTREP = SPACE.
      SIGNATURE-PROP_VALUE = ' '.                               "#EC NOTEXT
    *ELSE.
    *  I_SIGNATURE-PROP_VALUE = BDS_DOCTYPE_LIST-CONTREP.
    *ENDIF.
      APPEND SIGNATURE TO I_SIGNATURE.
      SIGNATURE-PROP_NAME  = 'BDS_DOCUMENTTYPE'.
      SIGNATURE-PROP_VALUE = WA_TOADV-AR_OBJECT. "'ZSRVCXLS'."TR001+
      APPEND SIGNATURE TO I_SIGNATURE.
      SIGNATURE-PROP_NAME  = 'DESCRIPTION'.
      SIGNATURE-PROP_VALUE = DESCRIPTION.
      APPEND SIGNATURE TO I_SIGNATURE.
      SIGNATURE-PROP_NAME  = 'LANGUAGE'.
      SIGNATURE-PROP_VALUE = VERSION_LANGU.
      APPEND SIGNATURE TO I_SIGNATURE.
      CALL FUNCTION 'BDS_BUSINESSDOCUMENT_CREA_TAB'
        EXPORTING
    *   LOGICAL_SYSTEM        =
          CLASSNAME             = 'BUS2222' "classname_select
          CLASSTYPE             = 'BO'" classtype_select
        CLIENT                = SY-MANDT
          OBJECT_KEY            = OBJECT_KEY
        BINARY_FLAG           = 'X'
    * IMPORTING
    *   OBJECT_KEY            =
        TABLES
          SIGNATURE             = I_SIGNATURE
          COMPONENTS            = I_COMPONENTS
        CONTENT               = I_FILE_CONTENT
    *   ASCII_CONTENT         =
    * EXCEPTIONS
    *   NOTHING_FOUND         = 1
    *   PARAMETER_ERROR       = 2
    *   NOT_ALLOWED           = 3
    *   ERROR_KPRO            = 4
    *   INTERNAL_ERROR        = 5
    *   NOT_AUTHORIZED        = 6
    *   OTHERS                = 7
      COMMIT WORK AND WAIT.
      IF SY-SUBRC <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFUNCTION.
    Message was edited by:
            Raja T

  • I have a manual that contains headings and index entries that contain less than and greater than characters, and . The Publish to Responsive HTML5 function escapes these correctly in the main body of the text but does not work correctly in either the C

    I have a manual that contains headings and index entries that contain less than and greater than characters, < and >. The Publish to Responsive HTML5 function escapes these correctly in the main body of the text but does not work correctly in either the Contents or the Index of the generated HTML. In the Contents the words are completely missing and in the index entries the '\' characters that are required in the markers remain in the entry but the leading less than symbol and the first character of the word is deleted; hence what should appear as <dataseries> appears as \ataseries\>. I believe this is a FMv12 bug. Has anyone else experienced this? Is the FM team aware and working on a fix. Any suggestions for a workaround?

    The Index issue is more complicated since in order to get the < and > into the index requires the entry itself to be escaped. So, in order to index '<x2settings>' you have to key '\<x2settings\>'. Looking at the generated index entry in the .js file we see '<key name=\"\\2settings\\&gt;\">. This is a bit of a mess and produces an index entry of '\2settings\>'. This ought to be '<key name=\"&amp;lt;x2settings&amp;gt;\" >'. I have tested this fix and it works - but the worst of it is that the first character of the index entry has been stripped out. Consequently I cannot fix this with a few global changes - and I have a lot of index entries of this type. I'm looking forward to a response to this since I cannot publish this document in its current state.  

  • I tried to rename a file, it gave me an error message (can't remember the number - 43??) and then the file disappeared from the original folder. When I do a search, the file comes up under the new name, but it does not show a path, and even though preview

    I tried to rename a file, it gave me an error message (can't remember the number - 43??) and then the file disappeared from the original folder. When I do a search, the file comes up under the new name, but it does not show a path, and even though preview shows the contents, I can't open the document (Powerpoint) and I can't move the document. I tried "Copy" and paste but it doesn't work. I tried "Share" with Airdrop and iChat, but the file is inaccessible. When i try to rename the file, it says the filename is too long.
    When I try to open it, it says the alias is not good, and asks if I want to fix the alias. I'm afraid to do that and lose all access to this document.
    Right now, it feels like a ghost document - it is on the computer intact, but it is in an undisclosed location and inaccessible.
    Please help!!

    I was able to resolve this by repairing permissions, even though no permissions error was listed specifically for that file.
    I could also have recovered it through Time Machine, but I'm interested in knowing how not to have this happen again!
    I was afraid of rebooting and possibly losing track even of the ghost.
    I did not try EasyFind - I'll keep that in mind next time.
    Thanks for all the comments.

  • HT203176 When I delete a file, it does not appear in the Trash - How can I fix this. Its a brand new MacBook Pro 17'

    When I delete a file, it does not appear in the Trash - How can I fix this. Its a brand new MacBook Pro 17''

    http://www.thexlab.com/faqs/trash.html for starters.

  • Build.vi does not output Generated files list for installer

    In LV 2011, Build.vi does not output a "Generated files" list when used on an installer. Example attached. When run on my system, "Generated files" is an empty array and "error out" shows no errors or warnings. The built installer can be found on disk, so I know the build succeeded.
    I critically need to know the target folder for my built installer so I can use it in an automated build tool. Assuming this is a real bug, can someone help me with a workaround that doesn't require an operator to point the VI to the target path?
    Attachments:
    build_vi_bug.zip ‏10 KB

    Hi David,
    You may find the solution in the following two links
    Creating Builds Programmatically
    Build executable and installer programmatically
    In the second link, there is an example code posted by Suse to find the destination path programmatically, hope it helps answer your question.
    Yupeng J.

  • RH7- Insert action does not display window to select the file.

    I have a nightmare situation with RH7 with no clue to resolve. What are my options to fix this
    I am having trouble with robohelp, selecting insert action does not display the pop up window. This prevents functions such as inserting images & files, importing files and creating hyperlinks to documents created in word, frame maker.
    when I perform this action, the pop up window appears virtually but is not visible to make the selection and RH freezes.
    I have to end the process or press esc to find some work around - so far none available
    Please help.

    Welcome to the community.
    Have you recently gone from a dual monitor setup to a single monitor?  When this happens, RH can sometimes keep tossing dialog boxes over where it thinks the second monitor is.  I typically use a program called ForceWindowVisible (get it here) to push wandering dialogs back into view.  Give that a try and see if it works.  Hope this helps,
    Ben
    GryphonMountain.net

Maybe you are looking for

  • Pricing in SAP Retail: Basic Purchase Price in UOM for the VKP5

    Dear Community, We need that in the SAP Retail pricing (VKP5 transaction), the Basic Purchase Price can be transferred to condition record for PB00 in the Purchase Order Unit of Measure instead of Sales Unit of Measure. Thanks in advance for your hel

  • How do I get a refund on a bad app

    Bought an App today for my iPhone and it doesn't do what I bought it for. Seems the description implied a feature that doesn't actually exist. Anyone know how to get a refund from the App Store on a bad App?

  • Can I reference page-flow bean from a bounded-task-flow page-fragment?

    I have a view activity implemented as page fragment in my bounded task flow. I declare a page-flow scope managed-bean in adfc-config.xml to do some initialization for the bounded-task-flow: <managed-bean id="__23"> <managed-bean-name id="__22">TaskFl

  • Best practise around handling time dependency for flat file loads

    Hi folks, This is a fairly common situation - handling time dependency for flat file loads. Please can anyone share their experience around handling this. One common approach is to handle the time validity changes within the flat file where it is eas

  • Links error in "flex in a week video training"

    can someone explain me why all links in the page http://www.adobe.com/devnet/flex/videotraining.html which don't have an icone before don't work? for exemple on my computer, Creating a user interface, Adding data to your application, Handling a user