ABAP for all

  

1) INTRODUCTION TO ABAP

~~~~~~~~~~~~~~~~~~~~~~


sap --> System application and products


functional

----------

> sales

> finance

> material management

> quality

> production

> hr

> logistics

> plant maintanace



technical

----------

> abap



abap--> advanced business application programming.



2) DATA TYPES ,DATA , PARAMETERS

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


-> simple english to make the program statements.

-> every statement must end with period(.).

-> space between abap keywords , variables are mandatory.


-> alll literals are enclosed with single codes.

-> abap key word is not case sensitive.

-> three steps--> saved-checked-activated.



DATA TYPES

~~~~~~~~~~

--> elementary types

--> referance types

--> complex data types


C -character

N- numeric

D- date

T- time

X- hexadecimal

String

I- integer

F -float

P- packed


declarative keywords

--------------------

> data

> parameters

> tables

> types

> constants

 ex

 ~~

data a type i.

data,type--> keywords

a--> variable/data objects

i--> data type


assign value

------------

data c type i value 10.

or

c = 10.

example program

--------------

REPORT ZAJAY_PRACTICE.

data number_1 type i value 20.

data: number_2 type i,answer type i.

number_2 = 20.

answer = number_1 + number_2.


write : 'answer is ',answer.



taking input from user{ parameters}

----------------------------------

PARAMETERS:  number_1 type i,number_2 type i.

data answer type i.

answer = number_1 + number_2.


write : 'answer is ',answer.




3 video[ parameters screen components conditions looping]

----------------------------------------------------------

obligatory and default

~~~~~~~~~~~~~~~~~~~~~~

obligatory --> required filed

default --> takes by default


example prog

------------

REPORT ZAJAY_PRACTICE.

PARAMETERS: number1 type i OBLIGATORY,number2 type i DEFAULT 50.

data result type i.


result = number1 + number2.


WRITE: 'result is',result.


conditional

~~~~~~~~~~~~

--> if.....endif


  > example program

  -----------------

REPORT ZAJAY_PRACTICE.

PARAMETERS: p_number type i .


if p_number mod 2 eq 0.

  write 'even number'.

else.

  write 'odd number'.

ENDIF.

-->case...endcase.

> example program

------------------

REPORT ZAJAY_PRACTICE.

CASE 'true1'.

  when 'true'.

    write 'true'.

  when 'false'.

    write 'false'.

  when others.

    write 'other word'.


  ENDCASE.


--> do.....enddo.

> example program

-------------------

REPORT ZAJAY_PRACTICE.

parameters: p_num type i.

data var type i value 1.

DO p_num TIMES.


  write : / 'loop',var.

  var = var + 1.

ENDDO.

--> prints 1 to 10 loops.

--> exit

REPORT ZAJAY_PRACTICE.

parameters: p_num type i.

data var type i value 1.

DO p_num TIMES.

  if var eq 5.

    exit.

  ENDIF.

  write : / 'loop',var.

  var = var + 1.

ENDDO.

--> if var is equals to 5 then exit the program.

--> continue

-> selection text

> example

----------

REPORT ZAJAY_PRACTICE.

PARAMETERS: p_number type i .


if p_number mod 2 eq 0.

  write 'even number'.

else.

  write 'odd number'.

ENDIF.

--> more-->text elements --> selection text -->in selection text 'enter the positive number'

output

-------

enter the positive number [ ]

radio button

~~~~~~~~~~~~

--> takes only one value

example

-------

REPORT ZAJAY_PRACTICE.

PARAMETERS: r1 RADIOBUTTON GROUP g1,

            r2 RADIOBUTTON GROUP g1,

            r3 RADIOBUTTON GROUP g1.

PARAMETERS: r11 RADIOBUTTON GROUP g2,

            r12 RADIOBUTTON GROUP g2.


--> r1,r2,r3 comes under g1 group that means select either r1 or r2 or r3.

--> r11,r12, comes under g2 group that means select either r11 or r12 .



chechbox

~~~~~~~~

--> it takes mutlple values.

example 

-------

REPORT ZAJAY_PRACTICE.

PARAMETERS: r1 AS CHECKBOX,

                r2 AS CHECKBOX,

                  r3 AS CHECKBOX.



4 video [ datadictionary,tables,types(structures)]

-----------------------------------------------------


--> exchanging the data between program screen when transfering data from abap dictionary and abap program.

--> it creates flat work area and help move the data b/w DB and program.


#work area

----------

--> tranfering data from database to report.

> tables mara

  -----------

REPORT ZAJAY_PRACTICE.

TABLES mara.

select * from mara into mara.

  write: / mara-matnr,mara-mtart.

  endselect.

#structures

----------

types: begin of str_material,

material type matnr,

mat_type type mtart,

mat_grp type matkl,

end of str_material.

data: wa_material type str_material.


