*************************Creation of Internal table*******************
DATA: BEGIN OF ti_record OCCURS 200,
Line(250),
END OF ti_record.
DATA: BEGIN OF ti_rec OCCURS 200,
Line(250),
END OF ti_rec.
******************************Selection screen*************************
selection-screen begin of block b1 with frame .
Parameters create radiobutton group g1.
PARAMETERS: JavaName(30) lower case.
parameters modify radiobutton group g1.
selection-screen end of block b1.
*******************Calling the java program creation page***************
at selection-screen.
if CREATE = 'X'.
if javaname is not initial.
refresh ti_record[].
concatenate 'public class' javaname into ti_record-line separated by space.
endif.
***************************Saving the java program*********************
data tfile type string.
concatenate 'D:\Programs\' javaname '.java' into tfile.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = tfile
FILETYPE = 'ASC'
TABLES
DATA_TAB = ti_record.
endif.
data new(15).
if MODIFY = 'X'.
new = 'ZJAVAMODIFY1'.
CALL TRANSACTION NEW.
endif.
*****************************************************************************************
ZJAVAMODIFY:
Code:
REPORT zjavamodify.
***********************selection screen.*********************
selection-screen begin of block b1 with frame .
Parameters compile radiobutton group g1.
Parameters modify radiobutton group g1.
Parameters execute radiobutton group g1.
PARAMETER : FILE(100) lower case.
selection-screen end of block b1.
DATA: BEGIN OF TI_RECORD OCCURS 1,
LINE(200),
END OF TI_RECORD.
data: st1(30),st2(30).
AT SELECTION-SCREEN ON VALUE-REQUEST FOR FILE.
CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
* DEF_FILENAME = ' '
DEF_PATH = '*.*'
* MASK = ' '
* MODE = ' '
* TITLE = ' '
IMPORTING
FILENAME = FILE
* RC =
.
End-of-selection.
********************************************************************
*****************************MODIFY*********************************
if modify = 'X'.
data: TXT_FILE1 TYPE STRING .
txt_file1 = file.
**************FM GUI_UPLOAD
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = txt_file1
TABLES
DATA_TAB = ti_recORD[].
**********End FM GUI_UPLOAD
EDITOR-CALL FOR ti_record .
**************FM GUI_UPLOAD
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = txt_file1
FILETYPE = 'ASC'
TABLES
DATA_TAB = ti_record.
**********End FM GUI_UPLOAD
endif.
********************end of modify********************
*******************BAT file for compilation n
execution.****************
if compile = 'X'.
DATA: begin of itab_bat_create occurs 0,
row(500) type c,
end of itab_bat_create.
data:comp_join1(250).
concatenate 'java' 'jCompiler' file into comp_join1
separated
by space.
itab_bat_create-row = 'c:'.
append itab_bat_create.
itab_bat_create-row = 'cd Documents and Settings\127740'.
append itab_bat_create.
itab_bat_create-row = comp_join1.
append itab_bat_create.
********FM GUI_DOWNLOAD
data: st type string.
st = 'C:\Documents and Settings\127740\compile_java.bat'.
call function 'GUI_DOWNLOAD'
EXPORTING
filename = st
filetype = 'ASC'
TABLES
data_tab = itab_bat_create[]
EXCEPTIONS
file_open_error = 1
file_write_error = 2
others = 3.
********end FM GUI_DOWNLOAD
*****FM dvsvas_doc_ws_execute_50
CALL FUNCTION 'DSVAS_DOC_WS_EXECUTE_50'
EXPORTING
PROGRAM = 'C:\Documents and Settings\127740\compile_java.bat'.
*****end FM dvsvas_doc_ws_execute_50
endif.
************************end of compile********************************
*********************************************************************
*************************************** output***********************
if execute = 'X'.
data: TXT_FILE3 TYPE STRING .
split File AT '.java' into: st1 st2 .
concatenate st1 'error.txt' into TXT_FILE3.
**************FM GUI_UPLOAD
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = txt_file3
TABLES
DATA_TAB = ti_recORD[].
**********End FM GUI_UPLOAD
if not ti_record[] is initial.
loop at ti_record.
write:/ ti_record.
endloop.
else.
data: TXT_FILE4 TYPE STRING .
split File AT '.java' into: st1 st2 .
concatenate st1 'output.txt' into TXT_FILE4.
**************FM GUI_UPLOAD
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = TXT_FILE4
TABLES
DATA_TAB = ti_recORD[].
**********End FM GUI_UPLOAD
loop at ti_record.
write:/ ti_record.
endloop.
endif.
endif.
************************end of
output****************************************
In ZJAVACREATE we have used the transaction new which is nothing but
the transaction code for zjavamodify.
Tips By : Ankit Sharma
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG. SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG. Every effort is made to ensure content integrity. Use information on this site at your own risk.