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

RFC Function module runs program - how do I get the results?

Former Member
0 Likes
2,369

Hello everybody,

I hope you can help me with this.

I need a RFC function module to get a table that another report generates. I can not edit the report but the function module.

But I don't get the table, I get a timeout error when I start the program by SUBMIT (report) EXPORTING LIST TO MEMORY.

And I just get a hard to read spool if I write it to spool. What I need is the list or internal table..

Right now I have the following coding:

DATA: i_sel_tab       TYPE TABLE OF rsparams,

         selection_table TYPE TABLE OF rsparams,

         i_sel_line      TYPE rsparams.

   DATA: report TYPE raldb_repo.


  SELECT SINGLE value FROM zpoption

    INTO report

    WHERE name = 'COBERICHT'.

   CALL FUNCTION 'RS_REFRESH_FROM_SELECTOPTIONS'

     EXPORTING

       curr_report     = report

     TABLES

       selection_table = selection_table

     EXCEPTIONS

       not_found       = 1

       no_report       = 2

       OTHERS          = 3.

*       VALUE(I_VERSN) TYPE  VERSN OPTIONAL

*"     VALUE(I_KSGRU) TYPE  KSGRU OPTIONAL

*"     VALUE(I_KOSTL) TYPE  KOSTL OPTIONAL

*"     VALUE(I_KAGRU) TYPE  KAGRU OPTIONAL

*"     VALUE(I_KSTAR) TYPE  KSTAR OPTIONAL

*"  EXPORTING


   LOOP AT selection_table INTO i_sel_line.

     CASE i_sel_line-selname.

       WHEN '$1GJAHR'.

         IF i_gjahr IS INITIAL.

           i_gjahr = year.

         ENDIF.

         i_sel_line-kind = 'P'.

         i_sel_line-low = i_gjahr.

         i_sel_line-sign = 'I'.

         i_sel_line-option = 'EQ'.

         APPEND i_sel_line TO i_sel_tab.

     

     ENDCASE.

   ENDLOOP.

   SUBMIT (report)

   WITH SELECTION-TABLE i_sel_tab

   EXPORTING LIST TO MEMORY

   AND RETURN.



Thank you so much in advance!

11 REPLIES 11
Read only

Former Member
0 Likes
2,048

Hello,

Option 1 - Call using Submit

   This is good if your destination program returns less amount of data, i mean the call is quick and data is returned fast.

Check this blog for the same -

Also take a look at table INDX option -

Option 2 - Write to a spool and read the spool later

   This option is good if you do not need to wait and data volume is more.

Check blog for reading from spool to internal table -    

Let me know if this helps.

Best Regards,

Swanand

Read only

0 Likes
2,048

Hello,

thank you, but I fear I don't understand your answer.

I already wrote that the command I use is submit with exporting list to Memory... but it leads to an error and I don't know why.

The option 2 sounds good too, but I would prefer the list from memory option.

Regards

Read only

0 Likes
2,048

Can you give more details on the error, like a screen shot or something ?

Well, did you try the below option ?

EXPORT wf_data FROM wf_data TO DATABASE indx(za)

    ID indxkey.

Read only

Former Member
0 Likes
2,048

Hi,

after what amount of minutes/hours did you get the runtime error?

Did you try to start your programm in background? running with f8 is limited to round about 10 min max runtime.

how large is the data-volume in the selection-Table and the output list when submitting programm?

regards

Stefan Seeburger

Read only

Private_Member_7726
Active Contributor
0 Likes
2,048

Hi,

the maximum allowed runtime for your RFC call will be determined by the settings for dialog workprocesses in the target system (default is 300 seconds), see: Configuration of System Resources for aRFC, tRFC, qRFC.


It's difficult to advise something not knowing more about the scenario you are trying to build, but I don't think it's a good idea to call some time-consuming functionality (or reporting functionality generally) over RFC.


cheers

Janis

Read only

0 Likes
2,048

Hello,

thank you for your answer.

The thing is, when I start the program without the function module, it just takes two seconds, till the list is generated. Would it help, if I post the program I'm calling?

(I need to use a RFC function module, it will be used for BusinessObjects Universe)

Thank you!

Read only

0 Likes
2,048

Hi,

