Sunday, 23 August 2015

Lock Objects and used in Report


What is Lock Objects:

The R/3 system synchronizes simultaneously access of several users to the same data records with a lock mechanism.


The lock objects always consists of key fields of the table.

LOCK MODES:

There are three types of Lock mode.

Exclusive Lock- The lock data can only be displayed or edited by a single user.A request for another exclusive lock or for a shared lock is rejected.

Shared Lock- More than one user can access the locked data at the same time in display mode.A register for another shared lock is accepted.

Exclusive but not cumulative: This can be requested several times from the same transactions.



NOTE: When we create lock object in DDIC then it automatically created two function Modules ,
with names ENQUEUE_<lock_obect_name> and DEQUEUE_<lock_object_name>.


If data records are to be locked  you must call function modules ENQUEUE _<lock_object_name>

Locked data records can be unlocked by calling function module DEQUEUE_<lock_object_name>



HOW TO CREATE A LOCK OBJECTS:














Working With Strings

String is a variable length data type.

Dynamic memory management is used internally.i.e Memory allocated(Adjusted) at run time according to the current field content.


It can have any length(can store any no of character).


Note: String is a dynamic length data type We cannot declare string variables through  PARAMETER.

PARAMETER p_name type string. it can not allowed because the system cannot understand how big the input field is.


Difference between char and strings:

CHAR:

Data:v_name type char 100,
         v_name = 'ABC'.

Memory is always allocated for 100 chars irrespective of the no of chars stored currently.



STRINGS:

Data: v_name type string.
v_name = 'ABC'.

Memory is allocated for only for ABC,which always depends on the no of chars stored currently.


String Operations:

CONCATENATE : To club more than one sub string into one main string.

SYNTAX:concatenate  <str1> <str2> <Str3>...<StrN> into <str> separated by <separator>.


CONDENCE: Replaces sequence of spaces into exactly one space.


CONDENCE 'SAP            ABAP                     CARRER'.

Result: SAP ABAP CARRER.


you also add in condence syntax like


CONDENCE 'SAP ABAP         CONSULTANT ' NO-GAPS.

REsult:

