Saturday, December 19, 2009

Page Number Running In Background Code Example




REPORT zpage1 NO STANDARD PAGE HEADING LINE-SIZE 80
LINE-COUNT 55.

TABLES: SFLIGHT.

SELECT-OPTIONS: CARRIER FOR SFLIGHT-CARRID.

DATA: IVBAP TYPE STANDARD TABLE OF SFLIGHT WITH HEADER LINE,
TAB_ENTRIES TYPE I,
TOTAL_PAGES TYPE P DECIMALS 3,
TOTAL_NUMBER_OF_PAGES TYPE P DECIMALS 0,
HEADER_LINE_COUNT TYPE I VALUE 3.

SELECT * FROM SFLIGHT INTO TABLE IVBAP WHERE CARRID IN CARRIER.

DESCRIBE TABLE IVBAP LINES TAB_ENTRIES.

TOTAL_PAGES = ( TAB_ENTRIES / SY-LINCT ).
TOTAL_PAGES = ( ( ( TOTAL_PAGES * HEADER_LINE_COUNT )
+ TAB_ENTRIES ) / SY-LINCT ).
TOTAL_NUMBER_OF_PAGES = CEIL( TOTAL_PAGES ).

LOOP AT IVBAP.

WRITE:/ IVBAP-CARRID,
IVBAP-PLANETYPE.

ENDLOOP.

TOP-OF-PAGE.

WRITE:/ 'LIST OF SALES ORDERS',
45 'Page',
SY-PAGNO,
'of' NO-GAP,
TOTAL_NUMBER_OF_PAGES.
ULINE.
SKIP.

Friday, December 11, 2009

Send System Message to User

There is few ways we can send message to user who log in in the SAP client.

There is one builtin function TH_POPUP that we can used to send message to the user.

Go to call function transaction SE37 and execute this function

Overlaying Character Fields

Overlaying Character Fields

Is good to use if you want to fill the number for certain format.

e.g if the data contain value 65 and the format data should be 65000

The OVERLAY statement overlays one string with another:
OVERLAY c1 WITH c2 [ONLY str].

This statement overlays all positions in field c1containing letters which occur in str with the contents of c2. c2remains unchanged. If you omit ONLY str , all positions of c1 containing spaces are overwritten.
If at least one character in c1 was replaced, sy-subrc is set to 0. In all other cases, sy-subrc is set to 4. If c1 is longer than c2, it is overlaid only in the length of c2.
Example

DATA: t(10) TYPE c VALUE 'a c e g i ',

string LIKE t,
over(10) TYPE c VALUE
'ABCDEFGHIJ',
str(2) TYPE c VALUE 'ai'.
string = t.
WRITE string.
WRITE / over.
OVERLAY string WITH over.
WRITE / string.
string = t.
OVERLAY string WITH over ONLY str.
WRITE / string.
Output:
a c e g i
ABCDEFGHIJ
aBcDeFgHiJ
A c e g I

Thursday, November 26, 2009

Selection Screen

I have found good tutorial on SAP selection Screen, below code is taken from this site


In this example I will show you below selection screen properties

* Adding button on selection screen
* Define radiobuttons
* Define checkboxes
* Add more than one object in per line of selection screen
* Disable an object
* Hide/Show an object
* Display blue colored parameters

REPORT ZMAVSARTEST.

Tables : Pgmi, Sscrfields.

Data : Begin Of IPgmi Occurs 0,
Werks Type Pgmi-Werks,
Prgrp Type Pgmi-Prgrp,
Nrmit Type Pgmi-Nrmit,
End Of IPgmi.
Data : WPgmi Like Line Of IPgmi.

Selection-Screen Begin of Block b1 With Frame Title TEXT-T01.
Select-Options : Prgrp For Pgmi-Prgrp Default ‘183X366_BTE’ Modif Id OB.
Parameters : Werks Like Marc-Werks Default ‘2000′,
S1 RadioButton Group G1,
S2 RadioButton Group G1,
S3 RadioButton Group G1,
PSay(3).
Selection-Screen End of Block b1.

Selection-Screen Begin of Block b2 With Frame Title TEXT-T02.
Parameters : S4 RadioButton Group G2,
S5 RadioButton Group G2.
Selection-Screen End of Block b2.

