Posted: Wed Dec 19, 2007 12:43 am Post subject: Smartform upload / download utility
Code:
REPORT zquality LINE-SIZE 150 NO STANDARD PAGE HEADING.
************************************************** **********************
*Program : ZSMART_FORM_UPLOAD_DOWNLOAD *
*Description : This utility/tool can download or upload smartform and *
* smartstyles. *
*
*================================================= =====================*
* *
* Abhishek is not responsible for any damages caused by the use or *
* misuse of this program and can not provide any warranty with this *
* program. Use it entirely at your own risk. *
* *
*----------------------------------------------------------------------*
* Incase you don't remember the key or your key has expired, Please *
* drop me a mail at [email protected] with your installation number. A *
* new key will be allocated to you. *
*================================================= =====================*
* CHANGE LOG *
* ---------------------------------------------------------------------*
*| Date | Ver | Name | Description |*
*|-----------|------------|------------------|------------------------|*
*| 30.04.2003| VER 1.01 | ABHISHEK | Created |*
*| 30.01.2004| VER 1.02 | ABHISHEK | Modified |*
*| 09.02.2004| VER 2.00 | ABHISHEK | Modified (Released) |*
*| | | | |*
************************************************** **********************
*&===== TABLES =====
TABLES: stxfadm,
stxsadm.
DATA: v_pass,
g_ans,
v_abhi(16),
g_ins00(14) VALUE ' ',
BEGIN OF tab OCCURS 0,
line(72),
END OF tab,
tname LIKE sy-repid.
*&===== SELCTION SCREEN =====
SELECTION-SCREEN BEGIN OF BLOCK smart1 WITH FRAME TITLE text-001.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 4(20) text-101.
PARAMETERS: p_fname LIKE stxfadm-formname DEFAULT 'ZTEST2'.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 4(20) text-102.
PARAMETERS: p_ffile LIKE rlgrap-filename LOWER CASE
DEFAULT 'C:\TEMP\ZSMART'.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF BLOCK ind1 WITH FRAME TITLE text-002.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 4(20) text-103.
PARAMETERS: p_ft RADIOBUTTON GROUP abh1.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 4(20) text-104.
PARAMETERS: p_fu RADIOBUTTON GROUP abh1.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 4(20) text-105.
PARAMETERS: p_fd RADIOBUTTON GROUP abh1.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK ind1.
SELECTION-SCREEN END OF BLOCK smart1.
SELECTION-SCREEN SKIP 2.
SELECTION-SCREEN BEGIN OF BLOCK smart2 WITH FRAME TITLE text-003.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 4(20) text-106.
PARAMETERS: p_sname LIKE stxfadm-formname DEFAULT 'ZTEST2'.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 4(20) text-102.
PARAMETERS: p_sfile LIKE rlgrap-filename LOWER CASE
DEFAULT 'C:\TEMP\ZSMART'.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF BLOCK ind2 WITH FRAME TITLE text-002.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 4(20) text-103.
PARAMETERS: p_st RADIOBUTTON GROUP abh2.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 4(20) text-104.
PARAMETERS: p_su RADIOBUTTON GROUP abh2.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 4(20) text-105.
PARAMETERS: p_sd RADIOBUTTON GROUP abh2.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK ind2.
SELECTION-SCREEN END OF BLOCK smart2.
SELECTION-SCREEN SKIP 2.
SELECTION-SCREEN BEGIN OF BLOCK abhi WITH FRAME TITLE text-004.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(70) text-107.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 5(15) text-108.
PARAMETERS: p_key(8).
SELECTION-SCREEN COMMENT 30(16) text-109.
PARAMETERS: p_ins(14).
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK abhi.
*&===== START-SELCTION-SCREEN =====
START-OF-SELECTION.
IF v_pass = space.
PERFORM sub_warning.
IF g_ans = '1'.
REFRESH tab. CLEAR tab.
abhishek: 'report ztabhi.'.
PERFORM form1000000.
GENERATE SUBROUTINE POOL tab NAME tname.
IF sy-subrc = 0.
PERFORM sub_000005
IN PROGRAM (tname) USING p_key v_abhi g_ins00 IF FOUND .
ELSE.
vmess 'Error!! Trying to copy this Utility, Please install'.
ENDIF.
REFRESH tab. CLEAR: tab, tname.
abhishek: 'report ztabhi.'.
PERFORM form100000.
PERFORM form100001.
PERFORM form100002.
PERFORM form100003.
PERFORM form100004.
PERFORM form100005.
GENERATE SUBROUTINE POOL tab NAME tname.
IF sy-subrc = 0.
SET PARAMETER ID 'ABH1' FIELD p_key.
IF p_fu = 'X'.
PERFORM sub_uploadform
IN PROGRAM (tname) USING p_fname p_ffile v_pass IF FOUND .
ELSEIF p_fd = 'X'.
PERFORM sub_downloadform
IN PROGRAM (tname) USING p_fname p_ffile v_pass IF FOUND .
ENDIF.
IF p_su = 'X'.
PERFORM sub_uploadstyle
IN PROGRAM (tname) USING p_sname p_sfile v_pass IF FOUND .
ELSEIF p_sd = 'X'.
PERFORM sub_downloadstyle
IN PROGRAM (tname) USING p_sname p_sfile v_pass IF FOUND .
ENDIF.
ELSE.
vmess 'ERROR: Either the key is wrong or Program has been modified'.
ENDIF.
ELSE.
vmess 'Action Cancelled'.
ENDIF.
ENDIF.
*&---------------------------------------------------------------------*
*& Form form1000000
*&---------------------------------------------------------------------*
FORM form1000000.
abhishek:
'FORM SUB_000005 USING P_KEY V_ABHI G_INS00. ',
'Data: L_xyz like sy-datum,',
' l_check(4) .',
'ZVABHI G_INS00.',
'ENDFORM.'.
ENDFORM. " form1000000
*&---------------------------------------------------------------------*
*& Form form100001
*&---------------------------------------------------------------------*
FORM form100001.
abhishek:
' DEFINE DATADECS.',
' DATA: BEGIN OF T_&1 OCCURS 0.',
' INCLUDE STRUCTURE &1.',
' DATA: END OF T_&1.',
' SELECT * INTO TABLE T_&1 FROM &1 WHERE STYLENAME = P_?NAME.',
' END-OF-DEFINITION.',
*&===== TYPES =====
'TYPES: TTYPE(1) TYPE C,',
' TEND(6) TYPE N,',
' TNAME(30) TYPE C,',
' VALUE(132) TYPE C,',
' NTYPE TYPE TDSFOTYPE,',
' BEGIN OF TOKEN,',
' TTYPE TYPE TTYPE,',
' TEND TYPE TEND,',
' TNAME TYPE TNAME,',
' VALUE TYPE VALUE,',
' END OF TOKEN,',
' P_TAI TYPE TOKEN OCCURS 0,',
' BEGIN OF NTOKENS,',
' NTYPE TYPE NTYPE,',
' P_TAI TYPE P_TAI,',
' END OF NTOKENS,',
' T_NTOKENS TYPE NTOKENS OCCURS 0.',
*&===== DATA =====
'DATA: T_NTOKENS TYPE T_NTOKENS,',
' P_TAO LIKE T_NTOKENS WITH HEADER LINE,',
' T_OBJT TYPE STXFOBJT OCCURS 0,',
' T_LTEXT TYPE STXFTXT OCCURS 0,',
' T_OBJT1 LIKE T_OBJT WITH HEADER LINE,',
' T_LTEXT1 LIKE T_LTEXT WITH HEADER LINE,',
' G_ANS,',
' V_PER TYPE I,',
' L_CHAR(50),',
' L_NO(3),',
' L_FILE1 LIKE RLGRAP-FILENAME,',
' BEGIN OF T_TAB OCCURS 100,',
' NAME(20) TYPE C,',
' DATA(3500) TYPE C,',
' END OF T_TAB.',
*&===== FIELD-SYMBOLS =====
'FIELD-SYMBOLS: <FS_PAR>.'.
ENDFORM. " form100000
*&---------------------------------------------------------------------*
*& Form form100002
*&---------------------------------------------------------------------*
FORM form100002.
abhishek:
'FORM SUB_UPLOADFORM using P_#NAME p_ffile v_pass.',
' DATA: I_FORMNAME(30),',
' P_TA` LIKE P_TA^-P_TA` WITH HEADER LINE.',
' DOWNLOADALL DAT L_FILE1 %_%A@.',
' IF SY-SUBRC = 0.',
' VMESS STYLE DOWNLOAD: Sucessfully completed.',
' ELSE.',
' VMESS ERROR in Downloading the File .',
' ENDIF.',
'ENDFORM. '.
ENDFORM. " form100005
*&---------------------------------------------------------------------*
*& Form sub_get_set_para
*&---------------------------------------------------------------------*
FORM sub_get_set_para.
p_ins = g_ins00.
GET PARAMETER ID 'ABH1' FIELD p_key.
GET PARAMETER ID 'ABH2' FIELD p_sfile.
GET PARAMETER ID 'ABH3' FIELD p_sname.
GET PARAMETER ID 'ABH4' FIELD p_ffile.
GET PARAMETER ID 'ABH5' FIELD p_fname. checkabap.
ENDFORM. " sub_get_set_para
*&---------------------------------------------------------------------*
*& Form set_para
*&---------------------------------------------------------------------*
FORM set_para.
SET PARAMETER ID 'ABH2' FIELD p_sfile.
SET PARAMETER ID 'ABH3' FIELD p_sname.
SET PARAMETER ID 'ABH4' FIELD p_ffile.
SET PARAMETER ID 'ABH5' FIELD p_fname.
ENDFORM. " set_para
*&---------------------------------------------------------------------*
*& Form SUB_VALIDATION
*&---------------------------------------------------------------------*
FORM sub_validation.
IF p_key = space.
vmess 'Please Enter the key.'.
ELSE.
v_abhi+0(1) = '@'.
v_abhi+1(1) = p_key+0(1).
v_abhi+2(1) = '`'.
v_abhi+3(1) = p_key+1(1).
v_abhi+4(1) = '!'.
v_abhi+5(1) = p_key+2(1).
v_abhi+6(1) = '~'.
v_abhi+7(1) = p_key+3(1).
v_abhi+8(1) = '^'.
v_abhi+9(1) = p_key+4(1).
v_abhi+10(1) = '%'.
v_abhi+11(1) = p_key+5(1).
v_abhi+12(1) = '#'.
v_abhi+13(1) = p_key+6(1).
v_abhi+14(1) = '?'.
v_abhi+15(1) = p_key+7(1).
ENDIF.
IF p_st = 'X' AND p_ft = 'X'.
vmess 'Please Select Upload Download Indicator.'.
ENDIF.
IF p_ft = space.
PERFORM sub_val_form.
ENDIF.
IF p_st = space.
PERFORM sub_val_style.
ENDIF.
ENDFORM. " SUB_VALIDATION
*&---------------------------------------------------------------------*
*& Form SUB_VAL_FORM
*&---------------------------------------------------------------------*
FORM sub_val_form.
DATA: l_file1(20),
l_file2(20).
IF p_fname = space.
vmess 'Please enter the form name'.
ENDIF.
IF p_fname+0(1) <> 'Z'.
IF p_fu = 'X'.
vmess 'Form name should start with Z only'.
ENDIF.
ENDIF.
IF p_ffile = space.
vmess 'Please enter the file name'.
ENDIF.
SPLIT p_ffile AT '.' INTO l_file1 l_file2.
IF l_file2 <> space.
vmess 'Dont enter the extention with file name'.
ENDIF.
IF p_fu = 'X'.
SELECT SINGLE * FROM stxfadm WHERE formname = p_fname.
IF sy-subrc = 0.
vmess 'Form already exists'.
ENDIF.
ENDIF.
IF p_fd = 'X'.
SELECT SINGLE * FROM stxfadm WHERE formname = p_fname.
IF sy-subrc <> 0.
vmess 'Form does not exists'.
ENDIF.
ENDIF.
ENDFORM. " SUB_VAL_FORM
*&---------------------------------------------------------------------*
*& Form SUB_VAL_STYLE
*&---------------------------------------------------------------------*
FORM sub_val_style.
DATA: l_file1(20),
l_file2(20).
IF p_sname = space.
vmess 'Please enter the Style name'.
ENDIF.
IF p_sname+0(1) <> 'Z'.
vmess 'Style name should start with Z only'.
ENDIF.
IF p_sfile = space.
vmess 'Please enter the file name'.
ENDIF.
SPLIT p_sfile AT '.' INTO l_file1 l_file2.
IF l_file2 <> space.
vmess 'Dont enter extention with file name'.
ENDIF.
IF p_su = 'X'.
SELECT SINGLE * FROM stxsadm WHERE stylename = p_sname.
IF sy-subrc = 0.
vmess 'Style already exists'.
ENDIF.
ENDIF.
IF p_sd = 'X'.
SELECT SINGLE * FROM stxsadm WHERE stylename = p_sname.
IF sy-subrc <> 0.
vmess 'Style does not exists'.
ENDIF.
ENDIF.
ENDFORM. " SUB_VAL_STYLE
*&---------------------------------------------------------------------*
*& Form SUB_WARNING
*&---------------------------------------------------------------------*
FORM sub_warning.
DATA: l_line1(50),
l_line2(50),
l_line3(50),
l_title(50).
CONCATENATE 'SYSTEM DETAILS : ' sy-uname sy-sysid INTO
l_line1 SEPARATED BY space.
IF p_fu = 'X'.
CONCATENATE 'Upload Form : ' p_fname INTO l_line2
SEPARATED BY space.
ENDIF.
IF p_fd = 'X'.
CONCATENATE 'Download Form : ' p_fname INTO l_line2
SEPARATED BY space.
ENDIF.
IF p_su = 'X'.
CONCATENATE 'Upload Style : ' p_sname INTO l_line3
SEPARATED BY space.
ENDIF.
IF p_sd = 'X'.
CONCATENATE 'Download Style : ' p_sname INTO l_line3
SEPARATED BY space.
ENDIF.
*&---------------------------------------------------------------------*
*& Form SUB_Installation
*&---------------------------------------------------------------------*
FORM sub_installation .
DATA: l_abhishek,
l_ques(450),
BEGIN OF ttab OCCURS 0,
line(61),
END OF ttab.
DEFINE note.
ttab-line = &1.
append ttab.
clear ttab.
END-OF-DEFINITION.
l_ques+0(49) =
'This utility has been checked and tested by down'.
l_ques+49(49) =
'loading & Uploading several Smartforms and smart'.
l_ques+98(49) =
'style and found OK. Extensive testing & rigorous'.
l_ques+147(49) =
'code review makes this utility more smart, '.
l_ques+196(49) =
'useful and Intelligent. '.
l_ques+245(49) =
'But you will be solely responsible for any '.
l_ques+294(49) =
'damage caused by use or misuse of this utility. '.
l_ques+343(49) =
'Also, you will not modify or change this'.
l_ques+392(49) =
'utility.'.
note:
'Installation Done, Successfully !!!!!! ',
'. ',
' Thank you for installing the exiting tool ',
' "The Smartform/Smartstyle Upload Download Tool" ',
'. ',
'. ',
'. ',
'. ',
'Please note down the below installation number and ',
'the key which will be used by the program for identifying ',
'the right access. ',
'. ',
'. ',
' INSTALLATION NUMBER: ',
' KEY : ',
'. ',
'. ',
'After expiration of your key, if you want to extend your key, ',
'Please drop me mail at [email protected]. ',
'. ',
'Dont forget to mention the installation number. ',
'A New will be allocated to you with extended period. ',
'. ',
'. ',
'Thank You. ',
'. ',
'Abhishek Kumar ',
'[email protected] '.
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
titlebar = 'I Agree'
text_question = l_ques
text_button_1 = 'I ACCEPT'
text_button_2 = 'I REJECT'
default_button =
display_cancel_button =
IMPORTING
answer = l_abhishek
EXCEPTIONS
text_not_found = 1
OTHERS = 2.
IF l_abhishek = '1'.
CLEAR l_abhishek.
PERFORM sub_0001 USING l_abhishek.
PERFORM sub_0002 USING l_abhishek.
PERFORM sub_0003 USING l_abhishek.
READ TABLE ttab INDEX 14.
ttab-line+25(14) = g_ins00.
MODIFY ttab INDEX 14.
READ TABLE ttab INDEX 15.
ttab-line+25(8) = p_key.
ttab-line+35(23) = 'Valid for next 15 Days'.
MODIFY ttab INDEX 15.
IF l_abhishek = space.
CALL FUNCTION 'POPUP_WITH_TABLE_DISPLAY'
EXPORTING
endpos_col = 70
endpos_row = 30
startpos_col = 10
startpos_row = 5
titletext = 'Welcome'
TABLES
valuetab = ttab
EXCEPTIONS
break_off = 1
OTHERS = 2.
PERFORM sub_0004 USING l_abhishek .
SUBMIT (sy-repid) VIA SELECTION-SCREEN .
ELSE.
REFRESH ttab. CLEAR ttab.
note:
' ERROR !! ',
'. ',
' Some error has been occured, while installing the tool. ',
'. ',
'Probable reason : ',
' 1. Error in generating the Text Element ',
' 2. Error in Instalation Congiguration ',
' 3. Error in Inserting the report ',
' 4. Error in Modifying the database tables ',
'. ',
'Error Code: ',
l_abhishek,
'. ',
'Please drop me a mail with error Code at "[email protected]": '.
CALL FUNCTION 'POPUP_WITH_TABLE_DISPLAY'
EXPORTING
endpos_col = 70
endpos_row = 30
startpos_col = 10
startpos_row = 5
titletext = 'Error'
TABLES
valuetab = ttab
EXCEPTIONS
break_off = 1
OTHERS = 2.
ENDIF.
ELSE.
LEAVE PROGRAM.
ENDIF.
ENDFORM. " SUB_Installation
*&---------------------------------------------------------------------*
*& Form sub_0001
*&---------------------------------------------------------------------*
FORM sub_0001 USING l_abhishek.
DATA: l_lines LIKE sy-index.
DATA: itab LIKE textpool OCCURS 50 WITH HEADER LINE.
READ TEXTPOOL sy-repid INTO itab LANGUAGE sy-langu.
DESCRIBE TABLE itab LINES l_lines.
IF itab[] IS INITIAL OR l_lines < 10.
REFRESH itab.
CLEAR itab.
app: 'I' '101' 'Smart Form Name',
'I' '102' 'File Name',
'I' '103' 'None',
'I' '104' 'Upload Indicator',
'I' '105' 'Download Indicator',
'I' '106' 'Smart Style Name',
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.