Sunteți pe pagina 1din 11

IBM Global Services

Linking Programs

Additional Topics | Linking Programs March-2005 © 2005 IBM Corporation


| 3.18.01
IBM Global Services

Objectives

 The participants will be able to:


 Experiment linking programs of different types.
 Construct the syntax of the “SUBMIT” statement to link report programs.
 Construct the syntax of “TRANSACTION” statement to link online programs.
 Test the technique of passing data between programs using the “EXPORT” and
“IMPORT” statements.

2 Additional Topics | Linking Programs | 3.18.01 March-2005 © 2005 IBM Corporation


IBM Global Services

Overview

 In ABAP, you can link programs together.

Report
Program
Report Program
Online
Program

Online
Program
Online Program
Report
Program

3 Additional Topics | Linking Programs | 3.18.01 March-2005 © 2005 IBM Corporation


IBM Global Services

Linking Programs

Type of Return to Called Program


“Called”
Program
YES NO

Report Program SUBMIT <program> SUBMIT <program>


AND RETURN [options].
[options].

Online Program CALL TRANSACTION LEAVE TO


<transaction code> TRANSACTION
[options]. <transaction code>
[options].

4 Additional Topics | Linking Programs | 3.18.01 March-2005 © 2005 IBM Corporation


IBM Global Services

SUBMIT Example
REPORT YSUB1. If the report program “called”
TABLES: LFA1. with a “SUBMIT” statement has
PARAMETERS: a selection screen, values can
FILE(45) DEFAULT ‘/tmp/vendfile’ be passed to the selection
LOWER CASE. screen using the “WITH”
DATA: VEND_ITAB LIKE LFA1 addition of the “SUBMIT”
OCCURS 0 WITH HEADER LINE. statement.
SELECT * FROM LFA1
INTO TABLE VEND_ITAB. REPORT YSUB2 .
IF SY-SUBRC = 0.
PARAMETERS:
LOOP AT VEND_ITAB.
SUBMIT YSUB2 AND RETURN NUM (10),
WITH NUM = VEND_ITAB-LIFNR NAME(35),
WITH NAME = VEND_ITAB-NAME1 CITY(35),
WITH CITY = VEND_ITAB-ORT01 FILENAME(45) LOWER CASE.
WITH FILENAME = FILE.
ENDLOOP. ** code to transfer information to file
ENDIF.

5 Additional Topics | Linking Programs | 3.18.01 March-2005 © 2005 IBM Corporation


IBM Global Services

TRANSACTION Example
REPORT YCALL1.
Transaction ‘FD02’
PARAMETERS:
CUST RADIOBUTTON GROUP GRP1,
VEND RADIOBUTTON GROUP GRP1. Program: SAPMF02D
Screen #: 0106
IF CUST = ‘X’.
LEAVE TO TRANSACTION ‘FD02’. (Change Customer Information)
ELSE.
CALL TRANSACTION ‘FK02’.
Transaction ‘FK02’
ENDIF.
Program: SAPMF02K
* remaining program code Screen #: 0106
(Change Vendor Information)

6 Additional Topics | Linking Programs | 3.18.01 March-2005 © 2005 IBM Corporation


IBM Global Services

Demonstration

 Illustration of the “Call transaction” method, through a simple program.

7 Additional Topics | Linking Programs | 3.18.01 March-2005 © 2005 IBM Corporation


IBM Global Services

Practice

 Illustration of the “Call transaction” method, through a simple program.

8 Additional Topics | Linking Programs | 3.18.01 March-2005 © 2005 IBM Corporation


IBM Global Services

Passing Data Between Programs


“Calling” a “Calling” an
Report Program Online Program

EXPORT & IMPORT SET PARAMETER ID & GET


PARAMETER ID

Export data to ABAP memory to be Set a value in SAP memory to be


imported in the “called” report retrieved in the “called” transaction.
program.

9 Additional Topics | Linking Programs | 3.18.01 March-2005 © 2005 IBM Corporation


IBM Global Services

Summary

 In ABAP, you can link together programs of different types.


 If the type of program to be “called” is a report program and you want control to
return back to the “calling” program, you should use some form of the following
statement: SUBMIT <program> AND RETURN [options].
 If the type of program to be “called” is a report program and you do not want
control to return back to the “calling” program, you should use some form of the
following statement: SUBMIT <program> [options] .
 If the type of program to be “called” is an online program and you want control to
return back to the “calling” program, you should use some form of the following
statement: CALL TRANSACTION <transaction code> [options] .
 If the type of program to be “called” is an online program and you do not want
control to return back to the “calling” program, you should use some form of the
following statement: LEAVE TO TRANSACTION <transaction code> [options] .
 You can use “EXPORT” and “IMPORT” or “SET PARAMETER ID” and “GET
PARAMETER ID” statements to pass data between programs.

10 Additional Topics | Linking Programs | 3.18.01 March-2005 © 2005 IBM Corporation


IBM Global Services

Questions

 What happens when you submit a report with addition “AND RETURN”?
 What are the different modes used with “CALL TRANSACTION”?
 What happens when you use addition “AND SKIP FIRST SCREEN” with Call
transaction?

11 Additional Topics | Linking Programs | 3.18.01 March-2005 © 2005 IBM Corporation

S-ar putea să vă placă și