Sei sulla pagina 1di 11

IBM Global Business Services

Linking Programs

Additional Topics | Linking Programs Dec-2008 IBM Corporation 2013


|
IBM Global Business 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 | Dec-2008 IBM Corporation 2013


IBM Global Business 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 | Dec-2008 IBM Corporation 2013


IBM Global Business 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 | Dec-2008 IBM Corporation 2013


IBM Global Business Services

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

5 Additional Topics | Linking Programs | Dec-2008 IBM Corporation 2013


IBM Global Business 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 | Dec-2008 IBM Corporation 2013


IBM Global Business Services

Demonstration

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

7 Additional Topics | Linking Programs | Dec-2008 IBM Corporation 2013


IBM Global Business Services

Practice

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

8 Additional Topics | Linking Programs | Dec-2008 IBM Corporation 2013


IBM Global Business 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 | Dec-2008 IBM Corporation 2013


IBM Global Business 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 | Dec-2008 IBM Corporation 2013


IBM Global Business 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 | Dec-2008 IBM Corporation 2013

Potrebbero piacerti anche