Difference betn Type & Like ?

Dear Friends,
like is used when you want to refer table fields
data v_matnr like mara-matnr
Type is used to define variable with system defined data types
data v_matnr(10) type c.
But my question is .
what will happen or what diff we can find when
data: v_matnr type mara-matnr is used than
data: v_matnr like mara-matnr ?
and what diff we can find when
data table1 like mara occurs 0 with header line.
and
data table1 type mara occurs 0 with header line ?
Thanx in advance

For all practical purposes there are the same. The only additional advantage with types is that you can define your own types(including complex ones) in the data dictionary and reuse them accross various programs.
But within a program if two variables are defined one using LIKE and another using TYPE, both referring to the same field, then there is no difference.
If I include a type pool within a program, then I can define my variables only using TYPE to refer to any type defined in that pool. I cannot use LIKE in this scenario. Also, if I want to use native types like C, N, etc, I cannot use LIKE there either. I can use LIKE ABC only if ABC is in the database or if ABC is defined previously in the same program.
I can use TYPE ABC, if ABC is defined in database as a TYPE and included in the program with the statement TYPE-POOLS. I can use it, if it is the native types. I can use it, if it is already defined in the dictionary as a structure/table or structure/table field, or even if it is defined as a data element or a domain. So I can declare a variable V_BUKRS TYPE BUKRS, but I cannot define a variable V_BUKRS LIKE BUKRS.
But if I intend to use V_BUKRS to store company code, I will prefer to declare it as V_BUKRS LIKE T001-BUKRS, only because if tomorrow for some reason, the definition of T001-BUKRS changes to a data element for example, BUKRS_N(say DEC 4) instead of the data element BUKRS(CHAR 4) that it refers to now, I don't have to change my programs because I am referring to the table field and inhereting its properties. Whereas, had I declared my V_BUKRS TYPE BUKRS and the table now changed to BUKRS_N, I will be forced to change my program as there will be a type incompatability.

