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: 

Submit report and list_from_memory

matma24
Participant
0 Kudos
3,255

Hello!

In my custom report I need to use data from SAP standart report (hplcrpa0).

I've tried SUBMIT in my custom report and then LIST_FROM_MEMORY but unfortunately I'm getting exception - "not_found".

Here is the code I've used :

data: list_tab type table of abaplist. 

submit hplcrpa0 exporting list to memory and RETURN 
with pnppernr-low = '2681' 
with pnpwerks-low = '0040'
with rep_id = '01'
with pnpbegda = '20190101' 
with pnpendda = '20191231'.

call function 'LIST_FROM_MEMORY' 
tables listobject = list_tab 
exceptions 
not_found = 1
others = 2.

I've also tried

try.
  cl_salv_bs_runtime_info=>get_data_ref( 
   importing r_data = lo_data ).
  assign lo_data->* to <lt_hplcrpa0>. 
 catch cx_salv_bs_sc_runtime_info.
  message `Unable to retrieve ALV data` type 'E'. 
endtry.

But it gives dumps all the time.

Could anyone help me please?

1 ACCEPTED SOLUTION

raymond_giuseppi
Active Contributor
2,089

Not sure this report (HR-(PL?) will generate a spool (transactional use of Control Framework) also it should try to display a log when no record found...

In second case, did you also call

  • cl_salv_bs_runtime_info=>set( ) before submit the report to prevent ALV display and keep data available
  • cl_salv_bs_runtime_info=>clear_all( ) after get result

In any case you should provide more information on the dump (wrong parameters, data, structure, etc.) -> e.g. how did you define <lt_hplcrpa0> (should be a type cl_hr_br_p1510_hbrtrpa0=>gty_t_teven_text;etc.)

NB: As this report can generate a XML file, is it possible to generate the XML and read it in your caller report?

22 REPLIES 22

former_member187692
Participant
0 Kudos
2,089

Hi there,

I couldn't find that report for trying out in my system(mine is S/4 HANA 1809).

But anyways, I have done a similar required just a few days ago & and it worked fine...

Firstly, I would suggest you to do a root cause analysis of the issue:-

1.) Whether the report is working properly in foreground.

2.) The parameter values which you pass is it getting the proper data.

3.) Check the DATE format while passing.

4.) Look for any conversion routines, if required.

5.) And last but not the least check the SAP community for similar question&answers.

https://answers.sap.com/questions/906614/submit-rep-exporting-list-to-memory-newbie-questio.html

https://answers.sap.com/questions/1933153/submitand-exporting-list-to-memory-how-to-get-resu.html

Here is my trails & it's working fine....

