04-11-2008 3:56 AM
hellow sirs,
is ther any way out for Automating the Export of BDC program
( Source Code) into Word file or note pad file..
i.e.. whenever i run my BDC it performs its function as well as it copy its Source Code into Word File..
thanking you
Rahul
04-11-2008 4:13 AM
HI Rahul .
Check this sample program to download source code of the program . Club your BDC program and this to get ur req done.
I hope that it helps u .
Regards,
Venkat.O
*&---------------------------------------------------------------------*
*& Report YDWNLD_REP
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT ydwnld_rep.
TABLES: trdir,trdirt,devaccess,tadir.
DATA: BEGIN OF itab OCCURS 0,
text(300),
END OF itab.
DATA program LIKE rlgrap-filename .
DATA: BEGIN OF int_reposrc OCCURS 0,
progname LIKE trdir-name,
END OF int_reposrc.
*------------------------------------------------------------------*
SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME.
*PARAMETER CNAM LIKE TRDIR-CNAM.
SELECT-OPTIONS: author FOR trdir-cnam.
SELECT-OPTIONS: pogram FOR trdir-name OBLIGATORY.
PARAMETERS: filename LIKE rlgrap-filename OBLIGATORY DEFAULT 'C:\'.
SELECTION-SCREEN END OF BLOCK b1.
*------------------------------------------------------------------*
SELECT * FROM devaccess.
CLEAR author.
author-sign = 'I'.
author-option = 'EQ'.
author-low = devaccess-uname.
APPEND author.
ENDSELECT.
SELECT name FROM trdir INTO TABLE int_reposrc
WHERE name IN pogram
AND cnam IN author.
LOOP AT int_reposrc.
CLEAR: itab,program.
REFRESH itab.
READ REPORT int_reposrc-progname INTO itab.
IF sy-subrc = 0.
CLEAR trdirt.
SELECT SINGLE * FROM trdirt WHERE name = int_reposrc-progname
AND sprsl = 'E'.
CLEAR tadir.
SELECT SINGLE * FROM tadir WHERE obj_name = int_reposrc-progname.
CONCATENATE filename tadir-devclass '\' int_reposrc-progname '-'
trdirt-text '.TXT' INTO program.
IF NOT itab[] IS INITIAL.
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
filename = program
filetype = 'DAT'
TABLES
data_tab = itab
EXCEPTIONS
file_open_error = 1
file_write_error = 2
invalid_filesize = 3
invalid_type = 4
no_batch = 5
unknown_error = 6
invalid_table_width = 7
gui_refuse_filetransfer = 8
customer_error = 9
no_authority = 10
OTHERS = 11.
ENDIF.
ENDIF.
ENDLOOP.
04-11-2008 4:13 AM
HI Rahul .
Check this sample program to download source code of the program . Club your BDC program and this to get ur req done.
I hope that it helps u .
Regards,
Venkat.O
*&---------------------------------------------------------------------*
*& Report YDWNLD_REP
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT ydwnld_rep.
TABLES: trdir,trdirt,devaccess,tadir.
DATA: BEGIN OF itab OCCURS 0,
text(300),
END OF itab.
DATA program LIKE rlgrap-filename .
DATA: BEGIN OF int_reposrc OCCURS 0,
progname LIKE trdir-name,
END OF int_reposrc.
*------------------------------------------------------------------*
SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME.
*PARAMETER CNAM LIKE TRDIR-CNAM.
SELECT-OPTIONS: author FOR trdir-cnam.
SELECT-OPTIONS: pogram FOR trdir-name OBLIGATORY.
PARAMETERS: filename LIKE rlgrap-filename OBLIGATORY DEFAULT 'C:\'.
SELECTION-SCREEN END OF BLOCK b1.
*------------------------------------------------------------------*
SELECT * FROM devaccess.
CLEAR author.
author-sign = 'I'.
author-option = 'EQ'.
author-low = devaccess-uname.
APPEND author.
ENDSELECT.
SELECT name FROM trdir INTO TABLE int_reposrc
WHERE name IN pogram
AND cnam IN author.
LOOP AT int_reposrc.
CLEAR: itab,program.
REFRESH itab.
READ REPORT int_reposrc-progname INTO itab.
IF sy-subrc = 0.
CLEAR trdirt.
SELECT SINGLE * FROM trdirt WHERE name = int_reposrc-progname
AND sprsl = 'E'.
CLEAR tadir.
SELECT SINGLE * FROM tadir WHERE obj_name = int_reposrc-progname.
CONCATENATE filename tadir-devclass '\' int_reposrc-progname '-'
trdirt-text '.TXT' INTO program.
IF NOT itab[] IS INITIAL.
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
filename = program
filetype = 'DAT'
TABLES
data_tab = itab
EXCEPTIONS
file_open_error = 1
file_write_error = 2
invalid_filesize = 3
invalid_type = 4
no_batch = 5
unknown_error = 6
invalid_table_width = 7
gui_refuse_filetransfer = 8
customer_error = 9
no_authority = 10
OTHERS = 11.
ENDIF.
ENDIF.
ENDLOOP.
04-11-2008 4:22 AM
thanks a heaps
venkat.
i m goin to use wil let you know as soon as i get things done.
cheers
rahul
04-14-2008 8:56 AM
thankin you so much.. Venkat..
this works really well
here i'm assigning u points as my Gesture for ur effort..!
and yes can u emailme . step by step method for Creating Reports using LDB method and ALV
thanks and Regards
Rahul
04-14-2008 9:06 AM
04-11-2008 4:17 AM
Hi Rahul,
U can write a program to meet your requirement. Just record the BDC of se38 as followed.
goto se38
mention the program name.
display.
export from se38. There is an option to export the file from SAP.
This will export your source code to a word file.
Venkat.
04-11-2008 4:20 AM
hellow venkat
thanks for ur response..
i know there is a ooption
but i want to perform this thing thru program. i dont want to do manuallly
i want to automate..
thanks. and Regards
Rahul