Lesson 14 – Some more data types use

PACKED data type :-

 

Data : V_ amount type p decimals 2.
V_ amount= ‘1234.65‘.
Write :/‘ the values of v_ amount is ‘, v_ amount.

 

Space before number – we check it in the debugging window that how many space is there for output length.

 

  1. Go inside ABAP editor.
  2. Utilities  >>  Settings  >>  ABAP editor  >>  editor  >>  front end editor
  3. Click on Debugging tab.
  4. Select classic debugger / new debugger.

 

Note : For decimal values use PACKED & not FLOAT only use FLOAT for pharma projects.

 

DATE data type :-

 

Data : v_ today type d.
V_ today = ‘20100907‘.
Write : ‘ today‘s date is ‘, v_ today.

 

Note :- Default value of date in every database is YYYYMMDD.

 

TIME data type :-

 

Data :v_ time type t.
V_time = ‘100203‘
Write: ‘ local time is ‘, V_time.

 

Note :- Default value of date in every database is HHMMSS.

 

Now lets understand if we need system date and time, we have system variables for that which stores system values.

 

Structure for that is SYST.

structure SYST

And field for system data is datum and field for system time is uzeit.

 

so basically system variable for date and time is sy-datum and sy-uzeit respectively.

 

STRING data type :-

 

Data :V_company type string .
V_ company = ‘ESAPTRAINING’.
Write : ‘company name is ‘, v_company.
Data : v_ company type string value ‘ESAPTRAINING’.
VALUE keyword-
Value keyword can be incorporated in the declaration for all the datatypes.

 

NUMERIC TEXT data types :-

 

Data : v_pincode(6) type n value ‘123456’,
v_pin(3) type n value ‘ic2’.
Write:/ ‘Pincode is ‘, v_pincode.
Write:/ ‘Pin is ‘, v_pin.

Output-
Pincode is 123456
Pin is 012

 

If we give ’12’ also it shows 012.

 

CONSTANTS :-

 

Constants: c_int type i value 234.
c_name type c value ‘queen’.
c_salary type p decimals 2 value ‘1234.21’.

 

Write: / ‘The constant value for c_int is‘ ‘, c_int.
Write: / ‘The constant value for c_name is ‘, c_name
Write: / ‘The constant value for c_salary is ‘, c_salary.

 

Video Link :-  Check above mentioned things in action in the below video.

Add a Comment

Your email address will not be published. Required fields are marked *