2005 Sep 14 11:32 PM
why is the flag not imported to the called sub program when calling from main program.
program main:
data: flag(1) type c value 'y'. " to indicate called from main program
data: mem1(60) type c. " import zprogram output
mem1 = 'S'.
data: mem2(60) type c. " export flag to mem2
mem2 = 'p'.
export flag to MEMORY ID mem2.
submit zprogram
and return
IMPORT internaltable FROM MEMORY id mem1.
program sub.
data: flag(1) type c. " to indicate called from main
data: mem1(60) type c. " import zprogram output
key = 'S'.
data: mem2(60) type c. " export flag to mem2
mem2 = 'p'.
IMPORT flag from memory id mem2.
if flag = 'y'.
EXPORT internaltable TO MEMORY id mem1.
ENDIF.
You have some syntax issues. Refer to the code below. The field FLAG carries the value of 'y' through to the called program ZSUB_Prog in this example. In your example, you were calling program ZPROGRAM; and your attached code was program ZSUB.
Program 1
REPORT ZMain .
data: flag(1) type c value 'y'. " to indicate called from main program
data: mem1(60) type c. " import zprogram output
mem1 = 'S'.
data: mem2(60) type c. " export flag to mem2
mem2 = 'p'.
export flag to MEMORY ID mem2.
submit ZSUB_Prog and return.
*Your logic here.
Program 2
REPORT ZSUB_Prog message-id zz.
data: flag(1) type c. " to indicate called from main
data: mem1(60) type c. " import zprogram output
*key = 'S'.
data: mem2(60) type c. " export flag to mem2
mem2 = 'p'.
IMPORT flag from memory id mem2.
if flag = 'y'.
Your logic here.
ENDIF.
2005 Sep 15 2:05 AM
You have some syntax issues. Refer to the code below. The field FLAG carries the value of 'y' through to the called program ZSUB_Prog in this example. In your example, you were calling program ZPROGRAM; and your attached code was program ZSUB.
Program 1
REPORT ZMain .
data: flag(1) type c value 'y'. " to indicate called from main program
data: mem1(60) type c. " import zprogram output
mem1 = 'S'.
data: mem2(60) type c. " export flag to mem2
mem2 = 'p'.
export flag to MEMORY ID mem2.
submit ZSUB_Prog and return.
*Your logic here.
Program 2
REPORT ZSUB_Prog message-id zz.
data: flag(1) type c. " to indicate called from main
data: mem1(60) type c. " import zprogram output
*key = 'S'.
data: mem2(60) type c. " export flag to mem2
mem2 = 'p'.
IMPORT flag from memory id mem2.
if flag = 'y'.
Your logic here.
ENDIF.
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |