WS_QUERY
hi all,
i wants to know the relavent function module for WS_QUERY whis is now absaolute
Please suggest me the function module name and how to use it.
Thank you.
Girish.
Hi again,
1. here we dont have erp 2004.
so i won't be able to tell u the FM.
2. however,
3. u can use the FM (ws_query)
or the fm which i told u
(see SFES function group)
4. They will work fine, there won't be any problem,
bcos these functions are already there
in standard sap programs and working fine.
regards,
amit m.
Similar Messages
-
"WS_QUERY" is obsolete in ECC 6.0
Hi Guys
Which is the correct Function module in ECC 6.0 is related to "WS_QUERY"
Thanks,
Gourisankar.Refer to this thread in sdn
CALL FUNCTION 'WS_QUERY'
or refer
Use the appropriate module from the function group SFES.
The appropriate function modules from funciton group SFES.
GUI_GET_DESKTOP_INFO
GUI_GET_FILE_INFO
GUI_EXEC
GUI_RUN etc
The Equivalent Function Module for in ABAP 4.7 is
WS_QUERY-File Exist is CL_GUI_FRONTEND_SERVICES=>FILE_EXIST , or ,
WS_QUERY-Directory Exist is CL_GUI_FRONTEND_SERVICES=>DIRECTORY_EXIST.
Reward if useful. -
Replacement for ws_query
Hi,
We are using WS_QUERY FM to get the length of file name.
CALL FUNCTION 'WS_QUERY'
EXPORTING
filename = l_filename
query = 'FL'
IMPORTING
return = return
This FM is obslete in ECC 6.0. So is there any FM or method which provides the same functionality.
Thanks & Regards,
Sri ramya g.data:V_FILENAME LIKE RLGRAP-FILENAME value 'C:\Documents and Settings\narayanp\Desktop\pass.txt',
V_RETURN TYPE I.
DATA:L_FILE TYPE STRING,
RC TYPE I.
CALL FUNCTION 'WS_QUERY'
EXPORTING
FILENAME = V_FILENAME
QUERY = 'FL'
IMPORTING
RETURN = V_RETURN
EXCEPTIONS
OTHERS = 1.
*MOVE V_FILENAME TO L_FILE.
*CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_GET_SIZE
EXPORTING
FILE_NAME = L_FILE
IMPORTING
FILE_SIZE = RC
EXCEPTIONS
FILE_GET_SIZE_FAILED = 1
CNTL_ERROR = 2
ERROR_NO_GUI = 3
NOT_SUPPORTED_BY_GUI = 4
others = 5
*IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
*ENDIF.
*CALL METHOD CL_GUI_CFW=>FLUSH
EXCEPTIONS
CNTL_SYSTEM_ERROR = 1
CNTL_ERROR = 2
others = 3
*IF SY-SUBRC <> 0.
*MOVE RC TO V_RETURN .
*ENDIF.
WRITE V_RETURN . -
Replacement of WS_QUERY to get length of filename
Hi,
We are using WS_QUERY FM to get the length of file name.
CALL FUNCTION 'WS_QUERY'
EXPORTING
filename = l_filename
query = 'FL'
IMPORTING
return = return
This FM is obslete in ECC 6.0. So is there any FM or method which provides the same functionality.
Regards
MandeepGUI_GET_DESKTOP_INFO
or
You can make use of the method "FILE_EXIST" or "DIRECTORY_EXIST" or "GET_PLATFORM" of the class "CL_GUI_FRONTEND_SERVICES" -
Ws_query function module obsolete in ECC 6.0
HI experts,
V r upgrading system from 4.6 to ecc 6.0 . In one of the programs FM ws_query is obsole, pls let me know the replacement of it.
form process_selections_filen.
call function 'WS_QUERY'
exporting
filename = p_filen
query = 'FE'
importing
return = g_subrc
exceptions
others = 1.
check syst-subrc ne 0 or g_subrc ne 1.
message e000(zz) with p_filen text-e01.
endform.You must OO ABAP.
You can use a method of CL_GUI_FRONTEND_SERVICES class to do the same process. This is the new class for handling files. -
FRONTEND_ERROR in the "WS_QUERY"
Hello Experts,
I am getting an runtime error when trying to open an archived invoice via transaction FBL5N.This runtime error is coming in the FM " WS_QUERY" with description as " Exception condition "Frontend Error raised." Is this error is related to the SAP/IXOS/LiveLink or the SAP Gui?
Currently I am using SAP GUI 640 and we recently upgraded to the ECC 6.0 from 4.7.
Please provide your valuable inputs to overcome this problem.
Thanks and Regards,
SachinEven we are getting this error.
Is there any solution to this error? -
Regarding WS_QUERY function
HEY GUYS,
i have used old func module as below.
CALL FUNCTION WS_QUERY
exporting
QUERY = XP
IMPORTING
RETURN = XXL_DIR
CALL FUNCTION WS_QUERY
exporting
QUERY = ws
IMPORTING
RETURN = win_sys
now i want the same functionality replacement in 4.7
can u sugest me both equavalent one.
regards
ambichan.Hi ambi,
try:
CALL METHOD cl_gui_frontend_services=>directory_list_files
EXPORTING
directory = directory
CHANGING
file_table = ftab
count = z.
*don't forget:
CALL METHOD cl_gui_cfw=>flush.
Andreas -
Hi,
what is the purpose of ws_query function module??
Thanks & Regards,
abc xyzShort Text
OBSOLETE: Execute Query Functions on Presentation Server
This module is obsolete. Use the appropriate module from the function group SFES.
Queries the file parameters and environment variables on the presentation server. The length or the existence of files can be determined.
Parameters
ENVIRONMENT
FILENAME
QUERY
WINID
RETURN
Exceptions
INV_QUERY
NO_BATCH
FRONTEND_ERROR
Function Group
GRAP
Thanks,
Max -
Hi all,
Can you please say me how am i to change this obsolete FM to class CL_GUI_FRONTEND_SERVICES
PARAMETERS: PCPATH LIKE RLGRAP-FILENAME
DEFAULT 'c:\temp\rbe_extract.txt'.
DATA: PATH LIKE PCPATH.
CALL FUNCTION 'WS_QUERY'
EXPORTING
ENVIRONMENT = ' '
FILENAME = PATH
QUERY = 'DE'
WINID = ' '
IMPORTING
RETURN = ERR_CODE
EXCEPTIONS
INV_QUERY = 1
NO_BATCH = 2
FRONTEND_ERROR = 3
OTHERS = 4.Hi,
Use this F.M
CL_GUI_FRONTEND_SERVICES=>DIRECTORY_EXIST (if the query is 'DE')
or CL_GUI_FRONTEND_SERVICES=>FILE_EXIST (if the query is 'FE')
IF U_QUERY = 'DE'.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>DIRECTORY_EXIST
EXPORTING
DIRECTORY = W_FILENAME
RECEIVING
RESULT = W_RETURN
EXCEPTIONS
CNTL_ERROR = 1
ERROR_NO_GUI = 2
WRONG_PARAMETER = 3
NOT_SUPPORTED_BY_GUI = 4
others = 5.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ELSEIF U_QUERY = 'FE'.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_EXIST
EXPORTING
FILE = W_FILENAME
RECEIVING
RESULT = W_RETURN
EXCEPTIONS
CNTL_ERROR = 1
ERROR_NO_GUI = 2
WRONG_PARAMETER = 3
NOT_SUPPORTED_BY_GUI = 4
others = 5.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF.
IF W_RETURN = 'X'.
C_RETURN = '1'.
ELSE.
C_RETURN = ' '.
ENDIF.
Cheers,
Simha.
Reward all the helpful answers... -
Replacement for ws_query FM
Is there any replacement for the function module WS_query.
santosh.bHi Santosh,
The Equivalent Function Module for <b>WS_QUERY</b>-File Exist in ABAP 4.7 is
CL_GUI_FRONTEND_SERVICES=>FILE_EXIST or WS_QUERY-Directory Exist is CL_GUI_FRONTEND_SERVICES=>DIRECTORY_EXIST.
Check this Link.
Re: absolute function
Regards,
AS -
Hi Experts, replace function module WS_QUERY to return the name of OS?
Hi Experts,
the function WS_QUERY can return your computer operating system, you can try it SE37(WS_QUERY), and only give value 'OS' to the QUERY parameter and execute the function, you can see it in RETURN parameter, but now this function is obsolete and I must replace it with another function or method, can anyone of you tell me which function can totally(the return value need to be the same, but any valuable feedback is also welcome) replace it? thanks in advance!
Kind regards
DawsonHi Dawson,
You can use the static method GET_PLATFORM of the class CL_GUI_FRONTEND_SERVICES.
Regards,
Jeevan -
Ws_query inEcc 6.0
hi friends,
can anyone tell me what is the replacement Callfunction
for WS_QUERY and WS_FILENAME_GET.this is both are obsolete
in ECC 6.0
thanks in advance
regards,
sooryaHi Soorya,
You can use ABAP Objects.
Copy paste the code below it works fine.
PARAMETER : p_file LIKE rlgrap-filename.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR path.
DATA: directory TYPE string,
filetable TYPE filetable,
line TYPE LINE OF filetable,
rc TYPE i.
CALL METHOD cl_gui_frontend_services=>get_temp_directory
CHANGING
temp_dir = directory.
CALL METHOD cl_gui_frontend_services=>file_open_dialog
EXPORTING
window_title = 'SELECT THE FILE'
initial_directory = directory
file_filter = '*.XLS'
multiselection = ' '
CHANGING
file_table = filetable
rc = rc.
IF rc = 1.
READ TABLE filetable INDEX 1 INTO line.
P_FILE = line-filename.
ENDIF.
The WS_* functions are replaced by class CL_GUI_FRONTEND_SERVICES.
More info: -->
Old...
> New !
POPUP_TO_DECIDE...
> POPUP_TO_CONFIRM
POPUP_TO_GET_VALUE...
> POPUP_GET_VALUES
RH_USERS_OF_ACTIVITYGROUP_GET...
> RH_ACTIVITYGROUP_USER_VIEW (??Check it) !
WS_EXEC...
> CL_GUI_FRONTEND_SERVICES=>EXECUTE (or, FM: GUI_EXEC) !
WS_FILE_DELETE...
> CL_GUI_FRONTEND_SERVICES=>FILE_DELETE (or, FM: GUI_DELETE_FILE)!
WS_QUERY...
> Various methods in CL_GUI_FRONTEND_SERVICES (like GET_PLATFORM etc...)!
WS_FILENAME_GET...
> CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG
Cheers
VJ
Message was edited by: Vijayendra Rao -
Looking for some assistancte in GUI_DOWNLOAD
Hi there,
See I have this exercise I have to do here. Basically I have to create a program that will download the contects of SBOOK to my pc. I have to use GUI_DOWNLOAD in this exercise. Also, the user will have to input the path and file name of the file to be downloaded to. I have place appropriate error message on the screen as well but I'm not sure how to do this.Being relatively new to this, I tried looking for some samples and this is what I came up so far.
REPORT ZISTANZS_TRNG_EX9C.
TABLES: SBOOK.
PARAMETERS: FILEINP(30) DEFAULT 'c:\TEMP\wee.txt' OBLIGATORY.
DATA: BEGIN OF ITAB OCCURS 100.
INCLUDE STRUCTURE SBOOK.
DATA: END OF ITAB.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = FILEINP
FILETYPE = 'ASC'
write_field_separator = 'X'
TABLES
DATA_TAB = ITAB
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_WRITE_ERROR = 2
OTHERS = 3.
Unfortunately, it doesn't work though. It keeps saying that my FILENAME is not the same data type as FILEINP? I'm asking for some assistance in how this can be properly solved? Any help would be appreciated /Hi,
Please refer the code below:
* File download, uses older techniques but achieves a perfectly
* acceptable solution which also allows the user to append data to
* an existing file.
PARAMETERS: p_file like rlgrap-filename.
* Internal table to store export data
DATA: begin of it_excelfile occurs 0,
row(500) type c,
end of it_excelfile.
DATA: rc TYPE sy-ucomm,
ld_answer TYPE c.
CALL FUNCTION 'WS_QUERY'
EXPORTING
query = 'FE' "File Exist?
filename = p_file
IMPORTING
return = rc.
IF rc NE 0. "If File alread exists
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
* TITLEBAR = ' '
* DIAGNOSE_OBJECT = ' '
text_question = 'File Already exists!!'
text_button_1 = 'Replace'
* ICON_BUTTON_1 = ' '
text_button_2 = 'New name'
* ICON_BUTTON_2 = ' '
* DEFAULT_BUTTON = '1'
* DISPLAY_CANCEL_BUTTON = 'X'
* USERDEFINED_F1_HELP = ' '
* START_COLUMN = 25
* START_ROW = 6
* POPUP_TYPE =
IMPORTING
answer = ld_answer
* TABLES
* PARAMETER =
EXCEPTIONS
text_not_found = 1
OTHERS = 2.
* Option 1: Overwrite
IF ld_answer EQ '1'.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
* BIN_FILESIZE =
filename = p_file "File Name
filetype = 'ASC'
* IMPORTING
* FILELENGTH =
TABLES
data_tab = it_excelfile "Data table
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE i003(zp) WITH
'There was an error during Excel file creation'(200).
exit. "Causes short dump if removed and excel document was open
ENDIF.
* Option 2: New name.
ELSEIF ld_answer EQ '2'.
CALL FUNCTION 'DOWNLOAD'
EXPORTING
filename = p_file "File name
filetype = 'ASC' "File type
* col_select = 'X' "COL_SELECT
* col_selectmask = 'XXXXXXXXXXXXXXXXXXXXXXXXXX'
* "COL_SELECTMASK
filetype_no_show = 'X' "Show file type selection?
* IMPORTING
* act_filename = filename_dat
TABLES
data_tab = it_excelfile "Data table
* fieldnames =
EXCEPTIONS
file_open_error = 01
file_write_error = 02
invalid_filesize = 03
invalid_table_width = 04
invalid_type = 05
no_batch = 06
unknown_error = 07.
ENDIF.
ELSE. "File does not alread exist.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
* BIN_FILESIZE =
filename = p_file "File name
filetype = 'ASC' "File type
* IMPORTING
* FILELENGTH =
TABLES
data_tab = it_excelfile "Data table
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE i003(zp) WITH
'There was an error during Excel file creation'(200).
exit. "Causes short dump if removed and excel document was open
ENDIF.
ENDIF.
Thanks,
Sriram Ponna. -
How to upload excel file in application server??
Hi,
How to upload an excel file into internal table in background mode from application server?
ThanksHi vipin,
check this it may help you...
hope below links helps you
Export the report list to Excel Sheet
http://www.sapdevelopment.co.uk/file/file_updown.htm
or below is a sample programme which helps you upload and download
REPORT ytest5 LINE-SIZE 80
LINE-COUNT 65
NO STANDARD PAGE HEADING.
TABLES: dd02l, dd03l.
* selection screen
SELECTION-SCREEN BEGIN OF BLOCK b00 WITH FRAME TITLE text-b00.
SELECTION-SCREEN BEGIN OF BLOCK b01 WITH FRAME TITLE text-b01.
PARAMETERS: tabname LIKE dd02l-tabname OBLIGATORY.
SELECTION-SCREEN END OF BLOCK b01.
SELECTION-SCREEN BEGIN OF BLOCK b03 WITH FRAME TITLE text-b03.
PARAMETERS: path(30) TYPE c DEFAULT 'C:SAPWorkdir'.
SELECTION-SCREEN END OF BLOCK b03.
SELECTION-SCREEN BEGIN OF BLOCK b04 WITH FRAME TITLE text-b04.
PARAMETERS: p_exp RADIOBUTTON GROUP radi,
p_imp RADIOBUTTON GROUP radi,
p_clear AS CHECKBOX.
SELECTION-SCREEN END OF BLOCK b04.
SELECTION-SCREEN END OF BLOCK b00.
* data
DATA: q_return LIKE syst-subrc,
err_flag(1) TYPE c,
answer(1) TYPE c,
w_text1(62) TYPE c,
w_text2(40) TYPE c,
winfile(128) TYPE c,
w_system(40) TYPE c,
winsys(7) TYPE c,
zname(8) TYPE c,
w_line(80) TYPE c.
* internal tables
DATA : BEGIN OF textpool_tab OCCURS 0.
INCLUDE STRUCTURE textpool.
DATA : END OF textpool_tab.
* table for subroutine pool
DATA : itab(80) OCCURS 0.
* events
INITIALIZATION.
PERFORM check_system.
AT SELECTION-SCREEN ON tabname.
PERFORM check_table_exists.
START-OF-SELECTION.
PERFORM init_report_texts.
PERFORM request_confirmation.
END-OF-SELECTION.
IF answer = 'J'.
PERFORM execute_program_function.
ENDIF.
TOP-OF-PAGE.
PERFORM process_top_of_page.
* forms
* FORM CHECK_TABLE_EXISTS *
FORM check_table_exists.
SELECT SINGLE * FROM dd02l
INTO CORRESPONDING FIELDS OF dd02l
WHERE tabname = tabname.
CHECK syst-subrc NE 0.
MESSAGE e402(mo) WITH tabname.
ENDFORM.
* FORM INIT_REPORT_TEXTS *
FORM init_report_texts.
READ TEXTPOOL syst-repid
INTO textpool_tab LANGUAGE syst-langu.
LOOP AT textpool_tab
WHERE id EQ 'R' OR id EQ 'T'.
REPLACE '&1............................'
WITH tabname INTO textpool_tab-entry.
MODIFY textpool_tab.
ENDLOOP.
ENDFORM.
* FORM REQUEST_CONFIRMATION *
FORM request_confirmation.
* import selected, confirm action
IF p_imp = 'X'.
* build message text for popup
CONCATENATE 'Data for table'
tabname
'will be imported' INTO w_text1 SEPARATED BY space.
* check if delete existing selected, and change message text
IF p_clear = ' '.
w_text2 = 'and appended to the end of existing data'.
ELSE.
w_text2 = 'Existing Data will be deleted'.
ENDIF.
CALL FUNCTION 'POPUP_TO_CONFIRM_STEP'
EXPORTING
defaultoption = 'N'
textline1 = w_text1
textline2 = w_text2
titel = 'Confirm Import of Data'
cancel_display = ' '
IMPORTING
answer = answer
EXCEPTIONS
OTHERS = 1.
ELSE.
* export selected, set answer to yes so export can continue
answer = 'J'.
ENDIF.
ENDFORM.
* FORM EXECUTE_PROGRAM_FUNCTION *
FORM execute_program_function.
PERFORM build_file_name.
CLEAR: q_return,err_flag.
IF p_imp = 'X'.
PERFORM check_file_exists.
CHECK err_flag = ' '.
PERFORM func_import.
ELSE.
PERFORM func_export.
ENDIF.
ENDFORM.
* FORM BUILD_FILE_NAME *
FORM build_file_name.
MOVE path TO winfile.
WRITE '' TO winfile+30.
WRITE tabname TO winfile+31.
WRITE '.TAB' TO winfile+61(4).
CONDENSE winfile NO-GAPS.
ENDFORM.
* FORM CHECK_FILE_EXISTS *
FORM check_file_exists.
CALL FUNCTION 'WS_QUERY'
EXPORTING
filename = winfile
query = 'FE'
IMPORTING
return = q_return
EXCEPTIONS
OTHERS = 1.
IF syst-subrc NE 0 OR q_return NE 1.
err_flag = 'X'.
ENDIF.
ENDFORM.
* FORM func_export *
FORM func_export.
CLEAR itab. REFRESH itab.
APPEND 'PROGRAM SUBPOOL.' TO itab.
APPEND 'FORM DOWNLOAD.' TO itab.
APPEND 'DATA: BEGIN OF IT_TAB OCCURS 0.' TO itab.
CONCATENATE 'INCLUDE STRUCTURE'
tabname
'.' INTO w_line SEPARATED BY space.
APPEND w_line TO itab.
APPEND 'DATA: END OF IT_TAB.' TO itab.
CONCATENATE 'SELECT * FROM'
tabname
'INTO TABLE IT_TAB.' INTO w_line SEPARATED BY space.
APPEND w_line TO itab.
APPEND 'CALL FUNCTION ''WS_DOWNLOAD''' TO itab.
APPEND 'EXPORTING' TO itab.
CONCATENATE 'filename = ' ''''
winfile '''' INTO w_line SEPARATED BY space.
APPEND w_line TO itab.
APPEND 'filetype = ''DAT''' TO itab.
APPEND 'TABLES' TO itab.
APPEND 'DATA_TAB = IT_TAB.' TO itab.
APPEND 'DESCRIBE TABLE IT_TAB LINES sy-index.' TO itab.
APPEND 'FORMAT COLOR COL_NORMAL INTENSIFIED OFF.' TO itab.
APPEND 'WRITE: /1 syst-vline,' TO itab.
APPEND '''EXPORT'',' TO itab.
APPEND '15 ''data line(s) have been exported'',' TO itab.
APPEND '68 syst-index,' TO itab.
APPEND '80 syst-vline.' TO itab.
APPEND 'ULINE.' TO itab.
APPEND 'ENDFORM.' TO itab.
GENERATE SUBROUTINE POOL itab NAME zname.
PERFORM download IN PROGRAM (zname).
ENDFORM.
* FORM func_import *
FORM func_import.
CLEAR itab. REFRESH itab.
APPEND 'PROGRAM SUBPOOL.' TO itab.
APPEND 'FORM UPLOAD.' TO itab.
APPEND 'DATA: BEGIN OF IT_TAB OCCURS 0.' TO itab.
CONCATENATE 'INCLUDE STRUCTURE'
tabname
'.' INTO w_line SEPARATED BY space.
APPEND w_line TO itab.
APPEND 'DATA: END OF IT_TAB.' TO itab.
APPEND 'DATA: BEGIN OF IT_TAB2 OCCURS 0.' TO itab.
CONCATENATE 'INCLUDE STRUCTURE'
tabname
'.' INTO w_line SEPARATED BY space.
APPEND w_line TO itab.
APPEND 'DATA: END OF IT_TAB2.' TO itab.
APPEND 'CALL FUNCTION ''WS_UPLOAD''' TO itab.
APPEND 'EXPORTING' TO itab.
CONCATENATE 'filename = ' ''''
winfile '''' INTO w_line SEPARATED BY space.
APPEND w_line TO itab.
APPEND 'filetype = ''DAT''' TO itab.
APPEND 'TABLES' TO itab.
APPEND 'DATA_TAB = IT_TAB.' TO itab.
IF p_clear = 'X'.
CONCATENATE 'SELECT * FROM'
tabname
'INTO TABLE IT_TAB2.' INTO w_line SEPARATED BY space.
APPEND w_line TO itab.
APPEND 'LOOP AT IT_TAB2.' TO itab.
CONCATENATE 'DELETE'
tabname
'FROM IT_TAB2.' INTO w_line SEPARATED BY space.
APPEND w_line TO itab.
APPEND 'ENDLOOP.' TO itab.
APPEND 'COMMIT WORK.' TO itab.
ENDIF.
APPEND 'LOOP AT IT_TAB.' TO itab.
CONCATENATE 'MODIFY'
tabname
'FROM IT_TAB.' INTO w_line SEPARATED BY space.
APPEND w_line TO itab.
APPEND 'ENDLOOP.' TO itab.
APPEND 'DESCRIBE TABLE IT_TAB LINES sy-index.' TO itab.
APPEND 'FORMAT COLOR COL_NORMAL INTENSIFIED OFF.' TO itab.
APPEND 'WRITE: /1 syst-vline,' TO itab.
APPEND '''IMPORT'',' TO itab.
APPEND '15 ''data line(s) have been imported'',' TO itab.
APPEND '68 syst-index,' TO itab.
APPEND '80 syst-vline.' TO itab.
APPEND 'ULINE.' TO itab.
APPEND 'ENDFORM.' TO itab.
GENERATE SUBROUTINE POOL itab NAME zname.
PERFORM upload IN PROGRAM (zname).
ENDFORM.
* Form CHECK_SYSTEM
* Check users workstation is running
* WINDOWS 95, or WINDOWS NT.
* OS/2 uses 8.3 file names which are no good for
* this application as filenames created are 30 char
* same as table name.
* You could change the logic to only use the first 8 chars
* of the table name for the filename, but you could possibly
* get problems if users had exported already with a table
* with the same first 8 chars.
* As an alternate method you could request the user to input
* the full path including filename and remove the logic to
* build the path using the table name.
FORM check_system.
CALL FUNCTION 'WS_QUERY'
EXPORTING
query = 'WS'
IMPORTING
return = winsys.
IF winsys NE 'WN32_95'.
WRITE: 'Windows NT or Windows 95/98 is required'.
EXIT.
ENDIF.
ENDFORM. " CHECK_SYSTEM
* FORM PROCESS_TOP_OF_PAGE *
FORM process_top_of_page.
FORMAT COLOR COL_HEADING INTENSIFIED ON.
ULINE.
CONCATENATE syst-sysid
syst-saprl
syst-host INTO w_system SEPARATED BY space.
WRITE : AT /1(syst-linsz) w_system CENTERED.
WRITE : AT 1 syst-vline, syst-uname.
syst-linsz = syst-linsz - 11.
WRITE : AT syst-linsz syst-repid(008).
syst-linsz = syst-linsz + 11.
WRITE : AT syst-linsz syst-vline.
LOOP AT textpool_tab WHERE id EQ 'R'.
WRITE : AT /1(syst-linsz) textpool_tab-entry CENTERED.
ENDLOOP.
WRITE : AT 1 syst-vline, syst-datum.
syst-linsz = syst-linsz - 11.
WRITE : AT syst-linsz syst-tcode(004).
syst-linsz = syst-linsz + 11.
WRITE : AT syst-linsz syst-vline.
LOOP AT textpool_tab WHERE id EQ 'T'.
WRITE : AT /1(syst-linsz) textpool_tab-entry CENTERED.
ENDLOOP.
WRITE : AT 1 syst-vline, syst-uzeit.
syst-linsz = syst-linsz - 11.
WRITE : AT syst-linsz 'Page', syst-pagno.
syst-linsz = syst-linsz + 11.
WRITE : AT syst-linsz syst-vline.
ULINE.
FORMAT COLOR COL_HEADING INTENSIFIED OFF.
LOOP AT textpool_tab WHERE id EQ 'H'.
WRITE : AT /1(syst-linsz) textpool_tab-entry.
ENDLOOP.
ULINE.
ENDFORM.
if it helps you reward with points.
regards,
venu
regards,
venu. -
Upload program for vendor master
Hi Friends,
Could you please help me in this.
actually i have a program like this:
i have to download the data from an excel sheet and reformat it and output into a text file so that the data can be uploaded into vendor master using standard progarm
<b>"RFBIKR00".</b>
i have written the program like this:
but in the middle when formatting the data...i'm facing the problem....
plz help me in solving that...
thnx very very much...........
the program i wrote is like this:
<b>
tables: lfa1,
lfb1,
lfm1,
lfbk,
bnka,
bgr00,
blf00,
blfa1,
blfb1,
blfbk,
blfm1,
blfb5,
blfbw,
blfei,
blfza,
blflr,
blfm2,
bwyt3,
bwyt1,
blfat.
*--- Internal table for spread sheet.
data: t_filedata like alsmex_tabline occurs 0 with header line.
*--- Internal table for Vendor Master Data in Spread Sheet.
data: begin of t_sheet occurs 0,
name1 like lfa1-name1, "vendor name1
name2 like lfa1-name2, "vendor name2
altkn like lfb1-altkn, "previous master record number
bukrs like lfb1-bukrs, "company code
ekorg like lfm1-ekorg, "purchase organization
ktokk like lfa1-ktokk, "account group
stras like lfa1-stras, "street
street4 like lfa1-name4, "street4
pfach like lfa1-pfach, "po box
ort01 like lfa1-ort01, "city
regio like lfa1-regio, "region
pstlz like lfa1-pstlz, "postal code
land1 like lfa1-land1, "country
telf1 like lfa1-telf1, "first telephone number
telfx like lfa1-telfx, "first fax number
stcd1 like lfa1-stcd1, "fed tax ID#
brsch like lfa1-brsch, "commodity code
akont like lfb1-akont, "reconciliation account
mindk like lfb1-mindk, "monitory indicator
zwels like lfb1-zwels, "payment method
reprf like lfb1-reprf, "check double invoice
banka like bnka-banka, "bank name
stret like bnka-stras, "house number and street
city like bnka-ort01, "city
provz like bnka-provz, "bank state
banks like lfbk-banks, "bank country
swift like bnka-swift, "swift code
bankl like lfbk-bankl, "aba#
bankn like lfbk-bankn, "bank account no
zterm like lfb1-zterm, "payment terms
terms like lfm1-zterm, "terms of payment key
end of t_sheet.
*--- Internal table for Vendor Master data in Text File.
data: begin of t_file occurs 0,
s_session type bgr00,
s_header type blf00,
s_blfa1 type blfa1,
s_blfb1 type blfb1,
s_blfbk type blfbk,
s_blfm1 type blfm1,
s_blfbk type blfbk,
s_blfb5 type blfb5,
s_blfza type blfza,
s_blfm1 type blfm1,
s_blfat type blfat,
s_bwyt1 type bwyt1,
s_bwyt3 type bwyt3,
s_blfm2 type blfm2,
s_blfei type blfei1,
s_blfbw type blfbw,
s_blflr type blflr,
end of t_file.
SELECTION SCREEN *****
*---Selection Parameters.
selection-screen begin of block b1 with frame title title1.
parameters: p_xlfile like rlgrap-filename.
parameters: p_txfile type rlgrap-filename.
selection-screen end of block b1.
INITIALIZATION *****
initialization.
*---Initialize text fields for selection-screen.
title1 = 'Selection Parameters'.
AT SELECTION-SCREEN *****
at selection-screen.
at selection-screen on p_xlfile.
perform check_file using p_xlfile.
at selection-screen on value-request for p_xlfile.
perform select_file using p_xlfile.
START-OF-SELECTION *****
start-of-selection.
clear t_sheet.
refresh t_sheet.
*---Upload Spreadsheet.
perform read_file using p_xlfile.
*---Process data into formatted internal table.
perform format_data.
append t_file.
clear t_file.
endloop.
*---Download data to Text file.
perform download_data.
TOP-OF-PAGE *****
top-of-page.
perform top_of_page.
S-U-B-R-O-U-T-I-N-E-S *****
Form TOP_OF_PAGE
Calling the Standard Report Header
form top_of_page.
perform header using 'CREATE FILE FOR'
'VENDOR MASTER UPLOAD'
132.
skip 2.
endform. "TOP_OF_PAGE
Form check_file **
Checking the File entered **
data: p_filename type string.
form check_file using p_filename.
*---The entered File must be Excel spreadsheet.
data: l_length type i,
l_ext(4) type c.
l_length = strlen( p_xlfile ).
subtract 4 from l_length.
l_ext = p_xlfile+l_length(4).
translate l_ext to upper case.
if l_ext <> '.XLS'.
message e009 with 'Only Excel spreadsheets are supported'.
endif.
*---Check if File exits and not empty.
data: l_return(10) type c.
CALL FUNCTION 'WS_QUERY'
EXPORTING
FILENAME = p_filename
QUERY = 'FL'
IMPORTING
RETURN = l_return
EXCEPTIONS
INV_QUERY = 1
NO_BATCH = 2
FRONTEND_ERROR = 3
OTHERS = 4
IF l_return = space or l_return = '0'.
message e530(pj) with p_filename.
ENDIF.
endform. "CHECK_FILE
Form select_file **
form select_file using p_filename like rlgrap-filename.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
PROGRAM_NAME = SYST-REPID
DYNPRO_NUMBER = SYST-DYNNR
FIELD_NAME = ' '
STATIC = 'X'
MASK = ',MS Excel (.xls),.xls.'
CHANGING
FILE_NAME = p_filename
EXCEPTIONS
MASK_TOO_LONG = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE e838(29) with p_filename.
ENDIF.
endform. "SELECT_FILE
Form read_file **
form read_file using p_filename like rlgrap-filename.
*---Display status message for User.
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
TEXT = 'Uploading Spreadsheet'
*---Upload spreadsheet.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
FILENAME = p_filename
I_BEGIN_COL = 1
I_BEGIN_ROW = 1
I_END_COL = 256
I_END_ROW = 65536
TABLES
INTERN = t_filedata
EXCEPTIONS
INCONSISTENT_PARAMETERS = 1
UPLOAD_OLE = 2
OTHERS = 3
IF t_filedata[] is initial.
message i009 with 'NO DATA FOUND IN FILE' p_filename.
stop.
ENDIF.
sort t_filedata by row col.
endform. "READ_FILE
Form format_data **
form format_data.
data: l_index type i.
field-symbols: <fs1>.
*---Display status message for user.
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
TEXT = ' Processing Data...'
loop at t_filedata.
l_index = t_filedata-col.
assign component l_index of structure t_sheet to <fs1>.
<fs1> = t_filedata-value.
at end of row.
append t_sheet.
clear t_sheet.
endat.
endloop.
refresh t_filedata.
free t_filedata.
endform. "FORMAT_DATA
Form download_data.
form download_data.
OPEN DATASET p_txfile for OUTPUT.
LOOP at t_file.
TRANSFER t_file to p_txfile.
ENDLOOP.
CLOSE DATASET p_txfile.
IF SY-SUBRC = 0.
WRITE: / 'Excel to Textfile for Vendor Master Upload: ', P_TXFILE.
ENDIF.
endform. "DOWNLOAD_DATA</b>Hi!
You don't need to program the 'translation' from a file into input data for RFBIKR00 yourself. SAP has done this, so that you can do this (nearly) without programming. If you need some special conversion rules, then you can add some coding, but most is possible without.
Have a look at transaction LSMW. It's not so complicated it looks at the first time. Just look at <a href="http://help.sap.com/saphelp_erp2004/helpdata/en/ad/2d54a41d7011d2b42e006094b944c8/frameset.htm">help</a> for the way to use LSMW.
Regards,
Christian
P.S.: sorry for lost your efforts, but you should switch to LSMW
Maybe you are looking for
-
I have 2 icloud accounts how can i see them both on my macbook and iphone
I have 2 icloud accounts how can I see them both on my macbook and iphone?
-
Transfer Order Collective Form
Hi All, I am working on TO Collective form. This form has a delivery number in it. But my requirement is they need the last 3 digits of the Delivery Number to be printed in a bigger font beside the company logo. I have written the following code in t
-
Configure a new Time Capsule via iMac in a home non-apple WLAN
Hi, I have a new Time Capsule and want to configure it via my iMac. Aim is to use the TC in an existing WLAN (Vodafone) and to have it as a backup device in my home WLAN. When I start the TC it always turned to a blinking amber. This is regardless if
-
Configuring Delegated Administrator
Following the Deployment Example of Sun Java Communications Suite 5 on a single host.. In the Configuring Delegated Administrator and Communications CLI when I run #/export/home/mail/SUNWcomm/sbin/config-commda and after entering the required input a
-
Some songs wont upload into ipod
for some reason, some songs won't upload into the ipod even though it should be uploaded automatically. i tried manually adding the songs but that didn't work. the comp says songs should already be in the ipod but they aren't there. they are in the s