You are on page 1of 15

Diff b/w sap memory and abap memory?

SAP Memory SAP memory is a memory area to which all main sessions within a SAPgui have access. You can use SAP memory either to pass data from one program to another within a session, or to pass data from one session to another. Application programs that use SAP memory must do so using SPA/GPA parameters (also known as SET/GET parameters). These parameters can be set either for a particular user or for a particular program using the SET PARAMETER statement. Other ABAP programs can then retrieve the set parameters using the GET PARAMETER statement. The most frequent use of SPA/GPA parameters is to fill input fields on screens ABAP/4 Memory ABAP memory is a memory area that all ABAP programs within the same internal session can access using the EXPORT and IMPORT statements. Data within this area remains intact during a whole sequence of program calls. To pass data to a program which you are calling, the data needs to be placed in ABAP memory before the call is made. The internal session of the called program then replaces that of the calling program. The program called can then read from the ABAP memory. If control is then returned to the program which made the initial call, the same process operates in reverse. SAP memory The SAP memory, otherwise known as the global memory, is available to a user during the entire duration of a terminal session. Its contents are retained across transaction boundaries as well as external and internal sessions. The SET PARAMETER and GET PARAMETER statements allow you to write to, or read from, the SAP memory. ABAP/4 memory The contents of the ABAP/4 memory are retained only during the lifetime of an external session (see also Organization of Modularization Units). You can retain or pass data across internal sessions. The EXPORT TO MEMORY and IMPORT FROM MEMORY statements allow you to write data to, or read data from, the ABAP memory.

1. SAP memory is for cross-transaction Applications and ABAP/4 memory is transaction-specific. 2. The SAP memory, otherwise known as the global memory, is available to a user during the entire duration of a terminal session. Its contents are retained across transaction boundaries as well as external and internal sessions. The contents of the ABAP/4 memory are retained only during the lifetime of an external session. You can retain or pass data across internal sessions. 3. The SET PARAMETER and GET PARAMETER statements allow you to write to, or read from, the SAP memory. The EXPORT TO MEMORY and IMPORT FROM MEMORY statements allow you to write data to, or read data from, the ABAP memory. External session: - when user logs on to R/3 system, the system creates a new terminal session called external session. E.g. System  Create Session. Internal session: - created by calling a transaction (with CALL TRANSACTION), a dialog module (with CALL DIALOG) or a report (with SUBMIT or RETURN).

For External Sessions, Internal Sessions are available. ABAP memory > Memory related to that particular session SAP memory > memory related to all sessions
o

Work bench request vs Customized request


Workbench request is for transporting objects like Programs, Function moduels etc basically Repository objects. Where as customization requests are for transporting Customization data entered into customizatio tables from one system to anohter. Workbench requests record changes made to ABAP Workbench objects. There are local and transportable Workbench requests. (Local Workbench requests have the target system <space>.) The package of the object and the transport route settings in the Transport Management System determine whether changes are recorded in a local or a transportable Workbench request.

Changes to Customizing settings are recorded in Customizing requests. When you release the requests, the current status of the recorded settings is exported, and can then be imported into the consolidation system and, if necessary, into subsequent delivery systems. The client settings determine whether changes to the Customizing settings are possible the changes are recorded When you create Customizing requests, the transport target is automatically assigned the standard transport layer by the SAP system. <b>Request type Transports of copies</b> Transports of copies allow you to transport (sub-)objects in an object list into any other SAP System you want. In contrast to Workbench or Customizing requests there is no automatic delivery into other systems for transport of copies.

Workbench Requests When you change a Repository object of the ABAP Workbench, a query window appears in which you need to specify a Workbench request. You can only save the changes if you have assigned the object to a change request. Workbench requests and the tasks assigned to them are normally used to record changes to Repository objects and Customizing for all clients. However, you can also include client-specific Customizing. Whether the changes to Repository objects are transported depends on whether a transport route is defined from the current SAP System for the package of these objects. From the system settings, the system automatically determines whether the change requests are transportable and to which target system they should be transported. Customizing requests Customizing requests record client-specific Customizing settings made in a single client (the source client of the request). An Workbench object change will reflect in other clients of the system , for example other clients of developments system , but an customizing change won't reflect in other clients of the system. Example for Workbench changes are - Changes in Reports etc.. Example for customizing changes are - Changes in SAP Script or Standard Text creation etc..

How to use table types in ddic table


can i include a table type in dictionary table? answer is no. Table-Types are meant to provide reference structures & attributes to the internal-tables in ABAP programs. They are not intended for the use in the creation of an ABAP Dictionary Table.