SAPABAP CONSULTANT(All ithe sequential Blanks converted into single blank and even deletes that single space also.

In this way there are lots of of commands in string operations like

TRANSALTE: to translate UPPER/LOWER CASE

REPLACE: REPLACE <str1> with <str2> into <str>.

SPLIT: To split the main string into substring at the given separator.

SHIFT: By default shifts to LEFT by 1 plcae.

Syntax:
1.SHIFT <str> <LEFT/RIGHT/CIRCULAR> by <N> places. (N>0).
2.SHIFT <str> left deleting leading <char>.
3.SHIFT <str> RIGHT Deleting Trailing<char>.

SEARCH:Search For the required sub string in the main string.

SEARCH<str> for <str1>.
'str' is a character string.
'.str' any character string between the periods.
'*str' a word ending with 'str'.including 'str'.
'str*' a word beginning with 'str' including str.


REsult: SY-SUBRC = 0 when search is successful,
                                 = 4 when not found.

            SY-FDPOS = contains the offset(Position) of the string.



COMPARING STRINGS:

its very important topic in string operations.


These Special comparisons can be applied to strings with types C.N,D and T.


Operator:

CO------------------------Contains Only
CN------------------------Contains Not Only
CA------------------------Contains ANY
NA------------------------Contains Not any
CS-------------------------Contains Strings
NS-------------------------Contains No Strings
CP-------------------------Matches Pattern
NP-------------------------Does not match pattern.





















Thursday, 13 August 2015

Data Dictionary Questions and Answers in 2015


1.What is foreign key ? how many types of foreign key in DDIC?

Ans.
     It accepts duplicate values as well as null value for a table field in data dictionary,we use foreign key to make relation ship between two tables with primary key.


there are three types of foreign key:

1.Full foreign key
2.Generic Foreign Key
3.Constant Foreign key

Full foreign Key- As you know foreign key is based on two tables,in this case we used all primary key in this type.


Generic Foreign Key-In this type you have a option to select which primary key you want to use among all the primary keys.


Constant Foreign Key-In this type you have a option to fixed a constant value.

2. What is conversion Routine?

Ans.Conversion routines are identified by a five-place name and are stored as a group of two function modules. The function modules have a fixed naming convention. The following function modules are assigned to conversion routine xxxxx:


  • CONVERSION_EXIT_xxxxx_INPUT
  • CONVERSION_EXIT_xxxxx_OUTPUT

the INPUT module converts from display format to internal format, and the OUTPUT module converts from internal format to display format.


Example: suppose you have create a custom table and there is field name Empid




3. Is it possible to create a table without using data element and domain? if yes support your answer and if no then support your answer?

Ans.yes it is possible to create a table without using data element and domain.

to create goto SE11-put a table name like Z**** then clik on create





Step-2-click on predefined ,then you saw some editable part on the screen to put datatype and size










Step-3-on that part you put your data type and size then activate













in this way you create a table without using data element and domain.


4.what is type group,what is the naming convention of type group structure,how you create a type group?


Type Group:-

It is the container of group of structures,it is 5 digits/character maximum ..

to create the type group use tcode SE11 and the structure name should start with the type group name.
it is mandatory to start the structure name with the type group name.

To create:

Step-1

Goto SE11 check the radio button type group and put name with Z or Y. then click on create

then you get a popup screen on that part you put the short description of type group and save in a package then you get a editor like this



then declare structure in your editor but you have to start the structure with the type group name

















then activate the type group.

there are some type groups in standard like SLIS .KKBLO etc just check .





Wednesday, 12 August 2015

Adding Custom Field In MB51 (Material Document List)


This is the topic to add custom field in MB51(Material Document List)

Requirement:Add material group and material description in MB51






Step:go to MSEG table add two fields like ZZMAT_GROUP & ZZMAT_DESC with structure




step2-then find out the program name for the transaction code MB51 which is RM07DOCS double click on that program name and on that click on spiral button to find the implicit enhancement position. when you find the position you have to add custom field to the LIST internal table.



step-3:then you search the perform name 'PERFORM output_list.' and double click on it and some logic on that part like this.



on this part write the code:


DATA l_v_name TYPE THEAD-TDNAME,
       it_line TYPE STANDARD TABLE OF TLINE,
       wa_line TYPE TLINE,
       l_v_text TYPE char100,
       index TYPE sy-tabix.
****add by sujit on dt:10.08.2015
types:begin of ty_makt,
      matnr type matnr,
      matkl type matkl,
      end of ty_makt,
      BEGIN OF ty_desc,
      MATKL  type MATKL,
      WGBEZ  type WGBEZ,
      end of ty_desc.


data:lt_matkl TYPE TABLE OF ty_makt,
     lt_desc  type TABLE OF ty_desc.


FIELD-SYMBOLS<lfs_matkl> type ty_makt,
               <lfs_desc>  type ty_desc.
******end of addition mat group and description on dt:10.08.2015


**************add by sujit on dt:10.08.2015
******add mat group and description by sujit on dt 10.08.2015
data lt_itab1 LIKE list[].
FIELD-SYMBOLS <lfs_itab> like LINE OF lt_itab1.
lt_itab1[] list[].
if lt_itab1 is NOT INITIAL.
  select matnr
         matkl
    from mara INTO TABLE lt_matkl
    FOR ALL ENTRIES IN lt_itab1
    WHERE matnr lt_itab1-matnr.
  if sy-subrc eq 0.
    sort lt_matkl by matnr.
      select
           matkl
           WGBEZ
      from T023T INTO table lt_desc
      FOR ALL ENTRIES IN lt_matkl
      where spras sy-langu and
            matkl lt_matkl-matkl.
      if sy-subrc eq 0.
        sort lt_desc by matkl.
      endif.
   endif.
  endif.

  LOOP at lt_itab1 ASSIGNING <lfs_itab>.

    READ TABLE lt_matkl ASSIGNING <lfs_matkl> with key
                                      matnr <lfs_itab>-matnr BINARY SEARCH.
    if sy-subrc eq 0.
      <lfs_itab>-zzmat_group <lfs_matkl>-matkl.
     READ TABLE lt_desc ASSIGNING <lfs_desc> WITH key
                                      matkl <lfs_matkl>-matkl  BINARY SEARCH.
     if sy-subrc eq 0.
       <lfs_itab>-zzmat_desc <lfs_desc>-wgbez.
     endif.
    endif.

  ENDLOOP.

  list[] lt_itab1[].
*************end of addition mat group and description on dt:10.08.2015
ENDENHANCEMENT.



step-4: then double click on Include structure ITAB and custom field on that declaration to show the fields in output list.



when double click on itab then you go to include RM07DOCS_GENERATED then you click on the spiral button append the fields to g_t_fields through enhanment.



this is the end of enhancement after that you run the tcode-MB51 and get the details on the out put.



if anyone face any problem post your comments the i will update you.

Saturday, 8 August 2015

Enhancement Framework

Enhancement frame work:

The enhancement options are divided into two types

1) Explicit enhancement
2) Implicit enhancement

