Application Development 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: 

Get the result of a standard program

Former Member
0 Kudos

A program gives an ALV table that I would like to use in a specific program.

I try to use the SUBMIT EXPORTING LIST TO MEMORY AND RETURN solution but without success.

All standard program can be used with this solution ? If not is it possible to get the result of a report in a internal table ?

Here is my test code for LIST TO MEMORY :

DATA : export TYPE abaplist  OCCURS 0 WITH HEADER LINE.

SUBMIT rhthist0 EXPORTING LIST TO MEMORY AND RETURN
  WITH pchplvar EQ '01'
  WITH pchotype EQ 'P'
  WITH pchobjid EQ '07000132'
*        WITH pchsobid IN pchobjid
*        WITH pchseark eq pchseark
  WITH pchobeg  EQ '19000101'
  WITH pchoend  EQ '99991231'.
*        WITH pchtimed eq pchtimed
*        WITH pchbegda eq pchobeg
*        WITH pchendda eq pchoend.

CALL FUNCTION 'LIST_FROM_MEMORY'
  TABLES
    listobject       = export
* EXCEPTIONS
*   NOT_FOUND        = 1
*   OTHERS           = 2
          .
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

I get a dump which said that there is noting in MEMORY.

Thanks,

Anthony.

3 REPLIES 3

Former Member
0 Kudos

Hey it is working fine for me..

DATA list_tab TYPE TABLE OF abaplist.

SUBMIT rhthist0 EXPORTING LIST TO MEMORY

AND RETURN

WITH pchplvar EQ '01'

WITH pchotype EQ 'O'.

  • WITH pchobjid EQ '07000132'

  • WITH pchobeg EQ '19000101'

  • WITH pchoend EQ '99991231'.

CALL FUNCTION 'LIST_FROM_MEMORY'

TABLES

listobject = list_tab

EXCEPTIONS

not_found = 1

OTHERS = 2.

IF sy-subrc = 0.

CALL FUNCTION 'WRITE_LIST'

TABLES

listobject = list_tab.

ENDIF.

Check the selection data once. may be for that data no output is available...

Also uncomment the exceptions in list_from_memory so that dump dont come...

Sandeep_Kumar
Advisor
Advisor
0 Kudos

Hi Anthony,

The cause of dump could be that nothing gets selected and as you have commented the exceptions it results in run time error.

make some changes like below:

SUBMIT rhthist0 EXPORTING LIST TO MEMORY

WITH pchplvar EQ '01'

WITH pchotype EQ 'P'

WITH pchobjid EQ '07000132'

  • WITH pchsobid IN pchobjid

  • WITH pchseark eq pchseark

WITH pchobeg EQ '19000101'

WITH pchoend EQ '99991231'

AND RETURN.

  • WITH pchtimed eq pchtimed

  • WITH pchbegda eq pchobeg

  • WITH pchendda eq pchoend.

CALL FUNCTION 'LIST_FROM_MEMORY'

TABLES

listobject = export

EXCEPTIONS

NOT_FOUND = 1

OTHERS = 2

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

Now, if the report fetches something , it will get the records from memory .

Regards,

SAndeep

matt
Active Contributor
0 Kudos

If you can't get it to work with SUBMIT EXPORTING LIST TO MEMORY AND RETURN, and not all programs will work with this, then probably the simplest solution would be to find out where the data is held before it goes to the ALV Contol, and repair the SAP program with an EXPORT TO MEMORY of this data.

Then your program can use IMPORT FROM MEMORY to get the data for its use.

matt

Message was edited by:

Matthew Billingham