changes & updates[same]

-----------------

tables mara --> data: wa_material type str_material.

select * from mara into wa_material 

--> select matnr,mtart,matkl from mara into wa_material 


write : mara-matnr,mara-mtart--> write wa_materail




example program

---------------

REPORT ZAJAY_PRACTICE.

TABLES mara.

types: begin of str_material,

  material type matnr,

  mat_type type mtart,

  mat_grp type matkl,

  end of str_material.

data: wa_material type str_material.

select matnr mtart matkl from mara into wa_material.

  write: / wa_material.

  endselect.


#constants

----------




5 video [ data types examples and additions to begin programming]

------------------------------------------------------------------

numeric --> I,F,P.

character --> C,N,D,T.

hexadecimal --> X.


charracter

-----------


REPORT ZAJAY_PRACTICE.

data: name1 type c value 'ajay babu varikallu',

      name2(40) type c value 'ajay babu varikallu',

        name3 type string value 'ajay babu varikallu'.


write:/ 'character data type without length',name1. "a

write: / 'character data type with length',name2.   "ajay babu varikallu

write: / 'character data type with string',name3.    "ajay babu varikallu'


number

-------


REPORT ZAJAY_PRACTICE.

data: num1 TYPE n value '12345',

      num2(5) type n value '123',

      num3(5) type n value '123' .

write: num1, "5

/ num2, "00123

/ num3 no-ZERO. " 123


date and time

-------------

REPORT ZAJAY_PRACTICE.

data: a_date type d,

      a_time type t.

a_date = '20230615'.

a_time = '103700'.

WRITE: a_date,  "15062023

        / a_time. "103700

SKIP 4.

WRITE: a_date using EDIT MASK '__/__/____',  "15/06/2023

        / a_time using EDIT MASK '__:__:__'. "10:37:00


concatinate two strings

-----------------------

REPORT ZAJAY_PRACTICE.

PARAMETERS:name1 type string,

            name2 type string.

data name type string.

CONCATENATE name1  name2 INTO NAME SEPARATED BY SPACE.

write :/ name COLOR 5. "ajay babu.


split

------


REPORT ZAJAY_PRACTICE.

PARAMETERS:name1 type string,

            name2 type string.

data name type string.

SPLIT name1 at '-' into data(pos1) data(pos2).

write : pos1, "ajay

        / pos2. "babu

> input : ajay-babu



length

-------

REPORT ZAJAY_PRACTICE.

PARAMETERS:name1 type string.


data(length) = strlen( name1 ) .

write : length. 

> input :ajay

> output : 4


index

-----

REPORT ZAJAY_PRACTICE.

PARAMETERS:name type string.



write : / name+0(4), "ajay

        / name+4(4). " bab



> input: ajay babu



6 video [landscape & custom package]

-------------------------------------


development------> quality-------> production.



client number

------------

--> three digits number

--> range 000 -- 999.

--> golden client.

--> technical - development/testing client.



package [se21/se80]

-------


development-->local object[$tmp]

   --> custom pacakage[z/y]


3 types

-------

--> structure package.

--> main package.

--> development package.




8 video [selection screen part1]

---------------------------------


#selection screen

~~~~~~~~~~~~~~~~~

--> design the input screen with more options to the user to provide inputs.

-->types of selection screen.

--> user command.

--> search and value help.

--> play around with screen elements.


selection screen design

------------------------

REPORT ZAJAY_PRACTICE.

SELECTION-SCREEN begin of BLOCK b1 WITH FRAME TITLE text-t01.

PARAMETERS:p_matnr type matnr.


PARAMETERS:r1 RADIOBUTTON GROUP g1,

            r2 RADIOBUTTON GROUP g1,

            r3 RADIOBUTTON GROUP g1.


PARAMETERS: c1 AS CHECKBOX,

            c2 AS CHECKBOX.

SELECTION-SCREEN end of BLOCK b1.



select-options

-------------

REPORT ZAJAY_PRACTICE.

SELECTION-SCREEN begin of BLOCK b1 WITH FRAME TITLE text-t01.


data wa_mara type mara.

data d_matnr type matnr.

SELECT-OPTIONS s_matnr for d_matnr.


SELECTION-SCREEN end of BLOCK b1.


select * from mara into wa_mara where matnr in s_matnr.

write: / wa_mara-matnr,wa_mara-mtart.

ENDSELECT.




pbo--> process before output.

pai--> process after input.




14 video

--------

--> abap for all

--> data dictionary

--> internal tables

--> modularization techniques

--> abap reports

--> module pool programming

--> authorization object

--> email funcationality

--> bapi

--> alv report

--> smart forms

--> enhancements

--> bdc

--> idoc

--> sap debugging

--> adobe forms

--> web dynpro

--> oo abap design pattern

--> oo abap













Comments

Popular posts from this blog

bapi introduction

amdp