In internal tables you can do this (use a table in a table), but in the Data Dictionary, you would either make the mobile phone number field a part of the key, or create a second table for the phone numbers (and extend the key there). Like KNA1 (key = KUNNR) and KNB1(Key = KUNNR and BUKRS). I think there is a miscommunication in this thread regarding the term "Table type". If it is meant to be "of the type table". As in "Can you use a table in a dictionary table?".

here we say that as we can place a strtucture as a field while creating a database table which can hold only a single value so we create a datatype using the table type and in the line type if u specify a structure then we can get a internal table type which we are trying to place it in the database table field so it can have multiple values in it, but this is not possible since table types cannot be place as fields in database tables so i am searching for an alternative solution in which a field can hold multiple values. the answer which u have given is not clear can u give it elobrately.

ex : i have created domain d1 with attributes int 4 set its length 10, using the above domain i create 2 data elements de1 and de2 where de1 is mobile and de2 is landline. using the above data elements i create a structure s1 having the components mobile and landline. using the above structure i create a table type t1. till here its fine . this when used can hold multiple values. but my intention is that as it can hold multiple values so i shall place it in the database table which i want to create . but this is not allowed so can u give me an alternative solution. You cannot include a Table Type in a Table. Because you create a Table Type only with the reference of a Table, as a Table Type is nothing like a proxy of a table and you can use their structure.

Hope your question has been answered. If so please close this thread as answered. ----------------------------------------------------------------------------------------------------------------------------- ---------------

Difference between DDIC Table Type and structure


Table type The table type specifies how you can access individual table rows via ABAP. Generally all internal tables are treated as table types. There are different types of table types like standard,sorted and hashed. Internal tables are used only during program execution i.e data flows into internal table only during program execution. Data manipulations in internal table during debugging will not effect database.No memory is allocated for table types like internal table. structure Structure contains data only when it is inserted in database table using append or include. We change the data in structure which will effect Database. Memory is allocated to structure only when it is included in table using append or include.

In a simple words, Structure is just a flat structure but Table type is an internal table. Sample code how to use them to create internal table: Create Internal table from a structure: DATA: IT_DATA TYPE STANDART TABLE OF Structure.

Create Internal table from a table type: DATA: IT_DATA TYPE table_type.

could u explain the diffrence betwen DDIC Tables and database table? how many selection -screen can be maintained in a report?
Tables are defined in Data dictionary and their Physical storage is in Database. So DDIC table and DB Table are Same. In Report there are 2 types of selection Screens. 1. Standard selection screen Eg: PARAMETERS : P_MATNR TYPE MARA-MATNR. this will create a Standard selection screen with a number 1000. It is called automatically after the INITIALIZATION event. 2. Customized Selection screen: We can Create many. SELECTION-SCREEN: BEGIN OF SCREEN 10. PARAMETERS: P_MATNR LIKE MARA-MATNR. SELECTION-SCREEN: END OF SCREEN 10. they must be called using the statement CALL SELECTION-SCREEN 10. Note: Only one STANDARD SELECTION SCREEN can be mainteined,but you can solve this problem by DIALOG programming or "window" option.

DDIC Objects.
Data types Data types are the actual type definitions in the ABAP Dictionary. They allow you to define elementary types, reference types, and complex types that are visible globally in the system. The data types of database tables are a subset of all possible types, namely flat structures. Data Elements

Data elements in the ABAP Dictionary describe individual fields. They are the smallest indivisible units of the complex types described below, and are used to specify the types of columns in the database. Data elements can be elementary types or reference types. Structures A structure is a sequence of any other data types from the ABAP Dictionary, that is, data elements, structures, table types, or database tables. When you create a structure in the ABAP Dictionary, each component must have a name and a data type. In an ABAP program, you can use the TYPE addition to refer directly to a structure. If you define a local data type in a program by referring to a structure as follows: TYPES <t> TYPE <structure>. Table Types Table types are construction blueprints for internal tables that are stored in the ABAP Dictionary. When you create a table type in the ABAP Dictionary, you specify the line type, access type, and key. The line type can be any data type from the ABAP Dictionary, that is, a data element, a structure, a table type, or the type of a database table. You can also enter a predefined Dictionary type directly as the line type, in the same way that you can with a domain. Type Groups Before Release 4.5A, it was not possible to define standalone types in the ABAP Dictionary to which you could refer using a TYPE addition in an ABAP program. It was only possible to refer SAP AG BC - ABAP Programming Data Types in the ABAP Dictionary to flat structures. Structures in programs corresponded to the structures of database tables or structures in the ABAP Dictionary. In ABAP programs, you could only refer to database tables and structures in the ABAP Dictionary using LIKE. It was, however, possible to refer to individual components of the Dictionary type. Complex local data types such as internal tables or deep structures had no equivalent in the ABAP Dictionary. The solution to this from Release 3.0 onwards was to use type groups. Type groups were based on the include technique, and allowed you to store any type definitions globally in the Dictionary by defining them using TYPES statements. Views: There are 4 types views are avilable in SAP. Database View - To club more than one table Projection View - To hide fields in one table Maintanance View - To maintain database records in table Help View - To provide help for a fields (Same functionality as Search help. This is outdated) View are improves perfromance in the following aspects 1. If you want to use more than two table in 'JOIN' condition better to use Views . It will improves performance of a program 2. If you want to use mutiple FOR ALL ENTRIES clause, better to club all SELECT statement in a view.

