Subsets of a specific length

I have a Vector of Integers, like so: {1, 2, 4, 7}, and I need to generate all subsets of a given size. So if I wanted all the subsets of size three for the above set, I would get: {{1, 2, 4}, {1, 2, 7}, {1, 4, 7}, and {2, 4, 7}}.
How can I generate all these subsets? I found the following code (by schillj) posted on another topic, but it generates all possible subsets of all possible sizes, where I only need ones of a given size:
int[] arr = new int[] {1,2,3,4};
long num_permutations = (1<<(arr.length));
System.out.println("Number of permutations = " + num_permutations);
// print out all the sets
for(int loop = 0; loop < num_permutations; loop++) {
  System.out.print("Set #" + loop + ":  ");
  // do the bit chunking
  for(int bit = 0; bit < arr.length; bit++) {
    if(0 != (loop & (1<<bit)) ) {
      System.out.print( arr[bit] + " ");
  System.out.println("");
}Any ideas how I might generate my subsets?

Well, after working at it for a while, here's what I've come up with... It's not elegant, but I post it here in case anyone else is interested. I'd be interested to hear if anyone has a simpler or more elegant solution to what seems like it should be a simple problem.
// Given a set (a Vector) v, generates all the subsets of this set of
// the given length. Returns a Vector of Vectors (each of which is one
// of the subsets).
public static Vector subsetsOfSize(Vector v, int s) {
  // Initialize the positions array.  Each element is set to its index.
  int[] positions = new int[s];
  for (int i = 0; i < positions.length; i++) {
    positions[i] = i;
  // Generate all the subsets of size s
  int maxVal = v.size() - 1;
  boolean maxedOut = false;
  Vector subsets = new Vector();
  do {
    subsets.add(createSubset(v, positions));
    maxedOut = rIncrementVars(positions, 0, maxVal);
  } while (maxedOut == false);
  subsets.add(createSubset(v, positions));
  return subsets;
// A helper function used by subsetsOfSize().
private static Vector createSubset(Vector v, int[] positions) {
  Vector subset = new Vector();
  for (int i = 0; i < positions.length; i++) {
    subset.add(v.get(positions));
return subset;
// Recursively increments any number of variables in the manner used by
// subsetsOfSize(). That is, it creates all the combinations of the
// (vars.length) numbers from 0 to maxVal. Returns true to the calling
// function when it has generated the last such combination, returns
// false otherwise. The first time this function is called, vars
// should be an array with each element set to its index.
private static boolean rIncrementVars(int[] vars, int n, int maxVal) {
boolean incThisVar;
if (n < vars.length - 1) {
incThisVar = rIncrementVars(vars, n + 1, maxVal);
} else {
incThisVar = true;
if (incThisVar == true) {
int maxValN = maxVal - (vars.length - 1 - n);
if (vars[n] < maxValN) {
vars[n]++;
for (int i = n + 1; i < vars.length; i++) {
vars[i] = vars[i - 1] + 1;
if (n == 0 && vars[n] == maxValN) {
return true;
} else {
return false;
} else {
return true;
} else {
return false;

Similar Messages

  • Error in determining country specific length for account number

    Cannot determine country-specific length for account number;No instance of object type AccountClosureAM has been created. External reference: 0271409168GTABNGODUMMY00USDGO

    Thanks KI & Sujit
    Can you please tell me the Menu Path for OB40
    I have one another problem as below
    Jurisdiction code not defined for procedure TAXINN
    Message no. FF748
    Diagnosis
    You have entered a jurisdiction code in a country whose calculation procedure does not allow the entry of jurisdiction codes.
    System response
    Procedure
    Check and, if necessary, correct the entry.
    Procedure for System Administration
    If it is not an input error, check and possibly change the system settings.
    To do this, choose Maintain entries (F5).
    Change your calculation procedure so that tax calculation is carried out using the jurisdiction code.
    Can you please tell me how to solve this.
    Rakesh

  • How do i save a graph for a specific length of time

    Dear All,
    I am using a magnetic field sensor on a mine detector. Lets say the minedetector sweeps the sector for 10 secs. i want your help on the following
    1) how do i save the waveform chart for the whole ten sec. All i know is that i came across an example where i can save the chart at a specific point as a jpg. But that example is also for a graph. for the chart i suppose we need to change the array in some way.
    2) If i save the value of magnetic field obtained at every sample in an array, can i save it as an excel file. how do i do that.
    Best regards
    Regards
    Asad Tirmizi
    Design Engineer
    Institute of Avionics and Aeronautics
    " Its never too late to be, what u want to be"
    Using LabVIEW 8.2
    Solved!
    Go to Solution.

    Whenever I'm asked to reproduce chart data, I use Excel. In other words, your #2. The charts are graphical items floating along on the screen. Once they are gone, they are gone. You could save the chart to jpg everytime the chart gets full, then string it together later, but why? The data are the data, not the chart.
    The easiest way to save an array for Excel is to simply write the data to a text file, and have LabVIEW save the file as a *.csv file. This file can then be directly opened in Excel, and then plotted.
    The other method would be to have LabVIEW save directly to an Excel worksheet. There are lots of examples of that on the forum.
    Richard

  • How to add spaces to the column value to make it up specifi length string please

    Hello There,
    Could you please guide me here to solve this issue,
    in my column (named as State) contains values as below
    California
    Washington
    Utah
    Connecticut
    Massachusets
    in the output how can i add a spaces to make up every column values as 15 length (for ex, Utah is 4 length then need to add 11 spaces, California is 10 would like to add 5 spaces)
    i tried below but no use in Sql 2008 R2
    SELECT  distinct state
       state
    +SPACE(35-len(state)),
    len(state+SPACE(35-len(state)))
    FROM dbo.ordersInfo
    Thank you in advance
    Milan

    Fixed length CHAR(n) data in SQL is automatically padded with spaces. Either change the column's data type or cast to it. Also, the ISO-11179 rules are that the column should be "state_name" and not just the root attribute "state" -- state_code, state_population,
    etc are a few of the confusions you created. 
    Another rule of RDBMS is that we do not do display formatting in the data. That is what presentation layers do. Why are you trying to fake COBOL in SQL? 
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • Setting specific length for a line

    I'm looking for a way to enter an exact length for a line. Also, exact dimensions for a rectangle.
    I'm assuming there's a 'Properties' window or something that has the shape's properties, but I'm not seeing anything. I've searched the help site, but not seeing anything there either.
    Any assistance would be greatly appreciated.
    doug

    Look for the little downturned arrow in the tool options bar for more options for the different shape tools.
    I don't know that you can set a fixed length for the Line Tool, but could use the rectangle tool for a fixed line length.

  • How to append 0 to any number to make it of specific length

    Hi,
    I have a requiement. There is a textfield it is of max length 3, if user enters any number like '1' or '5' then it should be automatically appended with '0' to make it of length 3 that is if user enter '3' then it should become '003'.
    Please helpme in implementing this.
    Thanks,
    Vikram

    Thanks for ur reply..
    Ya we can use that infact right now I am using lpad only but is there any formatter class which we can set in our bean so that it will automatically format it in desired way.
    Thanks,
    Vikram Singh

  • How do I save clips to a new length?

    Sorry if this is basic, but I can't get it working, and can't figure out how to search for it.
    I'm using FCP 5.0.4 on a PPC (non-intel).
    I have 11 original source clips which are an HD Apple Intermediate Codec. I need them to be native HDV and each trimmed to a specific length.
    I've imported all 11 files into an FCP project that uses Easy Setup for HDV 1080i60.
    I have edited all 11 clips to desired length on a sequence.
    I've TRIED to use Media Manager to recompress the media to HDV 1080i60 and delete the unused portions of the clips...
    BUT
    the clips end up getting saved with their original durations (that is, they haven't been saved to the lengths I edited them to in the sequence).
    What am I doing wrong? Can anybody walk me through the steps?
    Thanks!!

    I've TRIED to use Media Manager to recompress the media to HDV 1080i60 and delete >the unused portions of the clips...
    In order to let this work with MM you must ONLY select the sequence in the browser.
    And DESELECT 'include masterclips outside selection'.
    (optional you can select to have handles (=extra length) of your clips.
    If you one of those wrong you are asking MM to recompress all your footage.
    Rienk

  • HELP ! what happened to the length/time of songs bar to the far right??!!

    I use Spotify to make playlists for my job. Certain exercises require specific length of songs, what happened to the side bar that shows that?! how do i recover it ??

    I'm missing the help even though I didn't re-install the old iMovie HD! I installed the new iMovie, but I still get the help from the old iMovie!
    Excellent, I can now see all of the features that I don't have in the new version, that I did in the old version.

  • Region length

    Hi folks...
    I need to have an audio region trimmed to a specific length. Also, sometimes I need to know exactly how long some audio regions are. What's the best way to get this info. If you're familiar with Cubase, you can simply look at the info bar on top of the arrange window, and it will tell you the exact length of any selected region (in bars, or seconds, or samples or anything).
    What's the simplest way to do this in L8?
    thanks anyone?!

    Well, its not showing me much of anything. Just the sample rate, bit depth and size on disk of the main audio file (not the regions).
    I need to know the exact length of my audio regions...I need to know more detials than what the list is showing me...
    any other way to know exactly how long a 'region' is?

  • Noob question - How can I copy a specific time sequence from an audio file

    Hello, I want to chop up an audio file
    into time-specific lengths.  How can I accomplish this precisely?  I know I can position the playhead precisely but
    how can I copy a chunk of an audio file, for example, if I wanted the segment from 00:02:34.7
    to 00:05:42.1?  Is my only option the "drag" selection of the
    Time Selection tool?  Is there not an option to do some start and end point setting so I can be as arbitrarily precise as necessary?
    Thanks in advance for any help.

    Copy from Messages.
    Paste into Notes.
    Copy the desired sentence from Notes.
    Paste as desired.

  • SQL Error: ORA-12899: value too large for column

    Hi,
    I'm trying to understand the above error. It occurs when we are migrating data from one oracle database to another:
    Error report:
    SQL Error: ORA-12899: value too large for column "USER_XYZ"."TAB_XYZ"."COL_XYZ" (actual: 10, maximum: 8)
    12899. 00000 - "value too large for column %s (actual: %s, maximum: %s)"
    *Cause:    An attempt was made to insert or update a column with a value
    which is too wide for the width of the destination column.
    The name of the column is given, along with the actual width
    of the value, and the maximum allowed width of the column.
    Note that widths are reported in characters if character length
    semantics are in effect for the column, otherwise widths are
    reported in bytes.
    *Action:   Examine the SQL statement for correctness.  Check source
    and destination column data types.
    Either make the destination column wider, or use a subset
    of the source column (i.e. use substring).
    The source database runs - Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
    The target database runs - Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
    The source and target table are identical and the column definitions are exactly the same. The column we get the error on is of CHAR(8). To migrate the data we use either a dblink or oracle datapump, both result in the same error. The data in the column is a fixed length string of 8 characters.
    To resolve the error the column "COL_XYZ" gets widened by:
    alter table TAB_XYZ modify (COL_XYZ varchar2(10));
    -alter table TAB_XYZ succeeded.
    We now move the data from the source into the target table without problem and then run:
    select max(length(COL_XYZ)) from TAB_XYZ;
    -8
    So the maximal string length for this column is 8 characters. To reduce the column width back to its original 8, we then run:
    alter table TAB_XYZ modify (COL_XYZ varchar2(8));
    -Error report:
    SQL Error: ORA-01441: cannot decrease column length because some value is too big
    01441. 00000 - "cannot decrease column length because some value is too big"
    *Cause:   
    *Action:
    So we leave the column width at 10, but the curious thing is - once we have the data in the target table, we can then truncate the same table at source (ie. get rid of all the data) and move the data back in the original table (with COL_XYZ set at CHAR(8)) - without any issue.
    My guess the error has something to do with the storage on the target database, but I would like to understand why. If anybody has an idea or suggestion what to look for - much appreciated.
    Cheers.

    843217 wrote:
    Note that widths are reported in characters if character length
    semantics are in effect for the column, otherwise widths are
    reported in bytes.You are looking at character lengths vs byte lengths.
    The data in the column is a fixed length string of 8 characters.
    select max(length(COL_XYZ)) from TAB_XYZ;
    -8
    So the maximal string length for this column is 8 characters. To reduce the column width back to its original 8, we then run:
    alter table TAB_XYZ modify (COL_XYZ varchar2(8));varchar2(8 byte) or varchar2(8 char)?
    Use SQL Reference for datatype specification, length function, etc.
    For more info, reference {forum:id=50} forum on the topic. And of course, the Globalization support guide.

  • ABAP AND DATABASES

    Hi Experts..
    I would like to know how to create a databases in SQL and have access from ABAP.. to Modify, Consult and do the basic operations like insert information, drop and modify in the respective tables.
    I'm ussing MiniSap Minigui 6.2 on Windows XP and the BCUSER
    Thank you very much for your help
    REGARDS

    HI Araceli,
    Database Access using Advanced Business Application Programming (ABAP)
    Basics :
    Accessing the Database in the R/3 System is performed through the interface provided by the SAP System, which in the SAP System is referred to as the Database Interface. A user can access the database from his/her program through Open SQL and Native SQL depending upon the circumstances.
    About SQL
    The Structured Query Language (SQL) is a largely standardized language, which is used for accessing relational databases. It can be divided as follows:
    Data Manipulation Language (DML)
    These statements are for reading and changing data in database tables.
    Data Definition Language (DDL)
    These statements are for creating and administering database tables.
    Data Control Language (DCL)
    These statements are used for authorization and consistency checks.
    So  each database has a programming interface. This programming interface allows the user to access the database tables by using SQL statements. But, these SQL statements in the programming interfaces are not fully standardized. So, you must refer to the documentation of that system for a list of the SQL statements available and also their correct syntax in order to access a specific database system.
    Interface thru data base
    Each work process on an application server must have a database interface if you want to make the R/3 system independent of the database system, and also to use it correctly despite the differences in the SQL syntax between various databases. By means of this interface only, the R/3 system can communicate with the database. All of the database requests from the R/3 system are converted into the correct Standard SQL statements for the database system by the database interface. In order to perform this function, it has to use a database-specific component, which shields the differences between database systems from the rest of the database interface. You have to choose the appropriate layer when installing the R/3 system. A user can access a database from a program through Open SQL and Native SQL.
    Open SQL
    Open SQL are statements that make up a subset of Standard SQL which is fully integrated in ABAP. Open SQL consists of Data Manipulation Language (DML) which is a part of Standard SQL.
    One of the ways to access the database from a program is Open SQL. These Open SQL statements are nothing but a subset of Standard SQL, which is fully integrated in ABAP. Irrespective of which database system the R/3 installation is using, they allow you to access data. When I said that, Open SQL consists of the Data Manipulation Language (DML). I meant that it allows you to read (i.e. to SELECT) and change (For example  to INSERT, UPDATE, DELETE) data.
    Moreover, Open SQL also goes beyond Standard SQL. This is to provide statements that can simplify or speed up database access in conjunction with other ABAP constructions. Apart from that, it also gives you the freedom to buffer certain tables on the application server, thereby enabling you to save excessive database access. In this case, the database interface is responsible for comparing the buffer with the database. As far as buffer storage is concerned, they may be stored in two parts: the working memory of the current work process, and the shared memory for all work processes on an application server. The data in the various buffers is synchronized at set intervals by buffer management where an R/3 system is distributed across more than one application server. It should be noted that data in the buffer is not always up to date when you are buffering the database. That is why you should only use the buffer for data which does not change often. You can specify whether a table can be buffered in its definition in the ABAP Dictionary.
    Open SQL consists of a set of ABAP statements. These statements perform operations on the central database in the R/3 system. The results of the operations and any error messages which come out of it are independent of the current database system. Thus, uniform syntax and semantics for all of the database systems supported by SAP is provided by Open SQL. Regardless of the current database system, the ABAP programs, which use Open SQL statements only, will work in any R/3 system. Moreover, Open SQL statements work only with database tables that have been created in the ABAP Dictionary.
    You have the freedom to combine columns belonging to different database tables to a database view (or view for short) in the ABAP Dictionary. Views are also handled in exactly the same way as database tables in Open SQL statements.
    Some Open SQL keywords are as follows:
    SELECT - It reads data from database tables.
    INSERT - It adds rows to database tables.
    UPDATE - It changes the contents of rows of database tables.
    MODIFY - It inserts rows into database tables or changes the content of existing rows.
    DELETE - It deletes rows from database tables.
    OPEN CURSOR, FETCH, CLOSE CURSOR - It reads rows of database tables using the cursor.
    Return Codes
    The following two system fields are filled with return codes by all Open SQL statements:
    SY-SUBRC: The system field SY -SUBRC contains the value 0 after every Open SQL statement if the operation was successful. When a value is other than 0, then it is unsuccessful.
    SY-DBCNT: The system field SY-DBCNT contains the number of database lines processed after an open SQL statement.
    Native SQL
    The other possible way to access the database from a program is Native SQL. It is only loosely integrated into ABAP. It allows access to all of the functions contained in the programming interface of the respective database system. Native SQL statements are not checked and converted as compared to Open SQL statements. Unlike Open SQL, these are sent directly to the database system. The function of the database-dependent layer remains minimal when you use Native SQL. The Programs which use Native SQL are written specifically for a database system. You should avoid using Native SQL wherever possible when writing R/3 applications. However, you can use it in some parts of the R/3 Basis System, for instance, for creating or changing table definitions in the ABAP Dictionary.
    Regardless of the database platform that your R/3 system is using, Open SQL allows you to access database tables, which are declared in the ABAP Dictionary. Native SQL allows you to use database specific SQL statements in an ABAP program. This means that you can use database tables that are not administered by the ABAP Dictionary. Aside from that, you can also integrate data that is not part of the R/3 system.
    As a rule, an ABAP program that contains database-specific SQL statements will not run under different database systems. You have to use Open SQL statements only, if your program is used on more than one database platform.
    You must proceed with the EXEC SQL statement, and follow the ENDEXEC statement to use a: Native SQL statement. For example
    Listing 1
    EXEC SQL [PERFORMING
    ENDEXEC.There is no period after Native SQL statements. Also, using quotation marks (") or an asterisk (*) at the beginning of a native SQL statement's line does not introduce a comment as it would in normal ABAP syntax. You need to know if the table and field names are case-sensitive in your chosen database.
    The data is transported between the database table and the ABAP program using host variables in Native SQL statements. These are preceded in a Native SQL statement by a colon ( and are declared in the ABAP program. The elementary structures can be used as host variables. The structures of an INTO clause are treated exceptionally, as though all of their fields are listed individually. If the selection in a Native SQL SELECT statement is a table, then you can pass it to ABAP line by line using the PERFORMING addition. For each line read, the program calls a subroutine
    . Further, you can process the data within the subroutine. 
    After the ENDEXEC statement, SY-DBCNT contains the number of lines processed as it does in Open SQL. In almost all cases, SY-SUBRC contains the value a after the ENDEXEC statement. Cursor operations form an exception: after FETCH, SY-SUBRC is 4 if no more records could be read. This is also applied when you read a result set using EXEC SQL PERFORMING.
    Native SQL Scope 
    Native SQL is very important as it allows you to execute nearly all available statements through the SQL programming interface (usually known as SQL Call Interface or similar) for directly executing SQL program code (using EXEC IMMEDIATE or a similar command). The statements that are not supported are listed in the following section:
    ·         Native SQL and the Database Interface,
    ·         Native SQL and Transactions
    ·         Native SQL and the Database Interface
    Native SQL statements bypass the R/3 database interface. With the database buffer on the application server, there is no table logging, and no synchronization. Therefore, you should use Open SQL to change database tables declare in the ABAP dictionary wherever possible. Since the columns contain extra database specific length information for the column tables declared in the ABAP dictionary, containing long columns with the type LCHAR or LRAW should only be addressed using Open SQL. Native SQL may not produce the correct result, as it does not take this information into account. Native SQL does not support automatic client handling. Instead, you must treat a client field like any other field
    Native SQL and Transactions
    One should not use any transaction control statement such as COMMIT, ROLLBACK WORK, or any statements that set transaction parameters using Native SQL to ensure that transaction in the R/3 System are consistent.
    ABAP Dictionary
    The ABAP Dictionary is nothing but a part of the ABAP Workbench. It allows you to create and administer database tables. There are no statements from the DDL part of Standard SQL in Open SQL. It should be noted that normal application programs should not create or change their own database tables.
    To create and change database tables, the ABAP Dictionary has to use the DDL part of Open SQL. Besides this, it also administers the ABAP Dictionary in the database. In addition, the ABAP Dictionary contains meta-descriptions of all database tables in the R/3 system. Here, only database tables appears in the Dictionary, which you have created using the ABAP Dictionary. Open SQL statements can only access tables, which exists in the ABAP Dictionary.
    Authorization and Consistency Checks
    With regard to authorization and consistency checks, the DCL part of Standard SQL is not used in R/3 programs. Whereas, the work processes which are within the R/3 system are logged into the database system as users with full rights. By using the R/3 authorization concept, the authorizations of programs or users to read or change database tables is administered within the R/3 system. In addition, transactions must equally ensure their own data consistency using the R/3 locking concept.
    The R/3 lock concept allows you to monitor your system with regards to lock logics. The R/3 lock concept works closely together with the R/3 updates.
    As an example, say that a travel agent wants to book a flight for a customer who wants to fly to a particular city with a certain airline on a certain day. If there are still available seats on the flight, then the booking will be possible, otherwise it will lead to overbooking. Hence, the database entry corresponding to the flight must be locked against access from other transactions to avoid the possibility of overbooking. This is because two agents might both be doing this same thing at the same time, and we need to make sure that we don't overbook.
    Lock Mechanisms 
    When the database system receives change statements (INSERT, UPDATE, MODIFY, DELETE) from a program, it automatically sets database locks. Database locks are locks on the database entries affected by statements to prevent problems. Since the lock mechanism uses a, lock flag in the entry, you can only set a lock for an existing database entry. After each database commit, these flags are automatically deleted. This means that database locks can never be set for longer than a single database LUW, a single dialog step in an R/3 application program.
    Therefore, physical locks in the database system are insufficient for the requirements of an R/3 transaction. Locks in the R/3 system must remain set for the duration of a whole SAP LUW, that is, over several dialog steps. They must also be capable of being handled by different work processes and application servers. As a result, each lock must apply on all servers in that R/3 system.
    Database Accesses of the NetWeaver AS ABAP
    The NetWeaver AS ABAP stores long-term data in a central relational database table. In a relational database model, the real world is represented by tables. A table is a two-dimensional matrix, consisting of lines and columns (fields). The smallest possible combination of fields that can uniquely identify each line of the table is called the key. Each table must have at least one key, and each table has one key that is defined as its primary key. Relationships between tables are represented by foreign keys.
    Standard SQL
    SQL (Structured Query Language) is a largely standardized language for accessing relational databases. It can be divided into three areas:
    ·        Data Manipulation Language (DML)
    Statements for reading and changing data in database tables.
    ·        Data Definition Language (DDL)
    Statements for creating and administering database tables.
    ·        Data Control Language (DCL)
    Statements for authorization and consistency checks.
    Each database has a programming interface that allows you to access the database tables using SQL statements. The SQL statements in these programming interfaces are not fully standardized. To access a specific database system, you must refer to the documentation of that system for a list of the SQL statements available and their correct syntax.
    The Database Interface
    To avoid incompatible situations between different database tables and to make the NetWeaver AS ABAP system independent of the database system in use, each work process on an ABAP application server contains a database interface. The NW AS communicates with the database solely through the database interface. The database interface converts all of the database requests from the NW AS into the correct Standard SQL statements for the database system in use. To do this, it uses a database-specific component that shields the differences between database systems from the rest of the database interface. You choose the this component when you install NetWeaver AS ABAP in accordance with the database in use.
    ABAP programs have two options for accessing the database interface: Open SQL and Native SQL.
    Open SQL
    Open SQL statements are a fully integrated subset of Standard SQL within ABAP. They enable the ABAP programs to access data irrespective of the database system installed. Open SQL consists of the Data Manipulation Language (DML) part of Standard SQL; in other words, it allows you to read (SELECT) and change (INSERT, UPDATE, DELETE) data.
    Open SQL also goes beyond Standard SQL to provide statements that, in conjunction with other ABAP constructions, can simplify or speed up database access. It also allows you to buffer certain tables on the application server, saving excessive database access. In this case, the database interface is responsible for comparing the buffer with the database. Buffers are partly stored in the working memory of the current work process, and partly in the shared memory for all work processes on an application server. In SAP systems that are distributed across more than one application server, the data in the various buffers is synchronized at set intervals by buffer management. When buffering the database, you must remember that data in the buffer is not always up to date. For this reason, you should only use the buffer for data which does not often change. You specify whether a table can be buffered in its definition in the ABAP Dictionary.
    Native SQL
    Native SQL is only loosely integrated into ABAP, and allows access to all of the functions contained in the programming interface of the respective database system. Unlike Open SQL statements, Native SQL statements are not checked and converted, but instead are sent directly to the database system. When you use Native SQL, the function of the database-dependent layer is minimal. Programs that use Native SQL are specific to the database system for which they were written. When developing generally valid ABAP applications, you should – as far as possible – avoid using Native SQL. In some components of the SAP System, Native SQL is used – for example, in the ABAP Dictionary for creating or changing tables.
    The ABAP Dictionary
    The ABAP Dictionary, part of the ABAP Workbench, allows you to create and administer database tables. Open SQL contains no statements from the DDL part of Standard SQL. Normal application programs should not create or change their own database tables.
    The ABAP Dictionary uses the DDL part of Open SQL to create and change database tables. It also administers the ABAP Dictionary in the database. The ABAP Dictionary contains meta descriptions of all database tables in the NetWeaver AS ABAP system. Only database tables that you create using the ABAP Dictionary appear in the Dictionary. Open SQL statements can only access tables that exist in the ABAP Dictionary.
    Authorization and Consistency Checks
    The DCL part of Standard SQL is not important in ABAP programs. The work processes within the ABAP application server are logged on to the database system as users with full authorization. The authorizations of programs or program users to read or change database tables is managed by the authorization concept. Equally, transactions must ensure their own data consistency in the database using the SAP locking concept. For more information, refer to the chapter Data Consistency.
    Work Processes
    Work processes execute the individual dialog steps of ABAP application programs. They are components of ABAP application servers. The next two sections describe firstly the structure of a work process, and secondly the different types of work process in NetWeaver AS ABAP.
    Structure of a Work Process
    The following diagram shows the components of a work process:
    Screen Processor
    In ABAP application programming, there is a difference between user interaction and processing logic. From a programming point of view, user interaction is controlled by screens. As well as the actual input mask, a screen also consists of flow logic, which controls a large part of the user interaction. NetWeaver AS ABAP contains a special language for programming screen flow logic. The screen processor executes the screen flow logic. Via the dispatcher, it takes over the responsibility for communication between the work process and the SAPgui, calls modules in the flow logic, and ensures that the field contents are transferred from the screen to the flow logic.
    ABAP Processor
    The actual processing logic of an application program is written in ABAP - SAP’s own programming language. The ABAP processor executes the processing logic of the application program, and communicates with the database interface. The screen processor tells the ABAP processor which module of the screen flow logic should be processed next. The following screen illustrates the interaction between the screen and the ABAP processors when an application program is running.
    Database Interface
    The database interface provides the following services:
    ·        Establishing and terminating connections between the work process and the database.
    ·        Access to database tables
    ·        Access to Repository objects (ABAP programs, screens and so on)
    ·        Access to catalog information (ABAP Dictionary)
    ·        Controlling transactions (commit and rollback handling)
    ·        Table buffer administration on the ABAP application server.
    The following diagram shows the individual components of the database interface:
    The diagram shows that there are two different ways of accessing databases: Open SQL and Native SQL.
    Open SQL statements are a subset of Standard SQL that is fully integrated in ABAP. They allow you to access data irrespective of the database system that your installation is using. Open SQL consists of the Data Manipulation Language (DML) part of Standard SQL; in other words, it allows you to read (SELECT) and change (INSERT, UPDATE, DELETE) data. The tasks of the Data Definition Language (DDL) and Data Control Language (DCL) parts of Standard SQL are performed in NetWeaver AS ABAP by the ABAP Dictionary and the authorization system. These provide a unified range of functions, irrespective of database, and also contain functions beyond those offered by the various database systems.
    Open SQL also goes beyond Standard SQL to provide statements that, in conjunction with other ABAP constructions, can simplify or speed up database access. It also allows you to buffer certain tables on the ABAP application server, saving excessive database access. In this case, the database interface is responsible for comparing the buffer with the database. Buffers are partly stored in the working memory of the current work process, and partly in the shared memory for all work processes on an ABAP application server. Where NetWeaver AS ABAP is distributed across more than one ABAP application server, the data in the various buffers is synchronized at set intervals by the buffer management. When buffering the database, you must remember that data in the buffer is not always up to date. For this reason, you should only use the buffer for data which does not often change.
    Native SQL is only loosely integrated into ABAP, and allows access to all of the functions contained in the programming interface of the respective database system. In Native SQL, you can primarily use database-specific SQL statements. The Native SQL interface sends them as is to the database system where they are executed. You can use the full SQL language scope of the respective database which makes all programs using Native SQL specific for the database system installed. In addition, there is a small set of SAP-specific Native SQL statements which are handled in a special way by the Native SQL interface. ABAP applications contain as little Native SQL as possible. In fact, it is only used in a few components (for example, to create or change table definitions in the ABAP Dictionary).
    The database-dependent layer in the diagram serves to hide the differences between database systems from the rest of the database interface. You choose the appropriate layer when you install NetWeaver AS ABAP. Thanks to the standardization of SQL, the differences in the syntax of statements are very slight. However, the semantics and behavior of the statements have not been fully standardized, and the differences in these areas can be greater. When you use Native SQL, the function of the database-dependent layer is minimal.
    Types of Work Process
    Before you start NetWeaver AS ABAP, you determine how many work processes each ABAP application server will have, and what their types will be. Since all work processes have the same structure (see preceding section), the type of work process does not determine the technical attrributes of the ABAP application server but the type of tasks to be performed on it. The dispatcher starts the work processes and only assigns them tasks that correspond to their type. This means that you can distribute work process types to optimize the use of the resources on your ABAP application servers.
    The following diagram shows again the structure of an ABAP application server, but this time, includes the various possible work process types:
    Dialog Work Process
    Dialog work processes deal with requests from an active user to execute dialog steps (see also Dialog Programming).
    Update Work Process
    Update work processes execute database update requests. Update requests are part of an SAP LUW that bundle the database operations resulting from the dialog in a database LUW for processing in the background.
    Background Work Process
    Background work processes process programs that can be executed without user interaction (background jobs).
    Enqueue Work Process
    The enqueue work process administers a lock table in the shared memory area. The lock table contains the logical database locks for NetWeaver AS ABAP and is an important part of the SAP LUW concept. In NW AS, you may only have one lock table. You may therefore also only have one ABAP application server with enqueue work processes. Normally, a single enqueue work process is sufficient to perform the required tasks.
    Spool Work Process
    The spool work process passes sequential datasets to a printer or to optical archiving. Each ABAP application server may contain only one spool work process.
    Role of Work Processes
    The types of its work processes determine the services that an ABAP application server offers. The application server may, of course, have more than one function. For example, it may be both a dialog server and the enqueue server, if it has several dialog work processes and an enqueue work process.
    You can use the system administration functions to switch a work process between dialog and background modes while the system is still running. This allows you, for example, to switch an SAP System between day and night operation, where you have more dialog than background work processes during the day, and the other way around during the night.
    thanks
    karthik
    reward me points if usefull

  • How-To: Correctly entering WEP passcodes so Wi-Fi works

    After speaking with specialist and getting password protected Wi-Fi to work:
    1. Since my 10 digit WEP code only has numbers 0-9 and letters A-F, the iPhone sees it as a HEX code, not a standard WEP code. Thus, when entering it in the iPhone, you must go to the ASCII/HEX option, and put the $ symbol in, which tells it that your WEP key is really a HEX key.
    You can access the HEX input option under seurity.
    So, when joining networks in the future that are locked, 10 digit, and only numerals 0-9 and letter a-f, you can choose HEX and add the $ sign. (Some people report this working without adding the $ sign).
    2. If you appear to be connected with a signal after entering your passcode, but still cannot access the internet, you go back to Wi-Fi options and tell the iPhone to "Forget this Network". Then you re-access it and start the input over.
    3. Longer passwords or passwords with strange characters should be tried under both WEP and ASCII/HEX. Again, before each try, choose "Forget this Network" and start over.
    4. A good test to make sure that your iPhone really does work on your home internet is to go into your router and turn your passcode off. Then, on the iPhone, choose "Forget this Network", and start over. iPhone will fly and you'll see it work (unless your phone is defective - and this is not likely.) If you don't know how to do this, (turn off router password) call your service provider. They will walk you through it, and it is really easy to do (maybe 4 steps... you just need the providers name and password and you access the option on menu... very simple. It is also simple to turn it back on when done with your test).
    5. Once you know your iPhone works, you can play around with the different passcode options if you want to keep the network password protected. Again, remember the "Forget this Network" option between each try. Otherwise, you will appear connected with signal strength but really won't be able to access the internet.
    Notes:
    A. A Fios network specialist told me that the more encryption you have, the longer the internet takes - on everything: computers, devices, etc. 8 or 13 digits are ideal, and more than enough protection. And your internet will be faster.
    B. All this password confusion should be standardized, but different providers choose different formats, hence the confusion. Although iPhone is very capable and is advanced technology, they could only support so many formats, hence our need to do some "tweaking" for unconventional formats. Eventually these providers should standardize in the future. (Same problems can exist for people connecting Wii's and PS3's wirelessly to protected home networks. Standardization would fix this).
    C. Although my iPhone is working quickly and effortlessly now on my home Wi-Fi network, it did go a little faster when the WEP was turned off on the router (and so did my laptop), so I guess the network guy was right.
    D. You don't need to "Restore Your iPhone" in iTunes to get this all to work. Although some people have mentioned that a "soft reset" of iPhone has helped. To do this, hold down the button on the top of iPhone while you hold down the "Home" button.
    E. If your iPhone works in open networks, or at home with your passcode off in the router, then your iPhone works fine on Wi-Fi. If the above solution does not work for you at home with WEP security turned on in your router, then the problem is an encryption one. Your options are to keep your home network passcode off, or to call your service provider and try different types of passcode encryption until you find the right one.
    F. If you bought your own router and are not leasing it from your network provider, you can visit their website and try updating the firmware on your router or seeing what other options are available for passcode encryption and try those.
    G. If you have MAC Authorization or Identification enabled in your router settings, you will need to manually enter your iPhone's MAC address into your router settings. This address can be found on the iPhone's "About" Menu option, under "Settings". This type of layer of security is really unneccessary and pain. Most people do not have it enabled, but if you do, entering the iPhone's MAC address enable you to get on. (But I suggest you turn this off if it is on.)
    **If this post helped you, please respond or add a star if helpful so others can find it and use it.
    Using the iPhone on Wi-Fi really is a pleasure!!! Enjoy your iPhones!!

    Just a word to the wise. Turning off password protection in your router leaves your network wide open to whomever is close enough to see your network. Unfortunately, a walkthrough is not as easy as it sounds. Every routers interface is different, and without talking to you while you have it open and having some idea what the interface looks like, it would be difficult to say the least. However if you know where you turned it off, then you know where to turn it on. Look for some of the options you have seen here and you will hopefully be able to figure it out. 64bit WEP with no encription, with a passcode that is either ascii or Hex is problably the easiest to set up. It is not the most secure, but will keep most folks out. However a relatively determined hacker will still be able to get in. Each requires that you select a key of a specific length, that is what makes it 64bit. 128bit makes it more secure because the key has to be twice as long.
    Once you get your router set up with a password(key), you have to get it entered in your iphone. If you were all ready connected to your network, you will not be anymore, but the iphone will not really tell you that clearly. Now for the steps:
    1. Go into Settings - Wi-Fi and touch the blue arrow next to your network.
    2. The touch Forget this Network at the top of the screen. It will ask for a
    confirmation.
    3. Touch the back button which puts you back on the Wi-Fi Networks
    window.
    4. Cycle the Wi-Fi off and then back on. It will do a new search for networks.
    Yours should show up again.
    5. This time when you touch on it it should ask you to Enter Password. Touch
    the WEP Password entry on the Security line.
    6. This will bring up a new window where you should see 'WEP hex or ASCII'.
    Make sure that is checked, touch it if it is not.
    7. Then touch the back button and enter your password(key) you put in your
    router. If you set it to hex in your router, you may have to try the $ thing
    mentioned before, but I would try it without first.
    8. The password window will disappear. The lock should disappear from your
    network for a few moments and then reappear. Once it does, click on the
    next to it again. Check to see if you have valid information in the first 4
    lines.
    A couple of notes:
    You will get valid information if your router is set up for DHCP, which most are, but if yours is not, you will have to change the tab to BootP or Static and set those up with valid information. However since without a password(key) you did not have a problem, DHCP is probably running.
    Second, note I said valid information in the first 4 entries. If you see an ip address starting with 169.254, that is not a valid address. At this point go back to step 2 and try again, perhaps with the $. However since you cannot see the letters/numbers you entered in the password, it could just be a typo on your part, so maybe try it again both with and without the $.
    Hopefully this will get you going. Good luck. Was that fourth grade or second grade level, these days you never know. I guess it would have been second year college or later in my day. ; )

  • How to change the lenth of existing field in sap standard table

    Hi all,
    can anybody help,my requirement is, how to change the length of existing field in sap standard table....
    thanks in advance..

    Which field are you thinking of in particular?  Are you wanting to increase or decrease the length?
    Some fields are used so extensively that a change to their length will mean adjusting many tables, some of them potentially very large, and hence taking a long time to adjust.
    Some standard SAP programs expect certain fields to be of specific lengths and won't work if the length is changed.
    Some screens could cease to work.
    If you decrease length, then you could lose data.
    matt

  • Why can't I connect to a Wi-Fi Network with 7 or below digit password? What should I do?

    I can't connect to a Wi-Fi Network with just 7 or below digits of password. What should I do?

    What are you trying to do the password on .. I have never noticed that it is limited to specific lengths unless you use WEP.. surely you don't use wep.

Maybe you are looking for

  • Can't install Oracle 8.1.7 on Debian 3.0 (woody)

    Hello, I'm trying to install Oracle 8.1.7 on Debian 3.0 (kernel 2.4.19 and glibc 2.2.5) but the runInstaller program does not start. It displays the msg "Initializing Java Virtual Machine from ../stage/Components/oracle.swd.jre/1.1.8/1/DataFiles/Expa

  • Cannot use delete key or back space on the keybord in Sun Java St. Creator!

    Happy new year Java fans! I have a small problem but annoing me a lot!! Cannot use delete key or back space on the keybord in Sun Java St. Creator! It is ok outside the creator!! I am using solaris 10 on x86 machine. Thanks for help

  • Continual problem with the Adjustment brush in both Lightroom 3 and Lightroom 4

    The Adjustment brush in both Lightroom 3 and Lightroom 4 continually stops functioning correctly - that is any adjustment made using the sliders in the Adjustment Brush panel does not make an adjustment on the image.      Normally I would go to Libra

  • RFC FUNCTION/BAPI for derived Roles (PFCG)

    Hi all, I have found many RFC functions for Users and Roles management but nothing for create derived roles. Any idea for creating derived roles from external applications ? Thanks Andrea

  • Retrieving Already Purchased Songs

    My hard drive recently crashed and I lost a lof of purchased music from the itunes store. My account confirms that I have purchased these albums, but yet I can't have them again unless I buy them again. That's a lot of money. What do i do?