In than case, you might want to look at the report logic for selection screen parameters:

    nodialog      TYPE c                DEFAULT ''      MODIF ID in2,

    pnoprint      TYPE c                DEFAULT ''      MODIF ID in2,

especially the first one, and what values get passed to them via SELECTION TABLE.

My suspicion is that some kind of dialog gets triggered. I'd try to first test the report submission without any RFC involved. Write a small programm just to make sure it is executable without any dialog and that the list can be retrieved. Or have you tested that already?

cheers

Janis

Read only

0 Likes
2,048

Hello,

thank you.

I tried the call of the report without the EXPORTING LIST TO MEMORY parameter.

Like this the function module runs and the report brings back the result list on the screen.. but I need it in an internal table 😕

Regards

Judith

Read only

0 Likes
2,048

Hmm... I think there is still some hope, but I can't figure out exactly what's going on because I can't even  get the code to compile on our 702 ECC system... and I don't know, what values are getting supplied via SELECTION-TABLE...

Please try to check, what values are supplied to these paramenters via SELECTION-TABLE:

SUBMIT_P and NODIALOG.

And what values do these parameters take in table X_SELTAB during INITIALIZATION,  AT SELECTION-SCREEN and START-OF-SELECTION events when you execute the report sucessfull without EXPORTING LIST TO MEMORY .

Furthermore, what does this call return to print_parameters for your RFC User (write a test RFC FM, if need be):

CALL FUNCTION 'GET_PRINT_PARAMETERS'

       EXPORTING

         mode                   = 'CURRENT '

         no_dialog              = 'X'

       IMPORTING

         out_parameters         = print_parameters

         out_archive_parameters = archive_parameters.


This is the kind of stuff that requires debuging the report in order to understand exactly what's going on, but I'd be trying to set NODIALOG = 'X' when submitting, and that execution 'mode' requires valid print parameters maintained in user master (of RFC user), I believe.


cheers

Janis

Read only

0 Likes
2,048

When I debug the program it seems like it runs into an endless loop... could the reason for the problem be an ALV grid?

I could try the other way - the print spool again - I already got the list back by using the following coding.

But the entries in it_buf are not really readable, full of control characters 😕

SUBMIT (report)

  WITH SELECTION-TABLE i_sel_tab

  TO SAP-SPOOL

  DESTINATION 'locl'

  LIST NAME 'BO_LISTE'

  IMMEDIATELY 'X'

  KEEP IN SPOOL ''

  WITHOUT SPOOL DYNPRO

* EXPORTING LIST TO MEMORY

  AND RETURN.

  SELECT RQIDENT

    INTO number

    FROM TSP01

    WHERE RQOWNER EQ SY-UNAME

      AND RQCLIENT EQ SY-MANDT.

    ENDSELECT.

CALL FUNCTION 'RSPO_RETURN_ABAP_SPOOLJOB'

  EXPORTING

    rqident                    = number

*   FIRST_LINE                 = 1

*   LAST_LINE                  =

*   PAGES                      =

  tables

    buffer                     = it_buf

* EXCEPTIONS

*   NO_SUCH_JOB                = 1

*   NOT_ABAP_LIST              = 2

*   JOB_CONTAINS_NO_DATA       = 3

*   SELECTION_EMPTY            = 4

*   NO_PERMISSION              = 5

*   CAN_NOT_ACCESS             = 6

*   READ_ERROR                 = 7

*   OTHERS                     = 8

          .

IF sy-subrc <> 0.

* Implement suitable error handling here

ENDIF.

Read only

0 Likes
2,048

If that works, you could try the following two calls from RSPO_RETURN_ABAP_SPOOLJOB, it should return list:

SUBMIT RSPOLIST EXPORTING LIST TO MEMORY AND RETURN

                     WITH RQIDENT = RQIDENT

                     WITH FIRST = FIRST_LINE

                     WITH last = last_line

                     with pages = pages.

     CALL FUNCTION 'LIST_FROM_MEMORY'

          TABLES

               LISTOBJECT = MEM_TAB

          EXCEPTIONS

               NOT_FOUND  = 1

               OTHERS     = 2.


Some better way to get to spool number needs to be devised, I feel...


It's difficult to say why and where it goes into endless loop.


cheers

Janis