+ All Categories
Home > Business > Message, Debugging, File Transfer and Type Group

Message, Debugging, File Transfer and Type Group

Date post: 07-Nov-2014
Category:
Upload: y-z-mercan
View: 3,063 times
Download: 2 times
Share this document with a friend
Description:
6th part of series shared on http://sapdocs.info/sap/abap/documents-for-sap-abap-beginners/
Popular Tags:
41
ABAP Chapter 6 Message Debugging File Transfer Type Group
Transcript
Page 1: Message, Debugging, File Transfer and Type Group

ABAP Chapter 6 Message Debugging File Transfer Type Group

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

Message in ABAP

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

Message TypeMessage Type

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

E, W, I, S

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

Debugging

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

Debugging Mode Debugging Mode

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

Debugging Mode : Internal Table Debugging Mode : Internal Table

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

Debugging Mode : Internal Table Debugging Mode : Internal Table

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

Debugging Mode : Watchpoint Debugging Mode : Watchpoint

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

Watchpoint : SAP ECC 6.0 Watchpoint : SAP ECC 6.0

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

ABAP Practice

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

File Transfer

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

Transaction : AL11

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

Working with File on Presentation Server

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

Type Group : SE11

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

Type GroupABAP Program

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

Exercise IV

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

Exercise III : User Master

usr02-bname

usr02-trdat

adcp-tel_number

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

Exercise IV : Drill-Down Report


Recommended