10-07-2008 7:34 AM
hi all
wht i get in output display in abap editor that as to be save it in application server in format of notepad.
thanks
10-07-2008 7:44 AM
Hello,
There are 2 methods
1. in your current program, use the open dataset statement
wherever you have a write statement, replace it with a transfer statement to transfer the contents to the file instead of writing it to screen
Close your dataset at the end of the program
2. Run the following program
Change p_prog to your original report name
keep the rfc destination as NONE
change p_file to a filepath on your application server where you want your file to the written to
*&---------------------------------------------------------------------*
*& Report ZKRIS_RUN_VIA_RFC
*&
*&---------------------------------------------------------------------*
*& Author : Kris Donald
*& Date : 04-09-2008
*& Purpose : Run a program via rfc (S_TCODE auth is needed for SE38)
*&---------------------------------------------------------------------*
*& Date Changed by Tag Description
*&
*&---------------------------------------------------------------------*
REPORT zkris_run_via_rfc.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE f1.
PARAMETERS: p_dest LIKE rfcdes-rfcdest DEFAULT 'NONE'.
PARAMETERS: p_prog LIKE trdir-name DEFAULT 'Z'.
PARAMETERS: p_file(512) lower case default 'C:\file.txt'.
SELECTION-SCREEN END OF BLOCK b1.
INITIALIZATION.
f1 = 'Paramz'.
START-OF-SELECTION.
DATA: lv_errormessage LIKE sy-msgv1.
DATA: it_program LIKE progtab OCCURS 0 WITH HEADER LINE.
DATA: it_writes LIKE listzeile OCCURS 0 WITH HEADER LINE.
READ REPORT p_prog INTO it_program.
IF sy-subrc <> 0.
WRITE: /'Could not read program ', p_prog.
EXIT.
ENDIF.
* Create on target system and retrieve screen output.
CALL FUNCTION 'RFC_ABAP_INSTALL_AND_RUN'
DESTINATION p_dest
IMPORTING
errormessage = lv_errormessage
TABLES
program = it_program
writes = it_writes
EXCEPTIONS
OTHERS = 1.
open dataset p_file for output in text mode encoding default.
LOOP AT it_writes.
transfer it_writes to p_file.
ENDLOOP.
close dataset p_file.
10-07-2008 7:38 AM
Hi Santosh,
Please be descriptive in your query so that we can understand what help exactly you want.
Regards,
Shailesh
10-07-2008 7:40 AM
wht i get in output display in abap editor that as to be save it in application server in format of notepad. HOW TO WRITE CODE PLZ GUIDE ME PROPERLY
10-07-2008 7:46 AM
Hi,
If you want to transfer after showing the output then you need to do interactive reporting.
How are you displaying your data ? ALV or standard ? If in ALV you need to set pf status and do a user command and then when you click the button on your output screen you need to write the dataset commands in your User command form.
For standard output we need to do the same things but they are not very complex..
Are you planning to change any output a value and then transfer it? If not you can do output display and transfer to server parallelly.
Regards,
Pramod
10-07-2008 7:58 AM
10-07-2008 9:49 AM
10-07-2008 7:38 AM
Hi,
When you get your data into the final internal table then please use the dataset commands to write the value into the application server.
Please type 'OPEN DATASET' on your abap screen and press F1 and it will help you write the required code.
Regards,
Pramod
10-07-2008 7:44 AM
Hello,
There are 2 methods
1. in your current program, use the open dataset statement
wherever you have a write statement, replace it with a transfer statement to transfer the contents to the file instead of writing it to screen
Close your dataset at the end of the program
2. Run the following program
Change p_prog to your original report name
keep the rfc destination as NONE
change p_file to a filepath on your application server where you want your file to the written to
*&---------------------------------------------------------------------*
*& Report ZKRIS_RUN_VIA_RFC
*&
*&---------------------------------------------------------------------*
*& Author : Kris Donald
*& Date : 04-09-2008
*& Purpose : Run a program via rfc (S_TCODE auth is needed for SE38)
*&---------------------------------------------------------------------*
*& Date Changed by Tag Description
*&
*&---------------------------------------------------------------------*
REPORT zkris_run_via_rfc.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE f1.
PARAMETERS: p_dest LIKE rfcdes-rfcdest DEFAULT 'NONE'.
PARAMETERS: p_prog LIKE trdir-name DEFAULT 'Z'.
PARAMETERS: p_file(512) lower case default 'C:\file.txt'.
SELECTION-SCREEN END OF BLOCK b1.
INITIALIZATION.
f1 = 'Paramz'.
START-OF-SELECTION.
DATA: lv_errormessage LIKE sy-msgv1.
DATA: it_program LIKE progtab OCCURS 0 WITH HEADER LINE.
DATA: it_writes LIKE listzeile OCCURS 0 WITH HEADER LINE.
READ REPORT p_prog INTO it_program.
IF sy-subrc <> 0.
WRITE: /'Could not read program ', p_prog.
EXIT.
ENDIF.
* Create on target system and retrieve screen output.
CALL FUNCTION 'RFC_ABAP_INSTALL_AND_RUN'
DESTINATION p_dest
IMPORTING
errormessage = lv_errormessage
TABLES
program = it_program
writes = it_writes
EXCEPTIONS
OTHERS = 1.
open dataset p_file for output in text mode encoding default.
LOOP AT it_writes.
transfer it_writes to p_file.
ENDLOOP.
close dataset p_file.
10-07-2008 7:53 AM
hi,
what get in ouput display that as to be save it in server as text format
10-07-2008 7:56 AM
Hi,
For this in your output screen you need to define a new button for export to local server ( using set-pf-status command in your program ) and when you click on this button you need to handle this event using a user command routine.
Regards,
Pramod