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

Force Background processing with SUBMIT and keeping results in memory

Former Member
0 Likes
3,114

Hi Everyone

I have a very tricky issue that i need some help with.

I have a developed an RFC that allows a NON-SAP front-end to execute reports in the SAP backend the result of the report is saved in memory and formatted to XML and passed to the front-end where the report is displayed.

Therefore for this to work i have added the following code

************

g_guid = cl_salv_export_db_storage=>create_guid( ).

" Set ALV memory parameters

export l_mode = 'M' to memory id 'ALV_EXTRACT_MODE'.

export l_guid = g_guid to memory id 'ALV_EXTRACT_GUID'.

"Execute the selected report

SUBMIT (wlv_report_name)

USING SELECTION-SET wlv_variant_name

WITH PNPTIMED EQ ' '

WITH PNPBEGDA EQ im_begda

WITH PNPENDDA EQ im_endda

WITH PNPPERNR IN wlr_employee

AND RETURN.

data: l_xstring type xstring.

l_xstring = cl_salv_export_db_storage=>import_xmlstring(

guid = g_guid ).

*************

This allows me to get the report results to be passed to the front-end.

This works quite good for most reports but in some cases the reports has a popup message. In this case the execution fails as the report is not executed as a background job (if the report is executed in the background then the popups are ignored).

The issue is that the reports cannot be executed in the background as the memory will then not contain the report results and secondly the client does not want to use the spool for the report results at all. The second constraint is that the client does not want to alter the reports in any form to remove the popups due to the large volumes of reports.

What i have noted is that if the report is executed and i set the SY-BATCH parameter to "X" then it works perfectly (via the debugger). I can change the SY-BATCH value in my code but obviously once the SUBMIT is executed the SY parameters are reset.

My question is: Is there a way to force the SY parameter values when i perform a SUBMIT? Or is there any other possible solution to this issue?

1 ACCEPTED SOLUTION
Read only

Sandra_Rossi
Active Contributor
0 Likes
2,400

Hi,

About SY-BATCH, you can use batch input with display mode Q : CALL TRANSACTION 'ZZZ' DISMODE 'Q'. That does as N mode but with SY-BATCH = 'X'.

Thank you for your detailed post, I'm happy to have learnt something! I've searched a little bit and found this method in program SALV_TEST_INTERCEPTOR_REPORT.

Sandra

Hi Everyone

I have a very tricky issue that i need some help with.

I have a developed an RFC that allows a NON-SAP front-end to execute reports in the SAP backend the result of the report is saved in memory and formatted to XML and passed to the front-end where the report is displayed.

Therefore for this to work i have added the following code

************

g_guid = cl_salv_export_db_storage=>create_guid( ).

" Set ALV memory parameters

export l_mode = 'M' to memory id 'ALV_EXTRACT_MODE'.

export l_guid = g_guid to memory id 'ALV_EXTRACT_GUID'.

"Execute the selected report

SUBMIT (wlv_report_name)

USING SELECTION-SET wlv_variant_name

WITH PNPTIMED EQ ' '

WITH PNPBEGDA EQ im_begda

WITH PNPENDDA EQ im_endda

WITH PNPPERNR IN wlr_employee

AND RETURN.

data: l_xstring type xstring.

l_xstring = cl_salv_export_db_storage=>import_xmlstring(

guid = g_guid ).

*************

This allows me to get the report results to be passed to the front-end.

This works quite good for most reports but in some cases the reports has a popup message. In this case the execution fails as the report is not executed as a background job (if the report is executed in the background then the popups are ignored).

The issue is that the reports cannot be executed in the background as the memory will then not contain the report results and secondly the client does not want to use the spool for the report results at all. The second constraint is that the client does not want to alter the reports in any form to remove the popups due to the large volumes of reports.

What i have noted is that if the report is executed and i set the SY-BATCH parameter to "X" then it works perfectly (via the debugger). I can change the SY-BATCH value in my code but obviously once the SUBMIT is executed the SY parameters are reset.

My question is: Is there a way to force the SY parameter values when i perform a SUBMIT? Or is there any other possible solution to this issue?

7 REPLIES 7
Read only

Former Member
0 Likes
2,400

If you want to go with the option of spool, then you can use the following addition

SUBMIT <reportname> to SAP-SPOOL

SPOOL PARAMETERS <print_parameters>

WITHOUT SPOOL DYNPRO and RETURN.

and then read the spool,

if you want to go with the option of a background job, then you can use the following addition

SUBMIT <reportname> VIA JOB <name> NUMBER <num> AND RETURN.

<name> and <num> are generated using FM JOB_OPEN, and then you have to close it using JOB_CLOSE.

Thanks.

Read only

Sandra_Rossi
Active Contributor
0 Likes
2,401

Hi,

About SY-BATCH, you can use batch input with display mode Q : CALL TRANSACTION 'ZZZ' DISMODE 'Q'. That does as N mode but with SY-BATCH = 'X'.

Thank you for your detailed post, I'm happy to have learnt something! I've searched a little bit and found this method in program SALV_TEST_INTERCEPTOR_REPORT.

Sandra

Read only

0 Likes
2,400

Hi Riki & Sandra

Thanks fro your quick reply.

The call transaction solution looks promising but unfortunately i will have to use the SUBMIT as almost none of the reports has transactions linked to them. Secondly i cannot execute the SUBMIT via a Job or the Spool as this is exactly what the client what to get rid of. So i will have to Execute the SUBMIT statement with the Sy-BATCH = "X" but not via the Job or to the spool.

Thanks for your contributions

Kind regards

Read only

0 Likes
2,400

You just need to

1) pass the information you need, with program name, etc., parameters as free selections for instance

2) Call ZZZ transaction, which calls a ZZZPROG, which reads the information, and submits whatever program and parameters you want

Sandra

Read only

0 Likes
2,400

Thanks Everyone for you input.

The suggestion Sandra made solved the issue.

I have executed the code in a separate program linked to a transaction and then executed the transaction with MODE = 'P' and it works perfectly.

Kind regards

Read only

0 Likes
2,400

Hi, good news. You mean Q ? (because P is a special mode for debugging with the old debugger!)

Sandra

Read only

rajesh_paruchuru
Active Participant
0 Likes
2,400

Hi Wian,

Please check if this blog [Gain Programmatic Access to Data of SAPGUI ALV Reports|http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/24944] [original link is broken] [original link is broken] [original link is broken]; can help you,

it might be worth to investigate the parameters and their corresponding values of the cl_salv_bs_runtime_info=>set( ) method

and any other methods of the class.

-Rajesh.