Techniques of recursion
Although I can manage my way through recursive implementations. i want to train more in it like how actually Java implements it and also tough problems that the recursive approach can solve...
No
wastrel wrote:
jwenting wrote:
wastrel wrote:
yorkroad wrote:
wastrel wrote:
codeNombre wrote:
like how actually Java implements itThere's nothing special to a recursive call. It's like any method call.To understand recursion, you must first understand recursion.
sorryDon't be sorry. Joking is a good way to hide incompetence.the joke's on you if you didn't understand his statement, as such misunderstanding shows clearly that you don't understand recursion.When yorkroad cracked his recursion joke he referred to this statement,
"There's nothing special to a recursive call. It's like any method call."
so he apperantly thinks this statement defines a recursive relation, but it doesn't. It defines an equivalence relation.
Wrong. The statement is definitely recursive.
It was a funny joke but it was misplaced Wrong again.
and joking out of place is a sure sign of incompetence (or mistake).As is not recognizing that the joke in question is in fact appropriate.
Similar Messages
-
How to read all the files in the directory
Hi,
I want to read all the files from a directory and perform some operations on them. How to read one file at a time from the directory. Is there any operation like the * sign in Dos and Matlab. Is there any such vi which does that.
Thanks,
NitinI'm glad I could help, Danny. Using the VI Server technique for recursion is very slow and memory-intensive. I have never seen a need for recursion in LabVIEW that couldn't be solved with a loop and shift registers.
-D
Darren Nattinger, CLA
LabVIEW Artisan and Nugget Penman -
Mapping Techniques determines Runtime Performance
What mapping technique offers the best performance at runtime (i.e. graphical, ABAP, Java, XSLT)? I have the ability to use anyone of these techniques, but I want to ensure I am using the one that offers the best performance at runtime, not the quickest/easiest to implement at design time.
Hi..
imo mapping performance does only partially depend on technique used, another important influence is the developer himself. You can develop highly performant graphical mappings, java mappings and also XSLT mappings but you have to focus on performance, know the concepts and maybe have someone else look at the mapping after it is finished I'm not sure about ABAP mapping, but i would say graphical and custom java have the same performance. XSLT is indeed slower, but there are some problems which can not be solved in graphical mapping (e.g. recursion) which can be solved rather easily in XSLT. Also SAP uses XSLT extensively in their standard content (e.g. MDM 3.0) where we have not encountered serious performance problems so far.
best regards
Christine -
Hi,
types of Mapping Technigues in PI 7.0/PI7.1These links provided below will deal with various techniques that are handled in mappings.
Simple java code in graphical mapping - XI
The specified item was not found.
GlobalContainer - in graphical mapping (XI)
The specified item was not found.
XI: How to test your mapping (in real life scenarios)
The specified item was not found.
XI: XML node into a string with graphical mapping?
The specified item was not found.
Sending Java code as payload to do mapping in XI
Sending Java code as payload to do mapping in XI
Skelton of Mapping Runtime in SAP XI Did we bother to understand why the RFC Destination AI_RUNTIME_JCOSERVER is very important
Skelton of Mapping Runtime in SAP XI
Accessing System Parameters in Mapping Runtime
Accessing System Parameters in Mapping Runtime
Message Mapping Simplified - Part II NODE FUNCTIONS
Message Mapping Simplified - Part I
/people/sravya.talanki2/blog/2005/12/08/message-mapping-simplified-150-part-ii
Limitations of Message Mapping Editor in XI-Can we make it user-friendlier?
Limitations of Message Mapping Editor in XI-Can we make it user-friendlier?
The Use of "suppress" in the XI 3.0 Graphical Mapping Tool
The Use of "suppress" in the XI 3.0 Graphical Mapping Tool
New functions in the Graphical Mapping Tool SP13
New functions in the Graphical Mapping Tool XI 3.0 SP13
SAP PI 7.1 Mapping Enhancements Series: Correct Structural Inconsistencies
SAP PI 7.1 Mapping Enhancements Series: Correct Structural Inconsistencies
SAP PI 7.1 Mapping Enhancements Series: Graphical Support for JDBC and RFC Lookups
SAP PI 7.1 Mapping Enhancements Series: Graphical Support for JDBC and RFC Lookups
SAP PI 7.1 Mapping Enhancements Series: Parameterized Message Mappings
SAP PI 7.1 Mapping Enhancements Series: Parameterized Message Mappings
SAP NetWeaver Process Integration 7.1: Mapping Enhancements Blog Series
SAP NetWeaver Process Integration 7.1: Mapping Enhancements Blog Series
SAP PI 7.1 Mapping Enhancements Series: Mapping Enhancements Demo
SAP PI 7.1 Mapping Enhancements Series: Mapping Enhancements Demo
SAP PI 7.1 Mapping Enhancements Series: Copy XML Subtree
SAP PI 7.1 Mapping Enhancements Series: Copy XML Subtree
SAP PI 7.1 Mapping Enhancements Series: Using Graphical Variable
SAP PI 7.1 Mapping Enhancements Series: Using Graphical Variable
SAP PI 7.1 Mapping Enhancements Series: Share User-Defined Functions
SAP PI 7.1 Mapping Enhancements Series: Share User-Defined Functions
SAP PI 7.1 Mapping Enhancements Series: Import SQL Table's Metadata
SAP PI 7.1 Mapping Enhancements Series: Import SQL Table's Metadata
Using Folders in PI 7.1
Using Folders in PI 7.1
TechEd 2006: EPI351 - Graphical Mapping Tool-Advanced Message Mapping
TechEd 2006: EPI351 - Graphical Mapping ToolAdvanced Message Mapping
Minimize memory usage during Message Mapping when replicating an element
Minimize memory usage during Message Mapping when replicating an element
New Arithmetic and Statistical Functions in Message Mappings in SP18
New Arithmetic and Statistical Functions in Message Mappings in SP18
Never, ever use XI's built-in arithmetic functions
Never, ever use XI's built-in arithmetic functions
Sequence Number Generation: Mapping Pattern in PI
Sequence Number Generation : Mapping Pattern in PI
Summarization: Mapping Pattern in PI
Summarization : Mapping Pattern in PI
Message Mapping - using of E1BPPAREX => experience in the aspect of maintenance and customer usability
Message Mapping - using of E1BPPAREX => experience in the aspect of maintenance and customer usability
Duplicating Sub trees and Numbering Them Using the Graphical Mapping Tool
Duplicating Subtrees and Numbering Them Using the Graphical Mapping Tool
Message Splitting Using the Graphical Mapping Tool
Message Splitting Using the Graphical Mapping Tool
Replication of Nodes Using the Graphical Mapping Tool
Replication of Nodes Using the Graphical Mapping Tool
Standard functions in message mapping
http://help.sap.com/saphelp_nw04/helpdata/en/43/c4cdfc334824478090739c04c4a249/frameset.htm
New Arithmetic and Statistical Functions in Message Mappings in SP18
New Arithmetic and Statistical Functions in Message Mappings in SP18
Hack: Using XPATH in XI Message Mappings
Hack: Using XPATH in XI Message Mappings
Message mapping verification
Message mapping verification
Mapping Context Changes in XI
Mapping Context Changes in XI
Mapping trouble shooting
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e01e9400-9e81-2910-20a5-a862945a5e98
Mapping Context Changes in XI
Mapping Context Changes in XI
File Content Conversion for Multi Hierarchical Structure
File Content Conversion for Multi Hierarchical Structure
Number formatting to handle LARGE Numbers
Number formatting to handle LARGE Numbers
Optimizing Lookup's in XI
Optimizing Lookup's in XI
Data Mining using APriori Algorithm in XI - Part I, II & III
/people/jeyakumar.muthu2/blog/2005/12/19/data-mining-using-apriori-algorithm-in-xi-150-part-ii
/people/jeyakumar.muthu2/blog/2005/12/30/data-mining-using-apriori-algorithm-in-xi-150-part-iii
/people/jeyakumar.muthu2/blog/2005/11/23/data-mining-using-apriori-algorithm-in-xi-150-part-i
Java Mapping to handle flat files in SAP XI
Java Mapping to handle flat files in SAP XI
xpath functions in xslt mapping
xpath functions in xslt mapping
"JAVA MAPPING", an alternate way of reading a CSV file
"JAVA MAPPING", an alternate way of reading a CSV file
B2B Mapping Techniques Using the Graphical Mapping Tool
B2B Mapping Techniques Using the Graphical Mapping Tool
How to parse "XX/YY/ZZ;AA/BB/CC;11/22/33" in message mapping
How to parse "XX/YY/ZZ;AA/BB/CC;11/22/33" in message mapping.
Introduction to queues in message mapping
Introduction to queues in message mapping
ValueMapping using the Graphical Mapping Tool
ValueMapping using the Graphical Mapping Tool
Accessing Value Mapping defined in Directory using Java functions
Accessing Value Mapping defined in Directory using Java functions
Multi-Mapping without BPM - Yes, it's possible!
/people/jin.shin/blog/2006/02/07/multi-mapping-without-bpm--yes-it146s-possible
Designing Mapping:
http://help.sap.com/saphelp_nw04/helpdata/en/d2/58cd3b11571962e10000000a11402f/content.htm
User-Defined Functions
http://help.sap.com/saphelp_nw04/helpdata/en/22/e127f28b572243b4324879c6bf05a0/content.htm
Standard Functions
http://help.sap.com/saphelp_nw04/helpdata/en/43/c4cdfc334824478090739c04c4a249/content.htm
Runtime Procedure
http://help.sap.com/saphelp_nw04/helpdata/en/3d/24e15bf9d79243b45d49b13b03de8f/content.htm
Mapping Fields Within a Context
http://help.sap.com/saphelp_nw04/helpdata/en/e4/82cf0ec8b9494db92e27e2be69524f/content.htm
Structure Mapping by Setting the Context
http://help.sap.com/saphelp_nw04/helpdata/en/bd/ca1105c81c6742a0f8c8d49f8834bf/content.htm
Comparing Performance of Mapping Programs
Comparing Performance of Mapping Programs
Mapping examples:
New functions in the Graphical Mapping Tool XI 3.0 SP13
All mapping concepts:
https://www.sdn.sap.com/irj/sdn/wiki?path=/display/xi/mappingConceptsinSAPXI
Comparison of various Mappings:
Comparing Performance of Mapping Programs
https://www.sdn.sap.com/irj/sdn/wiki?path=/display/xi/mapping%2btechniques
How to test mapping:
The specified item was not found.
Mappings:
http://help.sap.com/saphelp_nw04/helpdata/en/73/f61eea1741453eb8f794e150067930/frameset.htm
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/9202d890-0201-0010-1588-adb5e89a6638
Message Mapping:
http://help.sap.com/saphelp_erp2004/helpdata/en/3d/24e15bf9d79243b45d49b13b03de8f/content.htm
http://help.sap.com/saphelp_nw04/helpdata/en/49/1ebc6111ea2f45a9946c702b685299/frameset.htm
Message Mapping Simplified - Part I - Sravya Talanki
/people/sravya.talanki2/blog/2005/12/08/message-mapping-simplified-150-part-ii - Sravya Talanki
Java Mapping:
Testing and Debugging Java Mapping in Developer Studio
Java Mapping (Part I)
http://help.sap.com/saphelp_erp2005vp/helpdata/en/43/09b16006526e72e10000000a422035/content.htm
http://help.sap.com/saphelp_nw04/helpdata/en/e2/e13fcd80fe47768df001a558ed10b6/content.htm
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/a08e8c15-682d-2b10-7798-c4592a417074 - by Santhosh
XSLT Mapping:
Step By Step Simple Approach for XSLT Mapping
File to Multiple IDocs (XSLT Mapping)
The specified item was not found.
http://help.sap.com/saphelp_erp2005vp/helpdata/en/43/03fe1bdc7821ade10000000a1553f6/content.htm
http://help.sap.com/saphelp_nw04/helpdata/en/73/f61eea1741453eb8f794e150067930/content.htm
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/30ac53f2-21d7-2a10-afa2-ce1a0577ca18
Excellent PDF Document on Mapping
http://help.sap.com/bp_bpmv130/Documentation/Operation/MappingXI30.pdf
Mapping Development with the ABAP Workbench
http://help.sap.com/saphelp_nw04/helpdata/en/10/5abb2d9df242f6a62e22e027a6c382/content.htm
ABAP Mappings
http://help.sap.com/saphelp_nw04/helpdata/en/ba/e18b1a0fc14f1faf884ae50cece51b/content.htm
how to create a flat file out of an IDoc-XML by means of an ABAP mapping program and the J2EE File Adapter.
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/46759682-0401-0010-1791-bd1972bc0b8a
Generic XSLT Mapping for SAP XI,Part I
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/01a57f0b-0501-0010-3ca9-d2ea3bb983c1
Generic XSLT Mapping for SAP XI,Part II
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/9692eb84-0601-0010-5ca0-923b4fb8674a
XSLT: Recursive Templates
XSLT: Recursive Templates
Easy RFC lookup from XSLT mappings using a Java helper class
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/05a3d62e-0a01-0010-14bc-adc8efd4ee14
ABAP Mapping:
http://help.sap.com/saphelp_nw04/helpdata/en/ba/e18b1a0fc14f1faf884ae50cece51b/content.htm -
I need to print out a list of all possiblle binary numbers with as many digits as an int k. For example, if k = 3, it would need to print out 000,001,010,011,100,101,110,111. for k = 2 it is only 00, 01, 10, 11. It is pretty clear that for any k, a recursive technique can be used to solve this problem, but I'm having trouble finding the solution. Please help. Thanks
You don't need recursion:for (int i = 0, max = 1 << (k - 1); i < max; ++i) {
print binary i to k digits
}But a recursive approach would be void increment (int[] data, int digit) {
if (digit > 0) {
--digit;
for (int i = 0; i < 2; ++i) {
data[digit] = i;
increment(data, digit);
} else {
print contents of data array
start (int k) { increment(new int[k], k); }Neither code tested.
Pete -
Can someone tell me if there's a problem with my recursive file search?
I've been trying to get a recursive file search working. I wanted to go through each directory and add every file to a database so I can use extremely fast, advanced file searches through my program. I wrote up this code
<CODE>
package myrecursive;
import java.io.*;
public class MyRecursive {
public static void main(String[] args) {
recursiveSearch("D:/");
private static void recursiveSearch(String x) {
String tempFile="";
File dir = new File(x);
File[] curDir = dir.listFiles();
for (int a=0;a<curDir.length;a++) {
if (curDir[a].isDirectory()==false) System.out.println(curDir[a]);
else {
tempFile=curDir[a].toString();
recursiveSearch(tempFile);
</CODE>
The code was simple but I didn't think I could write it like this without killing my resources or getting a buffer overload. I ran it and it worked. However, I am running a high end box with 512MB of RAM and a 2.4 GHz processor so I don't know if what worked for me will work on a lower end machine. I was told you should avoid calling a method from itself is this true? How would I avoid it? Should I keep it this way? Any recommendations?
NOTE: I ran the code through JBuilder. JBuilder has a console built into the IDE and will return a noise and the error code whenever it hits an error. Although my app kept shooting out files it found out I heard a noise a few times. Does this mean anything?First the formatting tags should be "[ ]" not "< >".
I was told you should avoid calling a method from itself is this true?Recursion is a valid programming technique and in fact makes many algorithms much easier to code.
so I don't know if what worked for me will work on a lower end machineIt may be a little slower but it will still work. Recursion only causes a problem with resources when you have many levels of recursion. On my system I have:
C:\WINDOWS\TEMP\Temporary Internet Files\Content.IE5\
In this case there is only 4 levels of recursion. This is not going to cause a problem. You would generally only have problems if your recusion routine is not working correctly and you get in an infinite loop which will lead to resource problems and an abend.
In your particular case you aren't even using many resources at all since all you are doing is printing the file name.
This [url http://forum.java.sun.com/thread.jsp?forum=57&thread=435487&start=3&range=1]post shows a recursive routine that list all files for a directory and displays them in a table. In this cause you might have a problem with resources depending on the number of files in the directory. But the resource problem is because of the memory to hold the filenames in the table, not because a recursive routine was used to get the filename. -
About modularization techniques
hi,,
can anybody send me the details about modularization techniques ?
mainly i want differences between INCLUDES and FUNCTION MODULES.
MACROS and SUBROUTINES.Hi
Purpose of modularization is: 1) Organizing your ABAP Code 2) Limit maintenance cost by coding every thing only once and making your ABAP code easier to understand.
Modularization techniques:
1) Organizing your ABAP code can be done by using INCLUDE reports and local MACRO's (DEFINE statement). Typical examples can be found in Module Pools and Function Groups with TOP-includes and special includes for PBO events, PAI events et cetera. You can discuss if using subroutines, functions or methods is also part of this type of modularization technique. At this moment, most ABAP programmers use subroutines partly as a means to create some sort of main line in their program, thus limiting large chunks of ABAP code. Regarding MACRO's there are some special problems, especially that they don't improve readability of ABAP coding, and you can not debug them.
2)Here, we are talkin about ABAP PROCEDURES: a) Subroutines, b) Functions and c) Methods
- 2a) Subroutines: can be used locally and globally (external subroutine calls). Subroutines have a formal interface ( USING, CHANGING, TABLES parameters). The interface parameters can be passed BY VALUE or BY REFERENCE. Data that is defined within a subroutine (FROM ... ENDFORM.) is local: lifetime and visibility is limited to the moment the subroutine is called. External Subroutines are subroutines that are called from another program. Typical example can be found in the way SAPscript and SMARTforms printprograms are called by RSNAST00. External Subroutines can be grouped into Subroutine Pools.
- 2b) Functions: are part of function groups. They are designed for global use and have a unique name. Function Modules also have a formal interface using IMPORTING, EXPORTING, CHANGING and TABLES parameters. The interface parameters can be passed BY VALUE or BY REFERENCE. Specific EXCEPTIONS can be defined for error handling. A function module can also have local data.
In theory, a function module can only use data a)from the interface parameters, b) defined locally in the function module and c) defined globally in the function group. However, it is possible to see global data from calling programs using field-symbols.
Remote Function Modules are function modules that can be called from other SAP or NON-SAP systems. BAPI's are examples of RFC-enabled function modules.
Function Groups and Function Modules are maintained using transaction SE37 (or SE80).
- 2c) Methods: are part of CLASSES. Here we are talking about ABAP Objects, supporting inheritance, instantiation, encapsulation, polymorphism, events, Interfaces, visibility sections (PUBLIC, PROTECTED, PRIVATE) and lifetime options STATIC and INSTANCE.
Classes can be defined locally or globally: a) Local Classes are classes, defined as part of an ABAP program. They can be used only within this program. b) The functionality of Global Classes is identical, but these classes are maintained using the Class Builder (SE24 or SE80).
The name of a method is not unique; you always need the name of the object to create the unique name. As a result, several classes will have exactly the same method name.
Methods also have a formal interface using IMPORTING, EXPORTING, CHANGING and RETURNING parameters. The interface parameters can be passed BY VALUE or BY REFERENCE. Specific EXCEPTIONS can be defined for error handling. A method can also have local data.
In general, using classes is considered a much better alternative to using subroutines and function modules, especially with regards to maintenance costs. Actually, you do not need subroutines anymore. Function Modules are only needed is some cases, for example as RFC's because the classes don't support remote calls.
One limitation of ABAP Classes is that they do not support dynpro's. This means that you always need a report/module pool/function group if you want to create screens.
Within methods, several types of obsolete ABAP statements are not allowed like: ON CHANGE OF, TABLES and OCCURS.
Consider that new tools and options like Web Dynpro, Unit Testing, Shared Objects, Exception Classes can only be understood when having the knowledge of ABAP OO. If you are debugging new SAP transactions, you'll see that they are also programmed using ABAP Objects.
Processing blocks that are called from ABAP programs:
1. Subroutines
2. Function modules
3. Methods
Procedures
Procedures contain a set of statements, and are called from other ABAP programs.
The processing blocks that you call from ABAP programs are called procedures
You define procedures in ABAP programs. When the program is generated, they remain as standalone modules. You can call procedures in the program in which they are defined, or from external programs. Procedures have an interface for passing data, and can also contain local data.
ABAP contains the following kinds of procedures:
Subroutines
Subroutines are principally for local modularization, that is, they are generally called from the program in which they are defined. You can use subroutines to write functions that are used repeatedly within a program. You can define subroutines in any ABAP program.
Function Modules
Function modules are for global modularization, that is, they are always called from a different program. Function modules contain functions that are used in the same form by many different programs. They are important in the R/3 System for encapsulating processing logic and making it reusable. Function modules must be defined in a function group, and can be called from any program.
Methods
Methods describe the functions and behavior of classes and their instances in ABAP Objects. Methods must be defined in classes. When you call them, you must observe certain special rules of object-oriented programming.
Subroutines
Subroutines are procedures that you can define in any ABAP program and also call from any program. Subroutines are normally called internally, that is, they contain sections of code or algorithms that are used frequently locally. If you want a function to be reusable throughout the system, use a function module.
subroutine is a block of code introduced by FORM and concluded by ENDFORM.
FORM [USING ... [)] ... ] [CHANGING... [)] ... ].
ENDFORM.
subroutines cannot be nested. You should therefore place your subroutine definitions at the end of the program
Calling Subroutines
PERFORM... .
Subroutines can call other subroutines (nested calls) and may also call themselves (recursive calls). Once a subroutine has finished running, the calling program carries on processing after the PERFORM statement. You can use the USING and CHANGING additions to supply values to the parameter interface of the subroutine.
Function Modules
Function modules are procedures that are defined in function groups (special ABAP programs with type F) and can be called from any ABAP program. Function groups act as containers for function modules that logically belong together.
Unlike subroutines, you do not define function modules in the source code of your program. Instead, you use the Function Builder. The actual ABAP interface definition remains hidden from the programmer. You can define the input parameters of a function module as optional. You can also assign default values to them. Function modules also support exception handling. This allows you to catch certain errors while the function module is running.
Function groups are containers for function modules. You cannot execute a function group. When you call an function module, the system loads the whole of its function group into the internal session of the calling program (if it has not already been loaded).
This is used by the system to create the components of the group (main program and corresponding include programs). When you create a function group or function module in the Function Builder , the main program and include programs are generated automatically.
The main program SAPL contains nothing but the INCLUDE statements for the following include programs:
LTOP. This contains the FUNCTION-POOL statement (equivalent for a function group of the REPORT or PROGRAM statement) and global data declarations for the entire function group.
LUXX. This contains further INCLUDE statements for the include programs
LU01, LU02, ... These includes contain the actual function modules.
The include programs LF01, LF02, ... can contain the coding of subroutines that can be called with internal subroutine calls from all function modules of the group.
All of the function modules in a function group can access the global data of the group. For this reason, you should place all function modules that use the same data in a single function group.
Function modules can have the following interface parameters:
Import parameters. These must be supplied with data when you call the function module, unless they are flagged as optional. You cannot change them in the function module.
Export parameters. These pass data from the function module back to the calling program. Export parameters are always optional. You do not have to receive them in your program.
Changing parameters. These must be supplied with data when you call the function module, unless they are flagged as optional. They can be changed in the function module. The changed values are then returned to the calling program.
Tables parameters. You use these to pass internal tables. They are treated like CHANGING parameters. However, you can also pass internal tables with other parameters if you specify the parameter type appropriately.
You can specify the types of the interface parameters, either by referring to ABAP Dictionary types or elementary ABAP types. When you call a function module, you must ensure that the actual parameter and the interface parameters are compatible.
Interface parameters are, by default, passed by value. However, they can also be passed by reference. Tables parameters can only be passed by reference. You can assign default values to optional importing and changing parameters. If an optional parameter is not passed in a function module call, it either has an initial value, or is set to the default value.
Exceptions are used to handle errors that occur in function modules. The calling program checks whether any errors have occurred and then takes action accordingly.
Calling Function Modules in ABAP
To call a function module, use the CALL FUNCTION statement:
CALL FUNCTION [EXCEPTIONS e1 = r 1.... e n = r n ].
You can specify the name of the function module either as a literal or a variable. Each interface parameter is explicitly assigned to an actual parameter . You can assign a return value to each exception . The assignment always takes the form = . The equals sign is not an assignment operator in this context.
After EXPORTING, you must supply all non-optional import parameters with values appropriate to their type. You can supply values to optional import parameters if you wish.
After IMPORTING, you can receive the export parameters from the function module by assigning them to variables of the appropriate type.
After CHANGING or TABLES, you must supply values to all of the non-optional changing or tables parameters. When the function module has finished running, the changed values are passed back to the actual parameters. You can supply values to optional changing or tables parameters if you wish.
You can use the EXCEPTIONS option to handle the exceptions of the function module. If an exception is raised while the function module is running, the system terminates the function module and does not pass any values from the function module to the program, except those that were passed by reference. If is specified in the EXCEPTION option, the calling program handles the exception by assigning to SY-SUBRC. must be a numeric literal.
If you specify of ERROR_MESSAGE in the exception list you can influence the message handling of function modules. Normally, you should only call messages in function modules using the MESSAGE ... RAISING statement. With ERROR_MESSAGE you can force the system to treat messages that are called without the RAISING option in a function module as follows:
Messages of classes S, I, and W are ignored (but written to the log in a background job).
Messages of classes E and A stop the function module as if the exception ERROR_MESSAGE had occurred (SY-SUBRC is set to ).
If you specify OTHERS after EXCEPTIONS, the system assigns a single return code to all other exceptions that you have not specified explicitly in the list.
You can use the same number for several exceptions.
You can trigger exceptions in the function module using either the RAISE or the MESSAGE ... RAISING statement. If the calling program handles the exception, both statements return control to the program. The MESSAGE ..... RAISING statement does not display a message in this case. Instead, it sets the following system fields:
1. Message class ® SY-MSGID
2. Message type ® SY-MSGTY
3. Message number ® SY-MSGNO
4. SY-MSGV1 to SY-MSGV4 (contents of fields to , included in a message).
You can use the system fields to trigger the message from the calling program.
Raising Exceptions
There are two ABAP statements for raising exceptions. They can only be used in function modules:
RAISE .
and
MESSAGE..... RAISING .
The effect of these statements depends on whether the calling program handles the exception or not. If the name of the exception or OTHERS occurs in the EXCEPTIONS addition of the CALL FUNCTION statement, the exception is handled by the calling program.
If the calling program does not handle the exception
The RAISE statement terminates the program and switches to debugging mode.
The MESSAGE ..... RAISING statement display the specified message. How the processing continues depends on the message type.
If the calling program handles the exception, both statements return control to the program. No values are transferred. The MESSAGE ..... RAISING statement does not display a message. Instead, it fills the system fields SY-MSGID, SY-MSGTY, SY-MSGNO, and SY-MSGV1 to SY-MSGV4.
Remote Function Modules
To implement a remote function module in ABAP, perform the following steps:
1. Register the module as remotely callable in the RFC server system.
In the function module Administration screen (transaction code SE37), set the field Can be called via REMOTE CALL. Registering a module as remote causes an RFC stub to be generated for it.
Asynchronous remote function calls (aRFCs) are similar to transactional RFCs, in that the user does not have to wait for their completion before continuing the calling dialog. There are three characteristics, however, that distinguish asynchronous RFCs from transactional RFCs:
When the caller starts an asynchronous RFC, the called server must be available to accept the request.
The parameters of asynchronous RFCs are not logged to the database, but sent directly to the server.
Asynchronous RFCs allow the user to carry on an interactive dialog with the remote system.
The calling program can receive results from the asynchronous RFC.
You can use asynchronous remote function calls whenever you need to establish communication with a remote system, but do not want to wait for the functions result before continuing processing. Asynchronous RFCs can also be sent to the same system. In this case, the system opens a new session (or window) and allows you to switch back and forth between the calling dialog and the called session.
To start a remote function call asynchronously, use the following syntax:
CALL FUNCTION RemoteFunction STARTING NEW TASK taskname
Destination ...
EXPORTING...
TABLES ...
EXCEPTIONS...
The following calling parameters are available:
TABLES
passes references to internal tables. All table parameters of the function module must contain values.
EXPORTING
passes values of fields and field strings from the calling program to the function module. In the function module, the correponding formal parameters are defined as import parameters.
EXCEPTIONS
see Using Pre-Defined Exceptions for RFC
RECEIVE RESULTS FROM FUNCTION func is used within a FORM routine to receive the results of an asynchronous remote function call. The following receiving parameters are available:
1. IMPORTING
2. TABLES
3. EXCEPTIONS
The addition KEEPING TASK prevents an asynchronous connection from being closed after receiving the results of the processing. The relevant remote context (roll area) is kept for re-use until the caller terminates the connection.
Call a transaction asynchronally and display it in an amodal window:
DATA: MSG_TEXT(80) TYPE C. "Message text
Asynchronous call to transaction SM59 ->
Create a new session
CALL FUNCTION ABAP4_CALL_TRANSACTION STARTING NEW TASK TEST
DESTINATION NONE
EXPORTING
TCODE = SM59
EXCEPTIONS
COMMUNICATION_FAILURE = 1 MESSAGE MSG_TEXT
SYSTEM_FAILURE = 2 MESSAGE MSG_TEXT
IF SY-SUBRC NE 0.
WRITE: MSG_TEXT.
ELSE.
WRITE: O.K.
ENDIF.
You must not use IMPORTING when calling aRFCs.
Transactional Remote Function Calls
RfcInstallTransactionControlinstalls four functions to control transactional behaviour.
RFC_ON_CHECK_TIDis called when a local transaction is starting.
RfcCreateTransID Get a unique transaction-ID for calling an
ABAP function module using the transactional RFC Interface
RfcIndirectCall Call an ABAP function module using the
transactional RFC Interface
RFC_ON_COMMIT is called when a local transaction ends.
RFC_ON_CONFIRM_TID is called when a local transaction is
completed.
RFC_ON_ROLLBACK is call
ed when a local transaction ends with
failure.
RFC_ONCALL
INCLUDE AND MACROS:
When you modularize source code, you place a sequence of ABAP statements in a module. Then, instead of placing all of the statements in your main program, you just call the module.
Include programs are global R/3 Repository objects. They are solely for modularizing source code, and have no parameter interface.
They have the following functions:
Library:Include programs allow you to use the same source code in different programs. For example, this can be useful if you have lengthy data declarations that you want to use in different programs.
Order. Include programs allow you to manage complex programs in an orderly way. Function groups and module pools use include programs to store parts of the program that belong together. The ABAP Workbench supports you extensively when you create such complex programs by creating the include programs automatically and by assigning them unique names.
Creating Your Own Include Programs
If you create an include program yourself, you must assign it the type I in its program attributes.
An include program cannot run independently, but must be built into other programs. Include programs can contain other includes.
The only restrictions for writing the source code of include programs are:
Include programs cannot call themselves.
Include programs must contain complete statements.
The INCLUDE statement has the same effect as copying the source code of the include program into the program. In the syntax check, the contents of the include program are also analyzed. Include programs are not loaded at runtime, but are expanded when the program is generated. Once the program has been generated, the load version contains static versions of all of its includes. If you subsequently change an include program, the programs that use it are automatically regenerated.
***INCLUDE STARTTXT.
WRITE: / 'Program started by', SY-UNAME,/ 'on host', SY-HOST, 'date:', SY-DATUM, 'time:', SY-UZEIT.ULINE.
We can then include this program in any other ABAP program to display a standard list header.
PROGRAM SAPMZTST.INCLUDE STARTTXT.
This could produce the following output:
Program started by KELLERH
on host ds0025 date: 03/19/1998 time: 09:00:39
Macros
If you want to reuse the same set of statements more than once in a program, you can include them in a macro. For example, this can be useful for long calculations or complex WRITE statements. You can only use a macro within the program in which it is defined, and it can only be called in lines of the program following its definition.
The following statement block defines a macro :
DEFINE .
END-OF-DEFINITION.
Macros do not belong to the definition part of the program. This means that the DEFINE...END-OF-DEFINITION block is not interpreted before the processing blocks in the program. At the same time, however, macros are not operational statements that are executed within a processing block at runtime. When the program is generated, macro definitions are not taken into account at the point at which they are defined
A macro definition inserts a form of shortcut at any point in a program and can be used at any subsequent point in the program. As the programmer, you must ensure that the macro definition occurs in the program before the macro itself is used. Particular care is required if you use both macros and include programs, since not all include programs are included in the syntax check (exception: TOP include).
To use a macro, use the following form:
When the program is generated, the system replaces by the defined statements and each placeholder &i by the parameter
. You can use macros within macros. However, a macro cannot call itself.
DATA: RESULT TYPE I,N1 TYPE I VALUE 5,N2 TYPE I VALUE 6.
DEFINE OPERATION. RESULT = &1 &2 &3.OUTPUT &1 &2 &3 RESULT.END-OF-DEFINITION.
DEFINE OUTPUT. WRITE: / 'The result of &1 &2 &3 is', &4.END-OF-DEFINITION.
OPERATION 4 + 3.OPERATION 2 ** 7.OPERATION N2 - N1.
The produces the following output:
The result of 4 + 3 is 7
The result of 2 ** 7 is 128
The result of N2 - N1 is 1
Inserting the macro changes nothing in the generated form of the program.
Check this link
http://www.sapbrainsonline.com/FAQs/TECHNICAL/SAP_ABAP_MODULARIZATION_FAQ.html
http://help.sap.com/saphelp_40b/helpdata/en/9f/db970e35c111d1829f0000e829fbfe/content.htm
http://help.sap.com/saphelp_40b/helpdata/en/9f/db970e35c111d1829f0000e829fbfe/content.htm
Regards
Pavan
Message was edited by:
Pavan praveen
Message was edited by:
Pavan praveen -
Dyanmic actions causing recursion issue
Hi all,
I've got two dynamic actions on two date fields (start/end). The dynamic actions are SQL functions that ultimately change the end date, if the start date is after the end date, and the start date if the end date is before the start date.
My issue now is that the dynamic actions are fired on item change. When one of the dates is changed, it triggers the other dynamic action...and the loop begins.
Here's the code for the start date action (reversed fields for end date):
DECLARE
v_start_date DATE := to_date(:P1_START_DATE, 'dd-Mon-yy');
v_end_date DATE := to_date(:P1_END_DATE, 'dd-Mon-yy');
BEGIN
IF v_start_date > v_end_date THEN
RETURN TO_CHAR(v_start_date,'dd-Mon-YY');
END IF;
RETURN TO_char(v_end_date, 'dd-Mon-YY');
END;I know the issue lies with the last return, as this is executing every time the action is fired. Although when I remove that return statement, I get a ajax/server error "invalid month for set value" (or something like that).
Any ideas on how to stop this from happening?Hi djston,
You can get around this by using a 'proxy' hidden field that holds the value set by the 'Set Value' action, then adding another action that copies that value over to your date items (without causing recursion). I described this technique in my response to a similar thread, Re: Dynamic Action infinite loop.
Hope it helps.
Anthony. -
How can I implement a recursive update within triggers?
Given
INSTANCE (table)
INST_ID
etc.
INSTANCE_STRUCTURE (table)
PARENT_ID (fk to INST_ID)
CHILD_ID (fk to INST_ID)
And that I COULD write code which recursively navigates the hierarchy (ie. START WITH parent_id = ? CONNECT BY PRIOR child_id = parent_id) and issues UPDATEs to each "child" along the way, thereby propogating the desired update, how can I accomplish the same thing using triggers?
Keep in mind I am using Oracle 7.3 and I have no choice. Also, the DBA is very difficult to get a hold of and I have no idea if there may be some server settings which are preventing some of my attempts from succeeding.
Of course the simplest method is to make an update trigger on INSTANCE select all CHILD_ID from INSTANCE_STRUCTURE and issue UPDATE to each which, in turn, would invoke the same trigger, however, we can't have a mutating table, now can we?
Next, I tried the old global variable in a package bit. That's when I first started getting this "end of channel" business which essentially disconnects me from Oracle (while using SQLPlus). I started to debug that, and then other users started getting errors ... apparently due to the global variable being global ACROSS sessions ... which I did not expect (correct me if I'm wrong and I can try it again), however, due to the amount of data I'm dealing with in any one particular line of hierarchy, I'm not sure I wouldn't get an error anyhow ... particularly if I have to maintain a global array for everyone at once. Anyhow, it was during that, that I realized the "too many open cursors" thing and so I started working with START WITH CONNECT BY to identify all rows which must be dealt with.
Then, I tried setting up some new tables (as opposed to global variables) in which I would identify userenv('sessionid') and other data so that a BEFORE UPDATE, FOR EACH ROW trigger could check to make sure that the AFTER UPDATE trigger had not begun yet (IOW, not recursing yet). Basically, everything's fine until the AFTER UPDATE trigger tries to apply UPDATEs for the children (identified from a cursor on START WITH CONNECT BY) ... then I get the "end of channel" thing again.
Obviously, this whole thing is an attempt to denormalize some data for performance reasons.
Any help would be appreciated.
Thanks.Nevermind, I figured somethin' out.
-
How to find square root, log recursively???
I need to find the square root of a number entered recursively and log as well. Your help would be greatly appreciated. Thanks in advance!
import java.io.*;
/**Class provides recursive versions
* of simple arithmetic operations.
public class Ops2
private static BufferedReader in = null;
/**successor, return n + 1*/
public static int suc(int n)
return n + 1;
/**predecessor, return n - 1*/
public static int pre(int n)
if (n == 0)
return 0;
else
return n - 1;
/**add two numbers entered*/
public static int add(int n, int m)
if (m == 0)
return n;
else
return suc(add(n, pre(m)));
/**subtract two numbers entered*/
public static int sub(int n, int m)
if (n < m)
return 0;
else if (m == 0)
return n;
else
return pre(sub(n, pre(m)));
/**multiply two numbers entered*/
public static int mult(int n, int m)
if (m == 0)
return 0;
else
return add(mult(n, pre(m)), n);
/**divide two numbers entered*/
public static int div(int n, int m)
if (n < m)
return 0;
else
return suc(div(sub(n, m), m));
/**raise first number to second number*/
public static int exp(int n, int m)
if (m == 0)
return 1;
else
return mult(exp(n, pre(m)), n);
/**log of number entered*/
public static int log(int n)
if (n < 2)
return 0;
else
return suc(log(div(n, 2)));
/**square root of number entered*/
public static int sqrt(int n)
if (n == 0)
return 0;
else
return sqrt(div(n, ));
/**remainder of first number entered divided by second number*/
public static int mod(int n, int m)
if (n < m)
return 0;
else
return mod(div(n, pre(m)), m);
public static void prt(String s)
System.out.print(s);
public static void prtln(String s)
System.out.println(s);
public static void main(String [ ] args)
prtln("Welcome to the amazing calculator");
prtln("It can add, multiply and do powers for");
prtln("naturals (including 0). Note that all the");
prtln("HARDWARE does is add 1 or substract 1 to any number!!");
in = new BufferedReader(new InputStreamReader ( System.in ) );
int It;
while ( (It = getOp()) >= 0)
prt("" + It + "\n");
private static int getOp( )
int first, second;
String op;
try
System.out.println( "Enter operation:" );
do
op = in.readLine( );
} while( op.length( ) == 0 );
System.out.println( "Enter first number: " );
first = Integer.parseInt( in.readLine( ) );
System.out.println( "Enter second number: " );
second = Integer.parseInt( in.readLine( ) );
prtln("");
prt(first + " " + op + " " + second + " = ");
switch( op.charAt( 0 ) )
case '+':
return add(first, second);
case '-':
return sub(first, second);
case '*':
return mult(first, second);
case '/':
return div(first, second);
case '^':
return exp(first, second);
case 'v':
return log(first);
case 'q':
return sqrt(first);
case '%':
return mod(first, second);
case 's':
return suc(first);
case 'p':
return pre(first);
default:
System.err.println( "Need +, *, or ^" );
return -1;
catch( IOException e )
System.err.println( e );
return 0;
}Hi,
Is there any one to make a program for me in Turbo
C++ for Dos, which can calculate the square root of
any number without using the sqrt( ) or any ready
made functions.
The program should calculate the s.root of the number
by a formula or procedure defined by the user
(programmer).
Thanks.This is a Java forum!
If you want Java help:
1. Start your own thread.
2. Use code tags (above posting box) if you post code.
3. No one will write the program for you. We will help by answering your questions and giving advice on how to fix problems in code you wrote.
4. The formula you need to implement is given above by dizzy. -
Confusion between references in recursion
Hi all,
I am trying to create B+ trees for a database. My algorithm for the insert function is:
void insert(page_no, entry, newchildentry )
if page_no is not a leaf ,say N
find i such that Ki <= entry's key value < K i+1 //choose subtree
insert(newPage(i), entry,newchildentry )
if newchildentry is null, return;
else
if N has space, insert the newchildentry, set it to null and return
else
split the page in half, the newchildentry is set to a new value
if N is the root , do some extra things return;
if page_no is a leaf, say L
if L has space, insert entry on to it, set newchildentry to null and return;
else split L in half, populate the newchildentry to some new values
return;
}The problem that i am facing is that newchildentry is being populated by some values in the "if page_no is a leaf, say L" part and on collapsing the recursion, these values are being lost and I can't figure what the problem is. i'm new to java even though i have programmed in c/c++ before and i think this would work. is it because java is maintaining different placeholders for the newchildentry?
thanks.
~dang_itHi all,
I am trying to create B+ trees for a database. My
algorithm for the insert function is:
void insert(page_no, entry, newchildentry )
if page_no is not a leaf ,say N
find i such that Ki <= entry's key value < K i+1
//choose subtree
insert(newPage(i), entry,newchildentry )
if newchildentry is null, return;
else
if N has space, insert the newchildentry,
hildentry, set it to null and return
else
split the page in half, the newchildentry is
dentry is set to a new value
if N is the root , do some extra things
ra things return;
if page_no is a leaf, say L
if L has space, insert entry on to it, set
newchildentry to null and return;
else split L in half, populate the newchildentry to
some new values
return;
}The problem that i am facing is that newchildentry is
being populated by some values in the "if page_no is
a leaf, say L" part and on collapsing the recursion,
these values are being lost and I can't figure what
the problem is. i'm new to java even though i have
programmed in c/c++ before and i think this would
work. is it because java is maintaining different
placeholders for the newchildentry?
thanks.
~dang_itIn the code that is failing, what type is newchildentry. You need to be aware that objects are not passed in the argument list. A copy of the object reference is passed. When the method finishes, even if the object contents have changed, the reference has not. So, to say that in some case you set newchildentry to null does not change the newchildentry object reference in the calling method.
� {� -
SCRIPT5007: Unable to get property 'top' of undefined or null and too much recursion
I am not sure about placing two questions into one post, but here it goes:
The error above "SCRIPT5007: Unable to get property 'top' of undefined or null" is coming from this function:
Code:
$(function () { //this is the way to run your code at the DOM Ready event $('a').click(function () { $('html, body').animate({ scrollTop: $($(this).attr('href')).offset().top }, 1500); return false; }); });
This is the effected code I believe that is causing the problem:
Code:
scrollTop: $($(this).attr('href')).offset().top
the error occurs when I click on a "clear" button in my form. My website is one long page and that function allows my navigation to slide up and down the site. Without it, everytime you click a nav, it jumps to that anchor.
For the 2nd problem, the too much recursion, the problem lies within here:
Code:
function () { if ($.isReady) return; imReady = true; $.each($.includeStates, function (url, state) { if (!state) return imReady = false }); if (imReady) { $.readyOld.apply($, arguments) } else { setTimeout(arguments.callee, 10) } }
where the error is actually coming from the 2nd "function" script. This is part of the browser compatibility script for mozilla/opera at the top of the index page. Any help would be great. Thanks.Ahh I apologize. I simply was posting to JavaScript forums in hopes of
finding a solution. Sorry for the mixup. -
i know File class and File[ ] of java
but can u give me code to delete (*.enc) file from folder inside folder. i mean recursively.
i used :
if(encFile.isDirectory())
File []fileList = (new File(encF)).listFiles();
//File[] fileList2= (new File(encF)).listFiles();
System.out.println("Your Directory is ="+encF);
for(int i=0; i < fileList.length; i++)
//put code here
if( (fileList.toString().endsWith(".enc")))
fileList[i].delete();
System.out.println("encFile:"+fileList[i]+" deleted.");
if(fileList[i].isDirectory())
if( (fileList[i].toString().endsWith(".enc")))
{ fileList[i].delete();
System.out.println("encFile:"+ fileList[i]+ "deleted");
System.gc();
}//for
}//check dir ifhttp://forum.java.sun.com/thread.jspa?forumID=31&threadID=563148
Next time, search for yourself. -
SSRS Recursive Hierarchy for Bill of Material
OK, here we go. I have been absolutely unable to find an answer anywhere after extensive searching so I will ask this here.
First of all, I am trying to create an SSRS report for a Bill of Materials (product structure) with parent child recursive grouping to enable drill down to multiple levels. For the most part, I have achieved the goal of doing this with a proper CTE stored
procedure and including a parent recursive reference to the Child group. Here is my result set of the CTE and the grouping settings:
This produces a very pretty report that allows for drill down to levels with indents and levels and everything! Just one problem..... By grouping on the Component to get the recursive technology to work, the result set of my CTE which has 37 rows gets truncated
down to 32 due to multiple rows getting merged because part numbers can be the same while used on more than one part. In this case, see rows 30 and 34. The child (component) is PLA331. Because they are the same part number but used with different parents,
one of them gets eliminated and the result of my report looks like this:
PLA331 should be listed under SA-0482 but it is not due to the grouping of the part PLA331. How do I get all of the results to display even if I am grouping on the component? I have tried removing 'Hide Duplicates' and it does nothing.
BOMs are a very important part of a business so I am actually quite shocked that I am the only one having this structure issue. Perhaps everybody else doesn't have the same part listed on multiple levels of a BOM? Or a lot of people THINK they have the correct
BOM structure but are unaware of this little problem?
Thanks,
SayslahHi Sayslah,
Based on your description, I create a similar report in my test environment. However, I cannot reproduce the same issue as your post.
Please refer to the steps below to check if there is something different. I create a dataset with three fields: Component, Parent, Qty.
1. Add a table in the report body.
2. In the Row Group dialog box, add Parent Group: [Component].
3. Setting Component Group with Recursive parent: Component.
4. Add Qty field in the table.
You can refer to the screenshot below:
If there are any misunderstanding, please feel free to let me know.
Regards,
Alisa Tang
Alisa Tang
TechNet Community Support -
Delete follow up document recursive
Hi folks,
I' writing a report in order to delete orders but before deleteing these orders i have to delete the follow-up documents. in some cases follow-up document also have another follow up, so before delete the first on i have to delete the last one and the the Order. i wrote loop at lt_doc_flow into ls_doc_flow.
lv_objects_to_delete = ls_doc_flow-REF_GUID.
insert ls_doc_flow-REF_GUID into table lt_objects_to_delete.
endloop.
and the call function'crm-order_delete.
in order to delte all docflow, but it doesn't work.
do u have any idea , how i can delete it recursive?
thanks .Hello Liliane
You have to define a recursive function in order to delete your documents.
The following sample reports shows how to do that:
*& Report ZUS_SDN_RECURSIVE_CALLS
REPORT zus_sdn_recursive_calls.
TYPE-POOLS: abap.
TYPES: BEGIN OF ty_s_doc.
TYPES: guid(3) TYPE n.
TYPES: ref_guid(3) TYPE n.
TYPES: text(50) TYPE c.
TYPES: deleted TYPE abap_bool.
TYPES: END OF ty_s_doc.
TYPES: ty_t_doc TYPE STANDARD TABLE OF ty_s_doc
WITH DEFAULT KEY.
DATA:
gs_doc TYPE ty_s_doc,
gt_doc TYPE ty_t_doc.
START-OF-SELECTION.
PERFORM fill_docs.
SORT gt_doc BY guid ref_guid.
WRITE: / 'Flow of Documents:'.
PERFORM write_docs.
WRITE: / 'Deleted Documents:'.
LOOP AT gt_doc INTO gs_doc
WHERE ( deleted = abap_false ).
PERFORM delete_doc
USING gs_doc.
ENDLOOP.
write: / syst-uline.
SKIP 2.
" Reset delete flag
gs_doc-deleted = abap_false.
MODIFY gt_doc FROM gs_doc
TRANSPORTING deleted
WHERE ( deleted = abap_true ).
" Change sorting
SORT gt_doc BY ref_guid.
WRITE: / 'Flow of Documents:'.
PERFORM write_docs.
WRITE: / 'Deleted Documents:'.
LOOP AT gt_doc INTO gs_doc
WHERE ( deleted = abap_false ).
PERFORM delete_doc
USING gs_doc.
ENDLOOP.
END-OF-SELECTION.
*& Form FILL_DOCS
* text
* --> p1 text
* <-- p2 text
FORM fill_docs .
* define local data
DATA:
ls_doc TYPE ty_s_doc.
" Example: Doc_001 -> referenced by Doc_011 -> referenced by Doc_101
" Doc_002 -> Doc_012, Doc_013 -> Doc_112, Doc_113
" Doc_003 -> not referenced
CLEAR: ls_doc.
ls_doc-guid = '001'.
ls_doc-ref_guid = '000'. " no reference to other document
ls_doc-text = 'Document 001'.
APPEND ls_doc TO gt_doc.
CLEAR: ls_doc.
ls_doc-guid = '011'.
ls_doc-ref_guid = '001'.
ls_doc-text = 'Document 011'.
APPEND ls_doc TO gt_doc.
CLEAR: ls_doc.
ls_doc-guid = '101'.
ls_doc-ref_guid = '011'.
ls_doc-text = 'Document 101'.
APPEND ls_doc TO gt_doc.
CLEAR: ls_doc.
ls_doc-guid = '002'.
ls_doc-ref_guid = '000'. " no reference to other document
ls_doc-text = 'Document 002'.
APPEND ls_doc TO gt_doc.
CLEAR: ls_doc.
ls_doc-guid = '012'.
ls_doc-ref_guid = '002'.
ls_doc-text = 'Document 012'.
APPEND ls_doc TO gt_doc.
CLEAR: ls_doc.
ls_doc-guid = '013'.
ls_doc-ref_guid = '002'.
ls_doc-text = 'Document 013'.
APPEND ls_doc TO gt_doc.
CLEAR: ls_doc.
ls_doc-guid = '112'.
ls_doc-ref_guid = '012'.
ls_doc-text = 'Document 112'.
APPEND ls_doc TO gt_doc.
CLEAR: ls_doc.
ls_doc-guid = '113'.
ls_doc-ref_guid = '013'.
ls_doc-text = 'Document 113'.
APPEND ls_doc TO gt_doc.
CLEAR: ls_doc.
ls_doc-guid = '004'.
ls_doc-ref_guid = '000'. " no reference to other document
ls_doc-text = 'Document 004'.
APPEND ls_doc TO gt_doc.
ENDFORM. " FILL_DOCS
*& Form delete_doc
* text
* -->P_GS_DOC_GUID text
FORM delete_doc
USING
value(us_doc) TYPE ty_s_doc.
* define local data
DATA:
ls_doc TYPE ty_s_doc.
LOOP AT gt_doc INTO ls_doc
WHERE ( ref_guid = us_doc-guid )
AND ( deleted = abap_false ).
PERFORM delete_doc
USING ls_doc.
ENDLOOP.
IF ( syst-subrc NE 0 ).
us_doc-deleted = abap_true.
MODIFY gt_doc FROM us_doc
TRANSPORTING deleted
WHERE ( guid = us_doc-guid ).
WRITE: / us_doc-guid, us_doc-text+0(15), us_doc-ref_guid.
ENDIF.
ENDFORM. " delete_doc
*& Form WRITE_DOCS
* text
* --> p1 text
* <-- p2 text
FORM write_docs .
* define local data
DATA:
ls_doc TYPE ty_s_doc.
LOOP AT gt_doc INTO ls_doc.
WRITE: / ls_doc-guid, ls_doc-text+0(15), ls_doc-ref_guid.
ENDLOOP.
SKIP.
ENDFORM. " WRITE_DOCS
Regards
Uwe
Maybe you are looking for
-
On some pages the text from more than one paragraph stack up on top of each other, like writing something then writing something else over the top of it. Some pages will run text and pictures together, like a car rear-ending another or a train pile u
-
Safari with 10.7.3 -Still no Screen Sleep Fix on HTML5 Video
Yesterdday 10.7.3 was released with new Safari and there is still NO fix for the Full Screen Sleep issue with HTML5 Video, whats wrong with you Apple, this bug is since Lion released with Safari,5.1 now 3 Versions later this small bug is still not fi
-
HT2729 after downloading a tv show the words don't match the lips any fix for that?
After downloading a tv show the words don't match the lips, is there any fix for that?
-
Corrupted project file. "An unknown error has occurred" help!
Hi everyone, have been working on a wedding video for 5 days straight and sdude my an error forced the app to close. After attempting to reopen the project an error message has popped up: "an unknown error has occurred" and closed the app again. Ate
-
Has anyone successfully printed on Konica Minolta Magicolor 2530DL on Mac OS X 10.9
Has anyone successfully printed on the Konica Minolta Magicolor 2530DL after upgrading to Mac OS X 10.9? Also has anyone successfully printed on the Epson EPL-5700i after upgrading to Mac OS X 10.9?