Skip to Content
-2

can't getting DATA FROM ANOTHER PROGRAM USING FIELD-SYMBOL

Mar 16 at 07:11 AM

224

avatar image

HI, MASTERS

I have written 2 z-programs one is to get the data

the second one is two fetch the data from the first program

here is the 1 st program

PARAMETERS p_matnr TYPE matnr DEFAULT '000000000000000023'.

DATA lt_makt TYPE STANDARD TABLE OF makt.
DATA ls_makt TYPE makt.

SELECT * FROM makt INTO table lt_makt WHERE matnr = p_matnr.

LOOP AT lt_makt INTO ls_makt.

WRITE : / ls_makt-matnr,
ls_makt-spras.

endloop.

2nd program is


parameters p_mat type matnr default '000000000000000023' NO-DISPLAY.

data: txtlines(1024) type c occurs 0 with header line.
TYPES LS_MAKT TYPE MAKT.

DATA lt_makt TYPE STANDARD TABLE OF makt.
SUBMIT ytest_sanju_submit EXPORTING LIST TO MEMORY AND RETURN
WITH p_matnr = p_mat.
IF sy-subrc <> 0.

ENDIF.

FIELD-SYMBOLS : <fs_makt> TYPE ANY TABLE. "makt.
DATA LV_FIELD(50) TYPE C .

lv_field = '(ytest_sanju_submit)ls_makt'.

ASSIGN (lv_field) to <fs_makt>.

the thing is i am not getting the value into the lv_field instead of value am getting the text

10 |10000 characters needed characters left characters exceeded

You paste twice the same code, so no field-symbol appearance?

1

now changed . can you please check it now

0

Still not clear which program is which.

0
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Matthew Billingham
Mar 16 at 08:55 AM
0

Attempting to use field symbols in this way is a bad idea, and totally pointless if both programs are Z, since you can change both, and so use more robust techniques.

You seem to have a fundamental misunderstanding though.You are trying to get the value of variable in program ytest_sanju_submit (an inner program), AFTER you've run it, from the outer program. The memory used by ytest_sanju_submit is no longer available when that program has finished execution. The field symbol technique is used to access the value of variables in the CALLING program from the CALLED program, when there's not really another way of sharing data . I'm not sure it even works with SUBMIT.

I suggest you spend some time reading up on ABAP memory.

Show 3 Share
10 |10000 characters needed characters left characters exceeded

It does not work with SUBMIT.

https://help.sap.com/http.svc/rc/abapdocu_751_index_htm/7.51/en-US/index.htm?file=abapassign_mem_area_dynamic_dobj.htm

the program "PROG" must be loaded into the same internal session as the current program

-> generally works only during external procedure calls

2

am just checking the functionality of field symbol by using this simple program.

if it works well then i go for the right one

thank you for your suggetions

0
PAPPIREDDY SANJEEVA REDDY

Your test scenario is incorrectly constructed. You CANNOT do what you are trying to do.

0
Horst Keller
Mar 16 at 09:11 AM
0

This line is apparently wrong:

lv_field = '(ytest_sanju_submit)-ls_makt)ls_makt'.

Show 2 Share
10 |10000 characters needed characters left characters exceeded

tried differently but still not getting sir. can you check it now

0
PAPPIREDDY SANJEEVA REDDY

programs must be loaded into the same internal session ...

0
Sandra Rossi Mar 17 at 07:27 AM
0

SUBMIT AND RETURN starts a new internal mode. With field symbols, you can only access the variables from the same internal mode, so it just can't work.

You can only pass data via parameters (SUBMIT WITH), or using ABAP memory (EXPORT/IMPORT), or SAP memory (SET/GET PARAMETER), or any classic persistent layer (database table, file, etc.), or using ABAP channels. See "memory organization" in ABAP documentation to better understand the concepts.

Share
10 |10000 characters needed characters left characters exceeded