Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

difference between collect and move stmts

Former Member
0 Kudos

hi

anyone plz explain...

1. Difference between collect and move stmts

2. Badi and user exit.

gowri

1 ACCEPTED SOLUTION

Former Member
0 Kudos

HI,

collect means

when ever the some records are repeating it will sum up all the

numeric fields ... into one record ( even the curr or quan fields )

and move behaves jkust like append

simply creating new records with out checking for anything

reward points if helpful

regards,

venkatesh

9 REPLIES 9

Former Member
0 Kudos

HI,

collect means

when ever the some records are repeating it will sum up all the

numeric fields ... into one record ( even the curr or quan fields )

and move behaves jkust like append

simply creating new records with out checking for anything

reward points if helpful

regards,

venkatesh

Former Member
0 Kudos

Hi gowri,

1. Move is simply assigning one variable to another.

simply like a = b.

whereas

2. Collect is for special purpose.

Its used for SUMMING purpose.

When we collect fields of A to B,

the system checks all the alpha-numeric fields.

If a cominbation is found, then it adds the numeric fields.

If not found, it simply adds one record to B.

3. Badi is more of user exit based on OO concept.

regards,

amit m.

former_member196299
Active Contributor
0 Kudos

hi ,

Collect stmt sumd up all the numeric keys of a matching recod in a table , where as move stmt appends a record .

The difference between BADI and USER EXIT are , BADI is based moreover on the OOPs convepts where as User Exits are based on normal ABAP codings serving the same purpose .

Reward if helpful !

Regards,

Ranjita

Former Member
0 Kudos

Hi,

1.

COLLECT

Effect

COLLECT allows you to create unique or summarized datasets. The system first tries to find a table entry corresponding to the table key. (See also Defining Keys for Internal Tables). The key values are taken either from the header line of the internal table itab, or from the explicitly-specified work area wa. The line type of itab must be flat - that is, it cannot itself contain any internal tables. All the components that do not belong to the key must be numeric types ( ABAP Numeric Types).

If the system finds an entry, the numeric fields that are not part of the table key (see ABAPNumeric Types) are added to the sum total of the existing entries. If it does not find an entry, the system creates a new entry instead.

The way in which the system finds the entries depends on the kind of the internal table:

TYPES: BEGIN OF COMPANY,

NAME(20) TYPE C,

SALES TYPE I,

END OF COMPANY.

DATA: COMP TYPE COMPANY,

COMPTAB TYPE HASHED TABLE OF COMPANY

WITH UNIQUE KEY NAME.

COMP-NAME = 'Duck'. COMP-SALES = 10. COLLECT COMP INTO COMPTAB.

COMP-NAME = 'Tiger'. COMP-SALES = 20. COLLECT COMP INTO COMPTAB.

COMP-NAME = 'Duck'. COMP-SALES = 30. COLLECT COMP INTO COMPTAB.

Table COMPTAB now has the following contents:

NAME | SALES

-


Duck | 40

Tiger | 20

<b>MOVE</b>

In MOVE actually copies data into another data field.

2.diff betweem badi n customer exits........

http://www.sap-img.com/abap/difference-between-badi-and-user-exits.htm

Regard,

Priyanka.

Former Member
0 Kudos

Hi

Collect command will be used to sum up the numeric values if their non-numeric fields are same.

Eg:

A 100

B 200

A 700

Collect command will sum up 100 and 700 as their non-numeric values are same.

Where as move is used to assign some value to a field and also it works like copy.

Eg. Data: a type i,

b type i.

a = 100.

move a to b.

Regards

Haritha.

Former Member
0 Kudos

Hi

Collect and Move Stmta are entirely different.

For Eg:

it-f1 it-f2

a 200

a 300

a 400

b 100

b 100.

after COLLECT it.

you will get

it-f1 it-f2

a 900

b 200.

Move is used to move a value from one variable to another variable.

data: a(10),b(10).

a = 'kkkkkk'.

move a to b.

then b will be kkkkk.

The same way you can use this for internal table operations also.

Thats all.

Business Add-Ins are a new SAP enhancement technique based on ABAP Objects. They can be inserted into the SAP System to accommodate user requirements too specific to be included in the standard delivery. Since specific industries often require special functions, SAP allows you to predefine these points in your software.

As with customer exits two different views are available:

In the definition view, an application programmer predefines exit points in a source that allow specific industry sectors, partners, and customers to attach additional software to standard SAP source code without having to modify the original object.

In the implementation view, the users of Business Add-Ins can customize the logic they need or use a standard logic if one is available.

In contrast to customer exits, Business Add-Ins no longer assume a two-level infrastructure (SAP and customer solutions), but instead allow for a multi-level system landscape (SAP, partner, and customer solutions, as well as country versions, industry solutions, and the like). Definitions and implementations of Business Add-Ins can be created at each level within such a system infrastructure.

SAP guarantees the upward compatibility of all Business Add-In interfaces. Release upgrades do not affect enhancement calls from within the standard software nor do they affect the validity of call interfaces. You do not have to register Business Add-Ins in SSCR.

The Business Add-In enhancement technique differentiates between enhancements that can only be implemented once and enhancements that can be used actively by any number of customers at the same time. In addition, Business Add-Ins can be defined according to filter values. This allows you to control add-in implementation and make it dependent on specific criteria (on a specific Country value, for example).

All ABAP sources, screens, GUIs, and table interfaces created using this enhancement technique are defined in a manner that allows customers to include their own enhancements in the standard. A single Business Add-In contains all of the interfaces necessary to implement a specific task.

The actual program code is enhanced using ABAP Objects. In order to better understand the programming techniques behind the Business Add-In enhancement concept, SAP recommends reading the section on ABAP Objects.

What is difference between badi and user-exists?

