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

LIST_FROM_MEMORY error NOT_FOUND??

Former Member
0 Likes
2,302

Hi!

i wonder why the <b>FM 'LIST_FROM_MEMORY' </b> raise error NOT_FOUND.


function LIST_FROM_MEMORY.
  import LISTOBJECT from memory id '%_LIST'.
    if SY-SUBRC <> 0.
 ->    raise NOT_FOUND.
    endif.
endfunction.

my code to convert abap report to excel file is as below. It works fine when execute on frontend, but error exist when execute as background job.

pls help...

thanks


* get all variants entered in the selection screen and store in seltab
  CALL FUNCTION 'RS_REFRESH_FROM_SELECTOPTIONS'
    EXPORTING
      CURR_REPORT     = 'ZTEST'
    TABLES
      SELECTION_TABLE = seltab.

* submit this report with seltab and export to memory
    SUBMIT ZTEST with SELECTION-TABLE seltab
                        EXPORTING LIST TO MEMORY
                        AND RETURN.

    CALL FUNCTION 'LIST_FROM_MEMORY'
      TABLES
        listobject = abaplist.      " <- Error above exists when execute this FM

* convert abap report to ASCII and later convert to excel file
    CALL FUNCTION 'LIST_TO_ASCI'
      EXPORTING
        LIST_INDEX = -1
      TABLES
        LISTASCI   = record
        LISTOBJECT = abaplist.        

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,438

You aren't catching the error. Call the FM like this:


CALL FUNCTION 'LIST_FROM_MEMORY'
  TABLES
    listobject = abaplist
  <b>EXCEPTIONS
    not_found  = 1.</b>

IF sy-subrc <> 0.
*No list to process.
ENDIF.

Rob

6 REPLIES 6
Read only

andreas_mann3
Active Contributor
0 Likes
1,438

Hi,

try to submit your report "normal"

..with bukrs = p_bukrs ...

2) how do you defined "abaplist" ?

A.

Read only

Former Member
0 Likes
1,438

Hi huai,

1. I tried just now

2. this error will come if

the program (which was submitted)

did not print/display anything in the output.

3. so in your program, ZTEST ,

first, for testing purpose,

just print a test matter 'HELLO'

(without any if condition)

4. Then check this FM. it will work fine.

regards,

amit m.

Read only

Former Member
0 Likes
1,438

Huai Ying Tan ,

if your submit program didn't give any report then obviously it will give the same error.

the problem with your submit.

SUBMIT ZTEST with SELECTION-TABLE seltab

EXPORTING LIST TO MEMORY

AND RETURN.

check the seltab values.

Regards

Vijay

Read only

Former Member
0 Likes
1,438

hi

good

go through these links, i hope these ll give you good idea abou the 'LIST_FROM_MEMORY'

http://www.synactive.com/docu_e/specials/webreport.html

https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/3090http [original link is broken] [original link is broken] [original link is broken] [original link is broken]://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/submit.htm

thanks

mrutyun^

Read only

Former Member
0 Likes
1,439

You aren't catching the error. Call the FM like this:


CALL FUNCTION 'LIST_FROM_MEMORY'
  TABLES
    listobject = abaplist
  <b>EXCEPTIONS
    not_found  = 1.</b>

IF sy-subrc <> 0.
*No list to process.
ENDIF.

Rob

Read only

Former Member
0 Likes
1,438

Hi there!

I solved my problem! I am working on ZTEST program, and try to export list to memory using submit ZTEST. And finally I found that i get the NOT FOUND error if i am submitting the same program, if I separate it into 2 program, such as SUBMIT ZTEST_2 EXPORT...., it works well no matter in frontend or as background job.

Thanks a lot for your help.. You guys do let me learn a lot about ABAP!

Best Regards,

huai ying..