Importing a text file with variable values into web reporting

Hello,
I'm looking for a possibility to import values from a text file into a variable selection in Web reporting.
With BEx reporting in Excel this is possible, by clicking on the multiple selection button in the variable popup screen, and subsequently selecting the "Import from Text file" button.
However, this function seems not to be available for web-reporting...
It would be great if someone could help me out with this!
Thanks & regards,
Arvid

Hi,
we could resolve this issue, so i thought it may also be helpful for others:
In our example we used a file with numbers for materials. This file is stored somewhere in a directory, to which SAP BI must have authorization to read.
The file looks something like this:
4711
4712
4713
4714
The file is named "import.txt" and lays in directory "/usr/sap/EC6/files/bi/"
*&  Include           ZXRSRU01
* global variables
Data: intern_range LIKE LINE OF i_t_var_range,
      l_s_range    TYPE rsr_s_rangesid,
      line(100)    TYPE c,
      p_file(128)  TYPE c,
      length_rangelow  type i,
      tmp_rangelow     like l_s_range-low.
* internal tables for selection-transfer from transaction
* Data: BEGIN OF it_file occurs 0,
*        it_p_file(128) TYPE c,
*      END of it_file.
IF i_step = 1.
** variables can be changed or set before pop-up appears
  CASE i_vnam.
* take material from external file to selection-list
     WHEN 'ZSD_UPMA'.
** call of transaction, with which the path can be set
*CALL TRANSACTION 'ZBW_VARIABLE' using it_file
*MODE 'A'      " call should be visible, so that variable can be set
*UPDATE 'S'.   " first transaction, then processing
** Der Pfad, der in dem Selektionsbild eingegeben wird, wird an die Variable übergeben
** Der Set-Parameter ist in Report ZSD_SELECT_VARIABLE
*  get parameter id 'VAR' field p_file.
p_file = '/usr/sap/EC6/files/bi/import.txt'.
* further handling of variable in BI
      OPEN DATASET p_file FOR INPUT IN TEXT MODE ENCODING DEFAULT.
      IF sy-subrc = 0.
        READ DATASET p_file INTO line.
        WHILE sy-subrc = 0.
          IF line(2) <> '//'.
            l_s_range-sign = 'I'.
            l_s_range-opt  = 'EQ'.
            l_s_range-low  = line.
* fill with leading Zeros
* in variable tmp_rangelow the value from l_s_range-low is taken
    tmp_rangelow    = l_s_range-low.
* read the length
    length_rangelow = strlen( tmp_rangelow ).
* in our case: material has 18 characters
    while length_rangelow lt 18.
      CONCATENATE '0' tmp_rangelow INTO tmp_rangelow.
      length_rangelow = length_rangelow + 1.
    endwhile.
* initialize l_s_range-low
    clear l_s_range-low.
* set with filled values
    l_s_range-low = tmp_rangelow.
* transfer to structure
            APPEND l_s_range TO e_t_range.
          ENDIF.
          READ DATASET p_file INTO line.
        ENDWHILE.
      ENDIF.
      CLOSE DATASET p_file.
    ENDCASE.
ELSEIF i_step = 2.
** in step 2 all variable values from pop-up input can be processed or
** User Exit variables can be derived
* UserExit Ende.
ENDIF.
Hope i could help!
Best regards,
Tobias

