Friday, June 15, 2012

Smartforms in sap abap

Smart forms are client independent (you can access the smartform from any client like 800, 810, 820....).
Each page has its own page format and can have background pictures and can be printed in colors.
Table painter is available so that you can print data in tabular format.
Paragraphs and Character formats are reusable . you can create them using smart styles.
Function module is generated automatically at the time of activating the Smartform.

Saturday, January 14, 2012

While Endwhile statement example in sap abap


REPORT demo_flow_control_while .

DATA: length     TYPE i VALUE 0,
      strl       TYPE i VALUE 0,
      string(30) TYPE c VALUE 'Test String'.

strl = strlen( string ).

WHILE string NE space.
  WRITE string(1).
  length = sy-index.
  SHIFT string.
ENDWHILE.

WRITE: / 'STRLEN:          ', strl.
WRITE: / 'Length of string:', length.

Do enddo statements in sap abap with example program


REPORT demo_flow_control_do .

* simple do

DO.

  WRITE sy-index.
  IF sy-index = 3.
    EXIT.
  ENDIF.
ENDDO.

SKIP.
ULINE.

* do n times

DO 2 TIMES.
  WRITE sy-index.
  SKIP.
  DO 3 TIMES.
    WRITE sy-index.
  ENDDO.
  SKIP.
ENDDO.

SKIP.
ULINE.

* varying

DATA: BEGIN OF text,
        word1(4) TYPE c VALUE 'This',
        word2(4) TYPE c VALUE 'is',
        word3(4) TYPE c VALUE 'a',
        word4(4) TYPE c VALUE 'loop',
      END OF text.

DATA: string1(4) TYPE c, string2(4) TYPE c.

DO 4 TIMES VARYING string1 FROM text-word1 NEXT text-word2.
  WRITE string1.
  IF string1 = 'is'.
    string1 = 'was'.
  ENDIF.
ENDDO.

SKIP.

DO 2 TIMES VARYING string1 FROM text-word1 NEXT text-word3
           VARYING string2 FROM text-word2 NEXT text-word4.
  WRITE: string1, string2.
ENDDO.

case endcase statement example in sap abap


REPORT demo_flow_control_case .

DATA: text1   TYPE c VALUE 'X',
      text2   TYPE c VALUE 'Y',
      text3   TYPE c VALUE 'Z',
      string  TYPE c VALUE 'A'.

CASE string.
  WHEN text1 OR text2.
    WRITE: / 'String is', text1, 'OR', text2.
  WHEN text3.
    WRITE: / 'String is', text3.
  WHEN OTHERS.
    WRITE: / 'String is not', text1, text2, text3.
ENDCASE.

If elseif statement example in sap abap


REPORT demo_flow_control_if .

DATA: text1(30) TYPE c VALUE 'This is the first text',
      text2(30) TYPE c VALUE 'This is the second text',
      text3(30) TYPE c VALUE 'This is the third text',
      string(5) TYPE c VALUE 'eco'.

IF text1 CS string.
  WRITE / 'Condition 1 is fulfilled'.
ELSEIF text2 CS string.
  WRITE / 'Condition 2 is fulfilled'.
ELSEIF text3 CS string.
  WRITE / 'Condition 3 is fulfilled'.
ELSE.
  WRITE / 'No condition is fulfilled'.
ENDIF.

Internal table declaration in sap abap with example program


PROGRAM demo_internal_table.

TYPES: BEGIN OF mytext,
         number TYPE i,
         name(10) TYPE c,
       END OF mytext.

TYPES mytab TYPE STANDARD TABLE OF mytext WITH DEFAULT KEY.

DATA text TYPE mytext.
DATA itab TYPE mytab.

text-number = 1. text-name = 'John'.
APPEND text TO itab.
text-number = 2. text-name = 'Paul'.
APPEND text TO itab.
text-number = 3. text-name = 'Ringo'.
APPEND text TO itab.
text-number = 4. text-name = 'George'.
APPEND text TO itab.

LOOP AT itab INTO text.
  WRITE: / text-number,text-name.
ENDLOOP.

Structure declaration in sap abap with example program




REPORT demo_structure.

TYPES: BEGIN OF name,
         title(5)       TYPE c,
         first_name(10) TYPE c,
         last_name(10)  TYPE c,
       END OF name.                            

TYPES: BEGIN OF mylist,
         client         TYPE name,
         number         TYPE i,
       END OF mylist.

DATA list TYPE mylist.

list-client-title = 'Lord'.
list-client-first_name = 'Howard'.
list-client-last_name = 'Mac Duff'.
list-number = 1.

WRITE list-client-title.
WRITE list-client-first_name.
WRITE list-client-last_name.
WRITE / 'Number'.
WRITE list-number.

Thursday, January 12, 2012

Hot Spot example report in sap abap


Execute this report in sap abap editor ........

REPORT demo_program_submit_sel_screen NO STANDARD PAGE HEADING.

DATA: int TYPE i,
      rspar TYPE TABLE OF rsparams,
      wa_rspar LIKE LINE OF rspar.

RANGES seltab FOR int.

WRITE: 'Select a Selection!',
     / '--------------------'.
SKIP.

FORMAT HOTSPOT COLOR 5 INVERSE ON.
WRITE: 'Selection 1',
     / 'Selection 2'.

