Need idea on dynamic programing?
Hi, I am new to ABAP. I need clear idea on dynamic programming. Can any one suggest me where do i get the help on this and also pls suggest any links of sample examples and material on this.
Hi Niranjan,
Here are the few links which helps you a lot.
<li>[Dynamic internal table with dynamic fields.|http://an-abaper.blogspot.com/2009/06/dynamic-internal-table-with-dynamic.html]
<li>[Dynamic Internal table Creation.|http://an-abaper.blogspot.com/2009/06/dynamic-internal-table-creation_16.html]
Thanks
Venkat.O
Similar Messages
-
Graph Bipartition by dynamic programming
Hello
I need to write an algorithm on this following problem
Partition vertex set V into two sets V1 and V2, so that number of edges E(V1) - E (V2) is as small as possible.
I need to use dynamic programming..... like knapsack problem,array will consists of rows n col where rows will be vertices and column as edges.
Also degree of vertex is used for solving this problem.
I need the solution urgently,
Please help.
Thanksredstar11 wrote:
u know what ,there r always two sides of the coins,n u r being too judgmental .Perhaps. I just reacted to what information was provided: I saw a homework assignment posted without a specific question. And my opinion on flagging questions as urgent still stands: I find it selfish. I nkow for a fact that some poster here just skip posts where the OP is asking for help "ASAP" or "urgently". Just so you know.
Also, your chances in getting helpful answers from anyone increase dramatically when you spell words fully. Take "n u r" for example, that's "and you are", and "u" is "you".
Thats 100% true that i am facing difficulty in understanding my problem, but i never intended ne body to do my homework,
I just needed somebody to assist me or give me some reference to read so that i can solve my problem.Ok, good to hear that.
If my post is bothering u, then i will delete it,
Sorry!!!No, no need to (you can't delete messages, btw). I am no forum admin or anything.
Anyway,good luck with your problem. -
Help needed regarding Dynamic Programming
Hi,
While doing dynamic programming , we bind the context variable with two types of
values .
1 . ddic
2 . extern
My doubt is in which case we should use ddic and where to use extern .
Can anybody help me out regarding this.
Thanks a lot.Hi Ki,
Predefined, Web Dynpro UI-specific, and user-defined Dictionary types all have the
prefix ddic:.
wdContext.getNodeInfo()
.addAttribute(
"Visibility",
"ddic:com.sap.ide.webdynpro.uielementdefinitions.Visbility")
Logical Dictionary types from Adaptive RFC models have the prefix extern:.
Check this links
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/9214b1e5-0601-0010-fdb0-ec32d43b06e0
/people/dipankar.saha3/blog/2007/05/31/how-to-create-dynamic-approval-process-using-conditional-loop-block-in-guided-procedure
Regards,
Mithu -
Dynamic Programming Change Making Problem - Need Someone to Review
I've created a dynamic program in which you can input any amount with any given coin denominations and it should output the least amount of coins needed to solve, HOWEVER, there are some glitches I was hoping some of you could point out and correct. Here's the code for my main method and the code for my instance methods.
public class Changemaker
public static void main (String args[])
int amt = Integer.parseInt(args[0]); // Initialize the method in which the program will be invoked
Tuple[][] t = new Tuple[args.length - 1][amt + 1]; // Create the matrix
int [] coins = new int [args.length - 1]; // Create empty array that stores the amount of coin denominations
for (int i = 0; i < coins.length; i++) // Store input values into array called coins
coins[i] = Integer.parseInt ( args[i+1] );
for (int i = 0; i < coins.length; i++) // Establish a 0 value in the first column of every row
t[0] = new Tuple (coins.length);
for (int i = 0; i < coins.length; i++) // Create a tuple that checks if the given coin denomination can create the amount
for (int j = 0; j < amt + 1; j++)
if (j - coins[i] < 0) // Create a null tuple if the amount is less than the arguments
t[i][j] = new Tuple (coins.length);
else // Mantra
int remainder = j - coins[i]; // Take the coin out of the amount
t[i][j] = new Tuple (coins.length); // Create a new blank tuple of coin length
t[i][j].setElement(i, 1);// Change the tuple location from 0 to 1 to keep track of it
t[i][j].add(t[i][remainder]); // Add the tuple in the remainder cell to the existing tuple
try
if (t[i][j].total() > t[i - 1][j].total()) // Return total elements in tuple directly above
if (t[i - 1][j] != null)
t[i][j] = t[i - 1][j];
catch (ArrayIndexOutOfBoundsException e)
System.out.println(t[i][j].toString());
}Class for Instance Methodspublic class Tuple
private int [] change;
public Tuple (int n) // Constructor class, elements initialized at zero
this.change = new int [n];
for ( int i = 0; i < this.change.length; i++)
this.change[i] = 0;
public Tuple (int [] data) // Constructor class that creates a n-tuple from given data
this.change = new int[data.length]; //Initialize the array change to incorporate data into each element
for (int i = 0; i < this.change.length; i++)
this.change[i] = data[i];
public void setElement (int i, int j) // Set element i to value j
this.change[i] = j;
public int getElement (int i)
return this.change[i];
public int length()
return this.change.length;
public int total() // Return total of elements in tuple
int sum = 0;
for (int i = 0; i < this.change.length; i++)
sum += this.change[i];
return sum;
public void add (Tuple t) // adds a tuple t to tuple
* Make a new "change" array that equals the current one
* Create another array called tuple t
* Add the new "change" array with the tuple t
for (int i = 0; i < this.change.length; i++)
this.change[i] = this.change[i] + t.getElement(i);
public boolean equals(Object t) // Return true if tuple identical to t
* Determine if object is a tuple t
* Check to see if tuple t is the same size of change
* If true, loop both and compare
for (int i = 0; i < this.change.length; i++)
if (this.change[i] != getElement(i))
return false;
return true;
public Tuple copy() //Return an exact copy of tuple
Tuple copy = new Tuple(this.change);
return copy;
public String toString() // Returns a string of the tuple
String s = "";
for (int i = 0; i < this.change.length; i++)
s += this.change[i];
return "<," + s + ",>";
/* Add for loop
* Add value at each index of array into string
*Output:*
*java ChangemakerTest 5 1 2 3*
<000>
<100>
<200>
<300>
<400>
<500>
<000>
<000>
<010>
<010>
<020>
<020>
<000>
<000>
<000>
<001>
<001>
<001>
*The correct output using the above execution line should be:*
<000>
<100>
<200>
<300>
<400>
<500>
<000>
<100>
<010>
<110>
<020>
<120>
<000>
<100>
<010>
<001>
<101>
<011>A bit of advice on getting advice.
1) Ask a specific question, nobody is going to debug your program for you
2) Avoid the word "Dynamic", especially if you don't know what it means. -
Why do we need IDE or tools for java card programming?
Hi,
I am a newbie to java card, using java card kit tools themself, we can test and burn the code into card right?
then why do we need IDE for java card, please correct me , if i am wrong,
Thanks in advance,
Sri.Dear Sri,
We have compiler, linker etc for every language starting of from C or C++ or Java. JDK has all the tools necessary to develop and run a Java program. Similarly Java Card Development Kit has all the tools for developing and deploying a Java Card applet. But what an IDE does is too integrate all these tools and make it easier for the JavaCard programmer to develop his applets. Just like Eclipse is used for Java applet development.And not everytime the code is burned to the card. Its only during masking code is burned to the card, i.e if u can call it burning. Masking makes an applet permanent on the card. -
Dynamic Programming - subsequence counting
I have two string arrays (X and Y) and I want to count the number of times that a sequence X appears as a subsequence of a sequence Y by using dynamic programing. Could you guys give me some ideas about how to create the DP table?
thanksblack_makeba wrote:
yes, this is a java programming. And the task is to figure out the algorithm. If I knew the algorithm, Coding would be trivial. So I am asking for any ideas about the algorithm.I have a weak spot for problems like this so here's a solution but I'm not sure it qualifies as "dynamic programming" in your assignment.
You start out with an X string like "abcd". We call this string X(0) because it's in its initial state. Now if the first letter "a" has been found the string is called X(1) which is "bcd" (the first letter has been found and is no longer of interest). When the X(0) string "abcd" has advanced to X(4) all letters have been found.
Example:
X(0): "abcd" - initial string
X(1): "bcd" - first letter found
X(2): "cd" - second
X(3): "d" - third
X(4): "" - whole string found
In the general case you have strings from X(0) to X(N) where N is the number of letters in the original X string.
Now you consider each letter in the Y sequence from left to right and for each letter you create an X(0) string. You may also have accumulated a number of X strings in other states like maybe five X(1) and four X(2) etcetera. You have a look at the current letter in the Y sequence and check if the X(0) string can be advanced to X(1). If not you discard it. Once a string is in X(1) it's never discarded. Then you also check all other X strings and see if you can advance them. You never advance a string beyond the X(N) state. This proceeds to the end of the Y sequence when the number of X(N) strings tells you how many hits there were.
Now here comes what I would call a "dynamic programming" strategy. In the above algoritm you keep all X strings of all states but you don't have to. You only need to know how many X strings you have in each state because they all advance too the next state in unison. So you get a table with one entry for each X state. The entry holds the number of X strings in that state.
What you need to figure out is how to update the X state table as you consider each letter in the Y sequence. The entry for X(N) is the number of hits. -
Need to start a program in Oracle System (External) from sap program
Hi guys,
I need to start a program in another oracle based system from sap program by writing native sql statements.
Does anyone have idea how to do this.
Rgds,
RamHi,
Here is another sample for procedures.Kindly reward points by clicking the star on the left of reply,if it is useful.
Code Sample for writing a procedure with input and output parameters
REPORT zzz_jaytest.
* Getting the regno and total as input parameters
PARAMETERS : p_regno(10) TYPE c DEFAULT 'R1000',
p_total TYPE i.
data : v_total type i.
* In this procedure, we are updating the total of a regno given as input.
* Here two parameters used in the procedure are input parameters.
* We are updating the record of regno entered in selection screen and
* adding the total entered to the already existing total. We have to give semicolon
* for the statement inside procedure.
exec sql.
CREATE or replace PROCEDURE PROC1 ( p_regno in char, p_total in number )
IS
BEGIN
UPDATE stu_det SET total = total + p_total where regno = p_regno;
END;
endexec.
* This is the code to execute the procedure for update.
* While executing the procedure, the parameter variable should be
* preceded with colon :
EXEC SQL.
EXECUTE PROCEDURE PROC1 ( in :p_regno, in :p_total )
ENDEXEC.
* In this procedure, we are selecting the details for the regno entered
* as input. Here p_regno is input parameter and v_total is used as output
* parameter. So that we can use the retrieved value of v_total in our
* ABAP program
exec sql.
CREATE or replace PROCEDURE PROC2 (p_regno in char, v_total out char)
IS
BEGIN
select total into v_total from stu_det
where regno = p_regno;
END;
endexec.
* This is the code to execute second procedure.
EXEC SQL.
EXECUTE PROCEDURE PROC2 ( in :p_regno, out :v_total )
ENDEXEC.
write : / 'Total of ', p_regno, ' is ', v_total. -
Submitting a dynamic program with layout name
Hi,
I searched many blogs and the SDN forum but couldn't find a solution.
I need to know the layout fields of an ALV report for a later usage. Let me explain it with code:
I used below code to extract data of a dynamic program.
cl_salv_bs_runtime_info=>set(
EXPORTING display = abap_false
metadata = abap_true
data = abap_true ).
Submit (program) USING SELECTION-SET variant EXPORTING LIST TO MEMORY
AND RETURN.
TRY.
cl_salv_bs_runtime_info=>get_data_ref(
IMPORTING r_data = lf_ref ).
ASSIGN lf_ref->* TO <lt_data>.
CATCH cx_salv_bs_sc_runtime_info.
MESSAGE `Unable to retrieve ALV data` TYPE 'E'.
ENDTRY.
cl_salv_bs_runtime_info=>clear_all( ).
CREATE DATA lf_ref1 LIKE LINE OF <lt_data>.
ASSIGN lf_ref1->* TO <lt_line>.
What I need is to submit program with a (known) layout. If it is not possible, how can i modify the ALV report to fit a layout's display properties. (If I can manage to get -dynamic program- layout's visible fields, it will work too.)
Thank you.Hi ,
Check this LINK you can take help from this
create dynamic varient and pass to Submit program .
[how to create a variant dynamically and get it?;
OR :
you can use function module to get layout names and reprot
ranges: lr_report for ltdx-report,
lr_handle for ltdx-handle,
lr_log_group for ltdx-log_group,
lr_username for ltdx-username,
lr_variant for ltdx-variant,
lr_type for ltdx-type.
call function 'LT_VARIANTS_READ_FROM_LTDX'
exporting
i_tool = r_tool
i_text = r_text
tables
et_variants = rt_variants
it_ra_report = lr_report
it_ra_handle = lr_handle
it_ra_log_group = lr_log_group
it_ra_username = lr_username
it_ra_variant = lr_variant
it_ra_type = lr_type
exceptions
not_found = 1
others = 2.
regards
Deepak.
Edited by: Deepak Dhamat on Jan 23, 2012 8:18 AM -
Hi, I am new on pda programming. I already develop a java program using j2sdk1.4.2_05. I need to run this program in pda for my final project. Can i do this using creme? What version do i must use?
If j2sdk1.4.2_05 can't, does jdk1.3.1 can?
And anybody know where can i find pocket pc emulator so i can test my program on pc?
Many Thanks before,
tinnahi,
I am currently doing a project in pda application. We are using jeode as a VM for the pda. But it uses java 1.2. Maybe you want to have a look at it. however u cant use the swing class in jeode and only awt is the class availlable for programming interfaces.
If you need jeode u can contact me. I can give you a free copy which was availlable till last year as now it has gone chargable.
Also do you have any idea about how can i read and write txt files or dat files from desktop using java. I want to use a usb cradle for connection.
This information would be really appreciated as I need this for my second year project. -
Dynamic Programing : WebDynPro ABAP
Hi expert ,
I need to create UI element (Text_view) dynamically ,
can anyone send the code for that one .
Thanks & Regards
Sankar.MHi,
Refer to this link -
Dynamic Programing
Regards,
Lekha. -
Dynamic programming How to assign a static UI element to a static tray
Hi There,
We are enhancing a standard WDA application and we have a few static UI element created on the view. And now we want to rearrange these element to look like this.
Current:
Root
-> Transparent container1
-> ZTray
-> Transparent container2
target
Root
-> ZTray
-> Transparent container1
-> Transparent container2
Can you help me to find out me how can i perform this 'move" assignment using dynamic programming.
Thanks for your inputs.
RgdsHi Sudhir,
You can start trying something like this in WDDOMODIFYVIEW.
DATA:
lo_element type ref to cl_wd_uielement,
LO_CONTAINER TYPE REF TO CL_WD_UIELEMENT_CONTAINER.
IF first_time = abap_true.
LO_CONTAINER ?= view->get_element( 'ROOTUIELEMENTCONTAINER' ).
lo_element = LO_CONTAINER->REMOVE_CHILD( ID = 'ZTRAY' ).
LO_CONTAINER->ADD_CHILD( INDEX = 1
THE_CHILD = LO_ELEMENT ).
ENDIF.
I never did something like that. I guess that depending on the layout type of the view this code will need some changes (e.g matrix layout). I tried a simple test with flow layout and worked fine here. -
Dynamic Programming - RTTC - Appending lines
I give up! Maybe someone else can help me with this Dynamic Programming problem.
I am using RTTC to create an itab. Now I want to append lines and for some reason can't seem to crack the syntax I need.
My latest attempt looks like this...
FIELD-SYMBOLS: <table> TYPE ANY TABLE,
<row> TYPE ANY.
lo_sdescr = cl_abap_structdescr=>create( lt_components ).
lo_tdescr = cl_abap_tabledescr=>create( lo_sdescr ).
CREATE DATA lr_alloc->alloc_table TYPE HANDLE lo_tdescr.
CREATE DATA lr_struct TYPE HANDLE lo_rdescr.
ASSIGN lr_alloc->alloc_table->* TO <table>.
APPEND INITIAL LINE TO <table> ASSIGNING <row>.
The syntax check I get on the APPEND statement is "You cannot use explicit or implicit index operations on tables with type "ANY TABLE".
All the doco and examples I can find use a simple "SELECT * ... INTO CORRESPONDING FIELDS OF TABLE <table>" syntax which it not what I need to do.
Any help it appreciated.
Thanks
Graham RobboHello Graham
The solution is quite simple (at least to overcome your syntax error):
FIELD-SYMBOLS:
<gt_itab> TYPE STANDARD TABLE, " use STANDARD instead of ANY
<gs_struc> TYPE ANY.
*& Report Z_RTTI_CREATE_COMPLEX_ITAB
*& NOTE: revised version of ZUS_SDN_RTTI_CREATE_STRUCTURES
*& Thread: Dynamic Programming - RTTC - Appending lines
*& <a class="jive_macro jive_macro_thread" href="" __jive_macro_name="thread" modifiedtitle="true" __default_attr="980407"></a>
REPORT z_rtti_create_complex_itab.
TYPE-POOLS: abap.
DATA:
celltab TYPE lvc_t_styl. " becomes field of complex itab
DATA:
gd_tabnam TYPE string,
gd_tabfield TYPE string,
go_table TYPE REF TO cl_salv_table,
go_sdescr TYPE REF TO cl_abap_structdescr,
go_sdescr_new TYPE REF TO cl_abap_structdescr,
go_tdescr TYPE REF TO cl_abap_tabledescr,
gdo_data TYPE REF TO data,
gdo_handle TYPE REF TO data,
gs_component TYPE abap_compdescr,
gs_comp TYPE abap_componentdescr,
gt_components TYPE abap_component_tab.
FIELD-SYMBOLS:
<gt_itab> TYPE STANDARD TABLE,
<gs_struc> TYPE ANY.
PARAMETER:
p_tabnam TYPE tabname DEFAULT 'KNB1'.
START-OF-SELECTION.
" Describe structure
go_sdescr ?= cl_abap_structdescr=>describe_by_name( p_tabnam ).
gd_tabnam = go_sdescr->get_relative_name( ).
" Simulate dynamic addition of columns
LOOP AT go_sdescr->components INTO gs_component.
" Build fieldname
CONCATENATE gd_tabnam gs_component-name INTO gd_tabfield
SEPARATED BY '-'.
CLEAR: gs_comp.
gs_comp-type ?= cl_abap_datadescr=>describe_by_name( gd_tabfield ).
gs_comp-name = gs_component-name.
APPEND gs_comp TO gt_components.
ENDLOOP.
" Create instances of dynamic structure and dynamic internal table
go_sdescr_new = cl_abap_structdescr=>create( gt_components ).
go_tdescr = cl_abap_tabledescr=>create( go_sdescr_new ).
" Create data refence followed by table creation
CREATE DATA gdo_handle TYPE HANDLE go_sdescr_new.
ASSIGN gdo_handle->* TO <gs_struc>.
CREATE DATA gdo_handle TYPE HANDLE go_tdescr. " !!!
ASSIGN gdo_handle->* TO <gt_itab>.
APPEND INITIAL LINE TO <gt_itab> ASSIGNING <gs_struc>.
TRY.
CALL METHOD cl_salv_table=>factory
IMPORTING
r_salv_table = go_table
CHANGING
t_table = <gt_itab>.
go_table->display( ).
CATCH cx_salv_msg .
ENDTRY.
END-OF-SELECTION.
Regards
Uwe -
Dynamic Programming Using Java
hiiii...anyone knows how to use a dynamic programming to compare a mouse movement using java??? i hope some one can help me......
This was just an idea. I do not know of any program
implementing this. I will not help you store coordinates
into a database, but I can explain my suggestion in
more detail.
Since the characters might be more dependent on the page
then the user, you must make a sub character for each page.
Your table row must then contain following fields:
user, time, page, x-cord, and y-cord.
Now assume following
- we will use the characters 'average speed' and
'centre of gravity of movement'.
- we have two sessions of data, that is two sets of table
rows as described above. Every set belongs to different
users.
- the sessions are spread on a set of pages.
Now we will compute the distance between these users. There
are a lot of distance metrics but let us choose the most
common one. Let P be a set of points in R^n and p.n
be the n coordinate of the point p in P. Then for any p1
and p2 in P, define the distance metric to be
D(p1,p2) = summa_{over n} (p1.n-p2.n)^2
Define the average speed for a certain user and page to be
Speed(user, page) (in) R. Further more let
Gravity(user, page) (in) R^2 be the centre of gravity of
movement for a user and page.
Then the total distance is
D(user_1, user_2) = summa_{over all pages} k1*D(Gravity(user_1, page), Gravity(user_2, page)) + k2*D(Speed(user_1, page), Speed(user_2, page))
where k1 and k2 are constants determines the importance
you want to assign the two characters. -
Need to create Dynamic Varient
Hi,
Need to create Dynamic Varient
My Requirement is :
When the program runs on last day of the month, varient has to be set up to populate the
the File path as :
/PA1/Interfaces/FlatFiles/new_sales_history.txt
When the program runs on Working day + 1, then the other varient has to be set up to populate the File Path as :
/PA1/Interfaces/FlatFiles/sales_history.txt
Can anybody let me know how i can create Dynamic Varient...?
Any suggestions will be appreciated!
Regards,
KittuConsider the following option:
1) Create two parameters on selection screen. One for working day file and another for working day + 1 file.
2) Use logic inside program to determine if working day or not. Accordingly use the correct file name (from parameter).
3) Users can override the file parameters online. If needed, when the program is run online (SY-BATCH = ' '), issue a confirmation popup for the file to be used.
I am not sure "dynamic variants" is the way to go here because you will have to build another program/process of updating it everyday. But here is information about it anyways...
To create customer defined variables to be used in a variant, you will have to create it in table TVARV. See the following two links for further information:
http://help.sap.com/saphelp_45b/helpdata/en/c0/980398e58611d194cc00a0c94260a5/frameset.htm
https://www.sdn.sap.com/irj/scn/wiki?path=/display/abap/creatingdynamicvariantusingtable+TVARV -
Hi All,
I need your help to write the code for the below.
We have 12 add-on tables.
We need to check one by one all 12 table for the transaction data matching. Each table structure is different.The transaction data structure will also be different during runtime.
If we found the matching in any one of this table then we need to select the specific or required field from that table and put into the internal table and come otherwise continue checking the 12 add-on tables for transaction data field matching.
This should be done using the dynamic programming.
So here table name and the field selection and also the where condition all are dynamic.
Please help me on this.
Regards
Gautham.Please search.
there are too many threads on this.
Maybe you are looking for
-
Database Table or T-Code for Substitutes
Hi, Can anybody help me on the following issue: in workflow, one user A is receiving email notifications for the workflow. however, we checked and found that he is not authorised for the workflow approvals and nowhere in application he has been defin
-
Retropay by element run Errors for one employee
When i am running retropay for 3711 employees one of them errors out and the retropay by element process ends as Incomplete. The following is the error for the assignment: Error ORA-01427: single-row subquery returns more than one row has occurred in
-
I recently got my brother's old iTouch iPod for x-mas. In addition to the music i've put on it i thought it might be cool to read books on it so i bought a book ("Tweak" by Nic Sheff) and tried to put it on my iTouch/pod by dragging and dropping it
-
Is there a way to bring the schema names forward when you deploy a mapping?
Hi all, I am working in a database instance where there are objects in multiple schemas needed for a single mapping. Currently I have to create a grant statement and then create a synonym to get the deployed package to compile and run. Is there an op
-
Adobe create suite 64-bit related queries
Hi, I have following couple of questions related to 64-bit support in Adobe Products. 1. Would like to know Adobe Illustrator CS3,CS4 and CS5 support 64-bit? 2. Would like to know Adobe Photoshop CS3,CS4 and CS5 support 64-bit? 3. Heard that CS5 woul