Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

OPEN DATA SET ERROR

Former Member
0 Likes
1,074

hie all , i'm experiencing a dump in a program using open dataset.. it appears there is some obsolete terms that i have used . the transfer key word is obsolete in ECC 6.0 but worked in 4.6, does anyone know the substitute name in of translate in ECC . 6.0 ..

my code section

filename(128) default '
umprod\usr\INTERFACE\CARGOUT08.txt'

bgr00-mandt = sy-mandt.

concatenate 'CARGO' sy-datum into bgr00-group.

bgr00-usnam = 'daniel'.

bgr00-nodata = c_nodata.

bgr00-xkeep = 'X'.

bgr00-stype = '0'.

transfer bgr00 to filename.

8 REPLIES 8
Read only

Sm1tje
Active Contributor
0 Likes
1,004

Transfer statement is NOT obsolet in ECC6.0. So, what is the exact error message (short dump message)?

If it is in the OPEN DATASET statement, then the code extract you have given, does not give clues about the actual error.

Read only

Former Member
0 Likes
1,004

the dump is

Runtime Errors DATASET_NOT_OPEN

Exception CX_SY_FILE_OPEN_MODE

if i remove the transfer statement the program runs but does not output anything.. i want to openFILENAME for output that's where the error comes about.

the code

$$ This program converts a file from RAPID into the structure

$$ required by the report RFBIBL00.

$$ Module : Financials

$$ Date : 24/11/98

  • Last Modification : 27/11/98.

$$

REPORT ZIMPORT2.

TABLES: BGR00,

BBSEG,

BBKPF.

DATA: BEGIN OF REC1,

FIELD1(2000),

END OF REC1.

DATA: C_NODATA(1) TYPE C VALUE '/'." NODATA

DATA AMOUNT LIKE BBSEG-WRBTR.

DATA ALLOCATION LIKE BBSEG-ZUONR.

DATA ALLOTEMP LIKE BBSEG-ZUONR.

DATA SGTXT LIKE BBSEG-SGTXT.

DATA COSTCENT LIKE BBSEG-KOSTL.

$$ Filenames for input and output.

PARAMETERS:

FILE1(140) DEFAULT '
umprod\usr\INTERFACE\CARGO08.TXT' LOWER CASE,

FILENAME(128) DEFAULT '
umprod\usr\INTERFACE\CARGOUT08.txt'

LOWER CASE,

RATEFILE(128) DEFAULT 'C:\Edson\Ratefile.txt' LOWER CASE.

DATA: BEGIN OF ITAB2 OCCURS 0,

WAERS LIKE BBKPF-WAERS,

KURSF LIKE BBKPF-KURSF,

END OF ITAB2 .

START-OF-SELECTION.

OPEN DATASET FILE1 FOR INPUT IN TEXT MODE.

OPEN DATASET FILENAME FOR OUTPUT IN TEXT MODE.

$$ Session data

PERFORM INIT_STRUKTUREN_ERZEUGEN(RFBIBLI0) USING C_NODATA.

PERFORM BGR00_DATEN.

$$

$$ Transfer data to rec1.

DO.

READ DATASET FILE1 INTO REC1.

IF SY-SUBRC NE 0.

EXIT.

ENDIF.

IF REC1-FIELD1+18(4) = 'ZW01'.

$$ Fill bbkpf structure with header data.

PERFORM BBKPF_DATEN_FB01.

$$ Write header data to file

CLEAR BBKPF.

ELSEIF REC1-FIELD1+18(4) = SPACE.

$$ Write line items to file.

PERFORM BBSEG_DATEN_DEBI.

ENDIF.

ENDDO.

CLOSE DATASET: FILE1, FILENAME.

$$ Form to populate the session structure BGR00 with data.

FORM BGR00_DATEN.

PERFORM INIT_BGR00(RFBIBLI0) USING BGR00.

BGR00-MANDT = SY-MANDT.

CONCATENATE 'CARGO' SY-DATUM INTO BGR00-GROUP.

BGR00-USNAM = 'gwenelos'.

BGR00-NODATA = C_NODATA.

BGR00-XKEEP = 'X'.

BGR00-STYPE = '0'.

TRANSFER BGR00 TO FILENAME.

ENDFORM.

$$ Form to populate header structure BBKPF with data

FORM BBKPF_DATEN_FB01.

PERFORM INIT_BBKPF(RFBIBLI0) USING BBKPF.

BBKPF-STYPE = '1'.

BBKPF-TCODE = 'FB01'.

BBKPF-BUDAT = REC1-FIELD1+0(8).

  • concatenate rec1-field110(4) rec1-field116(2) into

BBKPF-BLDAT = REC1-FIELD1+8(8).

BBKPF-BLART = REC1-FIELD1+16(2).

BBKPF-BUKRS = REC1-FIELD1+18(4) .

BBKPF-WWERT = REC1-FIELD1+22(8).

BBKPF-WAERS = REC1-FIELD1+30(5).

BBKPF-XBLNR = REC1-FIELD1+35(16).

  • CLEAR ALLOCATION.

  • CLEAR SGTXT.

  • ALLOCATION = REC1-FIELD1+67(6).

  • CONCATENATE BBKPF-BLART '_' ALLOCATION INTO ALLOTEMP.

  • SGTXT = REC1-FIELD1+99(25).