AT LINE-SELECTION.
  CASE sy-lilli.
    WHEN 4.
      seltab-sign = 'I'. seltab-option = 'BT'.
      seltab-low  = 1.   seltab-high   = 5.
      APPEND seltab.
      SUBMIT demo_program_submit_rep1 VIA SELECTION-SCREEN
                      WITH paramet eq 'Selection 1'
                      WITH selecto IN seltab
                      WITH selecto ne 3
                      AND RETURN.
    WHEN 5.
      wa_rspar-selname = 'SELECTO'. wa_rspar-kind = 'S'.
      wa_rspar-sign = 'E'. wa_rspar-option = 'BT'.
      wa_rspar-low  = 14.  wa_rspar-high = 17.
      APPEND wa_rspar TO rspar.
      wa_rspar-selname = 'PARAMET'. wa_rspar-kind = 'P'.
      wa_rspar-low  = 'Selection 2'.
      APPEND wa_rspar TO rspar.
      wa_rspar-selname = 'SELECTO'. wa_rspar-kind = 'S'.
      wa_rspar-sign = 'I'. wa_rspar-option = 'GT'.
      wa_rspar-low  = 10.
      APPEND wa_rspar TO rspar.
      SUBMIT demo_program_submit_rep1 VIA SELECTION-SCREEN
                      WITH SELECTION-TABLE rspar
                      AND RETURN.
  ENDCASE.

Abap write statement/command example in sap abap




Execute this program below and check you will understand different ways to use the write statement.

REPORT demo_write_statement.

DATA: number TYPE p VALUE '-1234567.89' DECIMALS 2,
      len TYPE i,
      pos TYPE i,
      text(10) TYPE c VALUE '1234567890',
      integer TYPE i VALUE  1234567890,
      g(5) TYPE c VALUE 'Hello', f(5) TYPE c VALUE 'Dolly',
      time TYPE t VALUE '154633',
      float TYPE f VALUE '123456789.0',
      pack TYPE p VALUE '123.456' DECIMALS 3,
      flag1 TYPE c    VALUE ' ',
      flag2 TYPE c    VALUE 'X',
      flag3(5) TYPE c VALUE 'Xenon'.

* simple WRITE statement

WRITE 'Hello, here I am!'.

SKIP 2.

* standard output format

WRITE:  'Number', number, 'is packed'.

SKIP 2.

* positioning

WRITE 'First line.'.
WRITE 'Still first line.'.
WRITE /'Second line.'.
WRITE /13 'Third line.'.

SKIP 2.

len = 10.
pos = 13.
WRITE 'The string ------------ appears in the text.'.
WRITE AT pos(len) text.

SKIP 2.

* cutting

WRITE: (5) integer, /(5) text.

SKIP 2.

* no empty lines in lists

WRITE:   'One',
       / '   ',
       / 'Two'.

SKIP 2.

* formatting

WRITE: g, f.
WRITE: /10 g,
       /   f UNDER g.
WRITE: / g NO-GAP, f.

SKIP 2.

WRITE: time,
  /(8) time USING EDIT MASK '__:__:__'.

SKIP 2.

WRITE: '000123',
     / '000123' NO-ZERO.

SKIP 2.

WRITE float EXPONENT 3.

SKIP 2.

WRITE pack DECIMALS 2.

SKIP 2.

WRITE: / pack ROUND -2,
       / pack ROUND -1,
       / pack ROUND 1,
       / pack ROUND 2.

SKIP 2.

WRITE: sy-datum,
     / sy-datum YYMMDD.

SKIP 2.

* icons and symbols

INCLUDE <symbol>.
INCLUDE <icon>.
WRITE: /  'Telephone symbol:', sym_phone AS SYMBOL.
SKIP.
WRITE: /  'Alarm icon:   ', icon_alarm AS ICON.

SKIP 2.

* checkboxes

WRITE: / 'Flag 1 ', flag1  AS CHECKBOX,
       / 'Flag 2 ', flag2  AS CHECKBOX,
       / 'Flag 3 ', flag3  AS CHECKBOX.

Wednesday, January 11, 2012

Introductory Statements for Programs in Sap Abap


1. Report
2. Program
3. Function-Pool
4. Class-Pool
5. Interface-Pool
6. Type-Pool.



Internal table declaration in sap abap

Types : begin of t_vbak,
            vbeln type vbak-vbeln,
             erdat type vbak-erdat,
             ernam type vbak-ernam,
           end of t_vbak.                                      "Declaring a structure

Data : it_vbak type standard table of t_vbak,      "internal table
          wa_vbak type t_vbak.                               "work area

Monday, January 9, 2012

Elements of an SAP GUI Window





Command field: You can use the command field to go to applications directly by entering the transaction code. You can find the transaction code either in the SAP Easy Access menu tree (see next slide) or in the relevant application under System® Status.
Menu bar: The menus shown here depend on which application you are working in. These menus contain cascading menu options.
Standard toolbar: The icons in the system function bar are available on all R/3 screens. Any icons that you cannot use on a particular screen are dimmed. If you leave the cursor on an icon for a moment, a small flag will appear with the name (or function) of that icon. You will also see the corresponding function key. Theapplication toolbar shows you which functions are available in the current application.
Title bar: The title bar displays your current position and activity in the system.
Status bar: The status bar displays information on the current system status, for example, warning and error messages.






OSS means

OSS-- Online Service System is one of the primary sources of service and support provided by
SAP. With OSS, Customers can search the SAP information database and find solutions for
errors and problems with R/3 systems. You can also submit your problems to SAP.

What is Abap

ABAP stands for Advanced Business Application Programming.It is a 4th generation Programming Language(ABAP/4).The ABAP programming language was originally used by developers to develop the SAP R/3 platform where R stands for Real Time data Processing and 3- 3tier.It supports Object Oriented Programming,  in 1999, SAP released an object-oriented extension to ABAP called ABAP Objects, along with R/3 release 4.6.


Sap R/3 Enterprise release 4.70 ------December 2003
Sap R/3 Enterprise Edition 4.7
Sap R/3 Enterprise Central Component 5.0 (ECC)
Sap R/3 Enterprise Central Component 6.0(ECC).