Selection-Screen Begin of Block b3 With Frame Title TEXT-T03.
Parameters : S6 RadioButton Group G3 User-Command Radyo,
S7 RadioButton Group G3.
Selection-Screen begin of line.
Parameters p_ch1 AS checkbox Modif ID SL.
Selection-Screen comment 3(20) text-001 Modif ID SL.
Parameters p_ch2 AS checkbox Modif ID SL.
Selection-Screen comment 27(20) text-002 Modif ID SL.
Parameters p_ch3 AS checkbox Modif ID SL.
Selection-Screen comment 51(20) text-003 Modif ID SL.
Selection-Screen end of line.
Selection-Screen begin of line.
Parameters p_ch4 AS checkbox Modif ID SL.
Selection-Screen comment 3(20) text-004 Modif ID SL.
Parameters p_ch5 AS checkbox Modif ID SL.
Selection-Screen comment 27(20) text-005 Modif ID SL.
Parameters p_ch6 AS checkbox Modif ID SL.
Selection-Screen comment 51(20) text-006 Modif ID SL.
Selection-Screen end of line.
Selection-Screen begin of line.
Parameters p_ch7 AS checkbox Modif ID SL.
Selection-Screen comment 3(20) text-007 Modif ID SL.
Parameters p_ch8 AS checkbox Modif ID SL.
Selection-Screen comment 27(20) text-008 Modif ID SL.
Parameters p_ch9 AS checkbox Modif ID SL.
Selection-Screen comment 51(20) text-009 Modif ID SL.
Selection-Screen end of line.
Selection-Screen begin of line.
Parameters p_ch10 AS checkbox Modif ID SL.
Selection-Screen comment 3(20) text-010 Modif ID SL.
Parameters p_ch11 AS checkbox Modif ID SL.
Selection-Screen comment 27(20) text-011 Modif ID SL.
Parameters p_ch12 AS checkbox Modif ID SL.
Selection-Screen comment 51(20) text-012 Modif ID SL.
Selection-Screen end of line.
Selection-Screen End of Block b3.

TYPE-POOLS icon.
Data : Functxt TYPE Smp_Dyntxt.

Selection-Screen: Function Key 1,
Function Key 2.
Initialization.
S7 = ‘X’.
Functxt-icon_id = ICON_ALARM.
Functxt-quickinfo = ‘Uç’.
Functxt-icon_text = ‘Uç’.
Sscrfields-functxt_01 = functxt.
Sscrfields-Functxt_02 = ‘Button2′.

At Selection-Screen.
Case Sscrfields-Ucomm.
When ‘FC01′.
Message ‘Uçakla mı uçacaksın?’ Type ‘I’.
When ‘FC02′.
Message ‘Button2′ Type ‘I’.
When Others.
Endcase.

At Selection-Screen Output.
Perform CheckRadio.

FORM CheckRadio.
Loop At Screen.
If S6 = ‘X’.
If Screen-Group1 = ‘SL’.
Screen-Active = 0.
Endif.
Elseif S7 = ‘X’.
If Screen-Group1 = ‘SL’.
Screen-Active = 1.
Endif.
Endif.
If Screen-Group1 = ‘OB’.
Screen-Intensified = ‘1′.
Endif.
If Screen-Name = ‘S5′.
Screen-Input = 0.
Endif.
Modify Screen.
Endloop.
ENDFORM.” CheckRadio

Start-Of-Selection.
Perform GetData.
End-Of-Selection.

Form GetData.
* Get your data in this subroutine
EndForm. ” GetData

Input History not avalaible

Recently i try to figure out why my auto fill or input history not displayed after i had installed new SAP Gui Lagon, after few doing some Google research , below is the result

1) change the sap gui logon setting
2) Reinstall MADC

Solution for number two is working for me and my system using windows XP sp3.

Below is the guide taken from this site

I had a customer that just couldn’t get MDAC to work under XP. Reinstalling XP SP3 didn’t work. Microsoft doesn’t make anything available to reinstall MDAC individually. So it’s a complete nightmare to fix it. Luckily, I was able to solve the issue with these steps:

1. Click Start > Run and type %windir%\inf and click OK.

2. Right-click mdac.inf and select Install.

This is where the nightmare started for me. I didn’t have any of the files below. I had to copy the OLE DB, msadc, Ole DB and Binaries folders from another computer and place them in the C:\Program Files\Common Files\System\ folder. If you are missing the servicepackfiles folder, you will have it after you reinstall XP Service Pack 3. You can also just extract the files from the SP3 file by using the windowsxp-kb936929-sp3-x86-enu.exe –x command.

