Top Banner
ABAP Chapter 6 Message Debugging File Transfer Type Group
41

ABAP Message, Debugging, File Transfer and Type Group

Jan 14, 2015

Download

Education

Y. Z. MERCAN

You can find more SAP ABAP documents at http://sapdocs.info/category/sap/abap/
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: ABAP Message, Debugging, File Transfer and Type Group

ABAP Chapter 6 Message Debugging File Transfer Type Group

Page 2: ABAP Message, Debugging, File Transfer and Type Group

Message in ABAP

Page 3: ABAP Message, Debugging, File Transfer and Type Group

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 Message, Debugging, File Transfer and Type Group

Message TypeMessage Type

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

E, W, I, S

Page 5: ABAP Message, Debugging, File Transfer and Type Group

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

Message A000(38)...

Program Start

SelectionScreen

A Message Exit

Page 6: ABAP Message, Debugging, File Transfer and Type Group

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

Message E000(38) ...

Program Start

SelectionScreen

E Message

New input

Require

Page 7: ABAP Message, Debugging, File Transfer and Type Group

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

Message W000(38)...

Program Start

SelectionScreen

W Message

New input

possible

List

Enter

Page 8: ABAP Message, Debugging, File Transfer and Type Group

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

Message I000(38)...

Program Start

SelectionScreen

I Message

List

Enter

Page 9: ABAP Message, Debugging, File Transfer and Type Group

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

Message S000(38)...

Program Start

SelectionScreen

List(Next Screen)

Page 10: ABAP Message, Debugging, File Transfer and Type Group

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 Message, Debugging, File Transfer and Type Group

Debugging

Page 12: ABAP Message, Debugging, File Transfer and Type Group

Debugging Mode Debugging Mode

Page 13: ABAP Message, Debugging, File Transfer and Type Group

Debugging Mode : Internal Table Debugging Mode : Internal Table

Page 14: ABAP Message, Debugging, File Transfer and Type Group

Debugging Mode : Internal Table Debugging Mode : Internal Table

Page 15: ABAP Message, Debugging, File Transfer and Type Group

Debugging Mode : Watchpoint Debugging Mode : Watchpoint

Page 16: ABAP Message, Debugging, File Transfer and Type Group

Watchpoint : SAP ECC 6.0 Watchpoint : SAP ECC 6.0

Page 17: ABAP Message, Debugging, File Transfer and Type Group

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 Message, Debugging, File Transfer and Type Group

ABAP Practice

Page 19: ABAP Message, Debugging, File Transfer and Type Group

File Transfer

Page 20: ABAP Message, Debugging, File Transfer and Type Group

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

There are 3 steps for file transfer

Open FileRead/Write FileClose File

Page 21: ABAP Message, Debugging, File Transfer and Type Group

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 Message, Debugging, File Transfer and Type Group

File TransferFile Transfer

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

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

Page 23: ABAP Message, Debugging, File Transfer and Type Group

* 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 Message, Debugging, File Transfer and Type Group

Transaction : AL11

Page 25: ABAP Message, Debugging, File Transfer and Type Group

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 Message, Debugging, File Transfer and Type Group

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 Message, Debugging, File Transfer and Type Group

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 Message, Debugging, File Transfer and Type Group

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 Message, Debugging, File Transfer and Type Group

Working with File on Presentation Server

Page 30: ABAP Message, Debugging, File Transfer and Type Group

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 Message, Debugging, File Transfer and Type Group

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 Message, Debugging, File Transfer and Type Group

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 Message, Debugging, File Transfer and Type Group

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 Message, Debugging, File Transfer and Type Group

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 Message, Debugging, File Transfer and Type Group

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 Message, Debugging, File Transfer and Type Group

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 Message, Debugging, File Transfer and Type Group

Type Group : SE11

Page 38: ABAP Message, Debugging, File Transfer and Type Group

Type GroupABAP Program

Page 39: ABAP Message, Debugging, File Transfer and Type Group

Exercise IV

Page 40: ABAP Message, Debugging, File Transfer and Type Group

Exercise III : User Master

usr02-bname

usr02-trdat

adcp-tel_number

Page 41: ABAP Message, Debugging, File Transfer and Type Group

Exercise IV : Drill-Down Report