What is difference between enhancements and user-exists? and what is the full form of BADI?

I have another doubt in BDC IN BDC WE HAVE MSEGCALL (i did not remember the > correct name) where the error logs are stored, MSEGCALL is a table or structure.

What is the system landscape?

1) Difference between BADI and USER-EXIT.

i) BADI's can be used any number of times, where as USER-EXITS can be used only one time.

Ex:- if your assigning a USER-EXIT to a project in (CMOD), then you can not assign the same to other project.

ii) BADI's are oops based.

2) About 'BDCMSGCOLL' it is a structure. Used for finding error records.

3) Full form of BADI 'Business addins'.

3) System land scape will be depends on your project

Ex:- 'Development server'>'Quality server'-> 'Production server'......

Reward All Helpfull answers..........

Former Member
0 Kudos

Hi,

Move-

move is used to assign the value of 1 varaible to another pr 1 table to another having same structure

eg move a to b.

collect-

the collect statement will automaticly add the numeric fields where you have the same entries in sno and sname.

Without this, you need to define a new field and work with an add statement inside the selection and write it to an special field in itab.

****do reward if usefull

vijay

Former Member
0 Kudos

Hi,

1.COLLECT:COLLECT is used to create unique or compressed datsets. The key fields are the default key fields of the internal table itab .

If you use only COLLECT to fill an internal table, COLLECT makes sure that the internal table does not contain two entries with the same default key fields.

If, besides its default key fields, the internal table contains number fields,the contents of these number fields are added together if the internal table already contains an entry with the same key fields.

If the default key of an internal table processed with COLLECT is blank, all the values are added up in the first table line.

If you specify wa INTO , the entry to be processed is taken from the explicitly specified work area wa . If not, it comes from the header line of the internal table itab .

After COLLECT , the system field SY-TABIX contains the index of the - existing or new - table entry with default key fields which match those of the entry to be processed.

COLLECT can create unique or compressed datasets and should be used precisely for this purpose. If uniqueness or compression are unimportant, or two values with identical default key field values could not possibly occur in your particular task, you should use APPEND instead. However, for a unique or compressed dataset which is also efficient, COLLECT is the statement to use.

If you process a table with COLLECT , you should also use COLLECT to fill it. Only by doing this can you guarantee that the internal table will actually be unique or compressed, as described above and COLLECT will run very efficiently.

If you use COLLECT with an explicitly specified work area, it must be compatible with the line type of the internal table.

In 'move' the actually data copies into another data field

2.

Difference between BADI and USER-EXIT.

i) BADI's can be used any number of times, where as USER-EXITS can be used only one time.

Ex:- if your assigning a USER-EXIT to a project in (CMOD), then you can not assign the same to other project.

ii) BADI's are oops based.

A. BAdI Definition

1. SE18

2. Enter the name for the BAdI to be created in customer namespace and press "Create".

3. Enter a definition for your BAdI and on the interface tab enter a name for the BAdI interface. SAP proposes a name and it is pretty good. Meanwhile a BAdI class is also created which is not in our concern.

e.g for "ZTEST", SAP proposes "ZIF_EX_TEST" for the interface and "ZCL_EX_TEST" for the class.

4. Save your BAdI.

5. Double-click on the interface name. It will pass to a Class Builder session to make you implement your interface. If you are not familiar to the Class Builder; it's a bit like Function Builder and it will be easy to discover its procedure.

6. Save and activate your interface.

B. Calling your BAdI from an application program

1. Declare a reference variable with reference to the Business Add-In interface.

e.g. DATA exit_ref TYPE REF TO zif_ex_test.

2. Call the static method GET_INSTANCE of the service class CL_EXITHANDLER. This returns an instance of the required object.

e.g.

CALL METHOD CL_EXITHANDLER=>GET_INSTANCE

CHANGING instance = exit_ref .

3. After those two steps, you can now call all of the methods of the BAdI where it is required in your program. Make sure you specify the method interfaces correctly.

C. BAdI Implementations

1. SE19

2. Enter the name for the BAdI implementation to be created in customer namespace and press "Create".

3. It will request the BAdI definition name to which this implementation will be tied.

4. Enter a definition for your implementation and on the interface tab enter a name for the implementing class. Again SAP proposes a name and it is pretty good.

e.g for "ZIMPTEST", SAP proposes "ZCL_IM_IMPTEST".

5. Save your implementation.

6. To implement a method, just double-click on the method name and you will be taken to the Class Builder to write the code for it. Here you redefine the BAdI interface methods.

7. You must activate your implementation to make it executable. You can only activate or deactivate an implementation in its original system without modification. The activation or deactivation must be transported into subsequent systems

Regards

Former Member
0 Kudos

Hi,

COLLECT

Inserts lines into an internal table in summarized form.

Syntax

COLLECT <line> INTO <itab>.

The statement first checks whether the internal table contains an entry with the same key. If not,

it acts like INSERT. If there is already a table entry with the same key, COLLECT does not insert

a new line. Instead, it adds the values from the numeric fields of the work area <line> to the

values in the corresponding fields of the existing table entry.

COLLECT sets SY-TABIX to the index of the existing or inserted line in the table. If the table

has the type HASHED TABLE, SY-TABIX is set to 0.

MOVE

Assigns values.

Syntax

MOVE <f1> TO <f2>.

Assigns the contents of the data object <f1> to the variable <f2>, with automatic type conversion

if necessary. Equivalent to <f2> = <f1>.

MOVE-CORRESPONDING

Assigns values between identically-named components of structures.

Syntax

MOVE-CORRESPONDING <struc1> TO <struc2>.

The contents of the components of the structure <struc1> are assigned to the identically-named

components of the structure <struc2>.

Regards,

Bhaskar