Reputation: 1287
I need to call a report inside a RFC function module in ABAP passing some parameters. This can be done using the SUBMIT
statement. When running the report, a selection screen is shown initially, which also offers three buttons that can be clicked. The selection screen and buttons are build using dynpros.
I would like to submit the report and also simulate the click of one of the three buttons. I know that I can simulate F8, for instance. Herefore I just need to remove the VIA SELECTION-SCREEN
part of the SUBMIT call. But in my case I want to simulate a custom button click.
Any suggestions? Thanks
Upvotes: 0
Views: 2250
Reputation: 313
Calling the selection-screen is also well controlled via the SUBMIT command. You can use the values you want to enter as parameters with the command WITH. I think pressing a button can also be mapped as a parameter. Here is the information: https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-US/abapsubmit_selscreen_parameters.htm
Alternatively, you can use the BDC table, although this only works if the report has a transaction associated with it. In the BDC table you can build up which actions run in sequence. This table is then passed to the transaction via the CALL TRANSACTION call. Here are some examples: https://answers.sap.com/questions/3098271/give-a-simple-bdc-example-for-call-transaction-met.html
I hope one of these solutions will work for you.
Upvotes: 2
Reputation: 69703
If you want to start another program and perform a series of actions in it, then you need to call it via a transaction code using CALL TRANSACTION
.
The CALL TRANSACTION
instruction allows you to pass a table of batch-input instructions. Which allow you to put input into dynpro fields, simulate button events, and even switch to other dynpros and repeat the process there. An example can be found in this article. I added some more comments to that code snippet to explain what it is actually doing:
DATA bdcdata_tab TYPE TABLE OF bdcdata WITH EMPTY KEY.
bdcdata_tab = VALUE #(
" Declare the first dynpro of the transaction we are going to proceed
( program = 'SAPLSEOD' dynpro = '1000' dynbegin = 'X' )
" Set the cursor into the DYNPRO field SEOCLASS-CLSNAME
( fnam = 'BDC_CURSOR' fval = 'SEOCLASS-CLSNAME' )
" Put a string into the Dynpro field SEOCLASS_CLSNAME
( fnam = 'SEOCLASS-CLSNAME' fval = class_name )
" Simulate a click on a button that triggers the function code =WB_DISPLAY
( fnam = 'BDC_OKCODE' fval = '=WB_DISPLAY' ) ).
CALL TRANSACTION 'SE24'
WITH AUTHORITY-CHECK
USING bdcdata_tab.
Upvotes: 4