abap debugging

41
ABAP Chapter 6 Message Debugging File Transfer Type Group

Upload: yzmercan

Post on 17-Nov-2014

1.091 views

Category:

Documents


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

Page 1: ABAP Debugging

ABAP Chapter 6 Message Debugging File Transfer Type Group

Page 2: ABAP Debugging

Message in ABAP

Page 3: ABAP Debugging

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 ‘----’ ‘---’ ‘---’ ‘---’ . …

Page 4: ABAP Debugging

Message TypeMessage Type

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

E, W, I, S

Page 5: ABAP Debugging

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

Message A000(38)...

Program Start

SelectionScreen

A Message Exit

Page 6: ABAP Debugging

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

Message E000(38) ...

Program Start

SelectionScreen

E Message

New input

Require

Page 7: ABAP Debugging

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

Message W000(38)...

Program Start

SelectionScreen

W Message

New input

possible

List

Enter

Page 8: ABAP Debugging

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

Message I000(38)...

Program Start

SelectionScreen

I Message

List

Enter

Page 9: ABAP Debugging

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

Message S000(38)...

Program Start

SelectionScreen

List(Next Screen)

Page 10: ABAP Debugging

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.

Page 11: ABAP Debugging

Debugging

Page 12: ABAP Debugging

Debugging Mode Debugging Mode

Page 13: ABAP Debugging

Debugging Mode : Internal Table Debugging Mode : Internal Table

Page 14: ABAP Debugging

Debugging Mode : Internal Table Debugging Mode : Internal Table

Page 15: ABAP Debugging

Debugging Mode : Watchpoint Debugging Mode : Watchpoint

Page 16: ABAP Debugging

Watchpoint : SAP ECC 6.0 Watchpoint : SAP ECC 6.0

Page 17: ABAP Debugging

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

Page 18: ABAP Debugging

ABAP Practice

Page 19: ABAP Debugging

File Transfer

Page 20: ABAP Debugging

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

There are 3 steps for file transfer

Open FileRead/Write FileClose File

Page 21: ABAP Debugging

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.

Page 22: ABAP Debugging

File TransferFile Transfer

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

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

Page 23: ABAP Debugging

* 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

Page 24: ABAP Debugging

Transaction : AL11

Page 25: ABAP Debugging

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

PPPPPPP P PPPP*

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

...

Page 26: ABAP Debugging

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.

Page 27: ABAP Debugging

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.

Page 28: ABAP Debugging

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.

Page 29: ABAP Debugging

Working with File on Presentation Server

Page 30: ABAP Debugging

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* _ .

Page 31: ABAP Debugging

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.

Page 32: ABAP Debugging

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’..

Page 33: ABAP Debugging

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.

Page 34: ABAP Debugging

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.

Page 35: ABAP Debugging

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.…

.

Page 36: ABAP Debugging

Upload/Download Data in BackgroundUpload/Download Data in Background

Call function ‘WS_DOWNLOAD’ Exporting P PPPPPPPP=

... and

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

Page 37: ABAP Debugging

Type Group : SE11

Page 38: ABAP Debugging

Type GroupABAP Program

Page 39: ABAP Debugging

Exercise IV

Page 40: ABAP Debugging

Exercise III : User Master

usr02-bname

usr02-trdat

adcp-tel_number

Page 41: ABAP Debugging

Exercise IV : Drill-Down Report