03-16-2017 7:11 AM
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
03-16-2017 7:15 AM
03-16-2017 8:34 AM
03-16-2017 8:49 AM
03-16-2017 8:55 AM
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.
03-16-2017 9:21 AM
It does not work with SUBMIT.
the program "PROG" must be loaded into the same internal session as the current program
-> generally works only during external procedure calls
03-16-2017 9:38 AM
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
03-16-2017 9:53 AM
Your test scenario is incorrectly constructed. You CANNOT do what you are trying to do.
03-16-2017 9:11 AM
This line is apparently wrong:
lv_field = '(ytest_sanju_submit)-ls_makt)ls_makt'.
03-16-2017 9:34 AM
tried differently but still not getting sir. can you check it now
03-16-2017 10:02 AM
03-17-2017 7:27 AM
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.