ABAP Debugging

Post on 17-Nov-2014

1.053 views 12 download

description

Download this and other parts of ABAP presentations from http://hotfile.com/dl/21410715/21bc2bb/SAP-ABAP-Slides.rar.htmlWant to get more SAP ABAP Materials ?Visit http://sapdocs.info/

Transcript of ABAP Debugging

ABAP Chapter 6 Message Debugging File Transfer Type Group

Message in ABAP

User MessagesUser Messages

If user has entered inconsistent values,you output a dialog message with MESSAGE statement

Dialog messages are stored in table T100 (Transaction : SE91)

r eport ztest.

…. AT SELECTION-SCREEN. … m essage e000(38) with ‘----’ ‘---’ ‘---’ ‘---’ . …

Message TypeMessage Type

SyntaxMessage [ A<nnn> ](message class) with <field1> <field2> …

E, W, I, S

Messages Type - A(Abend)Messages Type - A(Abend)

Message A000(38)...

Program Start

SelectionScreen

A Message Exit

Messages Type - E(Error)Messages Type - E(Error)

Message E000(38) ...

Program Start

SelectionScreen

E Message

New input

Require

Messages Type - W(Warning)Messages Type - W(Warning)

Message W000(38)...

Program Start

SelectionScreen

W Message

New input

possible

List

Enter

Messages Type - I(Information)Messages Type - I(Information)

Message I000(38)...

Program Start

SelectionScreen

I Message

List

Enter

Messages Type - S(Success)Messages Type - S(Success)

Message S000(38)...

Program Start

SelectionScreen

List(Next Screen)

Dynamic MessageDynamic Message

1Report ztest .PPPPPPPPPP today PPPP sy-datum.PP P -election screen. if today -PPPPPP<> . m essage e000(38) P‘ Please enter today : ’ sy-datum. .-PP-PPPPPPPPPP. : / ‘Today is :’, today.

Debugging

Debugging Mode Debugging Mode

Debugging Mode : Internal Table Debugging Mode : Internal Table

Debugging Mode : Internal Table Debugging Mode : Internal Table

Debugging Mode : Watchpoint Debugging Mode : Watchpoint

Watchpoint : SAP ECC 6.0 Watchpoint : SAP ECC 6.0

How to Set Debugging ModeHow to Set Debugging Mode

If you want to test transaction,enter /h in the command field,press ENTER and execute the transaction

Set breakpoints in the program Utilities->Breakpoints->Set Uses BREAK-POINT statement

ABAP Practice

File Transfer

File Transfer (Application Server)File Transfer (Application Server)

There are 3 steps for file transfer

Open FileRead/Write FileClose File

File TransferFile Transfer

* Prepare Internal TableData all_customers like customers occurs 0 with header line.

50Data msg_txt( ). PPPPP(128) ‘ omersdata.xt PPPPP’ .Start-of-selection. Select * from customers into table all_customers.

File TransferFile Transfer

PPPPPPP P PPPP* Open dataset filename for output in text mode

encoding default _. - PP <>0. : ‘ . : ’ , _.else.

* Transferring data to a file Loop at all_customers. Transfer all_customers to filename. Endloop. * Closing a file Close dataset filename. Endif.

File TransferFile Transfer

Transaction : AL11

File Transfer (Appending Data)File Transfer (Appending Data)

PPPPPPP P PPPP*

Open dataset filename for appending PP PPPP PPPP encoding default _. - PP <>0. : ‘ . : ’ , _.else.

...

Reading Data from OS FileReading Data from OS File

* Reading data from a file 128Parameters filename( ) default ‘customersdata.txt ’ lower case.

Data msg_txt(50). 0Data all_customers like customers occurs with header line.

Start-of-selection. PPPP PPPPPPP PPPPPPPP PPP PPPPP PP PPPP PPPP encoding default _. - P P < > 0 . : ‘ . : ’ , _. else.

Reading Data from OS FileReading Data from OS File

Do. Read dataset filename into all_customers. if sy-subrc <> 0. Exit. endif. Append all_customers. Enddo. Close dataset filename. Endif.

Deleting OS File Deleting OS File

PPPPP(128) ‘ omersdata.txt PPPPP’ .START-OF-SELECTION. Delete dataset filename. If sy-subrc = 0. write: / ‘Delete OK’. Endif.

Working with File on Presentation Server

Download Data to PCDownload Data to PC

PPPPPPPP PPPP PPPP PP*

parameters PPPPPPPP PPPP PPPPPP-PPPPPPPP default ‘:omers .txt’.

Data all_customers like customers occurs 0 PPPPPP PPPPP.START-OF-SELECTION. PPPPPP PPP PPPP PPPPP PPPPPPPPPP PPPP* _ .

Download Data to PCDownload Data to PC

CALL FUNCTION ‘DOWNLOAD’ Exporting filename = filename PPPPPP data_tab = all_customers Exceptions file_open_error = 1 … PPPPPP =5.

Download Data to PCDownload Data to PC

PP-PPPPPP. When 1. Write: ‘Error when file opened’. When 2. Write: ‘Error during data transfer’. … When 0.

Write: / ‘Data Download Finish’..

Upload Data from PCUpload Data from PC

* Upload data to PCparameters PPPPPPPP like -rlgrap filename default ‘c:\customers .txt’.

Data all_customers like customers occurs 0 with header line.START-OF-SELECTION.

Upload Data from PCUpload Data from PC

CALL FUNCTION ‘UPLOAD’ Exporting filename = filename PPPPPP data_tab = all_customers Exceptions file_open_error = 1 … PPPPPP =5.

Upload Data from PCUpload Data from PC

PP-PPPPPP. When 1. Write: ‘Error when file opened’. When 2. Write: ‘Error during data transfer’. … When 0.

Insert customers from table all_customers.…

.

Upload/Download Data in BackgroundUpload/Download Data in Background

Call function ‘WS_DOWNLOAD’ Exporting P PPPPPPPP=

... and

Call function ‘WS_UPLOAD’ Exporting filename = filename ...

Type Group : SE11

Type GroupABAP Program

Exercise IV

Exercise III : User Master

usr02-bname

usr02-trdat

adcp-tel_number

Exercise IV : Drill-Down Report