Skip to Content
-2

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

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Mar 16, 2017 at 08: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.

    Add comment
    10|10000 characters needed characters exceeded

  • Mar 16, 2017 at 09:11 AM

    This line is apparently wrong:

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

    Add comment
    10|10000 characters needed characters exceeded

  • Mar 17, 2017 at 07: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.

    Add comment
    10|10000 characters needed characters exceeded