Lock Objects: Lock objects are use in SAP to avoid the inconsistancy at the time of data is being insert/change into database. SAP Provide three type of Lock objects. - Read Lock(Shared Locked) protects read access to an object. The read lock allows other transactions read access but not write access to the locked area of the table - Write Lock(exclusive lock) protects write access to an object. The write lock allows other transactions neither read nor write access to the locked area of the table. - Enhanced write lock (exclusive lock without cumulating) works like a write lock except that the enhanced write lock also protects from further accesses from the same transaction. You can create a lock on a object of SAP thorugh transaction SE11 and enter any meaningful name start with EZ Example EZTEST_LOCK. Use: you can see in almost all transaction when you are open an object in Change mode SAP could not allow to any other user to open the same object in change mode. Example: in HR when we are enter a personal number in master data maintainance screen SAP can't allow to any other user to use same personal number for changes. Technicaly: When you create a lock object System automatically creat two function module. 1. ENQUEUE_<Lockobject name>. to insert the object in a queue. 2. DEQUEUE_<Lockobject name>. To remove the object is being queued through above FM. You have to use these function module in your program.

Search Helps: These are two types. Elementary n Collective. 1) Elementary search helps describe a search path. The elementary search help must define where the data of the hit list should be read from (selection method), how the exchange of values between the screen template and selection method is implemented (interface of the search help) and how the online input help should be defined (online behavior of the search help). 2) Collective search helps combine several elementary search helps. A collective search help thus can offer several alternative search paths. 3)An elementary search help defines the standard flow of an input help.

4) A collective search help combines several elementary search helps. The user can thus choose one of several alternative search paths with a collective search help. 5)A collective search help comprises several elementary search helps. It combines all the search paths that are meaningful for a field. 6)Both elementary search helps and other search helps can be included in a collective search help. If other collective search helps are contained in a collective search help, they are expanded to the level of the elementary search helps when the input help is called. DDIC stands for Data Dictionary. In DDIC there are two types of tables, 1.Transparent Tables 2.Pooled and Clustered Tables There exist ONE TO ONE relationship between ddic table and transparent table.. It means : There is a physical table on the database for each transparent table. The names of the physical tables and the logical table definition in the ABAP/4 Dictionary correspond and one field in dictionary correspond to one field in physical database.

When the table is activated, a physical table definition is created in the database for the table definition stored in the ABAP Dictionary. The table definition is translated from the ABAP Dictionary to a definition of the particular database in One to One Relationship..

<b>Pooled table</b> Pooled tables can be used to store control data (e.g. screen sequences, program parameters or temporary data). Several pooled tables can be combined to form a table pool. The table pool corresponds to a physical table on the database in which all the records of the allocated pooled tables are stored. <b>Cluster table</b> Cluster tables contain continuous text, for example, documentation. Several cluster tables can be combined to form a table cluster. Several logical lines of different tables are combined to form a physical record in this table type. This permits object-by-object storage or object-by-object access. In order to combine tables in clusters, at least parts of the keys must agree. Several cluster tables are stored in one corresponding table on the database .

OSS Note
Oss note is the message that created from question or problem from customer to SAP. If there is any fix to SAP standard, it wil be attached to the note. Ask your SAP administrator for the account. Then you can search or post an OSS note at