TRANSFER BBKPF TO FILENAME.

ENDFORM.

$$ Form to populate line items structure BBSEG with data.

FORM BBSEG_DATEN_DEBI.

PERFORM INIT_BBSEG(RFBIBLI0) USING BBSEG.

BBSEG-STYPE = '2'.

BBSEG-TBNAM = 'BBSEG'.

  • bbseg-newbk = rec1-field1+6(5).

BBSEG-NEWBS = REC1-FIELD1+0(2).

BBSEG-NEWKO = REC1-FIELD1+2(17).

IF REC1-FIELD1+2(17) = '800220'.

BBSEG-NEWBK = 'ZW01'.

ENDIF.

  • concatenate rec1-field134(12) ',' rec1-field146(2) into amount.

BBSEG-WRBTR = REC1-FIELD1+19(16).

  • CONCATENATE 'INV' ' ' ALLOCATION INTO ALLOCATION.

BBSEG-ZUONR = REC1-FIELD1+35(18).

  • BBSEG-WRBTR = REC1-FIELD1+33(16).

BBSEG-SGTXT = REC1-FIELD1+53(50).

BBSEG-KOSTL = REC1-FIELD1+117(4).

BBSEG-PRCTR = REC1-FIELD1+113(4).

WRITE: / BBSEG-KOSTL.

IF REC1-FIELD1+117(4) EQ SPACE.

BBSEG-KOSTL = '/'.

ENDIF.

IF REC1-FIELD1+113(4) EQ SPACE.

BBSEG-PRCTR = '/'.

ENDIF.

COSTCENT = BBSEG-KOSTL.

  • perform decide_cc_or_pc.

PERFORM CONVERT_ROUTE_CODE.

TRANSFER BBSEG TO FILENAME.

ENDFORM.

*& Form CONVERT_ROUTE_CODE

  • This form converts Rapid route code to comply with SAP codes

*

  • RAPID CODE SAP CODE

  • -------------- --------------

  • DHHW DKHV

  • DHKA DKHV

  • DKHW DKHV

  • DKVF DKHV

  • IHFR IHFG

  • IHLC IHLF

  • RHCP RHJC

----


FORM CONVERT_ROUTE_CODE .

CASE COSTCENT.

WHEN 'DHHV'.

BBSEG-KOSTL = 'DKHV'.

WHEN 'DHKA'.

BBSEG-KOSTL = 'DKHV'.

WHEN 'DKHW'.

BBSEG-KOSTL = 'DKHV'.

WHEN 'DKVF'.

BBSEG-KOSTL = 'DKHV'.

WHEN 'IHFR'.

BBSEG-KOSTL = 'IHFG'.

WHEN 'IHLC'.

BBSEG-KOSTL = 'IHLF'.

WHEN 'RHCP'.

BBSEG-KOSTL = 'RHJC'.

WHEN OTHERS.

ENDCASE.

ENDFORM. " CONVERT_ROUTE_CODE

----


  • This procedure determines whether an accoount requires

  • a cost centre or profit center

*----


*FORM DECIDE_CC_OR_PC.

*

*CASE BBSEG-KOSTL.

  • WHEN ' '.

  • BBSE

*

*ENDFORM. " DECIDE_CC_OR_PC

Read only

Former Member
0 Likes
1,004

hi,

i have come accross this problem when u use this statement u will get dump

OPEN DATASET FILE1 FOR INPUT IN TEXT MODE.

so . use exctly i not remember the statement but i can give some clue for

OPEN DATASET FILE1 FOR INPUT IN TEXT MODE with unincode system like that it will come

or ucan search in ECC 6.0 with some programs using for open data set statement .

Thanq

~linganna

Read only

0 Likes
1,004

hi check if the file is open in some place.... and try to catch the exceptions

[Check this help|http://www.sapnet.ru/abap_docu/ABAPOPEN_DATASET.htm]

Read only

Former Member
0 Likes
1,004

2 things:

1) Does file exists on Application server?

2) Do you have Suffucient Authroizations to read the file?

Regards

Shital

Read only

keerthy_k
Product and Topic Expert
Product and Topic Expert
0 Likes
1,004

Hi,

TRANSFER dobj TO dset.

This statement passes the content of data object dobj to the file specified in dset. For dobj, you can specify data objects with elementary data types and flat structures. In Unicode programs, dobj must be character-type if the file was opened as a text file (this restriction does not apply to legacy text files).

In ur case bgr00 shld contain all the fields as char.And u need to OPEN the fiel before transfering.

So use OPEN DATASET dset FOR INPUT IN TEXT MODE.

Keerthi

Edited by: Keerthy K on Mar 6, 2009 9:30 AM

Read only

Former Member
0 Likes
1,004

hi

it seems the text file in the application server(tcode : AL11) is not got created

So first use

OPEN DATASET DSN FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.

TRANSFER WA TO DSN. (from presentation server to application server)

CLOSE DATASET DSN.

OPEN DATASET DSN FOR INPUT IN TEXT MODE ENCODING DEFAULT.

READ DSN INTO WA1. (from application server to presentation)

CLOSE DATASET DSN.

Regards

Read only

Former Member
0 Likes
1,004

thanx for the solution