Similar Messages

  • What is the difference between TYPE and LIKE exaclty.

    Hi,
    Type refers to data type like C or I or N etc...
    example :
    matnr type mara-matnr.
    Like refers to data object.
    can also use in programs like:
    matnr like mara-matnr.
    I am not getting the exact difference in both.

    [Try here: lmgtfy|http://en.lmgtfy.com/?q=WhatisthedifferencebetweenTYPEandLIKEin+ABAP]

  • Difference betn credit memo n credit memo for returns

    Hi,
    What is difference betn credit memo n credit memo for returns?

    Hi
    CREDIT MEMO:
    Suppose, you have chrged (Price) the customer more or you have charged the customer for say 10 pieces but you have send actually 8 pieces,for which customer has paid you.
    In both the above scenarios, you need to pay back the excess amount paid by him.
    To payback, we create a Billing document called Credit memo. In standard SAP, Billing Type G2 is created for Credit memo.
    This Credit memo(G2) is created with reference to a Credit memo request (Sales document type) with Order type "CR".
    This Credit memo Request (CR) is created either with reference to Sales order or Billing document.
    Ofcourse, it can also be created with out any reference document also. In real time scenario, we normally create this Credit memo Request with reference to the Billing document (Invoice).
    No Delivery takes place in this scenario while creating a Credit memo (G2).
    CREDIT FOR RETURN
    When goods are physically returned back by the customer due to some complaint, then we first, create a Return order(Order Type RE) with reference to either Sales order or Billing document. Normally, in real time scenarios, we refer the Billing document.
    Return order can also be created with out any reference .
    In situation like, suppose you had sent 10 pieces of certain material to the customer for which he has paid. But he found that 2 pieces are defective or damaged in transit. So he has returned it to you for which you need to create a Return order(RE).
    From this Return order(RE) -
    > Return Delivery is created -
    > PGR.
    As customer has returned the goods to you, then there are 2 options with you. Either you may send fresh stock ,which we normally call "Replacement" OR you may pay back the value for the returned goods.
    If, we pay back, then we create a Credit memo for return, which called "Credit for Return" and in standard SAP represented by Billing Type (RE).
    In standard system, this "Credit for Return(RE)" is ALWAYS created with reference to the "Return Order(RE)".
    Even though, physical delivery takes place in return process, still the "Credit for return(RE)" is created with reference to the "Return order(RE)".
    If, client requires it to be created from Return delivery then you need to establish necessary settings in customisation which has already beed discussed in this forum several times.
    Hope, it is clear.
    Regards

  • Difference betn 161-122

    what is Difference betn 161 and 122 movement type
    Nikhil

    Hi,
    I think the main difference is between return to vendor via 122 and 161 is that
    - in case of mvt 122 you post the GI with reference to the PO (directly to the material document(GR) and thus to the PO)
    - in case of mvt 161 you have to create a new PO / new PO item and you post the goods issue with reference to that.
    So, if you use mvt 122 the return goods movement will be linked to the original PO item. If you decide to use mvt 161 there will be no connection with the original PO item.
    If you booked IR for the PO item and you do not want to cancel it, you should use mvt 161 return process (in case of GR-Based IV).
    Please visit SAP online help.
    http://help.sap.com/erp2005_ehp_04/helpdata/EN/a5/63341243a211d189410000e829fbbd/frameset.htm
    http://help.sap.com/erp2005_ehp_04/helpdata/EN/a5/63351643a211d189410000e829fbbd/frameset.htm
    I think this is the most important when you compare the two methodes.
    I do not agree with Mr R.B. that 161 is "planned" and 122 is not "planned" - the same decision making process may be behind both scenario. Of course, there is difference between the processes from MRP ponit of view, maybe in this sense we can call mvt 161 as "planned" (even though it can be the result of an ad hoc decision...).
    Regards,
    Csaba

  • Differance between Type & Like

    Hye Friends,
    Apart from the following differences what  are the other differences between these two statements.
    1 type is used for data type and like is used for ddic structures.
    What are the other differences??????????????
    Thanks in advance.
    Subodh G

    Hi Subodh,
    Check this info.
    The Statements TYPES and DATA
    Each ABAP program define its own data types using the statement.
    TYPES dtype [TYPE type|LIKE dobj] ...
    and declare its own variables or instance attributes of classes using the statement
    DATA var [{TYPE type}|{LIKE dobj}] ...
    Within the program or a class, you can also define local data types and variables within procedures. Local variables in procedures obscure identically-named variables in the main program or class.
    When creating data types and data objects, there are a number of naming convention that also apply for other local program definitions, such as procedures. These are described in detail in the keyword documentation.
    The Additions TYPE and LIKE
    The additions TYPE type and LIKE dobj are used in various ABAP statements. The additions can have various meanings, depending on the syntax and context.
    •        Definition of local types in a program
    •        Declaration of data objects
    •        Dynamic creation of data objects
    •        Specification of the type of formal parameters in subroutines
    •        Specification of the type of formal parameters in methods
    •        Specification of the type of field symbols
    Constructing New Data Types
    The TYPE addition allows you to construct new data types in the TYPES, DATA; CONSTANTS; and STATICSstatements. In the TYPES statement, these are local data types in the program. In the other statements, they are attributes of new data objects, meaning that the newly defined data types are not free-standing. Rather, they are linked to database objects.This means that you can refer to them using the LIKEaddition, but not using TYPE.
    To construct new data types, the addition TYPE can be used with the following type constructors:
    •        Construction of reference types
    REF TO type|dobj
    •        Construction of structured data types
    BEGIN OF struc_type.
    END OF struc_type.
    •        Construction of table types
    tabkind OF linetype [WITH key]
    These data types only exist during the runtime of the ABAP program.
    Referring to Known Data Types or Data Objects
    Using the additions TYPE or LIKE in the TYPESstatement, local data types in a program can be referred to known data types or data objects. This is mainly the case with user-defined elementary data types. If you declare variables using the additions TYPE type or LIKE dobj with statement DATA, the data type of var is already fully defined before the declaration is made.
    The known types or data that are referred to must be visible at the point where the data type or variable is declared.
    A known data type can be any of the following:
    •        A predefined ABAP type to which you refer using the TYPE addition
    •        An existing local data type in the program to which you refer using the TYPE addition
    •        The data type of a local data object in the program to which you refer using the LIKE addition
    •        A data type in the ABAP Dictionary to which you refer using the TYPE addition. To ensure compatibility with earlier releases, it is still possible to use the LIKE addition to refer to database tables and flat structures in the ABAP Dictionary. However, you should use the TYPE addition in new programs.
    The LIKE addition takes its technical attributes from a visible data object. As a rule, you can use LIKE to refer to any object that has been declared using DATA or a similar statement, and is visible in the current context.  The data object only has to have been declared. It is irrelevant whether the data object already exists in memory when you make the LIKE reference.
    •        In principle, the local data objects in the same program are visible. As with local data types, there is a difference between local data objects in procedures and global data objects. Data objects defined in a procedure obscure other objects with the same name that are declared in the global declarations of the program.
    •        You can also refer to the data objects of other visible ABAP programs. These might be, for example, the visible attributes of global classes in class pools. If a global class cl_lobal has a public instance attribute or static attribute attr, you can refer to it as follows in any ABAP program:
    DATA dref TYPE REF TO cl_global.
    DATA:  f1 LIKE cl_global=>attr,
           f2 LIKE dref->attr.
    You can access the technical properties of an instance attribute using the class name and a reference variable without first having to create an object. The properties of the attributes of a class are not instance-specific and belong to the static properties of the class.
    TYPES: BEGIN OF struct,
             number_1 TYPE i,
             number_2 TYPE p DECIMALS 2,
           END OF struct.
    DATA:  wa_struct TYPE struct,
           number    LIKE wa_struct-number_2,
           date      LIKE sy-datum,
           time      TYPE t,
           text      TYPE string,
           company   TYPE s_carr_id.
    This example declares variables with reference to the internal type STRUCT in the program, a component of an existing data object wa_struct, the predefined data object SY-DATUM, the predefined ABAP type t and STRING, and the data element S_CARR_ID from the ABAP Dictionary.
    Referring to Generic Data Types
    If you refer to one of the generic predefined ABAP types of fixed length (c, n, p, x) in the TYPES or DATA statement, you must specify the undefined technical attributes.
    TYPES|DATA var[(length)] TYPE type [DECIMALS dec]...
    TYPES|DATA var TYPE type [LENGTH len] [DECIMALS dec]...
    DATA: text1,
          text2 LENGTH 2,
          text3 TYPE c LENGTH 3,
          pack TYPE p DECIMALS 2 VALUE '1.225'.
    This example creates three character variables with field lengths of one, two, and three bytes respectively, and a packed number variable with field length 8 bytes and two decimal places. If the attribute Fixed point arithmetic is set, the value of pack is 1.23.
    This example shows how to declare elementary data objects with reference to predefined ABAP types.
    PROGRAM demo_elementary_data_objects.
    DATA text1  TYPE c LENGTH 20.
    DATA text2  TYPE string.
    DATA number TYPE i.
    text1 = 'The number'.
    number = 100.
    text2 = 'is an integer.'.
    WRITE: text1, number, text2.
    This program produces the following output on the screen:
    The number              100 is an integer.
    In this example, the data objects text1, text2 and number are declared with the DATA statement. The technical attributes are determined by referring to the predefined ABAP types c, string, and I. Values from unnamed literals are assigned to the data objects. The contents of the named data objects are displayed on the list.
    Specifying a Start Value
    When you declare an elementary fixed-length variable, the DATAstatement automatically fills it with the type-specific initial value as listed in the table in the Predefined ABAP Types section.
    However, you can also specify a starting value of a fixed-length elementary variable (also within a structure declaration) using the VALUE addition in the DATAstatement:
    DATA var ... VALUE val|{IS INITIAL}.
    Specifying start values:
    DATA: counter TYPE p VALUE 1,
          date    TYPE d VALUE '19980601',
          flag    TYPE n VALUE IS INITIAL.
    After this data declaration, the character string flag contains its type specific
    Initial value ‘0’
    Internal Tables
    Internal tables are dynamic variable  data objects. Like all variables, you declare them using the DATA statement.
    You can also declare static internal tables in procedures using the STATICSstatement, and static internal tables in classes using the CLASS-DATAstatement.
    This description is restricted to the DATAstatement. However, it applies equally to the STATICS and CLASS-DATA statements.
    Referring to Known Table Types
    Like all other data objects, you can declare internal tables using the LIKE or TYPE addition of the DATA statement.
    DATA itab TYPE type|LIKE obj [WITH HEADER LINE].
    Here, the LIKE addition refers to an existing table object in the same program. The TYPE addition can refer to an internal type in the program declared using the TYPES statement, or a table type in the ABAP Dictionary.
    You must ensure that you only refer to tables that are fully typed. Referring to generic table types (ANY TABLE, INDEX TABLE) or not specifying the key fully is not allowed (for exceptions, refer to Special Features of Standard Tables).
    The WITH HEADER LINE addition is obsolete; you should no longer use it. Also see the keyword documentation.
    The optional addition WITH HEADER LINE declares an extra data object with the same name and line type as the internal table. This data object is known as the header line of the internal table. You use it as a work area when working with the internal table (see Using the Header Line as a Work Area). When you use internal tables with header lines, you must remember that the header line and the body of the table have the same name. If you have an internal table with header line and you want to address the body of the table, you must indicate this by placing brackets after the table name (itab[]). Otherwise, ABAP interprets the name as the name of the header line and not of the body of the table. You can avoid this potential confusion by using internal tables without header lines. In particular, internal tables nested in structures or other internal tables must not have a header line, since this can lead to ambiguous expressions.
    TYPES vector TYPE SORTED TABLE OF i WITH UNIQUE KEY table_line.
    DATA: itab TYPE vector,
          jtab LIKE itab WITH HEADER LINE.
    MOVE itab TO jtab.   <-  Syntax error!
    MOVE itab TO jtab[].
    The table object itab is created with reference to the table type vector. The table object jtab has the same data type as itab. jtab also has a header line. In the first MOVE statement, jtab addresses the header line. Since this has the data type I, and the table type of itab cannot be converted into an elementary type, the MOVE statement causes a syntax error. The second MOVE statement is correct, since both operands are table objects.
    Declaring New Internal Tables
    You can use the DATA statement to construct new internal tables as well as using the LIKE or TYPEaddition to refer to existing types or objects. The table type that you construct does not exist in its own right; instead, it is only an attribute of the table object. You can refer to it using the LIKE addition, but not using TYPE. The syntax for constructing a table object in the DATA statement is similar to that for defining a table type in the TYPESstatement.
    DATA itab TYPE|LIKE tabkind OF linetype WITH key
              [INITIAL SIZE n]
              [WITH HEADER LINE].
    As illustrated when you define a table type yourself, the type constructor
    tabkind OF linetype WITH key
    defines the table type tabkind, the line type linetype, and the key key of the internal table itab. Since the technical attributes of data objects are always fully specified, the table must be fully specified in the DATAstatement. You cannot create generic table types (ANY TABLE, INDEX TABLE), only fully-typed tables (STANDARD TABLE and TABLE, SORTED TABLE, HASHED TABLE). You must also specify the key and whether it is to be unique (for exceptions, refer to Special Features of Standard Tables).
    As in the TYPES statement, you can, if you wish, allocate an initial amount of memory to the internal table using the INITIAL SIZEaddition. You can create an internal table with a header line using the WITH HEADER LINE addition. The header line is created under the same conditions as apply when you refer to an existing table type.
    DATA itab TYPE HASHED TABLE OF spfli
              WITH UNIQUE KEY carrid connid.
    The table object itab has the type hashed table, a line type corresponding to the flat structure SPFLI from the ABAP Dictionary, and a unique key with the key fields CARRID and CONNID. The internal table itab can be regarded as an internal template for the database table SPFLI. It is therefore particularly suitable for working with data from this database table as long as you only access it using the key.
    Hope this resolves your query.
    <b>Reward all the helpful answers.</b>
    Regards

  • Where do we define partner types like KU,LI,VS,LS...?

    where do we define partner types like KU,LI,VS,LS...?

    Hi,
    SPRO>S&D>BASIC FUNCTION>PARTNER DETERMINATION..
    Their u can select area where u want to define them.
    Only clicking after one of the options u will se partner function on the left side of ur screen, double click on it.
    There u will see all the partner functions...here u can create new partner function or use the available one..
    Hope it helps.
    Thanks
    Dushyant

  • Handle data type like CURR in generic table

    HI ALL
    I'm working on daynamic structure <ls_attributes>  and the values of fields are type string  lsmapping-field_value_
    here in the code i try to fill structure <ls_attributes> with acatul values from it_mapping.
    This is the code that im using
    io_node->get_attributes(
        IMPORTING
          es_attributes =  <ls_attributes>  ).
    LOOP AT it_mapping INTO ls_mapping .
        ASSIGN COMPONENT ls_mapping-tar_field OF STRUCTURE <ls_attributes>
        TO <lo_attr>.
        IF sy-subrc = 0.
          <lo_attr> = ls_mapping-field_value.
        ENDIF.
      ENDLOOP.
    the problem here that when i try to move value like 300.000.000,00 i get the following error .
    The program attempted to interpret the value "300.000.000,00" as a number, but
    since the value contravenes the rules for correct number formats,
    this was not possible.
    Any idea how can convert these string type to type like  KNA1-UMSA1  ?
    or string with value time like 04:29:31 with datatype USCHANGE-MODTI since the field is type T(6)
    and when i put there string i am getting 04:29: the second 31 is omited
    The main problem here is how to convert string with any value to
    the respective type <lo_attr> ,if its time, date, curr etc in  <ls_attributes> i get empty structure with the type of the fields (as field symbol )  
    Best regards
    Alex
    Edited by: Alex Dean on Dec 5, 2010 8:03 PM

    Hi Alex,
    SAP/ABAP works with implicit input/output conversion handled by screen processor for input and by WRITE statement for output.
    The external representation of a currency value, i.e. "1.000.000,00" (depending on user settings) is converted to internal representation ""1000000.00" by screen processor.
    If it does not go through screen, no implicit input conversion takes place and you get the dump as described.
    Editable ALV has just this problem because ALV cells are character fields of length 255. That's why SAP created a generic function module for this. The function module will determine the internal datatype of the field passed to parameter output_internal  and convert accordingly.
    In your case you should pass the currency key as well because the internal representation is different for different number of decimals.
    CALL FUNCTION 'RS_CONV_EX_2_IN'
        EXPORTING
          input_external                     = ls_mapping-field_value
          table_field                        = ls_tabfield
    *   CURRENCY                           = CURRENCY
        IMPORTING
          output_internal                    = <lo_attr>
        EXCEPTIONS
          input_not_numerical                = 1
          too_many_decimals                  = 2
          more_than_one_sign                 = 3
          ill_thousand_separator_dist        = 4
          too_many_digits                    = 5
          sign_for_unsigned                  = 6
          too_large                          = 7
          too_small                          = 8
          invalid_date_format                = 9
          invalid_date                       = 10
          invalid_time_format                = 11
          invalid_time                       = 12
          invalid_hex_digit                  = 13
          unexpected_error                   = 14
          invalid_fieldname                  = 15
          field_and_descr_incompatible       = 16
          input_too_long                     = 17
          no_decimals                        = 18
          invalid_float                      = 19
          conversion_exit_error              = 20
          OTHERS                             = 21
      IF sy-subrc = 0.
        rv_value = <inputt>.
      ENDIF.
    Regards,
    Clemens

  • Material types like ROG, HALB etc. (are hidded) in MM01

    Hi,
    I am not able to see material types like ROG, HALB etc. (are hidded). Only descreption is displayed.
    What needs to be done so that I can also able to see the material types in MM01
    Regards,
    Shetty

    Hi,
    In MM01 Go to customize local layout-->options--->flag 'show keys in all dropdown list' and flag 'sort items by key'.
    The material types will be diplayed with keys .
    Regards,
    Venkatesh

  • Lipstick font type or how to create lipstick font type like in this image

    looking to create a font type like this. Any suggestions how?
    Thanks

    Nothing will look as good as doing it by hand, so unless there were a lot of text, I'd do it that way.
    Here's a nice font in that vein, though:
    https://www.myfonts.com/fonts/mvbfonts/sacre-bleu/
    You could even try... cough... Mistral, but it will probably end up looking something of an 80s pastiche.

  • What is process type like delete overlap request

    Hi experts,
    what is process type like DELETE OVERLAP REQUEST. how to use it i mean after load data into target or before loading data.
    for good answer points will assign.

    Hi,
    Whenever you load a data(eg full load). you can delete the previous request and you can load the new data. That's a called deleting overlapping request.
    folllow these links.
    http://help.sap.com/saphelp_nw2004s/helpdata/en/f8/e5603801be792de10000009b38f842/frameset.htm
    process chain - delete request
    deleting overlapping requests via a process chain
    Delete overlapping requests from ODS
    Delete Overlapping Requests from InfoCube: Before or After the Generate Ind
    Delete overlapping request
    Proc chain auto delete of overlapping requests not working.
    if it is useful assign points
    Regards,
    Senthil Kumar.P

  • Difference between type lvc_t_fcat and slis_t_fieldcat_alv

    Can you tell me the difference between type lvc_t_fcat and slis_t_fieldcat_alv?
    Both are used for field catalogue so which one is better to use?

    Hi,
    the field catalog using lvc_t_fcat  has some better and enhanced features over the old slis_t_fieldcat_alv.
    Ideally when displayed a normal ALV using these fieldcatalogs does not have any difference...
    You can more enhanced features of ALV using lvc_t_fcat but these cannot be done using slis_t_fieldcat_alv
    For using lvc_t_fcat, you require a screen and a container area...
    Based on the requirement, use the  fieldcatalogs.
    Also slis_t_fieldcat_alv does not have any classes or methods but the other has so..(objecct oriented)
    Regards
    Sk

  • Difference between TYPE and LIKE?

    data: a type "a data element",
            b like a.
    I know the basic difference of these two statement. But what is the insight?

    Have a look at below links:
    http://help.sap.com/saphelp_nw2004s/helpdata/en/fc/eb367a358411d1829f0000e829fbfe/content.htm
    http://help.sap.com/saphelp_nw2004s/helpdata/en/fc/eb2ff3358411d1829f0000e829fbfe/frameset.htm
    If you use the addition TYPE, you can either reference to an inbuilt ABAP type, a predefined elementary type in the local program, or to a data element defined in the ABAP Dictionary. If you use a LIKE reference, dobj can be an existing data object with an elementary data type. If you do not use the TYPE or LIKE addition, the system uses the default predefined type c.
    In other words, LIKE means the datatype of the variable is similar to the referenced variable.
    TYPE means it is a predefined data type.
    Eg:
    DATA int TYPE i.
    Here int is of integer data type.
    DATA var LIKE int.
    var IS a variable having same data type of int. which in turn is integer.
    You can find these helpful when you reference database table variables... You need not know what is the datatype defined.
    Also it adds to FLEXIBILITY.
    Whenever you make changes to your database tables and fields, that change is REFLECTED back to your program that is, You need not change all your program code when you change your table fields...
    I hope it helps.
    Best Regards,
    Vibha
    *Please mark all the helpful answers

  • Difference between types of plan data

    Hi Friends,
    BPS
    1. Cost Center Planning: Costs and Allocations
    2. Cost Center Planning: Activity Type Prices
    3. Cost Center Planning: Cost Center/Activity Type Prices
    4. Cost Center Planning: Cost Driver
    For the above types of data, I like to understand what is the difference them.
    For type 1, I understand it is for primary costs.
    For type 2 and 3 they are related / same type of data. So what is the difference between them?
    For type 3, seems like combo of types 1 and 2.
    For type 4, I am not sure what it is about.
    Questions I have:
    <b>1</b>. Why is it only primary costs. Where is secondary costs?
    <b>2</b>. Type 1 costs is identified by cost elements of costs centers. But type 2 is by activity, quantity and rates ( i think). And costs calculated. So, is this type of cost outside the cost calculation of type 1 such that to get wholistic cost picture, need to add types 1 and 2 at least? Thus, are they mutually exclusive.
    <b>3</b>. Now, how does the same apply to type 4?
    <b>4</b>. What is the purpose of type 3?
    Hope you could advise me friends
    Regards
    Michael

    Hello Michael,
    Different types of CO planning relate to how an organization is using SAP Controlling functionalities. Activity represent typically internal labor/machine provided by one department (cost center) to a production order, project network etc. depending on the type of organization (production activities or project-driven operation etc.). Activity price would set per cost center for time of periods (months), representing standard price for valuation of actitivities.
    More CO documentation attached:
    http://help.sap.com/saphelp_erp2005/helpdata/en/dd/4298375ae2f84ae10000009b38f8cf/content.htm
    Regards
    Auvo Ahola

  • Type & like

    Plz get me the differences between 'like' and 'type' statements

    Hi,
    The Statements TYPES and DATA
    Each ABAP program define its own data types using the statement.
    TYPES dtype TYPE type ...
    and declare its own variables or instance attributes of classes using the statement
    DATA var {TYPE type} ...
    Within the program or a class, you can also define local data types and variables within procedures. Local variables in procedures obscure identically-named variables in the main program or class.
    When creating data types and data objects, there are a number of naming convention that also apply for other local program definitions, such as procedures. These are described in detail in the keyword documentation.
    The Additions TYPE and LIKE
    The additions TYPE type and LIKE dobj are used in various ABAP statements. The additions can have various meanings, depending on the syntax and context.
    ·        Definition of local types in a program
    ·        Declaration of data objects
    ·        Dynamic creation of data objects
    ·        Specification of the type of formal parameters in subroutines
    ·        Specification of the type of formal parameters in methods
    ·        Specification of the type of field symbols
    Constructing New Data Types
    The TYPE addition allows you to construct new data types in the TYPES, DATA; CONSTANTS; and STATICSstatements. In the TYPES statement, these are local data types in the program. In the other statements, they are attributes of new data objects, meaning that the newly defined data types are not free-standing. Rather, they are linked to database objects.This means that you can refer to them using the LIKEaddition, but not using TYPE.
    To construct new data types, the addition TYPE can be used with the following type constructors:
    ·        Construction of reference types
    REF TO type|dobj
    ·        Construction of structured data types
    BEGIN OF struc_type.
    END OF struc_type.
    ·        Construction of table types
    tabkind OF linetype
    These data types only exist during the runtime of the ABAP program.
    Referring to Known Data Types or Data Objects
    Using the additions TYPE or LIKE in the TYPESstatement, local data types in a program can be referred to known data types or data objects. This is mainly the case with user-defined elementary data types. If you declare variables using the additions TYPE type or LIKE dobj with statement DATA, the data type of var is already fully defined before the declaration is made.
    The known types or data that are referred to must be visible at the point where the data type or variable is declared.
    A known data type can be any of the following:
    ·        A predefined ABAP type to which you refer using the TYPE addition
    ·        An existing local data type in the program to which you refer using the TYPE addition
    ·        The data type of a local data object in the program to which you refer using the LIKE addition
    ·        A data type in the ABAP Dictionary to which you refer using the TYPE addition. To ensure compatibility with earlier releases, it is still possible to use the LIKE addition to refer to database tables and flat structures in the ABAP Dictionary. However, you should use the TYPE addition in new programs.
    The LIKE addition takes its technical attributes from a visible data object. As a rule, you can use LIKE to refer to any object that has been declared using DATA or a similar statement, and is visible in the current context.  The data object only has to have been declared. It is irrelevant whether the data object already exists in memory when you make the LIKE reference.
    ·        In principle, the local data objects in the same program are visible. As with local data types, there is a difference between local data objects in procedures and global data objects. Data objects defined in a procedure obscure other objects with the same name that are declared in the global declarations of the program.
    ·        You can also refer to the data objects of other visible ABAP programs. These might be, for example, the visible attributes of global classes in class pools. If a global class cl_lobal has a public instance attribute or static attribute attr, you can refer to it as follows in any ABAP program:
    DATA dref TYPE REF TO cl_global.
    DATA:  f1 LIKE cl_global=>attr,
           f2 LIKE dref->attr.
    You can access the technical properties of an instance attribute using the class name and a reference variable without first having to create an object. The properties of the attributes of a class are not instance-specific and belong to the static properties of the class.
    TYPES: BEGIN OF struct,
             number_1 TYPE i,
             number_2 TYPE p DECIMALS 2,
           END OF struct.
    DATA:  wa_struct TYPE struct,
           number    LIKE wa_struct-number_2,
           date      LIKE sy-datum,
           time      TYPE t,
           text      TYPE string,
           company   TYPE s_carr_id.
    This example declares variables with reference to the internal type STRUCT in the program, a component of an existing data object wa_struct, the predefined data object SY-DATUM, the predefined ABAP type t and STRING, and the data element S_CARR_ID from the ABAP Dictionary.
    Referring to Generic Data Types
    If you refer to one of the generic predefined ABAP types of fixed length (c, n, p, x) in the TYPES or DATA statement, you must specify the undefined technical attributes.
    TYPES|DATA var[(length)] TYPE type ...
    TYPES|DATA var TYPE type ...
    DATA: text1,
          text2 LENGTH 2,
          text3 TYPE c LENGTH 3,
          pack TYPE p DECIMALS 2 VALUE '1.225'.
    This example creates three character variables with field lengths of one, two, and three bytes respectively, and a packed number variable with field length 8 bytes and two decimal places. If the attribute Fixed point arithmetic is set, the value of pack is 1.23.
    This example shows how to declare elementary data objects with reference to predefined ABAP types.
    PROGRAM demo_elementary_data_objects.
    DATA text1  TYPE c LENGTH 20.
    DATA text2  TYPE string.
    DATA number TYPE i.
    text1 = 'The number'.
    number = 100.
    text2 = 'is an integer.'.
    WRITE: text1, number, text2.
    This program produces the following output on the screen:
    The number              100 is an integer.
    In this example, the data objects text1, text2 and number are declared with the DATA statement. The technical attributes are determined by referring to the predefined ABAP types c, string, and I. Values from unnamed literals are assigned to the data objects. The contents of the named data objects are displayed on the list.
    Specifying a Start Value
    When you declare an elementary fixed-length variable, the DATAstatement automatically fills it with the type-specific initial value as listed in the table in the Predefined ABAP Types section.
    However, you can also specify a starting value of a fixed-length elementary variable (also within a structure declaration) using the VALUE addition in the DATAstatement:
    DATA var ... VALUE val|{IS INITIAL}.
    Specifying start values:
    DATA: counter TYPE p VALUE 1,
          date    TYPE d VALUE '19980601',
          flag    TYPE n VALUE IS INITIAL.
    After this data declaration, the character string flag contains its type specific
    Initial value ‘0’.
    Regards,
    Renjith Michael.

  • Difference Betn Web Client & Win Client???

    Dear all,
    I know the Web Client and Win Client. But i want to know the exact difference between them?
    And Why and When We are using Web Client and Win Client and Which type of industries.
    If any body have real time documents for using it pls forwad to me.
    Can anybody explaing briefly.
    Thanks in advance
    Jayesh

    These are the Main Difference between Web Client And win Client:
    1.When it comes to the technology, the WebClient is   based on BSP (business server pages), which are generated by the SAP Web Application Server and creates HTML pages so that all the agent needs is a browser. In contrast, the WinClient is basd on ABAP Dynpro technology and requires a installation of a SAPGUI on the agent machine or a terminal server.
    2.In the area of multi-channel-integration, WebClient currently uses the ICI/BCB interface whereas IC WinClient uses SAPphone. Customers that have a SAPphone based integration up and running will be able to reuse this integration with IC WebClient. ICI/BCB based integration will be made available for IC WinClient customers with the 2005 CRM release.
    3.One important difference is the general approach towards UI design. In the WebClient you will find specialized, optimized user interfaces for a specfic subset of business processes. The WinClient will let you reuse any business process objects from CRM online.
    4.When it comes to integrate into other applications or user interfaces the WebClient can use any people centric UI (PCC UI) view (the CRM browser based user interface) or use WebGUI (aka SAPGUI for HTML) for R/3 (or other 4.6C/D basis based onwards systems) to render HTML. WinClient can easily integrate into any other SAPGui based application.
    5.ICWEB Client support the  auto  suggestion of solutions
    6.ICWEB Client has the functionality to replace views, add more fields with in the views.
    7.Like win Clients web client doesn‘t support the reminder scripts but it provides the similar functionality with the help of Alerts
    Following are the new eddition in web client :
    <i><b>My Worklist</b></i>To-do items for an agent  (sales and service items, business activities, tasks)
    <i><b>Navigation bar</b></i>
    Browser-type navigation
    <i><b>Real time statistics</b></i>
    Connection to communications infrastructure (e.g., call statistics) &#61664; see Manager‘s Portal
    <i><b>Scratch pad</b></i>
    Easy-access note pad integrated with interaction record
    Guess it will help you.
    Regards,
    Animesh

Maybe you are looking for