OSS message is a ticket customer create if they experience a problem with an SAP system. The message is forwarded to SAP Support for processing. Customer messages are created in Solution Manager or in the Service Marketplace. The messages are forwarded to the SAP Customer Service System, where they are processed by SAP service employees. You can retrieve your recorded customer messages, their status and replies from SAP in your Inbox in SAP Support Portal. Tips to follow in "Creating a perfect message". - Record only one problem per message per SAP Note 50048 - Completeness and correctness of master data (contact name, phone number, etc.) - Documentation of your analysis and SAP Note Search - Detailed steps to reproduce the error, including transactions, input parameters, variants, etc. - Open the remote connection and provide remote logon data - If possible reproduce the problem with the User ID you are providing in the message. This would eliminate any authorization issues - Create a u201Cmeaningfulu201D short text (error-related information) - Selection of appropriate priority level according to SAP Note 67739 - Selection of appropriate component area (as specific as possible) - Check the status of the message regularly for an update from SAP

How to add default value to a field in a table?

I have created a Z table. The requirement is, when we add entries to this table, one of the field should always contains a default value as 90% of times they will use this default value and they should be able to maintain any other value than this default value also.

To add default values to table field ,go to table via SE11. Select Table maintenance Generator and follow the path :ENVIRONMENT->MODIFICATION>EVENTS . Click on NEW ENTRIES. then inside T , specify 01 (before saving data in database) or as per you requirement and then give FORM routine SAVE_DEFAULT and press enter. Click on editor button and select suitable INCLUDE to add code as follows: Now inside ABAP editor , you can Form SAVE_DEFAULT . zkna1-KUNNR = '1000000000'. Endform. Now save and activate it . Now in SM30 , it will show you this default values.

1.Create a table maintainance generator using two step maintenance type. 2.In SM30 maintainance screen first screen will be the table control screen. 3.On click of 'NEW ENTRY' second screen will come which is a maintain view screen. 4.The screen flow logic of TMG is editable so in the PBO of the second screen after MODULE detail_init add your own module default_value. 5.Inside the module default_value write your default value like below: table-field = 'default value'. 6.Activate the TMG program. 7.With these changes on click of NEW ENTRY in the first screen default value will come in the second screen. Also, since it will be in the editable mode it can be changed too.

Assigning Column Headers Dynamically in ALV output


I have to create dynamic column headers based on the user input on the selection-screen. Basically users enter the period and the ALV output has to create the column headers dynamically for that along with some standard columns. For eg, The selection screen is like this: From: 'Q4' '2009' To 'Q2' '2011'. Then I have to create 12 columns for the months and rest for the Quarters. Then the output will be like this: Material, Description,10/09, 11/09, 12/09, 01/10, 02/10, 03/10, 04/10, 05/10, 06/10, 07/10, 08/10, 09/10, Q4/10, Q1/11, Q2/11 I have built the logic to determine the number of colums for the periods based on input. By reading other posts, I have learnt that I have to use call method cl_alv_table_create=>create_dynamic_table to get the functionality. I have also looked at program BCALV_TABLE_CREATE for some help. It only has column headers in increasing order. But I am not able to understand How to pass the Column Header Label (for eg 10/09 or Q1/10) to the fieldcat dynamically. Is there any blog/sample prog close to my req? Can anybody please please help me. I grealy appreciate it. ----------------------------------------------------------------------------------------------------------------------------- ---Defining the heading texts is not related to dynamic tables, you may change easily these texts even for ALV with static columns. In the fieldcat internal table, pass the heading texts in fields SELTEXT_L, SELTEXT_M, SELTEXT_S ---------------------------------------------------------------------------------------------------------------------------------------------You need to filll column heading based on dynamic internal table column names. In your final internal table, you will have some column names like '1009, 1109, 1209' .

While filling fieldcatalog you need to put your logic for column heading text. If column name is 1009, concatenate '10 ' '/' '09', or calculate the quarter 10 falls into ,and display Q4/09.

Dynamic internal table for ALV output


I am looking for a simple & efficient sample code for an ALV report output with dynamic columns. Can someone please help! Here is a small example. This is pretty old code, and it uses the FM approach. report zrich_0001. type-pools: slis. field-symbols: <dyn_table> type standard table, <dyn_wa>. data: it_alvfc type slis_t_fieldcat_alv, wa_alvfc type slis_fieldcat_alv, it_fldcat type lvc_t_fcat, wa_fldcat type lvc_s_fcat. selection-screen begin of block b1 with frame title text-001. parameters: p_flds(5) type c. selection-screen end of block b1. start-of-selection. * build the dynamic internal table perform build_dyn_itab. * write 5 records to the alv grid do 5 times. perform build_report. enddo. * call the alv grid. perform call_alv.

************************************************************************ * Build_dyn_itab ************************************************************************