Explicit enhancement:
Explicit enhancement options have to be inserted explicitly in the source code.they are created in an initial system and must be known to developers in target systems by means of enhancement spots.


Ex: it predefined enhancement options can be defined in source code,they are additionally stored in
       inside enhancement spots.

Implicit Enhancement:

These are provide by the framework and exit without any particular preparation by a developers,they not belong to any container.

Ex:It implemented at common places in your program, End-of executable program,include,function group,dialog module begin/end of form routine /function module/method end of method/end of private/protected/public section of local class.


How to implement the implicit enhancement :

Steps:we have the options to add some code in standard program as well as custom program

i am giving you example of MB5B(stock on Posting date) report.


to find the enhancement options in a program


steps-Go to TCODE MB5B(Stock on posting Date) then go to system to then click on status then you find the program name double click on program name

on program part there is a icon(Spiral Button) on application tool bar click on that and then got to edit
-enhancement-show implicit enhancement-then you find some astercik('''''''''''''') symbol of your program like the screen

















in this way you find the implicit enhancement point on that part part you add your own code.

if any doubt just check my another post add field on MB51






Thursday, 6 August 2015

Difference between clear refresh and free

CLEAR-it clear the header area as well as the body area of internal table and workarea.

As with the CLEAR statement the memory used by the table before you initialized it remains allocated . to release the memory space we use FREE

u declare internal table with  header line :

DATA:itab type standard table of mara occurs 0 with header line.


CLEAR itab.  (it means it clears the header area)
clear itb[]. (it means it clears the body area)




REFRESH:it always works for internal table.

this always applies to the body of the table.

FREE: always works for internal table only,

you can use FREE to initialize an internal table and also to release the memory space.

Tuesday, 4 August 2015

SAP ABAP Data Dictionary Case Sensitive in Customize Table


To create a table field in case sensitivity in customize table:

Steps:

Goto SE11 put the table name as Z****.then click on create and put the description of table after that create field.for every field you have to create data element and domain.on domain part there is a option of lower case.check the lower case part and active the domain


Click on Create then you get a new screen


Double click on data element name zcity then you get a new screen fro create data element






Click on Yes

put the domain name and double click on it


click on yes then go to technical setting part on that part you have to assign data type,size etc

assign detail and check the lower case option


after that field should be case sensitive....

To Know More Contact........

SAP  Senior ABAP Consultant at Global Nest IT Solution PVT LTD.

Contact Details:

Sujit Kr Nayak

  9477112972, 8820802752