Pages

Wednesday, 10 August 2011

Using Pattern to Create Type Definition

Almost all report start with definition of TYPES which is further used to define work area and internal table. Here is very easy way of defining TYPE without typing anything. This method uses the pattern button to get all required field from table. So hit pattern button in SE38.





Select 'Structured Data Object' and 'with fields from structure' and input the table or structure name where you fields are, press enter. On next screen you will see list of all field. Select the ones you want to be in your TYPE.



Once you are done with selecting hit ‘Copy’ button.



Enter name of your type on next screen, press enter. You should get DATA defined with all the field which you have chosen, replace DATA with TYPES.



Other advantage of using this method to define type is

  1. Obviously you will save time.
  2. There will not be any typo.
  3. Field in TYPE are in same sequence as it is defined in TABLE. This in some ways help in performance while selecting from TABLE and help you in writing WHERE clause it from TYPE you will know the right sequence.
  4. They all are align, which increases the readability of code and reduce maintenance cost.

So this was my first blog hope you find this useful.

No comments:

Post a Comment