form build_dyn_itab. * Create the dynamic internal table data: new_table type ref to data, new_line type ref to data. * Create fields . do p_flds times. clear wa_fldcat. wa_fldcat-fieldname = sy-index. wa_fldcat-datatype = 'CHAR'. wa_fldcat-intlen = 5. append wa_fldcat to it_fldcat . enddo. * Create dynamic internal table and assign to FS call method cl_alv_table_create=>create_dynamic_table exporting it_fieldcatalog = it_fldcat importing ep_table = new_table.

assign new_table->* to <dyn_table>. * Create dynamic work area and assign to FS create data new_line like line of <dyn_table>. assign new_line->* to <dyn_wa>. endform.

Have to split this code into two postings to keep formatting.

report zrich_0001. type-pools: slis. field-symbols: <dyn_table> type standard table, <dyn_wa>. data: it_alvfc type slis_t_fieldcat_alv, wa_alvfc type slis_fieldcat_alv, it_fldcat type lvc_t_fcat, wa_fldcat type lvc_s_fcat. selection-screen begin of block b1 with frame title text-001. parameters: p_flds(5) type c. selection-screen end of block b1.

start-of-selection. * build the dynamic internal table perform build_dyn_itab. * write 5 records to the alv grid do 5 times. perform build_report. enddo. * call the alv grid. perform call_alv.

************************************************************************ * Build_dyn_itab ************************************************************************ form build_dyn_itab. * Create the dynamic internal table data: new_table type ref to data, new_line type ref to data. * Create fields . do p_flds times. clear wa_fldcat. wa_fldcat-fieldname wa_fldcat-datatype wa_fldcat-intlen append wa_fldcat to enddo.

= sy-index. = 'CHAR'. = 5. it_fldcat .

* Create dynamic internal table and assign to FS call method cl_alv_table_create=>create_dynamic_table exporting it_fieldcatalog = it_fldcat importing ep_table = new_table. assign new_table->* to <dyn_table>. * Create dynamic work area and assign to FS create data new_line like line of <dyn_table>. assign new_line->* to <dyn_wa>. endform.

Have to split this code into two postings to keep formatting.

************************************************************* * Form build_report ********************************************************************* form build_report. * Fill some values into the dynamic internal table data: fieldname(20) type c. data: fieldvalue(5) type c. data: index(3) type c. field-symbols: <fs1>. do p_flds times. index = sy-index. * Set up fieldvalue concatenate 'FLD' index into fieldvalue. condense fieldvalue no-gaps. assign component index <fs1> = fieldvalue. enddo. * Append to the dynamic internal table append <dyn_wa> to <dyn_table>. endform. ************************************************************************ * CALL_ALV ************************************************************************ form call_alv. * Build FC for ALV loop at it_fldcat into wa_fldcat. wa_alvfc-fieldname = wa_fldcat-fieldname. wa_alvfc-seltext_s = sy-tabix. wa_alvfc-outputlen = wa_fldcat-intlen. append wa_alvfc to it_alvfc. endloop. * Call ABAP List Viewer (ALV) call function 'REUSE_ALV_GRID_DISPLAY' exporting it_fieldcat = it_alvfc tables t_outtab = <dyn_table>. endform. of structure <dyn_wa> to <fs1>.

Dynamic selection of ALV output, like in SE16

Example: In SE16, we supply VBAK, then, immediately next, we get the selection screen of VBAK, intended to input sales order or created date or created name etc. Say, we hv supplied sales order # 12345678 and normally, we get the list/ALV output with 12 columns But, from SE16>VBAK>selection screen-->MENU options, we can decide that, How many list/ALV columns need to display, either 12 or 2 or 20 etc And even we can decide which column need to display, which column need to hide etc. options So, Same thing I need to do for my custom(Z) table.......so, pls. let me know, How can I achieve this?

SE16 uses the FM RS_DATABROWSE_FIELDSELECT to display the option to choose the List Fields. You can use the same FM and get the selected Fields in the table RETT_NAME_TAB. You can than use the selected fields to create your Field Catalog for ALV. You can set the NO_OUT field of the field catalog for those fields which you don't want to come into the output when program runs first time.

SE16 uses the FM RS_DATABROWSE_FIELDSELECT to display the option to choose the List Fields. You can use the same FM and get the selected Fields in the table RETT_NAME_TAB. You can than use the selected fields to create your Field Catalog for ALV. You can set the NO_OUT field of the field catalog for those fields which you don't want to come into the output when program runs first time.

You might also like