CALL METHOD cl_gui_frontend_services= file_save_dialog
Hi,
I want to use 'CALL METHOD cl_gui_frontend_services=>file_save_dialog', to choose a path for saving my txt files. I only want the user to be able to choose the path and not have to supply a filename aswell. My filenames are standard in the program and I don't want them to be changed by the user.
Is there another method which is designed for this or is there a simple parameter I have missed?
Thanks and regards,
Simon.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR pa_f.
PERFORM f_search_help_pa_f1.
FORM f_search_help_pa_f1 .
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
program_name = sy-repid
dynpro_number = sy-dynnr
CHANGING
file_name = pa_f
EXCEPTIONS
mask_too_long = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. " f_search_help_pa_f1
Try this
Regards
Similar Messages
-
Error calling methods CL_GUI_FRONTEND_SERVICES
Hi all,
I have a requirement in BAPI (integrating solman to portal) to download file from app. server to local directory. I used the below FM to get temp directory of presntation server.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>GET_TEMP_DIRECTORY
CHANGING
TEMP_DIR = LV_TEMP_DIR
EXCEPTIONS
CNTL_ERROR = 1
ERROR_NO_GUI = 2
NOT_SUPPORTED_BY_GUI = 3
others = 4.
CALL METHOD cl_gui_cfw=>flush.
It works fine in R3, but when i called it from portal it shows Access not possible using 'NULL' object reference with a short dump .
st22 shows
Error in ABAP application program.
The current ABAP program "CL_GUI_FRONTEND_SERVICES======CP" had to be
terminated because one of the
statements could not be executed.
This is probably due to an error in the ABAP program.
An exception occurred. This exception is dealt with in more detail belo
. The exception, which is assigned to the class 'CX_SY_REF_IS_INITIAL',
neither
caught nor passed along using a RAISING clause, in the procedure
"GET_TEMP_DIRECTORY" "(METHOD)"
Since the caller of the procedure could not have expected this exceptio
to occur, the running program was terminated.
The reason for the exception is:
Attempt to access a component using 'NULL' object reference (points
to nothing).
An object reference must point to an object (an instance of a class)
before you can use it to access components (variable:
"CL_GUI_FRONTEND_SERVICES=>HANDLE").
Either the reference has not yet been set, or it has been reset to
'NULL' by a CLEAR statement.
When i put external break point and the dump comes during execution of CALL METHOD cl_gui_cfw=>flush.
Is it not possible to use CL_GUI_FRONTEND_SERVICES in RFC ??.
thanks and regards
JijoHi,
the dump is because you cannot use that function from a BSP application, which runs in internet or intranet. The procedure in this case is different:
DATA: flights TYPE flighttab,
flight LIKE LINE OF flights,
appl TYPE string,
filetype TYPE string,
output TYPE string,
output2 TYPE xstring,
response TYPE REF TO if_http_response,
l_len TYPE i,
seatsmax TYPE string,
seatsocc TYPE string.
appl = 'application/msexcel'.
filetype = 'attachment;filename=mi archivo.xls'.
SELECT * FROM sflight
INTO TABLE flights
UP TO 20 ROWS.
LOOP AT flights INTO flight.
seatsmax = flight-seatsmax. CONDENSE seatsmax.
seatsocc = flight-seatsocc. CONDENSE seatsocc.
CONCATENATE output
flight-carrid cl_abap_char_utilities=>horizontal_tab
flight-connid cl_abap_char_utilities=>horizontal_tab
flight-fldate cl_abap_char_utilities=>horizontal_tab
flight-planetype cl_abap_char_utilities=>horizontal_tab
seatsmax cl_abap_char_utilities=>horizontal_tab
seatsocc cl_abap_char_utilities=>horizontal_tab
cl_abap_char_utilities=>cr_lf
INTO output.
ENDLOOP.
response = runtime->server->response.
response->delete_header_field( name = if_http_header_fields=>cache_control ).
response->delete_header_field( name = if_http_header_fields=>expires ).
response->delete_header_field( name = if_http_header_fields=>pragma ).
response->set_header_field( name = if_http_header_fields=>content_type
value = appl ).
response->set_header_field( name = 'content-disposition'
value = filetype ).
CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
EXPORTING
text = output
mimetype = 'text/unicode; charset=utf-16le'
IMPORTING
buffer = output2.
CONCATENATE cl_abap_char_utilities=>byte_order_mark_little
output2 INTO output2 IN BYTE MODE.
l_len = XSTRLEN( output2 ).
response->set_data( data = output2
length = l_len ).
navigation->response_complete( ).
This is the code for downloading an Excel file. -
Hello SAP Gurus
My intention is to shutdown and restart communication channels on PI side. To do this externally, we can send a URL with right parameters.
I have written a simple ABAP code to do this by calling the method 'CL_GUI_FRONTEND_SERVICES 'with the URL. Since I have several channels, I am calling this method in a loop. It is doing the job well.
However, for each channel an IE browser screen pops up with the XML data for that particular URL. It is kind of annoying to see so many popups.
Is there a way in ABAP to supress this multiple browser pop ups? Is there a way to make this method run in the background?
I know that this method is meant to call a browser screen with the URL, however I want to suppress this Browser POP up and use the remaining function.
Any feedback will be highly appreciated.
Thanks
RamYou cannot use a frontend (GUI) service when a program is running in the background.
You'll have to call the URL in a different way... something that doesn't create a popup window. Or execute the command that is invoked when accessing that URL. -
Hello Experts,
Is there a way to disable the 'Cancel' button in method 'FILE_SAVE_DIALOG' of class
cl_gui_frontend_services? Because in our requirement, the saving of the file is mandatory.
Thank you guys and take care!HI, Viraylab
Use the Logic Bellow it will solve out your problem, using following you must provide a file name other wise after selecting Cancel button this dialog will appear again.
PERFORM save_dialog.
*& Form save_dialog
* text
FORM save_dialog.
DATA: filename TYPE string,
path TYPE string,
fullpath TYPE string.
CALL METHOD cl_gui_frontend_services=>file_save_dialog
EXPORTING
window_title = 'Select File Name'
CHANGING
filename = filename
path = path
fullpath = fullpath
EXCEPTIONS
cntl_error = 1
error_no_gui = 2
not_supported_by_gui = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
IF filename IS INITIAL.
PERFORM save_dialog.
ENDIF.
ENDFORM. "save_dialog
Please Reply if any Issue,
Best Regards,
Faisal -
Hi Guys,
I am saving Invoice Output type into local PDF file and using CL_GUI_FRONTEND_SERVICES=>FILE_SAVE_DIALOG to give user the choice where to save the file. It gives an abap short dump "Access not possible using 'NULL' object reference". and update is terminated in the same method.
I think output types are executing in Update Taks.
It's working fine when used in other programs(Normal)
Suggestions are Welcome. Thanks! Vijender
The code is :
CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_SAVE_DIALOG
EXPORTING
WINDOW_TITLE = 'Save PDF File'
DEFAULT_EXTENSION = 'PDF'
DEFAULT_FILE_NAME = LV_NAME_INIT
FILE_FILTER = '*.PDF'
INITIAL_DIRECTORY = 'C:'
PROMPT_ON_OVERWRITE = 'X'
CHANGING
FILENAME = LV_FNAME
PATH = LV_PATH_FOLDER
FULLPATH = LV_FILE_NAME
EXCEPTIONS
CNTL_ERROR = 1
ERROR_NO_GUI = 2
NOT_SUPPORTED_BY_GUI = 3
OTHERS = 4.HI, Viraylab
Use the Logic Bellow it will solve out your problem, using following you must provide a file name other wise after selecting Cancel button this dialog will appear again.
PERFORM save_dialog.
*& Form save_dialog
* text
FORM save_dialog.
DATA: filename TYPE string,
path TYPE string,
fullpath TYPE string.
CALL METHOD cl_gui_frontend_services=>file_save_dialog
EXPORTING
window_title = 'Select File Name'
CHANGING
filename = filename
path = path
fullpath = fullpath
EXCEPTIONS
cntl_error = 1
error_no_gui = 2
not_supported_by_gui = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
IF filename IS INITIAL.
PERFORM save_dialog.
ENDIF.
ENDFORM. "save_dialog
Please Reply if any Issue,
Best Regards,
Faisal -
Question for cl_gui_frontend_services= file_save_dialog
Hi Expert.
I made simple test page.
there is nothing but this code in oninitlization
* event handler for data retrieval
DATA: ld_filename TYPE string,
ld_path TYPE string,
ld_fullpath TYPE string,
ld_result TYPE i.
* Display save dialog window
CALL METHOD cl_gui_frontend_services=>file_save_dialog
EXPORTING
* window_title = ' '
DEFAULT_EXTENSION = 'XLS'
default_file_name = 'accountsdata'
INITIAL_DIRECTORY = 'c:temp'
CHANGING
filename = ld_filename
path = ld_path
fullpath = ld_fullpath
* Check user did not cancel request
CHECK ld_result EQ '0'.
and that shows
"method:FILE_SAVE_DIALOG ,line : 164
An attempt was made to execute a dynamic method callon an initial(NULL-) object reference. The reference must refer to an object."
why this error caught?
Did I miss something or made mistake BSP code above?
should I create some object before call cl_gui_frontend_services=>file_save_dialog?
I don't have any clue on this.
help me please. thanks .Oh yes - this most certainly will not work from BSP. This class and any other that uses the control framework are written as proxy objects to code that actually executes as part of the SAPGui on the client machine.
BSP is completly web centric. Its output can only be ran in a browser. To the browser the output of BSP doesn't look any different than any other web page that might come from ASP, JSP, PHP, etc.
Also because BSP runs in a browser - the amount of interaction that can occur with the client (particularly around file downloads) is somewhat limited. There is no file download element or a file save as dialog object. There are other ways to attach content to an HTTP Response or place it in a hidden iFrame - the browser is then responsible for intrepting this information and offering the file save as or open dialog based upon the appropriate MIME Type.
This weblog is the primer on BSP downloads written by the Jedi Master himself:
<a href="/people/mark.finnern/blog/2003/09/23/bsp-programming-handling-of-non-html-documents:///people/mark.finnern/blog/2003/09/23/bsp-programming-handling-of-non-html-documents
If you search you will find other examples in the older BSP weblogs as well. -
Cl_gui_frontend_services= file_save_dialog?
Hi All,
Im trying to use the below method, what are all the parameters need to fill and hw to declare those parameters.
CALL METHOD cl_gui_frontend_services=>file_save_dialog
EXPORTING
WINDOW_TITLE =
DEFAULT_EXTENSION =
DEFAULT_FILE_NAME =
FILE_FILTER =
INITIAL_DIRECTORY =
WITH_ENCODING =
PROMPT_ON_OVERWRITE = 'X'
CHANGING
filename =
path =
fullpath =
USER_ACTION =
FILE_ENCODING =
EXCEPTIONS
CNTL_ERROR = 1
ERROR_NO_GUI = 2
NOT_SUPPORTED_BY_GUI = 3
others = 4
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Puppy.Hi ,
copy this code and try this , after executing this code ypu will get the path into " lv_fullpath " .
and then pass this lv_fullpath to next function module like gui_download .
DATA: v_name TYPE string,
v_file TYPE rlgrap-filename,
lv_filename TYPE string,
lv_filen TYPE string,
lv_path TYPE string,
lv_fullpath TYPE string.
* MOVE v_name TO lv_filename.
CALL METHOD cl_gui_frontend_services=>file_save_dialog
EXPORTING
* WINDOW_TITLE =
* DEFAULT_EXTENSION =
* default_file_name = lv_filename
* WITH_ENCODING =
* FILE_FILTER =
* INITIAL_DIRECTORY =
* PROMPT_ON_OVERWRITE = 'X'
CHANGING
filename = lv_filen
path = lv_path
fullpath = lv_fullpath
* USER_ACTION =
* FILE_ENCODING =
EXCEPTIONS
cntl_error = 1
error_no_gui = 2
not_supported_by_gui = 3
OTHERS = 4
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Regards,
Aby. -
hi all, i'm using the: cl_gui_frontend_services=>file_save_dialog class and method..
My question, how can i do for RESTRICT the file extension of the file JUST to '.txt' ?? if the user select the name of the file to create to 123.pdf -for example- that the system don't let him to continue, or just add the txt extension to the final of the filename.. -like 123.pdf.txt ??
Thanks!!Hi Pampeano,
i I have created a small code snippet :-
LV_FILENAME TYPE STRING,
LV_FULLPATH TYPE STRING,
LV_PATH TYPE STRING,
LV_ACTION TYPE I,
LV_FILE TYPE STRING,
DEFAULT_EXTENSION TYPE STRING.
if DEFALUT_EXTENSION ne 'TXT'.
eRROR ........
ENDIF.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_SAVE_DIALOG
EXPORTING
WINDOW_TITLE = 'Please select the location'
DEFAULT_EXTENSION = DEAFAULT_EXTENSION
DEFAULT_FILE_NAME = LV_FILE
FILE_FILTER = '*.TXT'
CHANGING
FILENAME = LV_FILENAME
PATH = LV_PATH
FULLPATH = LV_FULLPATH
USER_ACTION = LV_ACTION
EXCEPTIONS
CNTL_ERROR = 1
ERROR_NO_GUI = 2
OTHERS = 3.
Regards
Abhii
Edited by: Abhii on Aug 17, 2010 7:44 AM
Edited by: Abhii on Aug 17, 2010 7:44 AM
Edited by: Abhii on Aug 17, 2010 7:44 AM
Edited by: Abhii on Aug 17, 2010 7:46 AM -
Question on cl_gui_frontend_services= file_save_dialog
Hi all,,, need your help.. thank you i n ad vance ..
why ist tht happen? the default extension, 'txt'
but the "save as type" in the dialog box shows 'XLS', excel file ??
CALL METHOD cl_gui_frontend_services=>file_save_dialog
EXPORTING
window_title = 'Save file to'
DEFAULT_EXTENSION = 'txt'
default_file_name = v_filename
INITIAL_DIRECTORY = 'c:\'
CHANGING
filename = t_file
path = ld_path
fullpath = ld_fullpath
user_action = ld_result.you can do in this way....
in this case default is 'XLS' and he can choose all the files.
CALL METHOD cl_gui_frontend_services=>file_save_dialog
EXPORTING
window_title = l_title
default_extension = 'XLS'
file_filter = ' '
CHANGING
fullpath = l_fullpath
path = l_path
filename = l_filename
EXCEPTIONS
OTHERS = 1.
Regards
Vijay -
Error calling class methods CL_GUI_FRONTEND_SERVICES
Hi all,
I have a requirement in BAPI (integrating solman to portal) to download file from app. server to local directory. I used the below FM to get temp directory of presntation server.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>GET_TEMP_DIRECTORY
CHANGING
TEMP_DIR = LV_TEMP_DIR
EXCEPTIONS
CNTL_ERROR = 1
ERROR_NO_GUI = 2
NOT_SUPPORTED_BY_GUI = 3
others = 4.
CALL METHOD cl_gui_cfw=>flush.
It works fine in R3, but when i called it from portal it shows Access not possible using 'NULL' object reference with a short dump .
st22 shows
Error in ABAP application program.
The current ABAP program "CL_GUI_FRONTEND_SERVICES======CP" had to be
terminated because one of the
statements could not be executed.
This is probably due to an error in the ABAP program.
An exception occurred. This exception is dealt with in more detail belo
. The exception, which is assigned to the class 'CX_SY_REF_IS_INITIAL',
neither
caught nor passed along using a RAISING clause, in the procedure
"GET_TEMP_DIRECTORY" "(METHOD)"
Since the caller of the procedure could not have expected this exceptio
to occur, the running program was terminated.
The reason for the exception is:
Attempt to access a component using 'NULL' object reference (points
to nothing).
An object reference must point to an object (an instance of a class)
before you can use it to access components (variable:
"CL_GUI_FRONTEND_SERVICES=>HANDLE").
Either the reference has not yet been set, or it has been reset to
'NULL' by a CLEAR statement.
When i put external break point and the dump comes during execution of CALL METHOD cl_gui_cfw=>flush.
Is it not possible to use CL_GUI_FRONTEND_SERVICES in RFC ??.
thanks and regards
Jijo[CL_GUI_FRONTEND_SERVICES|https://www.sdn.sap.com/irj/sdn/advancedsearch?cat=sdn_all&query=cl_gui_frontend_services+portal&adv=false&sortby=cm_rnd_rankvalue] needs a SAPGUI, so it is not possible to use it in RFC, BSP or other portal.
Regards -
Hello Experts,
I am currently practicing BDC and I think the first step is to locate where my text file is. Now based on my code below, after selecting my text file nothing happens.
Also, what will be my next after getting the file from a specific location? Thanks guys!
REPORT z_aris_practice_bdc_0
NO STANDARD PAGE HEADING
LINE-SIZE 255
LINE-COUNT 64
MESSAGE-ID zz.
*BDC Data
DATA: BEGIN OF bdc_tab OCCURS 0.
INCLUDE STRUCTURE bdcdata.
DATA: END OF bdc_tab.
*Internal Table
DATA: BEGIN OF it_input OCCURS 0,
user TYPE usr02-bname,
title TYPE sza5_d0700-title_medi,
lname TYPE addr3_data-name_last,
fname TYPE addr3_data-name_first,
initials TYPE addr3_data-initials,
nickname TYPE addr3_data-nickname,
function TYPE addr3_data-function,
END OF it_input.
DATA: gt_lines TYPE sy-tabix,
gt_file TYPE filetable,
wa_file TYPE filetable,
gt_subrc TYPE i.
*CONSTANTS
CONSTANTS: c_mask(60) TYPE c VALUE ',..'.
*Selection Screen
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS: p_input LIKE rlgrap-filename.
SELECTION-SCREEN END OF BLOCK b1.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_input.
CALL METHOD cl_gui_frontend_services=>file_open_dialog
EXPORTING
WINDOW_TITLE =
DEFAULT_EXTENSION =
DEFAULT_FILENAME =
FILE_FILTER =
initial_directory = 'C:\Temp\'
multiselection = 'X'
CHANGING
file_table = gt_file[]
rc = gt_subrc
USER_ACTION =
EXCEPTIONS
file_open_dialog_failed = 1
cntl_error = 2
error_no_gui = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*START-OF-SELECTION
START-OF-SELECTION.
PERFORM put_in_itab.
PERFORM process_records.
*& Form get_files
text
FORM put_in_itab.
DATA: lv_file TYPE string.
lv_file = p_input.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = lv_file
FILETYPE = 'ASC'
has_field_separator = 'X'
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
CHECK_BOM = ' '
VIRUS_SCAN_PROFILE =
NO_AUTH_CHECK = ' '
IMPORTING
FILELENGTH =
HEADER =
TABLES
data_tab = it_input
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
OTHERS = 17
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
DESCRIBE TABLE it_input LINES gt_lines.
ENDIF.
ENDFORM. "get_files
*& Form process_records
text
FORM process_records.
LOOP AT it_input.
ENDLOOP.
ENDFORM. "process_recordsHii viraylab,
go throgh this link..This sample code solves ur problem....
/people/milind.upasani/blog/2007/03/07/step-by-step-approach-to-ceate-simple-bdc-session-program-using-reusable-template
U are new to BDC it seems...
first u read the sap help ... then u will come know what to do after wards....
http://help.sap.com/saphelp_47x200/helpdata/en/fa/097720543b11d1898e0000e8322d00/frameset.htm
Be familiar with the structure BDCDATA.
<b>Data transfers</b> In this page..
Next u need to know about the <b>transaction RECORDER the tcode is SHDB.</b>
Nothing is difficult in this ..
For example When u r creating a data element in SE11 u go through some screens in a flow, by clicking some pushbuttons and by generating some function codes manually, and entering values manually...
But here u wont do it manually, these values will be populated from file into an internal table...
Before calling a transaction into which u r going to populate the data is to be filled into a table with structure <b>BDCDATA.</b>
<b>U need to use CALL TRANSACTION 'SE11' using BDCDATA or
the session method..</b>
Reward points for helpful answers...
sai ramesh -
hi,
I am getting error as i marked BOLD in this program...can u give solutions for that..
REPORT YSBDC6.
TABLES:LFA1.
DATA:BEGIN OF ITAB OCCURS 0,
LIFNR LIKE LFA1-LIFNR,
LAND1 LIKE LFA1-LAND1,
NAME1 LIKE LFA1-NAME1,
END OF ITAB.
DATA:BEGIN OF JTAB OCCURS 0.
INCLUDE STRUCTURE BDCDATA.
DATA:END OF JTAB.
DATA:BEGIN OF KTAB OCCURS 0.
INCLUDE STRUCTURE BDCMSGCOLL.
DATA:END OF KTAB.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_UPLOAD
EXPORTING
FILENAME = 'C:\PRABA.TXT'
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X'
CHANGING
DATA_TAB = ITAB[].
LOOP AT ITAB[] INTO ITAB.
REFRESH JTAB.
PERFORM SUB USING 'YVTRANS' '100'.
PERFORM SUB1 USING:'LFA1-LIFNR' ITAB-LIFNR,
'LFA1-LAND1' ITAB-LAND1,
'LFA1-NAME1' ITAB-NAME1.
PERFORM SUB1 USING 'BDC_OKCODE' 'INSERT'.
CALL TRANSACTION 'YVTRANS' USING JTAB MODE 'A' MESSAGES INTO KTAB.
LOOP AT KTAB.
IF KTAB-MSGTYP = 'I' OR KTAB-MSGNR = 000.
WRITE: /1 'vendor', 15 ITAB-LIFNR, 25 'INSERTED'.
ELSEIF
KTAB-MSGTYP ='E' OR KTAB-MSGNR = 001.
WRITE: /1 'vendor', 15 ITAB-LIFNR, 25 'NOT INSERTED'.
ENDIF.
<b>REFRESH KTAB."ERROR IN THIS LINE 'YOU MAY NOT
"Delete or overwrite table 'ktab' with in a loop through itself</b>
ENDLOOP.
ENDLOOP.
FORM SUB USING A B.
CLEAR JTAB.
JTAB-PROGRAM = A.
JTAB-DYNPRO = B.
JTAB-DYNBEGIN = 'X'.
APPEND JTAB.
ENDFORM.
FORM SUB1 USING C D.
CLEAR JTAB.
JTAB-FNAM = C.
JTAB-FVAL = D.
APPEND JTAB.
ENDFORM.HI,
thanks for both..for immediate response..my PC got struck up that why i could not
after editing this program i got error like YVTRANS not found..that means i have written seperate code for YVTRANS like below..is it correct..can u give solution for this..
REPORT YVTRANS.
TABLES:LFA1.
*DATA: WA TYPE LFA1.
*ITAB TYPE TABLE OF LFA1.
MODULE USER_COMMAND_0100 INPUT.
CASE SY-UCOMM.
WHEN 'INSERT'.
INSERT LFA1.
IF SY-SUBRC = 0.
MESSAGE I000(0) WITH 'RECORD INSERTED'.
ELSE.
MESSAGE E001(0) WITH 'NOT INSERTED'.
ENDIF.
WHEN 'EXIT'.
LEAVE PROGRAM.
ENDCASE.
ENDMODULE.
orginal program
REPORT YSBDC6.
TABLES:LFA1.
DATA:BEGIN OF ITAB OCCURS 0,
LIFNR LIKE LFA1-LIFNR,
LAND1 LIKE LFA1-LAND1,
NAME1 LIKE LFA1-NAME1,
END OF ITAB.
DATA:BEGIN OF JTAB OCCURS 0.
INCLUDE STRUCTURE BDCDATA.
DATA:END OF JTAB.
DATA:BEGIN OF KTAB OCCURS 0.
INCLUDE STRUCTURE BDCMSGCOLL.
DATA:END OF KTAB.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_UPLOAD
EXPORTING
FILENAME = 'C:\PRABA.TXT'
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X'
CHANGING
DATA_TAB = ITAB[].
LOOP AT ITAB[] INTO ITAB.
REFRESH JTAB.
PERFORM SUB USING 'YVTRANS' '100'.
PERFORM SUB1 USING:'LFA1-LIFNR' ITAB-LIFNR,
'LFA1-LAND1' ITAB-LAND1,
'LFA1-NAME1' ITAB-NAME1.
PERFORM SUB1 USING 'BDC_OKCODE' 'INSERT'.
CALL TRANSACTION 'YVTRANS' USING JTAB MODE 'A' MESSAGES INTO KTAB.
LOOP AT KTAB.
IF KTAB-MSGTYP = 'I' OR KTAB-MSGNR = 000.
WRITE: /1 'vendor', 15 ITAB-LIFNR, 25 'INSERTED'.
ELSEIF
KTAB-MSGTYP ='E' OR KTAB-MSGNR = 001.
WRITE: /1 'vendor', 15 ITAB-LIFNR, 25 'NOT INSERTED'.
ENDIF.
ENDLOOP.
REFRESH KTAB.
ENDLOOP.
FORM SUB USING A B.
CLEAR JTAB.
JTAB-PROGRAM = A.
JTAB-DYNPRO = B.
JTAB-DYNBEGIN = 'X'.
APPEND JTAB.
ENDFORM.
FORM SUB1 USING C D.
CLEAR JTAB.
JTAB-FNAM = C.
JTAB-FVAL = D.
APPEND JTAB.
ENDFORM. -
hi abaper expert,
can a method be called from a method or a program ?
if it can be called from a method or a program, how can we do it ?
please give an example
many thanks in advance
regards
eddhieHi
Yes it is, but only if you need to use an INSTANCE method.
DATA: <OBJECT> TYPE REF TO <CLASS>.
CREATE OBJECT <OBJECT>.
CALL METHOD <OBJECT>-><METHOD>
If you need a static method:
CALL METHOD <CLASS>=><METHOD>.
For example the method to dowload a file (defined in the class CL_GUI_FRONTEND_SERVICES) is static so
CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD
EXPORTING
IMPORTING
Max
Max -
What is the functionality CALL METHOD CL_GUI_CFW= FLUSH
Hi,
What is the functionality of method "FLUSH" in class CL_GUI_CFW
Should it be used after every call method CL_GUI_FRONTEND_SERVICES=>......
What is the purpose of using it? What happens if we don't use it?hi
good
The class CL_GUI_CFW contains static methods that apply to all instantiated custom controls when you call them.
You can force a synchronization point in your program by calling a method that is not buffered, or by calling the static method FLUSH.
CLASS event_handler IMPLEMENTATION.
METHOD handle_f1.
DATA row TYPE i.
MESSAGE i888(sabapdocu) WITH text-003.
CALL METHOD sender->get_selection_pos
IMPORTING from_line = row.
CALL METHOD sender->get_line_text
EXPORTING line_number = row
IMPORTING text = field.
CALL METHOD cl_gui_cfw=>set_new_ok_code
EXPORTING new_code = 'F1'.
CALL METHOD cl_gui_cfw=>flush.
ENDMETHOD.
thanks
mrutyun^ -
Hi Experts,
How can i get a file header using this method cl_gui_frontend_services=>gui_download
Thanks
BasuHi,
You can use the FM - GUI_DOWNLOAD to specify the headers. It can be done in the following manner -
TYPES: BEGIN OF ty_head, "Structure for header
h(10) TYPE c,
END OF ty_head.
DATA: it_head TYPE TABLE OF ty_head WITH HEADER LINE.
"Adding header details
it_head-h = 'Field1'.
APPEND it_head.
it_head-h = 'Field2'.
APPEND it_head.
it_head-h = 'Field3'.
APPEND it_head.
it_head-h = 'Field4'.
APPEND it_head.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = p_file
filetype = 'ASC'
write_field_separator = 'X'
header = '00' "<= note this
TABLES
data_tab = it_tab
fieldnames = it_head[] "<= Pass your header table here
EXCEPTIONS
OTHERS = 1.
Hope this helps.
Regards,
Himanshu
Maybe you are looking for
-
Account 410100 requires an assignment to a Co object
Hi Team, I am Trying to post one entry T code F-02 ( fast entry screen) , In the fast entry screen we require WBS element as Co object , we added WBS element but system still gives error message Account 410100 requires an assignment to a Co obje
-
The language used in Apple E-mails.
I just received an e-mail from Apple starting "Dear Mother ******" When did Apple begin to use this type of language when addressing anyone?
-
How do I get my contacts to sync using iCloud for iPhone and iPad.
I can sync my pictures using icloud on my iPhone and my iPad however when I try to do the same for contacts having no luck. Also when I type a callander event on my iPad it comes up on my phone however when I type entry on iPad on calendar it does no
-
How to clear downloading items from iphone
I bought a season of a TV show using my iphone. My mistake as I didn't want them downloading to my phone. So I paused the downloads. How do I clear it so it does not keep telling me I have 21 items to download?
-
and if any one knows about these dj set ups it could help if any pointers send them to me at [email protected] will be a great help also what other type of equipment should i buy? to go with it thanks ppl