Posts

Showing posts from May, 2023

structures in abap

  Declare a structure. TYPES  :  begin  of  ty_ZHOME_TABLE ,         name  type  ZHOME_TABLE - name  ,         email  type  ZHOME_TABLE - email  ,         m_number  type  ZHOME_TABLE - m_number  ,         location  type  ZHOME_TABLE - location  ,          end  of  ty_ZHOME_TABLE .

comments in abap

  Comments.              two types of comments in abap.           REPORT  ZAJAY_PRACTICEABAP .           * write 'hi'.           write  :  'hello world' ,                     'welcome to bosch' .                    "  'this is ajay'.     

even odd program

 even odd program.           REPORT  ZEVEN_ODD .           types  ty_id  type  i .           parameters  p_var  type  ty_id .           if  p_var  mod  2  eq  0 .            write :  'even' .           else .            write :  'odd' .           endif .

continue statement

 continue statement.     continue statement used to skip the current iteration of loop          REPORT  ZCONTINUE_PROGRAM .           data  var  type  i  value  1 .           while  var <  10 .         if  var  =  5 .              continue .             else .               write  :  / var .          endif .           endwhile . explanation:             the variable var starts from 1 to 10.if the var                is equals to 5 the continue that means 5 will not    ...

exit statement

  exit statement.           REPORT  ZEXIT_PROGRAM .           data  var  type  i  value  1 .           while  var <=  10 .        write  :  / var .           var  =  var +  1 .            if  var  =  5 .              exit .            endif .         endwhile . explanation:         loop starts from 1 to 10.if var[variable] is equals           to 5 then break the loop.

case statement

 case statement.     case statement like switch statement           REPORT  ZCASE_PROGRAM .           data  var  type  string  value  'save' .           case  var .            when  'save' .              write :  'save' .            when  'cancel' .              write  :  'cancel' .           endcase . explanation:             if the variable var is type string and assign                     value is save .case var means case save that                     means...

looping statements

 while loop.           REPORT  ZWHILE_PROGRAM .           data  var  type  i  value  1 .           while  var <=  10 .            write :  / var .           var  =  var +  1 .           endwhile . Do loop.            REPORT  ZDO_PROGRAM .           data  var  type  i  value  1 .           do  10  times .           write :  var .          add  2  to  var .           enddo .

conditional statements

if condition. REPORT ZIF_PROGRAM. data var type i value 1. if var = 1.      write:'hello this is if condition'. endif. if_else condition REPORT  ZIF_PROGRAM . data  var  type  i  value  2 . if  var  =  1 .   write : 'hello this is if condition' . else .    write : 'hello this is else block' . endif .

Declare a TYPES

  Declare a TYPE as a character with 10 positions. REPORT  ZAJAY_PRACTICEABAP . TYPES  customer_name  TYPE  c  LENGTH  10 . data  name  type  customer_name . name  =  'ajay' . write  name . Declare an integer. REPORT  ZAJAY_PRACTICEABAP . TYPES  ty_value  TYPE  i . data  value  type  ty_value . value  =  100 . write  value . another method:  Declare a type as a number with 7 positions. REPORT  ZAJAY_PRACTICEABAP . TYPES  ty_value  type  n length 7 . data  value  type  ty_value . value  =  100011 . write  value . Declare a date type. Declare a time type. Hello world program.      REPORT  ZAJAY_PRACTICEABAP .      write  'hello world' . Chain Statements.      REPORT  ZAJAY_PRACTICEABAP .      write  :  'hello world' , ...