Reading a value into a variable

How can I fill a variable with an integer from the keyboard??
Using the codeline
var = (int)System.in.read; System.in.read;System.in.read;
I don�t get the number but the aschii code for the character.
Why??
DEADOC

You get the ascii code because thats what System.in reads.
Read a string and then parse it into an int
StringBuffer sb = new StringBuffer();
int i;
while ((i = System.in.read()) != 10 && i != 13) { // read until you hit enter
  sb.append((char)i);
String s = sb.toString(); // the string you entered
int var = Integer.parseInt(s); // will throw an exception if the string cannot be parsed to an int
System.out.println("You entered: "+var); // print the integer value

Similar Messages

  • Store multiple values into a variable

    I was wondering if it was possible to store multiple values into one varaible. Something along the lines of...
    Oracle: 10g
    --Table xSample (this is obviously a dumbed down version of the table for the sake of showing what I want to accomplish
    S_ID   YEAR
    1         2009
    2         2009
    3         2009
    4         2009
    --Query
    select     s_id
    into       pID
    from      xSample
    where    year = 2009;Basically the reason I was trying to figure out how to store multiple values into a variable is b/c I was going to use that variable (pID) as a parameter and have it's values passed dynamically when the proc was called. The values would go into a query that would look something like:
    select *
    from cust_data
    where person_id in (pID)
    aka
    select *
    from cust_data
    where person_id in (1,2,3,4)Not sure if this is possible, but if anyone knows of a way I could accomplish this that would be great.
    Edited by: user652714 on Dec 23, 2009 9:37 AM

    Here's a basic idea building a comma seperated list, then consuming it in another query (taking the in list approach from Tom's post, linked earlier).
    create table xsample (s_id number not null, year number);
    insert into xsample select level, 2009 from dual connect by level <=4;
    commit;
    declare
       --4000 should be lots ... hopefully?
       v_parameter_list varchar2(4000);
    begin
      --create the comma seperated list
      select
        substr(max(sys_connect_by_path(s_id, ',') ), 2, 4000)
      into
        v_parameter_list
      from
        select s_id, row_number() over(order by 1) as rn
        from xsample
        where year = 2009
      start with rn = 1
      connect by prior rn = rn - 1;
      --consume the comma seperated list
      for x in
        with data as
          select
            trim( substr (txt,
            instr (txt, ',', 1, level  ) + 1,
            instr (txt, ',', 1, level+1)
            - instr (txt, ',', 1, level) -1 ) ) as token
          from
            select ','||v_parameter_list||',' txt
            from dual
          connect by level <= length(v_parameter_list)-length(replace(v_parameter_list,',',''))+1
        select *
        from xsample
        where s_id in (select * from data) 
      loop
        dbms_output.put_line('next item = ' || x.s_id);
      end loop;
    end;
    /

  • Retriving values into a variable

    hi,
    I'm novice to calcscripts...
    i have declared one variable within a fix cmd.
    I want to retrieve data into this variable combination whatever mentioned in the fix cmd some members also need prior.
    var LyBase;
    LyBase=@Prior(FY11,Base);
    i'm getting error-1200329:ivalid assignment of base
    i want to know
    "LyBase"="Can i give member combination here to retrieve data into this variable";

    variables need to be used in a calc block, here are some examples as it has been covered in the past
    Re: Temporary Variable Issue: Invalid Member Name
    Re: Using variables in Calc scripts and Business Rules
    Cheers
    John
    http://john-goodwin.blogspot.com/
    Hi john,
    thanks for ur reply,i have declared the variable inside the fix cmd,but when i'm trying to retrieve a value into this variable it is throwing error,
    *Error: 1012038 The constant [FY10->Actuals->Locked->Base] assigned to variable [LyBase] is not a number*.
    calc script is as follows
    fix(my sparse dim mbrs)
    var LyBase;
    LyBase=FY10->Actuals->Locked->Base;
    when executing this script i'm getting the above error.how can i fix it?

  • Can we assign jython variable value into ODI variable?

    Hi Team,
    We are trying to save jython variable value into ODI variable so that ODI variable can use in later steps.
    we are facing failure regards same.
    Please suggest us so that we can use ODI variable value in later steps.
    Thanks
    Ankush.

    See if this post help you :- How to assign value for a ODI variable from Jython Script
    Doc id 424579.1 on metalink should help.

  • How to read the input field value into ABAP variable?

    Hi All,
    i need a read the value of an input field into an ABAP variable,and i am doing this in the following way
    lstring = request->get_form_field('myFlag').
    here 'myFlag' is the input field name,but this is not returning me any value into lstring.
    I have gone through the SDN and tried to do this.
    could you please help me out to resolve this issue.
    Thanks in Advance,
    Praveena

    Dear Praveena
    In which event are you putting this code. Place it in oninputprocessing event(Page with flow logic Model of coding). Then it will surely work.
    Regards
    Vijay.M

  • Fetches more values into one variable

    Hi, inside a cursor loop I'd like to assign, each fetch, a value to a variable, in order, at the end to have a collection of all the values fetched into the same variable.
    The code is the following:
    CREATE OR REPLACE procedure APPS.AAA as
    v_pino varchar2(64);
    CURSOR tks_opened_range IS
    SELECT incident_number AS YP_TKS_OPENED_WITHIN_RANGE FROM cs.cs_incidents_all_b a, cs_incident_statuses_b b, Cs_Incident_Statuses_Tl c
    WHERE b.incident_status_id = c.incident_status_id
    AND a.incident_status_id = b.incident_status_id
    AND (b.attribute1 <> '3' OR b.attribute1 IS NULL)
    AND c.language = 'EL'
    AND ((sysdate - to_date(incident_attribute_6, 'dd-mm-yyyy hh24:mi'))*1440) BETWEEN 1 AND 11111111111
    AND incident_attribute_2 IN ('ΓΕΝΙΚΗ ΔΙΕΥΘΥΝΣΗ ΤΕΧΝΟΛΟΓΙΑΣ')
    ORDER BY incident_number;
    rec_tks_opened_range tks_opened_range%ROWTYPE;
    begin
    FOR rec_tks_opened_range IN tks_opened_range
    LOOP
    v_pino := rec_tks_opened_range.YP_TKS_OPENED_WITHIN_RANGE;
    DBMS_OUTPUT.PUT_LINE('v_pino: ' || v_pino);
    end loop;
    end AAA;
    This works with the variable v_pino!....but at the end, the value of the variable v_pino is ONLY the last fetched by the cursor.
    Is there a way to declare a variable (or better a collection) or a new type in order to have all the data fetched into this variable and the end of the fetching ?
    I need to know this trick because, after, I have to assign this variable to a pipelined table function.
    Thanks in advance
    Alex
    /

    Great Devang !! Thanks a lot ! It works ! Now I am able to retrieve all the values I need and store them into my variable gino
    I searched on the note you mentioned in your mail in order to pass an array as a variable to a table function (PIPE ROW call), but I didn't find nothing about it.
    Now I explain to you my situation.
    I already implemented a table function that works perfectly. I have 2 cursors declared and 2 PIPE ROW calls.
    FUNCTION statistic_report_2_1 (p_resolv_time_ll varchar2, p_resolv_time_ul varchar2, p_ypiresia varchar2)
    RETURN xxi_statistic_rep_2_1_tab PIPELINED
    IS
    -- CURSORS FOR THE FIRST SHEET - Tickets opened per group and per duration
    -- Cursor for tickets opened within 1 hour --
    CURSOR tks_opened_1_h IS
    SELECT incident_number AS YP_TKS_OPENED_WITHIN_1_HOUR
    FROM cs.cs_incidents_all_b a, cs_incident_statuses_b b, Cs_Incident_Statuses_Tl c
    WHERE b.incident_status_id = c.incident_status_id
    AND a.incident_status_id = b.incident_status_id
    AND (b.attribute1 <> '3' OR b.attribute1 IS NULL)
    AND c.language = 'EL'
    AND ((sysdate - to_date(incident_attribute_6, 'dd-mm-yyyy hh24:mi'))*1440) < 60
    AND incident_attribute_2 IN (SELECT * FROM TABLE(CAST(xxi_szf_discoverer.ypiresia_values(p_ypiresia) AS xxi_ypiresia_list_tab)))
    ORDER BY incident_number;
    rec_tks_opened_1_h tks_opened_1_h%ROWTYPE;
    -- Cursor for tickets opened between 1 hour and 3 hours --
    CURSOR tks_opened_1_3_h IS
    SELECT incident_number AS YP_TKS_OPENED_BE_1_3_HOURS FROM cs.cs_incidents_all_b a, cs_incident_statuses_b b, Cs_Incident_Statuses_Tl c
    WHERE b.incident_status_id = c.incident_status_id
    AND a.incident_status_id = b.incident_status_id
    AND (b.attribute1 <> '3' OR b.attribute1 IS NULL)
    AND c.language = 'EL'
    AND ((sysdate - to_date(incident_attribute_6, 'dd-mm-yyyy hh24:mi'))*1440) BETWEEN 60 AND 179
    AND incident_attribute_2 IN (SELECT * FROM TABLE(CAST(xxi_szf_discoverer.ypiresia_values(p_ypiresia) AS xxi_ypiresia_list_tab)))
    ORDER BY incident_number;
    rec_tks_opened_1_3_h tks_opened_1_3_h%ROWTYPE;
    PRAGMA AUTONOMOUS_TRANSACTION;
    BEGIN
    -- FIRST SHEET OPEN CURSORS --
    TICKETS NUMBER OPENED WITHIN 1 HOUR
    FOR rec_tks_opened_1_h IN tks_opened_1_h
    LOOP
    PIPE ROW(stat_rep_2_1_type(
    rec_tks_opened_1_h.YP_TKS_OPENED_WITHIN_1_HOUR
    END LOOP;
    -- TICKETS NUMBER OPENED BETWEEN 1 HOUR AND 3 HOURS --
    FOR rec_tks_opened_1_3_h IN tks_opened_1_3_h
    LOOP
    PIPE ROW(stat_rep_2_1_type(
    ,rec_tks_opened_1_3_h.YP_TKS_OPENED_BE_1_3_HOURS));
    END LOOP;
    RETURN;
    END statistic_report_2_1;
    But, in this way and with this syntax, I obtain for each PIPE ROW call only one field filled each time, because I can’t call 2 cursors in a nested loop together (data duplication);
    For example:
    1st PIPE ROW call : only the first field is filled and into the second I have to put ‘’
    2nd PIPE ROW call : only the second field is filled and into the first I have to put ‘’
    ….and I cant’ call with a single PIPE ROW call two cursor variables…..
    Into a Discoverer report this data layout is really bad (you can imagine with thousand
    of records).
    For this reason I thought to use an array variable (gino) to pass to a single PIPE ROW call outside the cursor loop……but it doesn’t work !!!
    Can you suggest me how to resolve this problem….if it possible ?
    Did I have to declare other TYPE or collection ?
    Thanks you so much
    Alex

  • How to read RGB values into Set

    Hi,
    I have been told that to count the total number of unique colors in an image is by reading each pixel RGB values into a set.
    I have checked this and it is true that the set can do this fine if considering only either one channel of the R,G or B (this does not allow me to know the exact number of color exist). However, I am confuse on how to have all three R, G and B values into a set so that the set can consider the whole 3 values of RG and B as a color which can then be differentiated separately.
    I think pixelgrabber allow to getPixel RGB values but I am working with JIU getsample method. Perhaps I missed out other methods in JIU which have the same functionality as in pixelGrabber.
    I am working on an image analysis so I need to figure out this out first.
    I am hoping anyone can help me out with this and I thank you.

    as mentioned, pack the rgb values into an integer.
    instead of a set, you will get better performance and
    memory useage using a sorted, dynamically allocated
    int array. With some minor work, you better this
    structure by using more than one sorted array and a
    cheap rgb mask hashing mechanism. I don't know what
    JIU is, but look at the source of java.awt.Color for
    details on how to pack/unpack rgb values.Hi,
    Thank for your feedback. I have tried to pack the rgb values into an integer. At the moment I just making used of Set (will look into probably ArrayList after I get the rgb values correct). However, I am not sure whether my code is correct (which I doubt) or not. Not sure how the output looks like that. If you could have a look at it and confirm me, I would be very much thanking you.
    the code snippet:
    public void countColour() {
    int r, g, b;
    int[] rgb1DArray = new int[h * w];
    int[] rgb = new int[4];
    Set set = new HashSet();
    int alpha = 255;
    for (int i = 0, cnt = 0; i < w; i++) {
    for (int j = 0; j < h; j++) {
    r = intImg.getSample(0, i, j);
    g = intImg.getSample(1, i, j);
    b = intImg.getSample(2, i, j);
    System.out.println(r+ "," g "," +b); // just checking rgb values
    //rgb[0] = alpha;
    rgb[1] = r;
    rgb[2] = g;
    rgb[3] = b;
    System.out.println(rgb[0]+ "," rgb[1] "," rgb[2] "," +rgb[3]);
    rgb1DArray[cnt] = ((rgb[1])<<16)|
    ((rgb[2]<<8))|(rgb[3]);
    System.out.println("rgb["+cnt+"] :" +rgb1DArray[cnt]);
    output:
    Image file size is 230 x 236
    204,221,203
    0,204,221,203
    rgb[0] :13426123
    204,212,191
    0,204,212,191
    rgb[1] :13423807
    180,166,140
    0,180,166,140
    rgb[2] :11839116
    236,209,166
    0,236,209,166
    rgb[3] :15520166

  • Reading Timestamp value into an SSIS variable

    I need to read the last timestamp value (MAX(TimeStampValue)) from a table, store it in a variable in SSIS and using the variable, perform a comparison against another table and load delta records. 
    The string data type is not playing well with the timestamp data type and things get even more complicated if I try to store the timestamp value as a varchar in a table.
    Is there any variable data types in SSIS that will store the timestamp value easier than a string?

    It could be due to the time stamp value being incompatible with the date time functions which you need to fix.
    So to make it conform manipulate on its value to get the proper format.
    PS: Varchar WILL swallow any text, please be more specific, think how others would be reproducing YOUR issue.
    Arthur My Blog

  • Trying to Read In Values Into Hash

    I am reading in a file...and i have this file being read
    Fileds:Name|Address|SS
    john|billsbury drive|030303030
    how do i make a hash table so that when my tokener reads Name, it could store john so that it would be
    Name = John
    Address = billsbuy drive
    etc.
    You will see that i am using an array to get the different names of fields, but this is not gonna work because I never know how big my array really is. So please help.
    here is my code wher e i read in my info from file.
    import java.io.*;
    import java.util.*;
    import java.text.*;
    import java.util.Date;
    import java.lang.*;
    public class file {
    public static void main(String[] args)
    // Display today's date using a default fomat for the current locale
    DateFormat defaultDate = DateFormat.getDateInstance();
    System.out.println(defaultDate.format(new Date()));
    // Display Current time using a short time format for the current locale
    DateFormat shortTime = DateFormat.getTimeInstance(DateFormat.SHORT);
    System.out.println(shortTime.format(new Date()));
    // Display date and time using a long format for both
    DateFormat longTimestamp = DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL);
    System.out.println(longTimestamp.format(new Date()));
    // Declare Variables
    StringBuffer desc;
    BufferedReader in = null;
    // Keep looking through the file while it is still not end of file
    try
    // Opens the file and reads it
    File theFile = new File("23133202.2");
    in = new BufferedReader(new FileReader(theFile));
    // Get Length of File, and see how big it is
    long filelength = theFile.length();
    Date lastModified = new java.util.Date(theFile.lastModified());
    String str = new String("");
    char ch = (char)179;
    int i=0, x, y, a, b, c, d;
    int fromIndex = 0;
    String name;
    int fieldCount = 0;
    // Read the file line by line using a Token
    while((str = in.readLine()) != null){
    StringTokenizer st = new StringTokenizer(str,":");
    int count = st.countTokens();
    String[] dataField = new String[1000];
    // tokener contains all the field variables
    String tokener = new String("");
    while(st.hasMoreTokens())
    tokener = st.nextToken();
    //System.out.println(tokener);
    //System.out.println(str);
    // Get Group Names, and Start Inserting Data Into Database
    if (str.indexOf("Group") != -1) {
    tokener = st.nextToken();
    x = tokener.indexOf("\u00B3");
    name = tokener;
    // y = tokener.indexOf("IDNR");
    // a = tokener.indexOf("LASTNAME");
    // b = tokener.indexOf("UNIQID");
    // c = tokener.indexOf("EXAMFILE");
    System.out.println(x);
    System.out.println("I want" + " " + name);
    // System.out.println(y);
    } else if (str.indexOf("Fields") != -1) {
    tokener = st.nextToken();
    System.out.println("SOMETHING NEW");
    StringTokenizer tk = new StringTokenizer(str,"\u00B3");
    String tok = new String("");
    while(tk.hasMoreTokens()) {
    tok = tk.nextToken();
    dataField[fieldCount] = tok;
    System.out.println("IN BABY" + " " + dataField[fieldCount]);
    fieldCount ++;
    } else {
    System.out.println("Not What I want" + " " + tokener);
    } // end the main while
    in.close();
    // end try
    catch (Exception e)
    try {
    in.close();
    catch (Exception ignore) { }
    e.printStackTrace();
    // end catch...in.close();

    By decyphering your code again, I relialised that the first field is present in your file, so, here is your code:
    import java.io.BufferedReader;
    import java.io.File;
    import java.io.FileReader;
    import java.text.DateFormat;
    import java.util.Date;
    import java.util.StringTokenizer;
    import java.util.Vector;
    import java.util.Hashtable;
    public class file {
        public static void main(String[] args) {
    // Display today's date using a default fomat for the current locale
            DateFormat defaultDate = DateFormat.getDateInstance();
            System.out.println(defaultDate.format(new Date()));
    // Display Current time using a short time format for the current locale
            DateFormat shortTime = DateFormat.getTimeInstance(DateFormat.SHORT);
            System.out.println(shortTime.format(new Date()));
    // Display date and time using a long format for both
            DateFormat longTimestamp = DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL);
            System.out.println(longTimestamp.format(new Date()));
    // Declare Variables
            StringBuffer desc;
            BufferedReader in = null;
    // Keep looking through the file while it is still not end of file
            try {
    // Opens the file and reads it
                File theFile = new File("23133202.2");
                in = new BufferedReader(new FileReader(theFile));
                String keyLine = in.readLine(); // Get Keys
                String valueLine = in.readLine(); // Get values
                StringTokenizer keys = new StringTokenizer(keyLine, ":|");
                keys.nextToken(); // Ignore the 'fields:' entry
                StringTokenizer values = new StringTokenizer(valueLine, "|");
                Hashtable yourHashtable = new Hashtable();
                while (keys.hasMoreTokens()) {
                    String key = keys.nextToken();
                    String value = values.nextToken();
                    yourHashtable.put(key, value);
                System.out.println("yourHashtable = " + yourHashtable);
    // end try
            catch (Exception e) {
                e.printStackTrace();
            finally {
                try {
                    in.close();
                } catch (Exception ignore) {
    // end catch...in.close();
    }The output this produced is:
    06-Nov-01
    20:30
    06 November 2001 20:30:06 o'clock GMT
    yourHashtable = {Name=john, SS=030303030, Address=billsbury drive}
    HTH,
    Manuel Amago.

  • READING INTO ONE VARIABLE

    HI
    HOW CAN I READ VALUE INTO ONE VARIABLE.???
    ie,
           IN RUNTIME IF IM ENTERING VALUE TO VARIABLE 'A'  MEANS   HW CAN I TAKE THE VALUE TO 'A'.

    DYFIELDS-FIELDNAME ='<Parameter Name>'.
    APPEND DYFIELDS.
    DATA DYFIELDS LIKE DYNPREAD OCCURS 1 WITH HEADER LINE.
    CALL FUNCTION 'DYNP_VALUES_READ'
    EXPORTING
    DYNAME = SY-CPROG
    DYNUMB = SY-DYNNR
    TABLES
    DYNPFIELDS = DYFIELDS .
    READ TABLE DYFIELDS INDEX 1.
    This function module will read out the values into Internal table DYNFIELDS.
    Use this function module at  " On value request for <parameter>.

  • How to get BW-BPS variable value into Visual Basic?

    Hello,
    Scenario:
    Time characteristic 0FISCYEAR has a variable ZVFYEAR. In layout this time characteristic is defined as DATA COLUMN. When user changes VFYEAR variable’s value i want to get the value of variable into Visual Basic and to format header for table in the layout.
    How to get BW-BPS variable value into Visual Basic?
    Could you help me?
    Thanks in advance.
    Best Regards,
    Arunas Stonys

    Hi,
    If i understand your requirments correctly ,you need to read the value of the Variable and Put it on the layout. Here is how  i would solve this,
    Read the value of the variable using an ABAP program.The logic for this would be to read the variable value and post it on the layout on a cell.You can do this by calling the ABAP program on opening the layout.this can be done using LB_EXIT_FM  T-code. Now using the  SAP delivered SAPAfterDataPut  macro, read the cell in which you have placed the variable values and assign it to the necessary values you want to on the layout.All this will be done before the layout opens.
    Hope this helps.
    regards
    Sai Vishnubhatla

  • [JCOP Shell] how to get the result of a script into a variable ?

    Hello all,
    I have a jcsh script that swaps the Two nibbles of an hexadecimal number.
    #swap.jcsh
    X= 0xAB
    R= $(/expr $(/expr ${X} << 4 ) + $(/expr ${X} >> 4 )  )
    /echo 0x${R;h2} the value echoed is 0xBA, right.
    now, I want to replace the X varibale by an argument variable ( ${1} ) and , instead of echoing the result, storing it into another varibale; example :
    Y= swap 0x23this is not working. ;-(
    Does anyone knows how to do it ? is there a "return" equivalent to put at the end of my "swap" script ?
    mkdata are you there ? :)
    Kartagos

    Thank you very much mkdata
    I solve it temporarely by using a global Variable TEMP that will be used by scripts to store the result, then the caller script will simply read the value of this variable (old old school global variable method :) )
    now I'm considering re-writing my libraries
    I knew that there something "DEFUN" but i didn't find any help (when typing "help /error" it talks about something called "defun")
    I think I should write to the JCOP Team to update their docs.
    Regards
    Khaled

  • How i pass table column  value to string variable or return to java applete

    Hi Master,
    How do I pass a table column value into string variable. See my code below:
    import java.sql.*;
    public class Waheed {
    public Waheed() {
    public static void main (String args [])
    String s = "9 23 45.4 56.7";
    System.out.println ("going for connection");
    // DriverManager.registerDriver (new oracle.jdbc.driver.OracleDriver());
    try{
    Class.forName("oracle.jdbc.driver.OracleDriver");
    Connection conn =
    DriverManager.getConnection("jdbc:oracle:thin:@fahim:1521:aamir","muhammad","mfa786");
    Statement stmt = conn.createStatement();
    ResultSet rset = stmt.executeQuery("select accid from accbal");
    System.out.println ("going for connection");
    while (rset.next())
    s= rset.getString("accid"); this line give me error
    System.out.println (rset.getString("accid"));
    System.out.println (s);
    catch(Exception e){
    e.printStackTrace();
    This line give me an error:
    s= rset.getString("accid");
    s is string variable
    Plese give me an idea how I can pass accid in s variable.
    Thanks.
    Aamir

    See the code sample in the following thread (try using upeercase).
    JDBC  connection
    Kuassi

  • A large program with MANY .vi's loads an onboard program to a 7344 board, later in anothor .vi I load a value into var = 1. and then run Onboard program. Program runs but value of var =1 is not used.

    Onboard program calls the "Load constant to variable.vi" in first block. Same call is made in labview code just before the run program block. the variable in the onboard program ALWAYS defalts to (0). WHY???

    Hello,
    Thank you for contacting National Instruments.
    My guess is that the variable is being overwritten by the first call (Load Constant to Variable VI) of the onboard program. The order of operations for the second VI appears to be the following:
    1) Load Constant to Variable (variable 1 = 10000)
    2) Run the onboard program
    3) Onboard program calls Load Constant to Variable (variable 1 = 0)
    Any value that the first step of the onboard program loads (step 3 above) will overwrite the value loaded just before the onboard program runs (step 1 above).
    I have attached an image of the block diagrams for both VIs I used for testing. The first VI loads an initial value into variable 1, starts program storage, loads position, loads veloci
    ty from variable 1, loads acceleration and deceleration, starts motion, then ends storage. The second program simply loads a new value into the variable then runs the stored program. As the variable value in the second program is modified, the velocity changes appropriately. I tested this with a PCI-7344 in LabVIEW 7.1 with NI-Motion 6.1.3.
    Hopefully this will help you track down the source of the problem.
    Best Regards,
    Jesse D.
    Applications Engineer
    National Instruments
    Attachments:
    OnboardTestImage.JPG ‏36 KB

  • How to read Filter selection variable values into ABAP code

    HI IP Gurus,
    Requierement: In my filter characterstics, i have assigned variables, which use will enter when running th e planning sequence.
    so  variable values entered by user , i would like to get those values into ABAP code and pass them to some function module.
    SO please give me step by step detail how to achive this.
    MY understanding use the below method . but not sure how to proceed.Please let me know abap code to get values.
    GET_TAB_PARAM_DATA_SEL and GET_PARAM_DATA_SEL.
    Please help me.
    Thanks in advance.Will Assign points
    Sania

    Hi Srinivas,
    So In RSPLF1 , in paramters tab, Do i have create structure(str1) and then create component Data selection (Dtsel1) under str1(what setting i have to do here, where should i enter variable value and do i need to give info object name and how do it in code.i tried to following example, not able to get any values in tab_sel .
    It will be great, if you could explain in detail.
    other thing i found out is in Initialization method i can read i_t_data_charsel table values , where it contains filter slected values.but could not pass  these values to execute method
    Is there is any way that i can pass values from init method to execute method.
    A tabular structured parameter with name "MY_TABSTRUC" is defined for the function type. "MY_TABSTRUC" consists of the two parameter components "MY_ELEM" and "MY_DATASEL". You access the parameter values as follows:
    DATA: TAB_PARAM_STRUC TYPE RSPLFA_T_PARAM_STRUC,
           REF_PARAM_STRUC    TYPE REF TO IF_RSPLFA_PARAM_STRUC,
          REF_PARAM_ELEM     TYPE REF TO IF_RSPLFA_PARAM_ELEM,
          REF_PARAM_DATASEL  TYPE REF TO IF_RSPLFA_PARAM_DATESEL,
           L_VAL(20)          TYPE C,
           TAB_SEL            TYPE RSPLF_T_CHARSEL.
    get table of parameter MY_TABSTRUC:
      TAB_PARAM_STRUC = I_R_PARAM_SET->GET_TAB_PARAM_STRUC( 'MY_TABSTRUC' ).
    process all lines:
      LOOP AT TAB_PARAM_STRUC into REF_PARAM_STRUC.
      get component MY_ELEM:
        REF_PARAM_ELEM = REF_PARAM_STRUC->GET_COMP_ELEM( 'MY_ELEM' ).
      get internal value of MY_ELEM:
        REF_PARAM_ELEM->GET_VALUE( IMPORTING E_VALUE = L_VAL ).
      get component MY_DATASEL:
        REF_PARAM_DATASEL = REF_PARAM_STRUC->GET_COMP_DATA_SEL( 'MY_DATASEL' ).
      get data selection table of MY_DATASEL:
        TAB_SEL = REF_PARAM_DATASEL->GET_T_SEL( ).
      ENDLOOP.
    Thanks in Advance..please help me

Maybe you are looking for