Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

ABAP PROGRAM

Former Member
0 Likes
719

Hi,

I need to get back some values from a program to use in other program.

could anyone give me the guidance to do it.

thanks in advance.

6 REPLIES 6
Read only

Former Member
0 Likes
669

u can use submit program.

for proper syntex press f1 on submit.

Go through the following Document for Submit Statement

SUBMIT rep.

Additions

1. ... LINE-SIZE col

2. ... LINE-COUNT lin

3. ... TO SAP-SPOOL

4. ... VIA SELECTION-SCREEN

5. ... AND RETURN

6. ... EXPORTING LIST TO MEMORY

7. ... USER user VIA JOB job NUMBER n

8. ... Various additions for parameter transfer to rep

9. ... USING SELECTION-SETS OF PROGRAM prog

Effect

Calls the report rep . Leaves the active program and starts the new report rep .

Addition 1

... LINE-SIZE col

Effect

Prints the report with the line width col .

Addition 2

... LINE-COUNT lin

Effect

Prints the report with lin lines (per page).

Addition 4

... VIA SELECTION-SCREEN

Effect

Displays the selection screen for the user. In this case, the selection screen is redisplayed after return from the report list display - the user's entries are retained.

Addition 5

... AND RETURN

Effect

Returns to the calling transaction or program after the called program has been executed. SUBMIT ... AND RETURN creates a new internal mode .

Addition 6

... EXPORTING LIST TO MEMORY

Effect

Does not display the output list of the called report, but saves it in SAP memory and leaves the called report immediately. Since the calling program can read the list from memory and process it further, you need to use the addition ... AND RETURN . Also, since the called report cannot be requested for printing, the addition ... TO SAP-SPOOL is not allowed here. You can read the saved list from SAP memory with the function module 'LIST_FROM_MEMORY' and then (for example) store it in the database with EXPORT . You can process this list further with the function modules 'WRITE_LIST' , 'DISPLAY_LIST' ... of the function group "SLST" .

Addition 7

... USER user VIA JOB job NUMBER n

Effect

Schedules the specified report in the job specified by the job name job and the job number n . The job runs under the user name user and you can omit the addition USER user . The assignment of the job number occurs via the function module JOB_OPEN (see also the documentation for the function modules JOB_CLOSE and JOB_SUBMIT . This addition can only be used with the addition ...AND RETURN .

Note

When scheduling a report with the SUBMIT ... VIA JOB job NUMBER n statement, you should always use the addition ...TO SAP-SPOOL to pass print and/or archive parameters. Otherwise, default values are used to generate the list and this disturbs operations in a production environment.

Addition 9

... USING SELECTION-SETS OF PROGRAM prog

Effect

Uses variants of the program prog when executing the program rep .

Note

Important

The programs prog and rep must have the same SELECT-OPTIONS and PARAMETER s. Otherwise, variants of the program prog may be destroyed.

Note

When using this addition, the specified variant vari of the program prog is taken in USING SELECTION-SET vari . On the other hand, all variant-related actions on the selection screen of rep (Get , Save as variant , Display , Delete ) refer to the variants of prog .

Example

SUBMIT REPORT01

VIA SELECTION-SCREEN

USING SELECTION-SET 'VARIANT1'

USING SELECTION-SETS OF PROGRAM 'REPORT00'

AND RETURN.

Effect

Executes the program REPORT01 with the variant VARIANT1 of the program REPORT00 .

Note

Runtime errors

LOAD_PROGRAM_NOT_FOUND : The specified program was not found.

SUBMIT_WRONG_TYPE : The specified program is not a report.

SUBMIT_IMPORT_ONLY_PARAMETER : Only one value passed to a report parameter.

SUBMIT_WRONG_SIGN : Invalid value passed to a selection with the addition SIGN .

SUBMIT_IN_ITAB_ILL_STRUCTURE : Table passed to a selection with WITH sel IN itab had an unexpected structure.

Try with this Example

Data: listobject like abaplist occurs 1 with header line.

CALL FUNCTION 'LIST_FROM_MEMORY'

TABLES

listobject = listobject

EXCEPTIONS

OTHERS = 1 .

IF sy-subrc <> 0.

message ID '61' TYPE 'E' NUMBER '731'

with 'LIST_FROM_MEMORY'.

ENDIF.

Read only

Former Member
0 Likes
669

hi,

Its simple.

Use submit program and in this case you can pass the values directly.

Or

first you need to exporting the values to memory from program 1 and then import the values in program 2.

Regards,

Richa

Read only

Former Member
0 Likes
669

if you want one program variable values to be appear in other programs at runtime,

first you need to do,

export the first program variable values to MEMORY

then in the second program

IMPORT the values from that memory location.

Regards

Srikanth

PS: Dont create multiple posts for the same question.

Read only

Former Member
0 Likes
669

The best way is to EXPORT the values to memory in the called pgm and IMPORT in the calling one.

example...

Pgm : ZXYZ.

submit ZABC and return.

import itab from memory.

Pgm : ZABC.

calculate the values

EXPORT itab to MEMORY.

Read only

Former Member
0 Likes
669

U can EXPORT/IMPORT statements.

Export statement:

EXPORT obj1 ... objn TO DATA BUFFER f.

- EXPORT obj1 ... objn TO MEMORY.

- EXPORT obj1 ... objn TO SHARED MEMORY itab(ar) ID key.

- EXPORT obj1 ... objn TO SHARED BUFFER itab(ar) ID key.

- EXPORT obj1 ... objn TO DATABASE dbtab(ar) ID key.

- EXPORT obj1 ... objn TO DATASET dsn(ar) ID key.

- EXPORT (itab) TO ... .

Import Statement:

- IMPORT obj1 ... objn FROM DATA BUFFER f.

- IMPORT obj1 ... objn FROM MEMORY.

- IMPORT obj1 ... objn FROM SHARED MEMORY itab(ar) ID key.

- IMPORT obj1 ... objn FROM SHARED BUFFER itab(ar) ID key.

- IMPORT obj1 ... objn FROM DATABASE dbtab(ar) ID key.

- IMPORT obj1 ... objn FROM DATASET dsn(ar) ID key.

- IMPORT obj1 ... objn FROM LOGFILE ID key.

- IMPORT DIRECTORY INTO itab FROM DATABASE dbtab(ar) ID key.

- IMPORT (itab) FROM ... .

Or u can SUBMIT Statement to pass some value to that program and get the result done.

1. SUBMIT rep.

2. SUBMIT (name).

Extras:

1. ... LINE-SIZE col

2. ... LINE-COUNT line

3. ... TO SAP-SPOOL List output to the SAP spool database

4. ... USING SELECTION-SCREEN scr

5. ... VIA SELECTION-SCREEN

6. ... AND RETURN

7. ... EXPORTING LIST TO MEMORY

8. ... USER user VIA JOB job NUMBER n

9. ...Various additions for passing parameters to rep

10. ... USING SELECTION-SETS OF PROGRAM prog

Or U can SET PARAMETER/ GET PARAMETER.

SET PARAMETER ID pid FIELD f.

GET PARAMETER ID pid FIELD f.

Regards,

Prakash.

Read only

gopi_narendra
Active Contributor
0 Likes
669

Use IMPORT or EXPORT Statements