Download using open data set and close data set
can any body please send some sample pgm using open data set and close data set .the data should get downloaded in application server
very simple pgm needed
Hi Arun,
See the Sample code for BDC using OPEN DATASET.
report ZSDBDCP_PRICING no standard page heading
line-size 255.
include zbdcrecx1.
*--Internal Table To hold condition records data from flat file.
Data: begin of it_pricing occurs 0,
key(4),
f1(4),
f2(4),
f3(2),
f4(18),
f5(16),
end of it_pricing.
*--Internal Table To hold condition records header .
data : begin of it_header occurs 0,
key(4),
f1(4),
f2(4),
f3(2),
end of it_header.
*--Internal Table To hold condition records details .
data : begin of it_details occurs 0,
key(4),
f4(18),
f5(16),
end of it_details.
data : v_sno(2),
v_rows type i,
v_fname(40).
start-of-selection.
refresh : it_pricing,it_header,it_details.
clear : it_pricing,it_header,it_details.
CALL FUNCTION 'UPLOAD'
EXPORTING
FILENAME = 'C:\WINDOWS\Desktop\pricing.txt'
FILETYPE = 'DAT'
TABLES
DATA_TAB = it_pricing
EXCEPTIONS
CONVERSION_ERROR = 1
INVALID_TABLE_WIDTH = 2
INVALID_TYPE = 3
NO_BATCH = 4
UNKNOWN_ERROR = 5
GUI_REFUSE_FILETRANSFER = 6
OTHERS = 7.
WRITE : / 'Condition Records ', P_FNAME, ' on ', SY-DATUM.
OPEN DATASET P_FNAME FOR INPUT IN TEXT MODE.
if sy-subrc ne 0.
write : / 'File could not be uploaded.. Check file name.'.
stop.
endif.
CLEAR : it_pricing[], it_pricing.
DO.
READ DATASET P_FNAME INTO V_STR.
IF SY-SUBRC NE 0.
EXIT.
ENDIF.
write v_str.
translate v_str using '#/'.
SPLIT V_STR AT ',' INTO it_pricing-key
it_pricing-F1 it_pricing-F2 it_pricing-F3
it_pricing-F4 it_pricing-F5 .
APPEND it_pricing.
CLEAR it_pricing.
ENDDO.
IF it_pricing[] IS INITIAL.
WRITE : / 'No data found to upload'.
STOP.
ENDIF.
loop at it_pricing.
At new key.
read table it_pricing index sy-tabix.
move-corresponding it_pricing to it_header.
append it_header.
clear it_header.
endat.
move-corresponding it_pricing to it_details.
append it_details.
clear it_details.
endloop.
perform open_group.
v_rows = sy-srows - 8.
loop at it_header.
perform bdc_dynpro using 'SAPMV13A' '0100'.
perform bdc_field using 'BDC_CURSOR'
'RV13A-KSCHL'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'RV13A-KSCHL'
it_header-f1.
perform bdc_dynpro using 'SAPMV13A' '1004'.
perform bdc_field using 'BDC_CURSOR'
'KONP-KBETR(01)'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'KOMG-VKORG'
it_header-f2.
perform bdc_field using 'KOMG-VTWEG'
it_header-f3.
**Table Control
v_sno = 0.
loop at it_details where key eq it_header-key.
v_sno = v_sno + 1.
clear v_fname.
CONCATENATE 'KOMG-MATNR(' V_SNO ')' INTO V_FNAME.
perform bdc_field using v_fname
it_details-f4.
clear v_fname.
CONCATENATE 'KONP-KBETR(' V_SNO ')' INTO V_FNAME.
perform bdc_field using v_fname
it_details-f5.
if v_sno eq v_rows.
v_sno = 0.
perform bdc_dynpro using 'SAPMV13A' '1004'.
perform bdc_field using 'BDC_OKCODE'
'=P+'.
perform bdc_dynpro using 'SAPMV13A' '1004'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
endif.
endloop.
*--Save
perform bdc_dynpro using 'SAPMV13A' '1004'.
perform bdc_field using 'BDC_OKCODE'
'=SICH'.
perform bdc_transaction using 'VK11'.
endloop.
perform close_group.
Hope this resolves your query.
Reward all the helpful answers.
Regards
Similar Messages
-
What is open data set and close data set
what is open data set and close data set,
how to use the files in sap directories ?hi,
Open Dataset is used to read or write on to application server ... other than that i am not sure that there exists any way to do the same ... here is a short description for that
FILE HANDLING IN SAP
Introduction
Files on application server are sequential files.
Files on presentation server / workstation are local files.
A sequential file is also called a dataset.
Handling of Sequential file
Three steps are involved in sequential file handling
OPEN
PROCESS
CLOSE
Here processing of file can be READING a file or WRITING on to a file.
OPEN FILE
Before data can be processed, a file needs to be opened.
After processing file is closed.
Syntax:
OPEN DATASET <file name> FOR {OUTPUT/INPUT/APPENDING}
IN {TEXT/BINARY} MODE
This statement returns SY_SUBRC as 0 for successful opening of file or 8, if unsuccessful.
OUTPUT: Opens the file for writing. If the dataset already exists, this will place the cursor at the start of the dataset, the old contents get deleted at the end of the program or when the CLOSE DATASET is encountered.
INPUT: Opens a file for READ and places the cursor at the beginning of the file.
FOR APPENDING: Opens the file for writing and places the cursor at the end of file. If the file does not exist, it is generated.
BINARY MODE: The READ or TRANSFER will be character wise. Each time n characters are READ or transferred. The next READ or TRANSFER will start from the next character position and not on the next line.
IN TEXT MODE: The READ or TRANSFER will start at the beginning of a new line each time. If for READ, the destination is shorter than the source, it gets truncated. If destination is longer, then it is padded with spaces.
Defaults: If nothing is mentioned, then defaults are FOR INPUT and in BINARY MODE.
PROCESS FILE:
Processing a file involves READing the file or Writing on to file TRANSFER.
TRANSFER Statement
Syntax:
TRANSFER <field> TO <file name>.
<Field> can also be a field string / work area / DDIC structure.
Each transfer statement writes a statement to the dataset. In binary mode, it writes the length of the field to the dataset. In text mode, it writes one line to the dataset.
If the file is not already open, TRANSFER tries to OPEN file FOR OUTPUT (IN BINARY MODE) or using the last OPEN DATASET statement for this file.
IF FILE HANDLING, TRANSFER IS THE ONLY STATEMENT WHICH DOES NOT RETURN SY-SUBRC
READ Statement
Syntax:
READ DATASET <file name> INTO <field>.
<Field> can also be a field string / work area / DDIC structure.
Each READ will get one record from the dataset. In binary mode it reads the length of the field and in text mode it reads each line.
CLOSE FILE:
The program will close all sequential files, which are open at the end of the program. However, it is a good programming practice to explicitly close all the datasets that were opened.
Syntax:
CLOSE DATASET <file name>.
SY-SUBRC will be set to 0 or 8 depending on whether the CLOSE is successful or not.
DELETE FILE:
A dataset can be deleted.
Syntax:
DELETE DATASET <file name>.
SY-SUBRC will be set to 0 or 8 depending on whether the DELETE is successful or not.
Pseudo logic for processing the sequential files:
For reading:
Open dataset for input in a particular mode.
Start DO loop.
Read dataset into a field.
If READ is not successful.
Exit the loop.
Endif.
Do relevant processing for that record.
End the do loop.
Close the dataset.
For writing:
Open dataset for output / Appending in a particular mode.
Populate the field that is to be transferred.
TRANSFER the filed to a dataset.
Close the dataset.
Regards
Anver
if hlped pls mark points -
Exception Handling for OPEN DATA SET and CLOSE DATA SET
Hi ppl,
Can you please let me know what are the exceptions that can be handled for open, read, transfer and close data set ?
Many Thanks.HI,
try this way....
DO.
TRY.
READ DATASET filename INTO datatab.
CATCH cx_sy_conversion_codepage cx_sy_codepage_converter_init
cx_sy_file_authority cx_sy_file_io cx_sy_file_open .
ENDTRY.
READ DATASET filename INTO datatab.
End of changes CHRK941728
IF sy-subrc NE 0.
EXIT.
ELSE.
APPEND datatab.
ENDIF.
ENDDO. -
Open data set and close data set
hi all,
i have some doubt in open/read/close data set
how to transfer data from internal table to sequential file, how we find sequential file.
thanks and regards
chaitanyaHi Chaitanya,
Refer Sample Code:
constants: c_split TYPE c
VALUE cl_abap_char_utilities=>horizontal_tab,
c_path TYPE char100
VALUE '/local/data/interface/A28/DM/OUT'.
Selection Screen
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS : rb_pc RADIOBUTTON GROUP r1 DEFAULT 'X'
USER-COMMAND ucomm, "For Presentation
p_f1 LIKE rlgrap-filename
MODIF ID rb1, "Input File
rb_srv RADIOBUTTON GROUP r1, "For Application
p_f2 LIKE rlgrap-filename
MODIF ID rb2, "Input File
p_direct TYPE char128 MODIF ID abc DEFAULT c_path.
"File directory
SELECTION-SCREEN END OF BLOCK b1.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_f1.
*-- Browse Presentation Server
PERFORM f1000_browse_presentation_file.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_f2.
*-- Browse Application Server
PERFORM f1001_browse_appl_file.
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
IF rb_pc = 'X' AND screen-group1 = 'RB2'.
screen-input = '0'.
MODIFY SCREEN.
ELSEIF rb_srv = 'X' AND screen-group1 = 'RB1'.
screen-input = '0'.
MODIFY SCREEN.
ENDIF.
IF screen-group1 = 'ABC'.
screen-input = '0'.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
*& Form f1000_browse_presentation_file
Pick up the filepath for the file in the presentation server
FORM f1000_browse_presentation_file .
CONSTANTS: lcl_path TYPE char20 VALUE 'C:'.
CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
def_path = lcl_path
mask = c_mask "',.,..'
mode = c_mode
title = text-006
IMPORTING
filename = p_f1
EXCEPTIONS
inv_winsys = 1
no_batch = 2
selection_cancel = 3
selection_error = 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.
flg_pre = c_x.
ENDIF.
ENDFORM. " f1000_browse_presentation_file
*& Form f1001_browse_appl_file
Pick up the file path for the file in the application server
FORM f1001_browse_appl_file .
DATA: lcl_directory TYPE char128.
lcl_directory = p_direct.
CALL FUNCTION '/SAPDMC/LSM_F4_SERVER_FILE'
EXPORTING
directory = lcl_directory
filemask = c_mask
IMPORTING
serverfile = p_f2
EXCEPTIONS
canceled_by_user = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE e000(zmm) WITH text-039.
flg_app = 'X'.
ENDIF.
ENDFORM. " f1001_browse_appl_file
*& Form f1003_pre_file
Upload the file from the presentation server
FORM f1003_pre_file .
DATA: lcl_filename TYPE string.
lcl_filename = p_f1.
IF p_f1 IS NOT INITIAL.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = lcl_filename
filetype = 'ASC'
has_field_separator = 'X'
TABLES
data_tab = i_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 s000 WITH text-031.
EXIT.
ENDIF.
ELSE.
PERFORM populate_error_log USING space
text-023.
ENDIF.
ENDFORM. " f1003_pre_file
*& Form f1004_app_file
upload the file from the application server
FORM f1004_app_file .
REFRESH: i_input.
OPEN DATASET p_f2 IN TEXT MODE ENCODING DEFAULT FOR INPUT.
IF sy-subrc EQ 0.
DO.
READ DATASET p_f2 INTO wa_input_rec.
IF sy-subrc EQ 0.
*-- Split The CSV record into Work Area
PERFORM f0025_record_split.
*-- Populate internal table.
APPEND wa_input TO i_input.
CLEAR wa_input.
IF sy-subrc <> 0.
MESSAGE s000 WITH text-030.
EXIT.
ENDIF.
ELSE.
EXIT.
ENDIF.
ENDDO.
ENDIF.
ENDFORM. " f1004_app_file
Move the assembly layer file into the work area
FORM f0025_record_split .
CLEAR wa_input.
SPLIT wa_input_rec AT c_split INTO
wa_input-legacykey
wa_input-bu_partner
wa_input-anlage.
ENDFORM. " f0025_record_split
Reward points if this helps.
Manish -
IPhoto won't open. Modified and created dates say 12/31/69
iPhoto won't open. Modified and created dates say 12/31/69. Help! OS is Tiger. Older G4 Powerbook.
As a test launch iPhoto with the Option key held down and try to create a new, test library. Can you? If you can then your current library is damaged and needs to be repaired.
Apply the two fixes below in order as needed:
Fix #1
Launch iPhoto with the Command+Option keys held down and rebuild the library.
Select the options identified in the screenshot.
Fix #2
Using iPhoto Library Manager to Rebuild Your iPhoto Library
Download IPhoto Library Manager 4 for OS XC 10.6.8 and iPhoto 8.1.2 and later or iPhoto Library Manager 3 (for OS X 10.5.8 and iPhoto 7.1.5 and earlier) and launch.
Click on the Add Library button, navigate to your Home/Pictures folder and select your iPhoto Library folder.
Now that the library is listed in the left hand pane of iPLM, click on your library and go to the File ➙ Rebuild Library menu (iPLM 3) or Library ➙ Rebuild Library menu (iPLM 4) option.
In the next window name the new library and select the location you want it to be placed.
Click on the Create button.
Note: This creates a new library based on the LIbraryData.xml file in the library and will recover Events, Albums, keywords, titles and comments but not books, calendars or slideshows. The original library will be left untouched for further attempts at fixing the problem or in case the rebuilt library is not satisfactory.
OT -
Hi guys,
I’m new to Mac and have a MacBook Pro Lion OS (10.6.8 I think !!!) with Parallels 7 (Windows 7) installed. Can someone please tell me what is the best software program that I can use to read, write and modify data / files on external HD (NTFS format) from the Mac OS ? I heard of Paragon and Tuxera NTFS. Are they free ? Are they good ? Are there any other software programs out there ? I heard that some people have issues with Paragon.
Thanks.Your best bet would be to take the drive to the oldest/compatible with that drive Windows PC and grab the files off, right click and format it exFAT (XP users can download exFAT from Microsoft) and then put the files back on.
Mac's can read and write all Windows files formats except write to NTFS (and in some cases not read) so if you can change the format of the drive to exFAT (all data has to be remove first) then you will have a drive that doesn't require paid third party NTFS software (a license fee goes to Microsoft) for updates.
Also it's one less hassle to deal with too.
.Drives, partitions, formatting w/Mac's + PC's -
How to open an URL and close the URL window, using adobe javascript
Hi,
Is it possible to open an URL and close the URL back again(without allowing the user to perform any other operation)? I was able to acheive the opening of the URL, using the app.launchURL("address". true); - But here it lauches in new window, and how do i close the window using the javascript. Is it possible?
Thanks.Hi all
In addition to what Bobby W - Adobe TS added, you might find
the following useful as a bypass or workaround to the pesky prompt.
var pw=window.parent;pw.opener=window.self;window.open("
http://www.adobe.com");
pw.close();
I think this will only work for IE browsers. Actually, I
think the whole window.close() only works for IE, but could be
wrong about that.
Cheers... Rick -
GL Account Start date and Close date
Hi,
Is it possible to maintain start date and close date of a GL account
Thanks & Regards
RadhaRequirement is, from a specific date the GL account should allow for posting and in the same way the GL account should not allow for posting for a specific posting.
So is it possible to give validity period for a GL account -
Can TestStand open, read, write and close binary files?
From a TestStand sequence, I need to open, read, write and close binary files. Does TestStand support this capability?
Christine -
In the past I have used the C/C++ Adapter to call directly into the CVI RTE functions. The CVI functions I have used are OpenFile, WriteFile and CloseFile. The functions are exported from the DLL as CVI_OpenFile, CVI_WriteFile, and CVI_CloseFile. I just had to make sure that on termination of the sequence, that the integer handle was properly released by calling the close function.
If you are using LabVIEW, you could call directly into the low level VIs to do a similar set of operations.
Scott Richardson (NI)
Scott Richardson
National Instruments -
I download epub books from Overdrive. Only one epub file will not open in ADE on my Mac or on my Nook. The many others I've downloaded will open on both and will copy to the Nook as usual. Using the latest edition of ADE. Could be a corrupted ePub file? Curiously, this is the second time I've downloaded this epub from the same site, and I had no problem the first time. It still has 9 days remaining in the borrowing period.
Forgot to make clear that on both my Mac and the Nook, attempting to open the epub causes ADE to crash.
-
Select Records between Begin Date/Time and End Date/Time
Hi, I need to select records from table GLPCA where the CPUDT and CPUTM are between a START DATE/TIME and END DATE/TIME.
I have the below logic from an SAP Solution, but it doesn't seem to be working right in my opinion. It is picking up records earlier than the date ranges. Can anyone tell me how I might be able to accomplish this? I'm hoping this is an easy one for the ABAPPERs...
Thanks,
START DATE 20091022
START TIME 125736
END DATE 20091022
END TIME 135044
CPUDT 20091022
CPUTM 100257
SELECT * FROM GLPCA
WHERE ( CPUDT >= STARTDATE AND ( CPUTM >= STARTTIME OR ( CPUDT <= ENDDATE AND CPUTM <= ENDTIME ) ) ).Thank you all! I ended up using the following:
SELECT * FROM GLPCA
WHERE RYEAR IN L_R_RYEAR
AND ( ( CPUDT = STARTDATE AND CPUTM >= STARTTIME ) OR CPUDT > STARTDATE )
AND ( ( CPUDT = ENDDATE AND CPUTM <= ENDTIME ) OR CPUDT < ENDDATE ).
This child was born from the following thread that was found:
update date and time of client record -
UTC Date Time and Normal Date Time
Hi All,
1. How UTC date time and Normal date time differs in siebel.
2. If legacy data needed to be loaded into siebel, in siebel few fields are date time and UTC date time fields. what would happen if we load both normal date time and UTC date time without considering them techinically?
3. UTC date time holds any specific format in physical database? If we want to load legacy data to UTC date time format what is the query to manipulate it?
Thankyou
SeanSean,
Please check document below, I believe it has most of the answers to the questions you have:
http://download.oracle.com/docs/cd/E14004_01/books/GlobDep/GlobDepUTC.html
Hope it helps,
Wilson -
Difference between Realtime Data Acqisition and Direct Data Access ?
Hi experts,
What is RDA and DDA and whrere these two are used ?
What is the Difference between Realtime Data Acqisition and Direct Data Access?
Please explain me in a detail manner, i will assign points for ur valuable answers..............Hi,
Eventhough the aim of the two methods are to report on the latest data, there is a difference in both.
In Realtime Data Acqisition you are loading the data into BW and then reporting on that data from BW Infoproviders.
http://help.sap.com/saphelp_nw04s/helpdata/en/52/777e403566c65de10000000a155106/content.htm
I think you are refering to Virtual providers by the term Direct Data Access. In Direct Data Access you are not loading data into BW. Data is residing in R/3 itself. Your reports will fetch data from R/3 directly. The data is called during execution of a query in the source system.
http://help.sap.com/saphelp_nw04s/helpdata/en/23/c0234239f75733e10000000a155106/frameset.htm
http://help.sap.com/saphelp_nw70/helpdata/EN/13/3e34429692b76be10000000a155106/frameset.htm
http://help.sap.com/saphelp_nw04/helpdata/en/da/5909392a430303e10000000a114084/frameset.htm
Hope this helps.
Thanks,
JituK -
i have problem with my wifi in 4 S, i cant connect to any wifi itried resetting network setting and reset all setting but the result was the same, its only keeps searching for wifi and cant find any, itried to use OTHER but also didnt work.please help me???
If Join was on then your home wi-fi must be set to Non-Broadcast. If you did not set this up (maybe your provider did) then you will need to find the Network Name they used, and any password they used. The SSID is Security Set ID and to see more try http://en.wikipedia.org/wiki/SSID . Basically it is the name used to identify your router/network. A lot of times the installer will leave it set as LinkSys, or Broadcom or whatever the manufacturer set it as for default. Your best bet is to get whoever installed it to walk you through how they set it up, giving you id's and passwords so you can get in. HOWEVER, if you are not comfortable with this (if you set security wrong, etc.) you would be well ahead of the game to hire a local computer tech (networking) to get this working for you. You can also contact the vendor of your router and get help (if it is still in warranty), or at least get copies of the manuals as pdf files. Sorry I can't give you more help, I hope this gives you an idea where to go from here to find more.
-
Is there a keyboard shortcut in OS 10.6 for "open folder window" and "close folder window"? I have a hand condition at the moment that makes it painful to mouse the cursor over to the arrow and click it (for instance, in the sidebars for Finder or iTunes) to open or close a folder. If anyone knows a keyboard shortcut for this, I'd really appreciate it--thanks!
OS X keyboard shortcuts
Maybe you are looking for
-
Suppress Decimals for CURR field in ALV Grid based on condition
Hello All, I am displaying records in ALV Grid. For a Company Code, I get the Currency Code from table T001. If the Currency is JPY, I want to display the value of CURR field without decimals. For example: if the value is 200.00, I want to display on
-
Firefox is set to delete browsing history on exit. Appears to be working fine. However, if I open Internet Explorer - after closing Firefox - my cookies and history are listed in Internet Explorer. I have to go to Tools >Options> Internet History and
-
Help with third-party Atari App from AppStore
Not sure anyone knows but I thought I'd take a stab at it. You download the Atari app for free, then you cam buy game packs. Example, one game pack includes Centipede, Millipede, etc... So, the games are awesome... Look great, made specifically for i
-
From External HD to new iMac?
I got a new iMac (old one died). I have my entire home folder (old Mac) backed-up on an external HD. How do I get the files from the external HD to the new mac? What do I need to transfer? How? I'm unable to find instructions to do this? Here are som
-
Informatica OEM - DAC tablespace size?
What is the table space size required by DAC (while installing Informatica OEM 7.1.2)