3. When prompted for each of the following files, try to browse and locate them in the directories specified.

  • adcjavas.inc – C:\Windows\servicepackfiles\i386
  • handler.reg – C:\Program Files\Common Files\System\msadc
  • MDACRdMe.htm – C:\Program Files\Common Files\System\Ado. I had to rename MDACReadme.htm to MDACRdMe.htm first.
  • oledbjvs.inc – C:\Program Files\Common Files\System\Ole DB
  • mssoap1.dll – C:\Program Files\Common Files\MSSoap\Binaries
  • mssoapr.dll – C:\Program Files\Common Files\MSSoap\Binaries

After all these steps, MDAC was working again.

Friday, March 13, 2009

SAP ABAP Certification - List of Topics

1. SAP Technology (+)
  •  SAP Systems (mySAP Business Suite and SAP NetWeaver)
  •  Technical Structure of an SAP Web Application Server
2. ABAP Workbench Fundamentals (++)
  • Data Types and Data Objects (Declaration)
  • Internal Tables
  • Data Retrieval (Authorization Check)
  • Subroutines
  • Function Groups and Function Modules
  • Programs Calls and Data Storage Management
3. Advanced ABAP (++)
  • ABAP Runtime
  • ABAP Types and Data Objects (Use)
  • Open SQL (Efficient Programming)
  • Dynamic Programming

4. ABAP Objects (++)
  • Classes and Objects
  • Inheritance
  • Polymorphism (Casting)
  • Interfaces
  • Events
  • Global Classes and Interfaces
  • Exception Handling
  • SharedObjects

5. ABAP Dictionary (++)
  • Database Tables
  • Performance with Table Accesses
  • Consistency Through Input Check (Foreign Key Dependency)
  • Dependencies with ABAP Dictionary Objects
  • Views
  • SearchHelp

6. Techniques of List Processing (++)
  • Outputting Data in Lists
  • Selektion Screen
  • Logical Databases
  • Interactive Lists
  • Creating Lists Using ALV Grid Control:
– Simple Lists
– Field Catalog
– Layout
– Event Handling

7. Dialog Programming (++)
  • Screen (Fundamentals)
  • Program Interface (GUI Title, GUI Status)
  • Screen Elements for Output (Text Fields, Status Icons, and Group Boxes)
  • Input/Output Screen Elements
  • Subscreen and Tabstrip Control
  • TableControl
  • Context Menu
  • Lists in Dialog Programming


8. Database Updates (+)
  • Database Updates with Open SQL
  • LUW’s and Client/Server Architecture
  • SAPLockConcept
  • Organizing Database Updates
  • Complex LUW Processing
  • Number Assignment
  • Creating Change Documents

9. Enhancements and Modifications (+)
  • Changing the SAP Standard
  • Personalization
  • Enhancing Dictionary Elements
  • Enhancements Using Customer Exits
  • Business Transaction Events
  • Business Add-Ins
  • Modifications

Percentage of questions for each topic:
+ = 1 - 10%
++ = 11 - 20%
+++ = over 20%
Information subject to change. Copyright © SAP AG 2005.

Introduction Object Oriented Programming in SAP ABAP

Object oriented programming tries to map the real world objects with their attributes and methods as realistically as possible in program constructs. The aim is to create the program flow in such a way as if it is taking place in the real world. This makes the interaction between the developer and the user easier. The user can formulate business requirements on a program in the language in which the user is familiar with and the developer can convert these directly instead of the classic programming model.

In the object oriented programming model a different approach is used. Attributes and methods which belong to a specific object are grouped together and made accessible to the user using a well defined interface behind which the actual implementation details are hidden. so, the attributes of the object are only changed by the methods of the object and not directly by the user of and object. This ensures that the status of the object is always consistent.

When do you call an object an object oriented programming? if it has these features.

Abstraction
Abstraction refers to the ability to reflect the real world  processes as realistically as possible through programming. These processes can be a business or a technical nature.

Encapsulation
Implementation details are hidden behind well-defined an documented interfaces. They ensure that the abstract representation of a object is used only in accordance with its spefication.

Inheritance
New abstractions i.e. classes are derived from existing ones. They inherit all the attributes and methods of the higher class and can expand and specialize them.

Polymorphism
Different objects can present the same interface to the outside. A user only needs to know the interface and need not know every minute details of the classes.

Wednesday, March 11, 2009