Similar Messages

  • Display variable values in Web report

    Hi Bw Mates,,,
    I am trying to display the variable values in Web Report.
    I put one text Item in Template and checked the Variable Display and entered the variable name in List.
    still I cannot see the variable values in the report.
    Thanks for your help.
    RSB

    <object>
             <param name="OWNER" value="SAP_BW"/>
             <param name="CMD" value="GET_ITEM"/>
             <param name="NAME" value="TEXTELEMENTS_1"/>
             <param name="ITEM_CLASS" value="CL_RSR_WWW_ITEM_TEXT_ELEMENTS"/>
             <param name="DATA_PROVIDER" value="DATAPROVIDER_1"/>
             <param name="GENERATE_LINKS" value=""/>
             <param name="GENERATE_CAPTION" value="BORDER"/>
             <param name="SHOW_COMMON_ELEMENTS" value=""/>
             <param name="ELEMENT_TYPE_1" value="VARIABLE"/>
             <param name="ELEMENT_NAME_1" value="Z_CP_018"/>
             ITEM:            TEXTELEMENTS_1
    </object>
    as the other poster mentioned the variable name has to be in upper case.
    if only_values = 'X' you will just get the value other wise
    you will get something like below.
    variable description = variable value
    Regards
    Raja
    Reward the helpful answers and close the thread once its answered.
    sorry for the delay in answering, it was weekend for us

  • Problem importing text file with null value

    I used the following codes to import a text file and it
    worked perfectly.
    However, it skipped the TAB (chr(9)) on the imported row when
    there is no data (empty string) in one of the columns.
    Can someone help? thanks!
    sample text file data:
    00001 desc1 12.00
    00002 25.00
    00003 desc2 15.00
    Code that I used:
    <cffile action="read" file="#FilePath#"
    variable="data">
    <cfset newLine = chr(13) & chr(10)>
    <cfset tabChar = chr(9)>
    <cfoutput>
    <cfloop list="#data#" index="row"
    delimiters="#newLine#">
    <cfset cols = listToArray(row, tabChar)>
    ID = #cols[1]#
    desc = #cols[2]#
    price = #cols[3]# <br>
    </cfloop>
    </cfoutput>

    There is no perfect way to handle this with out you writing
    more complicated code.
    A good compromise is to replace this line:
    <cfset cols = listToArray(row, tabChar)>
    with this:
    <cfset cols = listToArray (Replace (row, tabChar &
    tabChar, tabChar & "{empty}" & tabChar, "ALL"),
    tabChar)>

  • Importing text file with variable spaces

    Hi all
    I have a text file with a varying amount of spaces in it. Typical output from the file is attached.
    How can I separate the values into separate columns please?
    Thanks in advance.

    You're going to need some substrings:
    DECLARE @flatFileLine VARCHAR(MAX) = '2002 01118511 0.00 0 0.00 0.00 PENDING '
    SELECT
    SUBSTRING(@flatFileLine,1,4),SUBSTRING(@flatFileLine,5,17),SUBSTRING(@flatFileLine,22,17),SUBSTRING(@flatFileLine,39,17),SUBSTRING(@flatFileLine,56,17),SUBSTRING(@flatFileLine,73,17),SUBSTRING(@flatFileLine,90,17)

  • Reading a text file and transferring values into array

    Hi,
    I have a problem. So what I am trying to do is that, I read a text file and insert specific values from the text file into an array for future needs.
    But I have to make sure that there is no duplicate entries. So thats what I have but, my method takes forever to finish...
    here is my code:
    String nomFichier = "Test_" + numTest + "_" + date + ".txt";
            String ligne = "";
            int z = 0;
            int j = 0;
            BufferedReader lecteurFichier = new BufferedReader(new FileReader(nomFichier));
            while ((ligne = lecteurFichier.readLine()) != null) {
                if (z > 3)
                    String valeur = "";
                    String dist = "";
                    boolean unique = true;
                    String [] chiffre = ligne.split(";");
                     if (intervalleAnalyser == 1)
                        valeur = chiffre[3];
                        dist = chiffre[4];
                    if (intervalleAnalyser == 2)
                        valeur = chiffre[2];
                        dist = chiffre[4];
                    if (intervalleAnalyser == 3)
                        valeur = chiffre[1];
                        dist = chiffre[4];
                    if (z == 4) {
                        intervalleDiagramme[j] = valeur;
                        j++;
                    if (z > 4) {
                        for (int i = 0; i < intervalleDiagramme.length; i++)
                             for (int x = 0; x < i; x++)
                                 if(intervalleDiagramme[i] == intervalleDiagramme[x])
                                    unique = false;
                        if (unique)
                            intervalleDiagramme[j] = valeur;
                        j++;
                z++;
            lecteurFichier.close(); // toujours fermer le fichier

    Hi,
    Thanks for your reply,
    1) Yeah I have a method that asks the question and assigns it to a variable.
    2) Well the z will stop once there is no lines to read no?
    for the set.add(), I am not that familar...
    I changed bit a code and I have this now:
    if (z > 4) {
                        for (int i = 0; i < intervalleDiagramme.length; i++)
                            System.out.println(intervalleDiagramme);
    if(intervalleDiagramme[i].equals(valeur))
    System.out.println(intervalleDiagramme[i] + " " + valeur);
    unique = false;
    if (unique)
    intervalleDiagramme[j] = valeur;
    EDIT:
    I figured a way to assign " " to all the values in my array. But I get this error:
    Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 380
    at TP3.lireFichier(TP3.java:305)
    And my line 305 is: intervalleDiagramme[j] = valeur;
    EDIT2:
    So ok I found my mistake and corrected it. But I want to know is there a way of doing this without setting the size of the array? because sometimes there needs to be 21 values sometimes 19 and sometimes 20....
    If I take out: = new String [21] out I get a NullPointer error...
    Edited by: Ara1992Habs on Dec 13, 2009 7:29 AM
    Edited by: Ara1992Habs on Dec 13, 2009 7:37 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Importing XML Text files with Indesign friendly 'Carriage Returns'

    Hi,
    I have a question wrt importing XML into Indesign.  I have my text stored in Excel (Fig A) and intend to export as an XML file where each line will represent each page.  However, my first attempt failed to treat the 'carriage returns' as I'd envisaged:
    The 'carriage returns' used within an Excel cell (ALT-ENTER) are maintained when transforming to a CSV file (Fig B).  However, when converting to an XML file, the conversion only takes place on a line by line basis and hence the XML file becomes incomplete (Fig C).
    So, it appears I need to make sure that the CSV file contains one line per entry, while also maintaining the actual carriage returns in my source spreadsheet and for Indesign to recognise them.  In order to do this, I'll need to substitute the 'carriage returns' in my excel column to be represented by a new set of characters.  My question is how can I let Indesign know to recognise this set of characters to be converted to a carriage return, when importing text.
    For example, if this set of characters was '%%%%%%', then my new csv file would look like Figure D and the XML would be produced correctly, like Figure E.  Then importing this XML file to InDesign, the carriage returns would automatically be reinstated, hopefully.
    I hope someone can help me as I am only starting out in Indesign and feel Im running before I can walk by venturing into the XML/Indesign arena too soon.
    Best Regards
    Luke

    Hi,
    Thanks for all the responses.
    With regard to XML, it could well be an issue has crept in because I am using another utility to convert my csv's to xml and maybe there are better options out there. I will take a look for other utilities and try that (Its not possible from Excel easily, even though there is an option to save as an XML file).
    Secondly, because the XML was readable by internet explorer, I assumed it had a satisfactory standard XML format which would be accepted by any program, including InDesign.  This proved true, since the XML file i generated was actually recognised by my Indesign document and populated the tags correctly, albeit without any carriage returns. 
    When I save my excel sheet as a csv, it does actually hold the carriage returns causing multiple lines per entry, hence why I need to substitute the actual carriage returns in my excel sheet to a alternative character set so that the entry remains on one line.
    Re: Double quotes on text fields.  Im sorry, I didnt realise I had commas in my sample csv example.
    I should have corrected it, but I intend on using semi-colons as my csv delimiter and don't intend on having semi-colons in my excel sheet itself, so I possibly won't need any double-quotes.
    So, it looks like this is what I need to do ;
    i)   Add a column in Excel which substitutes all the carriage returns with a line break identifier (^n).
    ii)  Convert Excel file to a semi-colon csv holding this new column,
    iii) Convert csv file to XML using a good CSV->XML utility,
    iv)  Add the respective XML tags to my INDD document,
    v)   Add a GREP rule which does a find/replace on all instances of ^n and replace with a line break,
    vi)  Import the XML file,
    vii) Apply the find/replace GREP rule on the whole document. Carriage returns on my text fields should be consistent with my original excel sheet.
    Thanks for all your help fellas.  Will report on how I get on once Im done.
    Best Regards
    L

  • How do I import binary data files (with header info) into DIAdem?

    We have lots of data acquired by nCode datagate. Files are binary data with header info. How do I import this into DIAdem? Typical (short) file attached. Also of interest, can I stream data from Sony PC208/SIR1000 recorders?
    Attachments:
    Propshft.dac ‏4 KB

    I have successfully imported your file into DIAdem using the nCode file filter included with DIAdem. You might have to make that file filter known to DIAdem by following these steps (this assumes you have version 8 of DIAdem):
    1. Go to the 'Window' menu in DIAdem and select 'Close all'
    2. Go to the 'Settings' menu and select 'GPI-DLL Registration'
    3. Click the 'Add' button in the window and select the 'GfSnCode' DLL in the 'DIAdem/AddInfo' directory
    4. The program will prompt you to restart.
    5. After you have restarted DIAdem, go to the DATA icon, select 'File - Open' from the DATA menu and in the dialog that appears, choose 'nSoft Data File Format' in the 'Files of type:' field.
    6. Select your data file and load
    That's it.
    With regards to your Sony reco
    rder data, I would need to get my hands on an actual data file to try it out. In general, DIAdem can import ANY binary file format by creating a header in the 'File - Import via header' section in DATA. If you have lots of data files from the SONY recorder, a DLL can be created for that specific file format with the free DLL toolkit included with DIAdem.
    Leave me a message here if you have any additional questions.
    Otmar
    Otmar D. Foehner
    Business Development Manager
    DIAdem and Test Data Management
    National Instruments
    Austin, TX - USA
    "For an optimist the glass is half full, for a pessimist it's half empty, and for an engineer is twice bigger than necessary."

  • Issue with variable values while adding report to Bookmarks/Favorites

    Hello All,
    I am able to save the reports from my portal as bookmarks with the appropiate navigation state & variable values for reports which do not have a mandatory value variable with no default value. For all other queries like queries with no mandatory variables or queries containing mandatory variables with default values, this is working fine. Any inputs is appreciated. We are in BI7.0 with SP12.
    Thanks,
    Danny

    What's your question, because from your statement, it seems like everything is fine ??
    Cheers,
    Andrew

  • How to include text lable in Variable selection screen (Web Reporting)

    Hi Experts,
    I have created one query and in Web Report-->variable selection screen I have one Date field for that field I have to display a label stating that user to input date in the format YYYY.MM(like a text label).Actually I have created 10 to 12 report . I need u r suggestion such that a single change will reflect my requirement in all the reports and I have created all the reports for same multiprovider.
    Thanks in Advance
    Yours,
    Bala

    Bala,
    Prompts can originate from one of two places:  either via Designer and using the @prompt functionality or while creating the report building a prompt in the Query Filters panel.  If the prompt was built using the @prompt method, and all 10-12 reports are using that particular @prompt, then one change via Designer will cause all reports to reflect the new verbiage.  If you built the 10-12 reports using the prompt in the second scenario, then each individual report needs to be opened, modified and then saved.  If you must use the latter method, then you can open the first report, modify the prompt verbiage, then highlight the new verbiage with your mouse and hit Control-C (which copies that text to the Clipboard of your Windows system).  Then go to the second report, locate the verbiage that needs to be changed, delete it, then Control-V (which pastes), and voila, some keyboarding strokes are saved....
    Thanks,
    John

  • Importing WORD text files with formatting and Text Flow issues IDCS3

    I am a designer who has used ID since it first came out, but have not been utilizing the larger document capabilities lately as I've been working in large format graphics (like really large, so if you have questions on that I can answer!). I am working on a new magazine and the copy is in WORD. I want to know the best way to bring in the text and keep the italic and bold formatting. The WORD docs have no style format done by the writers, so therefore changing the styles to my styles in the custom import section doesn't work. I tried making a character style sheet with no font chosen just "italics", but didn't work. I still was unable to make a paragraph style on top of it.
    If anyone has a good methodology for bringing in WORD text and keeping it's attributes while applying ID style sheets please help!
    Also with text flow, I have always had an issue with ID with not creating more pages to keep the flow going. In a test I just did I placed the text, but it did not create any new pages. I know there's a way to make that work, but spell it out for me like I'm a person losing their mind which seems to be the case!
    Thank you in advance to the person who can give me advice!

    What for settings do you have on the importoptions when bringing in Word? Keep formatting or loose formatting? And if loose formatting: is Keep local formatting on or off?

  • Importing text file (with file names) into Automator.. is it possible?

    Hello all,
    I have been working with Windows Batch files for my line of work. I have a couple of file names in a text file (a column), which I want to copy from one folder of one hdd to another folder on a different hdd. I have been trying to do this kind of work with a Mac. I already know how you copy and rename files in automator (which isn't difficult, of course) but you have to 'select' the files in the finder first (with get specified items).
    But the only way i see that you can specify items is by selecting them... is there a way to import a text file with all the file names instead of selecting all the file names manually?
    or is there an AppleScript alternative which I can use to import the text file (or just copy into applescript) and run before the query's of copying and renaming the files? I am kind of new to Apple programming.
    The text file looks like this:
    image1.jpg
    image2.jpg
    etc..
    so there has to be a command to: 'goto' a specific folder as well.
    Thanks in advance!

    You can import text files, but if they are just names you will need an additional action to add the source folder path. A *Run AppleScript* action can be used, for example:
    Tested workflow:
    1) *Ask for Finder Items* {Type: files } -- choose the text file containing the names
    2) *Combine Text Files* -- this gets the text file contents
    3) *Filter Paragraphs* { return paragraphs that are not empty } -- skip blank lines
    4) *Run AppleScript* -- copy and paste the following script:
    <pre style="
    font-family: Monaco, 'Courier New', Courier, monospace;
    font-size: 10px;
    font-weight: normal;
    margin: 0px;
    padding: 5px;
    border: 1px solid #000000;
    width: 680; height: 340px;
    color: #000000;
    background-color: #FFEE80;
    overflow: auto;"
    title="this text can be pasted into an Automator 'Run AppleScript' action">
    on run {input, parameters} -- add folder path
    add the specified folder path to a list of file names
    input: a list of text items (the file names)
    output: a list of file paths (aliases)
    set output to {}
    set SkippedItems to {} -- this will be a list of skipped items (errors)
    set SourceFolder to (choose folder with prompt "Choose the folder containing the file names") as text -- this is the folder containing the names
    repeat with AnItem in the input -- step through each name in the input
    try
    set AnItem to SourceFolder & AnItem -- add the prefix
    set the end of the output to (AnItem as alias) -- test
    on error number ErrorNumber -- oops
    set ErrorNumber to ("  (" & ErrorNumber as text) & ")" -- add the specific error number
    set the end of SkippedItems to (AnItem as text) & ErrorNumber
    end try
    end repeat
    ShowSkippedAlert for SkippedItems
    return the output -- pass the result(s) to the next action
    end run
    to ShowSkippedAlert for SkippedItems
    show an alert dialog for any items skipped, with the option to cancel the workflow
    parameters - SkippedItems [list]: the items skipped
    returns nothing
    if SkippedItems is not {} then
    set {AlertText, TheCount} to {"Error with AppleScript action", count SkippedItems}
    if TheCount is greater than 1 then
    set theMessage to (TheCount as text) & space & " items were skipped:"
    else
    set theMessage to "1 " & " item was skipped:"
    end if
    set {TempTID, AppleScript's text item delimiters} to {AppleScript's text item delimiters, return}
    set {SkippedItems, AppleScript's text item delimiters} to {SkippedItems as text, TempTID}
    if button returned of (display alert AlertText message (theMessage & return & SkippedItems) ¬
    alternate button "Cancel" default button "OK") is "Cancel" then error number -128
    end if
    return
    end ShowSkippedAlert
    </pre>
    5) *Copy Finder Items* { To: _your external drive_ }

  • When I import a text file(comma separated )into a numbers spread sheet all the data goes into one column. Why does the text not go into separate columns based on the commas.

    When I import a text file(comma separated) into a numbers spreadsheet all the data goes into one column instead of individual columns based on the comma separators.  Excel allows you to do this during the import..  Is there a way to accomplish this in numbers without opening it in Excel and the importing into Numbers.

    Your user info says iPad. This is the OS X Numbers forum. Assuming you are using OS X… Be sure the file is named with a .csv suffix.
    (I don't have an iPad, so I don't know the iOS answer.)

  • Import a text file into database

    If anybody could help me with this, i would GREATLY appreciate it! I need to write a procedure to import a text file into an oracle database table. -Thanks!

    See my response in Re: import a text file into database.
    Cheers, APC

  • Error while importing a text file for a list of values

    Hi Experts,
    While importing a text file for a list of values in designer, I am getting error message as below:
    "Invalid setting in Excel key of the Engines section of the Windows Registry. (3433)".
    I am using BO XI R3. Universe Designer version : 12.1.0.882
    Any suggestion ?
    Regards

    plzzzzzzzzzzzzzzzzz.............sme1 help me out

  • How do I import a pdf file with layers into Motion 5?

    In earlier version of Motion, you could import a pdf file with all layers or even select layers you wanted to import. You did this by dragging the pdf file into the project and holding it until a popup appeard providing you choices for how you wanted to complete the import. In Motion 5.0.1 however, no such popup appears and it imports the file as a flat image file. Any ideas how to change this pelase?
    Thanks
    Greg

    Thanks Ben & Praveen. In FCP7 It was possible to import PDF files and as you did the import, make choices regarding layers you wished to import. FCPX appears to import PDFs but only as flattened files. I'll try keeping the file in PSD format and importing as you recommend.

Maybe you are looking for