SPAN { font-family: "Courier New"; font-size: 10pt; color: #000000; background: #FFFFFF; } .L0S31 { font-style: italic; color: #808080; } .L0S33 { color: #4DA619; } .L0S52 { color: #0000FF; } .L0S55 { color: #800080; } .L0S70 { color: #808080; }

SUBMIT rmplan00
WITH plnty = 'Q'
WITH material = ls_mapl-matnr"'67999'
WITH werk = '3110'
EXPORTING LIST TO MEMORY
AND RETURN.

SPAN { font-family: "Courier New"; font-size: 10pt; color: #000000; background: #FFFFFF; } .L0S31 { font-style: italic; color: #808080; } .L0S32 { color: #3399FF; } .L0S33 { color: #4DA619; } .L0S52 { color: #0000FF; } .L0S55 { color: #800080; }

CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
listobject = lt_ABAPLIST"list_tab
EXCEPTIONS
not_found = 1
OTHERS = 2.
CALL FUNCTION 'LIST_TO_ASCI'
TABLES
listasci = lt_asci
listobject = lt_ABAPLIST.

0 Kudos
2,089

Hello!

The problem with tutorials is the fact they all use Z reports - thats working for me, but when I want to run standard report its not working anymore.

1. Yes its working correct

2. Yes, when i debug I see content of report is correct

3. It's fine

former_member187692
Participant
0 Kudos
2,089

Code Snippet:-

SUBMIT rmplan00
WITH plnty = 'Q'
WITH material = ls_mapl-matnr"'67999'
WITH werk = '3110'
EXPORTING LIST TO MEMORY
AND RETURN.

CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
listobject = lt_ABAPLIST"list_tab
EXCEPTIONS
not_found = 1
OTHERS = 2.
CALL FUNCTION 'LIST_TO_ASCI'
TABLES
listasci = lt_asci
listobject = lt_ABAPLIST.

0 Kudos
2,089

As you can see it's the same as I post 🙂 but with "List_From_Memory" I'm getting sy-subrc = 1 (not_found) as i said in the first post

Sandra_Rossi
Active Contributor
0 Kudos
2,089

The solutions you mention above work only for precise cases (the first solution is for a report which outputs an ABAP List issued to the first default screen sequence, the second solution is for a report which outputs an ALV, provided that you use a minimal SAP version). There are other types of reports. Now, the question is to know in which context you are, and what technology is using this report HPLCRPA0 (that I don't know). Maybe if you share a screenshot it will help people to guess what technology it uses.

matma24
Participant
0 Kudos
2,089

It's an ALV.

I guess the problem is that ALV doesn't have "flat" structure.

raymond_giuseppi
Active Contributor
2,090

Not sure this report (HR-(PL?) will generate a spool (transactional use of Control Framework) also it should try to display a log when no record found...

In second case, did you also call

  • cl_salv_bs_runtime_info=>set( ) before submit the report to prevent ALV display and keep data available
  • cl_salv_bs_runtime_info=>clear_all( ) after get result

In any case you should provide more information on the dump (wrong parameters, data, structure, etc.) -> e.g. how did you define <lt_hplcrpa0> (should be a type cl_hr_br_p1510_hbrtrpa0=>gty_t_teven_text;etc.)

NB: As this report can generate a XML file, is it possible to generate the XML and read it in your caller report?

0 Kudos
2,089

It does not generate a spool so thats the reason why I can't get it with LIST_FROM_MEMORY.

As for your instructions :

Yes of course I called set( ) & clear_all( ) methods.

lt_hplcrpa0 is of type any table.


the dump I'm getting is CX_SY_STRUCT_COMP_NAME in method CHECK_COMPONENT_TAB of class cl_abap_structdescr.

0 Kudos
2,089

In which code/program was the dump raised (your code, the called program, execution of class cl_salv_bs_runtime_info, etc.)

Could you consider some inheritance from CL_HR_BR_P1510_HBRTRPA0 (CLASS xxx INHERITING FROM) in your caller?

0 Kudos
2,089

Hello,

short text:

"In the source code, the termination point is in line 71 of (Include) program "CL_ABAP_STRUCTDESCR===========CM00I". The termination is due to exception "CX_SY_STRUCT_COMP_NAME" occurri procedure "CREATE_DATA_FOR_COMPONENT" "(METHOD)". This exception was not handled locally or declared in the RAISING clause in the procedure's signature however."

"Level 1 Class CX_SY_STRUCT_COMP_NAME

Program CL_ABAP_STRUCTDESCR===========CP Include CL_ABAP_STRUCTDESCR===========CM00I Row 71

Short Te Component Name '3B_AMOUNT' of the Component 7 Contains an Invalid Character"

"Component Name '3B_AMOUNT' of the Component 7 Contains an Invalid Character"

0 Kudos
2,089

Could you put the whole dump as an attachment to your post. (or post the abap stack part of the dump)

Also try to set a break-point before the statement that raise the dump.

0 Kudos
2,089

The problem is with component name - '3B_AMOUNT' (screen attached in main post)

0 Kudos
2,089

I can't edit main post so I'm attaching screenshot here:

0 Kudos
2,089

it's my fault, I was not precise enough

  • Export the dump in a text format (txt, html)
  • Attach it to a new comment (insert file)

Nevertheless if SAP defined its work area 'wild' with an invalid name, first character numeric and dump arise in a standard code and not in your called, that cannot be guessed from what you posted, you won't be able to export it, and so should look for another option

Proposal: with enhancement in standard program:

  • Add an hidden/no-display parameter to the report,
  • When received from your called progam (not initial) export data to memory, don't display the ALV and leaver report/return

0 Kudos
2,089

Unfortunately as of "security" reasons I cannot post whole dump, but the part i shared above should be enough about why that's happening and where.

I just don't know how to fix it

0 Kudos
2,089

Then could you post the abap stack part of the dump, look for 'Active Calls/Events' block

Nb: in text format it's very easy to remove sensible data with notepad...

0 Kudos
2,089

That's exactly the solution I was thinking about but since most of blogs on forum advise against exporting to memory and then read in my custom report I was thinking about a nicer way (cl_salv_bs_runtime_info).

Active Calls/Events screen :

0 Kudos
2,089

As "GET_DATA_REF" triggered an exception related to field names when trying to build the internal table, could you try to use parameter R_DATA_LINE instead, or even method "GET_DATA".

NB: For your reference, this utility class use some export to/import from memory internally.

import t_component to lt_component from memory id cl_salv_bs_runtime_info=>c_memid_data_def.

So you could even build your own logic to recover data, with better error handling than the SAP tool.

Sandra_Rossi
Active Contributor
0 Kudos
2,089

If it's ALV, CL_SALV_BS_RUNTIME_INFO is the thing to try. Before the SUBMIT, did you first call:

cl_salv_bs_runtime_info=>set(
              EXPORTING display  = abap_false
                        metadata = abap_true
                        data     = abap_true ).

(as shown by Muralikrishnan Ponedath Vijayan)

matma24
Participant
0 Kudos
2,089

Yes I did call set method first.

matma24
Participant
0 Kudos
2,089

Yes I did call set method first.

When I call it with display true i see correct report so I'm sure it's working just fine, I just can't read that in my Z-report.

Sandra_Rossi
Active Contributor
0 Kudos
2,089

Raymond gave you all the information you need. You must attach the short dump. You must define your field symbol as a table (at least generically), and access dynamically its components. Do some debug to display LO_DATA->*