‎2008 Jun 18 6:29 PM
Hi Guru's,
using BDC i am planning to create customer master but i struck up on mid ...
could please help me out on this..
i had uploaded the flat file data using gui_upload and and those data moved into record fields individually...
but i am unable to cteate customer and it is went to short dump...
please correct me what i did mistakes in my program logic...
REPORT zarepas_bdc_customer_create1
NO STANDARD PAGE HEADING LINE-SIZE 255.
INCLUDE bdcrecx1.
*CHANGE AS PER EQUIREMENT UPLOAD THE FILE DATA
TYPES: BEGIN OF gty_itab1,
xyz(205),
END OF gty_itab1.
DATA: gt_itab1 TYPE STANDARD TABLE OF gty_itab1,
gwa_itab1 TYPE gty_itab1.
TYPES: BEGIN OF gty_itab2,
vkorg(4),
vtweg(2),
spart(2),
ktokd(4),
anred(15),
name1(35),
stras(35),
ort01(35),
ort02(35),
pstl2(10),
land1(3),
spras(2),
pstlz(10),
civve(1),
awahr(3),
waers(5),
kzazu(1),
vsbed(2),
antlf(1),
END OF gty_itab2.
DATA: gt_itab2 TYPE STANDARD TABLE OF gty_itab2,
gwa_itab2 TYPE gty_itab2.
PARAMETERS: p_files TYPE string.
PARAMETERS: dataset(132) LOWER CASE DEFAULT
'test_customer_read_file'.
DO NOT CHANGE - the generated data section - DO NOT CHANGE ***
*
If it is nessesary to change the data section use the rules:
1.) Each definition of a field exists of two lines
2.) The first line shows exactly the comment
'* data element: ' followed with the data element
which describes the field.
If you don't have a data element use the
comment without a data element name
3.) The second line shows the fieldname of the
structure, the fieldname must consist of
a fieldname and optional the character '_' and
three numbers and the field length in brackets
4.) Each field must be type C.
*
Generated data section with specific formatting - DO NOT CHANGE ***
DATA: BEGIN OF record,
data element: VKORG
vkorg_001(004),
data element: VTWEG
vtweg_002(002),
data element: SPART
spart_003(002),
data element: KTOKD
ktokd_004(004),
data element: ANRED
anred_005(015),
data element: NAME1_GP
name1_006(035),
data element: STRAS_GP
stras_007(035),
data element: ORT01_GP
ort01_008(035),
data element: ORT02_GP
ort02_009(035),
data element: PSTL2
pstl2_010(010),
data element: LAND1_GP
land1_011(003),
data element: SPRAS
spras_012(002),
data element: PSTLZ
pstlz_013(010),
data element: CIVVE
civve_014(001),
data element: AWAHR
awahr_015(003),
data element: WAERS_V02D
waers_016(005),
data element: KZAZU_D
kzazu_017(001),
data element: VSBED
vsbed_018(002),
data element: ANTLF
antlf_019(001),
END OF record.
End generated data section ***
START-OF-SELECTION.
*using gui_upload we are upload the file data from presentation server to gt_itab1
CALL METHOD cl_gui_frontend_services=>gui_upload
EXPORTING
filename = p_files
filetype = 'ASC'
CHANGING
data_tab = gt_itab1
EXCEPTIONS
OTHERS = 8.
LOOP AT gt_itab1 INTO gwa_itab1.
IF gwa_itab1-xyz(1) = 'T'.
gwa_itab2 = gwa_itab1-xyz(205).
APPEND gwa_itab2 TO gt_itab2.
ENDIF.
ENDLOOP.
*here we are moving from internal structure to record fileds i BDC.
LOOP AT gt_itab2 INTO gwa_itab2 .
MOVE: gwa_itab2-vkorg TO record-vkorg_001,
gwa_itab2-vtweg TO record-vtweg_002,
gwa_itab2-spart TO record-spart_003,
gwa_itab2-ktokd TO record-ktokd_004,
gwa_itab2-anred TO record-anred_005,
gwa_itab2-name1 TO record-name1_006,
gwa_itab2-stras TO record-stras_007,
gwa_itab2-ort01 TO record-ort01_008,
gwa_itab2-ort02 TO record-ort02_009,
gwa_itab2-pstl2 TO record-pstl2_010,
gwa_itab2-land1 TO record-land1_011,
gwa_itab2-spras TO record-spras_012,
gwa_itab2-pstlz TO record-pstlz_013,
gwa_itab2-civve TO record-civve_014,
gwa_itab2-awahr TO record-awahr_015,
gwa_itab2-waers TO record-waers_016,
gwa_itab2-kzazu TO record-kzazu_017,
gwa_itab2-vsbed TO record-vsbed_018,
gwa_itab2-antlf TO record-antlf_019.
PERFORM open_dataset USING dataset.
PERFORM open_group.
DO.
READ DATASET dataset INTO record.
IF sy-subrc <> 0. EXIT. ENDIF.
PERFORM bdc_dynpro USING 'SAPMF02D' '0100'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RF02D-KTOKD'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'RF02D-VKORG'
record-vkorg_001.
PERFORM bdc_field USING 'RF02D-VTWEG'
record-vtweg_002.
PERFORM bdc_field USING 'RF02D-SPART'
record-spart_003.
PERFORM bdc_field USING 'RF02D-KTOKD'
record-ktokd_004.
PERFORM bdc_dynpro USING 'SAPMF02D' '0110'.
PERFORM bdc_field USING 'BDC_CURSOR'
'KNA1-SPRAS'.
PERFORM bdc_field USING 'BDC_OKCODE'
'VW'.
PERFORM bdc_field USING 'KNA1-ANRED'
record-anred_005.
PERFORM bdc_field USING 'KNA1-NAME1'
record-name1_006.
PERFORM bdc_field USING 'KNA1-STRAS'
record-stras_007.
PERFORM bdc_field USING 'KNA1-ORT01'
record-ort01_008.
PERFORM bdc_field USING 'KNA1-ORT02'
record-ort02_009.
PERFORM bdc_field USING 'KNA1-PSTL2'
record-pstl2_010.
PERFORM bdc_field USING 'KNA1-LAND1'
record-land1_011.
PERFORM bdc_field USING 'KNA1-SPRAS'
record-spras_012.
PERFORM bdc_field USING 'KNA1-PSTLZ'
record-pstlz_013.
PERFORM bdc_dynpro USING 'SAPMF02D' '0120'.
PERFORM bdc_field USING 'BDC_CURSOR'
'KNA1-LIFNR'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=VW'.
PERFORM bdc_dynpro USING 'SAPMF02D' '0125'.
PERFORM bdc_field USING 'BDC_CURSOR'
'KNA1-NIELS'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=VW'.
PERFORM bdc_dynpro USING 'SAPMF02D' '0130'.
PERFORM bdc_field USING 'BDC_CURSOR'
'KNBK-BANKS(01)'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=VW'.
PERFORM bdc_dynpro USING 'SAPMF02D' '0340'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RF02D-KUNNR'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=VW'.
PERFORM bdc_dynpro USING 'SAPMF02D' '0370'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RF02D-KUNNR'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=VW'.
PERFORM bdc_field USING 'KNA1-CIVVE'
record-civve_014.
PERFORM bdc_dynpro USING 'SAPMF02D' '0360'.
PERFORM bdc_field USING 'BDC_CURSOR'
'KNVK-NAMEV(01)'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=VW'.
PERFORM bdc_dynpro USING 'SAPMF02D' '0310'.
PERFORM bdc_field USING 'BDC_CURSOR'
'KNVV-BZIRK'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=VW'.
PERFORM bdc_field USING 'KNVV-AWAHR'
record-awahr_015.
PERFORM bdc_field USING 'KNVV-WAERS'
record-waers_016.
PERFORM bdc_dynpro USING 'SAPMF02D' '0315'.
PERFORM bdc_field USING 'BDC_CURSOR'
'KNVV-VSBED'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=VW'.
PERFORM bdc_field USING 'KNVV-KZAZU'
record-kzazu_017.
PERFORM bdc_field USING 'KNVV-VSBED'
record-vsbed_018.
PERFORM bdc_field USING 'KNVV-ANTLF'
record-antlf_019.
PERFORM bdc_dynpro USING 'SAPMF02D' '0320'.
PERFORM bdc_field USING 'BDC_CURSOR'
'KNVV-PERFK'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=VW'.
PERFORM bdc_dynpro USING 'SAPMF02D' '1350'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RF02D-KUNNR'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=VW'.
PERFORM bdc_dynpro USING 'SAPMF02D' '0324'.
PERFORM bdc_field USING 'BDC_CURSOR'
'KNVP-PARVW(01)'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=VW'.
PERFORM bdc_transaction USING 'XD01'.
ENDDO.
ENDLOOP.
PERFORM close_group.
PERFORM close_dataset USING dataset.
‎2008 Jun 18 6:36 PM
‎2008 Jun 18 7:00 PM
‎2008 Jun 18 7:07 PM
please let me know if this info in not sufficieant....
Short text
File "test_customer_read_file" is already opened.
What happened?
Error in the ABAP Application Program
The current ABAP program "ZAREPAS_BDC_CUSTOMER_CREATE1" had to be terminated
because it has
come across a statement that unfortunately cannot be executed.
Error analysis
An exception occurred that is explained in detail below.
The exception, which is assigned to class 'CX_SY_FILE_OPEN', was not caught in
procedure "OPEN_DATASET" "(FORM)", nor was it propagated by a RAISING clause.
Since the caller of the procedure could not have anticipated that the
exception would occur, the current program is terminated.
The reason for the exception is:
The file with the name "test_customer_read_file" cannot be opened because it is
already open
.
Information on where terminated
Termination occurred in the ABAP program "ZAREPAS_BDC_CUSTOMER_CREATE1" - in
"OPEN_DATASET".
The main program was "ZAREPAS_BDC_CUSTOMER_CREATE1 ".
In the source code you have the termination point in line 110
of the (Include) program "BDCRECX1".
The termination is caused because exception "CX_SY_FILE_OPEN" occurred in
procedure "OPEN_DATASET" "(FORM)", but it was neither handled locally nor
declared
in the RAISING clause of its signature.
The procedure is in program "ZAREPAS_BDC_CUSTOMER_CREATE1 "; its source code
begins in line
109 of the (Include program "BDCRECX1 ".
96 ----
97 * at selection screen *
98 ----
99 AT SELECTION-SCREEN.
100 * group and user must be filled for create session
101 IF SESSION = 'X' AND
102 GROUP = SPACE OR USER = SPACE.
103 MESSAGE E613(MS).
104 ENDIF.
105
106 ----
107 * open dataset *
108 ----
109 FORM OPEN_DATASET USING P_DATASET.
>>>>> OPEN DATASET P_DATASET
111 FOR INPUT IN TEXT MODE
112 ENCODING DEFAULT.
113 IF SY-SUBRC <> 0.
114 WRITE: / TEXT-E00, SY-SUBRC.
115 STOP.
116 ENDIF.
117 ENDFORM.
118
119 ----
120 * close dataset *
121 ----
122 FORM CLOSE_DATASET USING P_DATASET.
123 CLOSE DATASET P_DATASET.
‎2008 Jun 18 7:28 PM
close the file in AL11 transcation(Not on your PC) before you run your program.
Regards,
Ravi
‎2008 Jun 18 7:15 PM
Hey
Before you run your program please close the upload file, i mean dont let open the file in your computer close the file and run the program.
If your file is in application server close the file and come out of it
Regards
Edited by: Chaitanya V Kumar Naru on Jun 18, 2008 8:30 PM
‎2008 Jun 18 7:48 PM
Hi Ravi&Chaithanya....
my file is in presentation srever and it is close before upload the data ...
then then the control comming out from the progam ...
wat i did is...
1st i recorded the BDC program...
in that same program i made changes as below...
PARAMETERS: p_files TYPE string.
TYPES: BEGIN OF gty_itab1,
xyz(205),
END OF gty_itab1.
DATA: gt_itab1 TYPE STANDARD TABLE OF gty_itab1,
gwa_itab1 TYPE gty_itab1.
TYPES: BEGIN OF gty_itab2,
vkorg(4),
vtweg(2),
spart(2),
ktokd(4),
anred(15),
name1(35),
stras(35),
ort01(35),
ort02(35),
pstl2(10),
land1(3),
spras(2),
pstlz(10),
civve(1),
awahr(3),
waers(5),
kzazu(1),
vsbed(2),
antlf(1),
END OF gty_itab2.
DATA: gt_itab2 TYPE STANDARD TABLE OF gty_itab2,
gwa_itab2 TYPE gty_itab2.
*here upload the file from presentation server...
CALL METHOD cl_gui_frontend_services=>gui_upload
EXPORTING
filename = p_files
filetype = 'ASC'
CHANGING
data_tab = gt_itab1
EXCEPTIONS
OTHERS = 8.
LOOP AT gt_itab1 INTO gwa_itab1.
IF gwa_itab1-xyz(1) = 'T'.
gwa_itab2 = gwa_itab1-xyz(205).
APPEND gwa_itab2 TO gt_itab2.
ENDIF.
ENDLOOP.
*here we are moving from internal structure to record fileds i BDC.
LOOP AT gt_itab2 INTO gwa_itab2 .
MOVE: gwa_itab2-vkorg TO record-vkorg_001,
gwa_itab2-vtweg TO record-vtweg_002,
gwa_itab2-spart TO record-spart_003,
gwa_itab2-ktokd TO record-ktokd_004,
gwa_itab2-anred TO record-anred_005,
gwa_itab2-name1 TO record-name1_006,
gwa_itab2-stras TO record-stras_007,
gwa_itab2-ort01 TO record-ort01_008,
gwa_itab2-ort02 TO record-ort02_009,
gwa_itab2-pstl2 TO record-pstl2_010,
gwa_itab2-land1 TO record-land1_011,
gwa_itab2-spras TO record-spras_012,
gwa_itab2-pstlz TO record-pstlz_013,
gwa_itab2-civve TO record-civve_014,
gwa_itab2-awahr TO record-awahr_015,
gwa_itab2-waers TO record-waers_016,
gwa_itab2-kzazu TO record-kzazu_017,
gwa_itab2-vsbed TO record-vsbed_018,
gwa_itab2-antlf TO record-antlf_019.
here i kept end loop in end of program
as per exisiting recorded program the is like below...
and the control also comming from here....
-->PERFORM open_dataset USING dataset.
PERFORM open_group.
DO.
READ DATASET dataset INTO record.
IF sy-subrc <> 0. EXIT. ENDIF.
Note : as per existing program one DATASET is there is that effecting for our file...(like below logic)
PARAMETERS: dataset(132) LOWER CASE DEFAULT
'test_customer_read_file'.--->is this file effecting for us...
please let me know my explation is not clear....
Hi Ravi and verified in the AL11 also..i traced our file name but i don't no how to chect the status of file is open or close...please guide me...(if it is a problam...)
‎2008 Jun 18 7:50 PM
chaithanya...i executed the same program as u said again i am getting the same error discription like below..
Runtime Errors DATASET_REOPEN
Except. CX_SY_FILE_OPEN
Date and Time 18.06.2008 13:29:54
Short text
File "test_customer_read_file" is already opened.
What happened?
Error in the ABAP Application Program
The current ABAP program "ZAREPAS_BDC_CUSTOMER_CREATE1" had to be terminated
because it has
come across a statement that unfortunately cannot be executed.
Error analysis
An exception occurred that is explained in detail below.
The exception, which is assigned to class 'CX_SY_FILE_OPEN', was not caught in
procedure "OPEN_DATASET" "(FORM)", nor was it propagated by a RAISING clause.
Since the caller of the procedure could not have anticipated that the
exception would occur, the current program is terminated.
The reason for the exception is:
The file with the name "test_customer_read_file" cannot be opened because it is
already open
.
Missing RAISING Clause in Interface
Program ZAREPAS_BDC_CUSTOMER_CREATE1
Include BDCRECX1
Row 109
Module type (FORM)
Module Name OPEN_DATASET
Trigger Location of Exception
Program ZAREPAS_BDC_CUSTOMER_CREATE1
Include BDCRECX1
Row 110
Module type (FORM)
Module Name OPEN_DATASET
Source Code Extract
Line SourceCde
105
106 ----
107 * open dataset *
108 ----
109 FORM OPEN_DATASET USING P_DATASET.
>>> OPEN DATASET P_DATASET
111 FOR INPUT IN TEXT MODE
112 ENCODING DEFAULT.
113 IF SY-SUBRC <> 0.
114 WRITE: / TEXT-E00, SY-SUBRC.
115 STOP.
116 ENDIF.
117 ENDFORM.
‎2008 Jun 18 8:18 PM
Hi
you are saying that your file is at presentation server instead of using the method try using FM GUI_UPLOAD
Regards
Edited by: Chaitanya V Kumar Naru on Jun 18, 2008 9:19 PM
‎2008 Jun 18 8:25 PM
Hi
At Open data set.
OPEN DATA SET <.....> IN TEXT MODE ENCODING DEFAULT.
regards
‎2008 Jun 18 8:29 PM
Hi Chaithanya..
exactly what u want me to do for resolving this issuee..
Thanks in advance
Srinivas...
‎2008 Jun 18 8:32 PM
Hi,
You are trying to upload the data from your Desktop.
In which case, you should use the function module GUI_UPLOAD and NOT OPEN DATASET/READ DATASET statements.
YOu should use OPen dataset / read dataset if you are uploading the data from Application server.
Regards,
Ravi Kanth Talagana
‎2008 Jun 18 8:34 PM
Hi
at
PERFORM open_dataset USING dataset.
PERFORM OPEN_DATASET IN TEXT MODE ENCODING DEFAULT.
I have no idea on methods i mean oops if you say that this is correct using open data set in oops then the above solution will work.
Regards
Edited by: Chaitanya V Kumar Naru on Jun 18, 2008 9:35 PM
Edited by: Chaitanya V Kumar Naru on Jun 18, 2008 9:36 PM
‎2008 Jun 18 8:39 PM
It's really not clear what you're trying to do with your dataset. You both try to upload it from the presentation server and the application server. If it really is on the presentation server, get rid of the open dataset.
Rob
‎2008 Jun 18 8:44 PM
yahh chaithanya that 100% correct for upload file using meathods...
thanks for your valuble time for spending to me.....:)
please let me know if anyone you is not clear with my question...
Thanks in advance and will give full points...
Srinivas....
‎2008 Jun 19 6:26 PM
Hi,
you have used the generated code from the recording. The generated program by default reads the file from the application server.
in your we have to change the program in a way that it should read the data from the presentation server. for that you have to delete the code pertaining to the application server ( any statements with dataset).
I have given here an example to read the data from the presentation server. go through it.
report ZTEST_CUSTOMER1
no standard page heading line-size 255.
include bdcrecx1.
parameters: p_fname type string.
DATA: BEGIN OF wa_customer,
kunnr(010),
ktokd(004),
name1(035),
sortl(010),
ort01(035),
land1(003),
spras(002),
pstlz(010),
lzone(010),
END OF wa_customer,
i_customer LIKE TABLE OF wa_customer.
start-of-selection.
PERFORM upload_data.
perform open_group.
Loop at i_customer into wa_customer.
PERFORM bdc_dynpro USING 'SAPMF02D' '0100'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RF02D-KTOKD'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'RF02D-KUNNR'
wa_customer-kunnr.
PERFORM bdc_field USING 'RF02D-KTOKD'
wa_customer-ktokd.
PERFORM bdc_dynpro USING 'SAPMF02D' '0110'.
PERFORM bdc_field USING 'BDC_CURSOR'
'KNA1-SPRAS'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'KNA1-NAME1'
wa_customer-name1.
PERFORM bdc_field USING 'KNA1-SORTL'
wa_customer-sortl.
PERFORM bdc_field USING 'KNA1-ORT01'
wa_customer-ort01.
PERFORM bdc_field USING 'KNA1-LAND1'
wa_customer-land1.
PERFORM bdc_field USING 'KNA1-SPRAS'
wa_customer-spras.
PERFORM bdc_field USING 'KNA1-PSTLZ'
wa_customer-pstlz.
PERFORM bdc_dynpro USING 'SAPMF02D' '0120'.
PERFORM bdc_field USING 'BDC_CURSOR'
'KNA1-LZONE'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'KNA1-LZONE'
wa_customer-lzone.
PERFORM bdc_dynpro USING 'SAPMF02D' '0125'.
PERFORM bdc_field USING 'BDC_CURSOR'
'KNA1-NIELS'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=UPDA'.
PERFORM bdc_transaction USING 'XD01'.
endloop.
perform close_group.
FORM upload_data .
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = p_fname
filetype = 'ASC'
has_field_separator = 'X'
TABLES
data_tab = i_customer
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.
ENDFORM. " upload_dataThanks,
Rajinikanth
‎2008 Jun 18 8:46 PM
Hi ROB...
the file is in [resentation server...
please let me know if you have any questions...
thanks in advance and will give full points...
Srinivas...
‎2008 Jun 18 8:59 PM
Like I said earlier - if it's on the presentation server, you don't need a READ DATASET. Remove that line.
Rob
‎2008 Jun 18 8:54 PM
hi
go thru this link
http://www.sapnet.ru/abap_docu/ABENUNICODE_DATASET.htm
from unicode enabled version you have to maintain the things which are given in the above link.
I have no other answers.......
Regards.....
‎2008 Jun 18 8:56 PM
once again thanks chaithanya for ur valuble time and support....:)
‎2008 Jun 18 11:41 PM
Hi ROB...
i removed and ran and i am etting same problem...
if any alternative process....
please let me know if my question is not clear...
thanks in advance...and will give full points...
Srinivas........
‎2008 Jun 19 2:24 PM
I mistyped the second response. Get rid of the:
OPEN DATASET.statement.
Rob
‎2008 Jun 19 4:28 PM
Hi ROB,
yah now the issue is the data is in excell sheet in presentation server...
please let me know which meathod i hav to for upload excell sheet data to internal table...
earlier i am using below meathod for upload flat file to internal table...
*using gui_upload we are upload the file data from presentation server to gt_itab1
CALL METHOD cl_gui_frontend_services=>gui_upload
EXPORTING
filename = p_files............>flat file
filetype = 'ASC'
CHANGING
data_tab = gt_itab1----
>internal table
EXCEPTIONS
OTHERS = 8.
LOOP AT gt_itab1 INTO gwa_itab1.
IF gwa_itab1-xyz(1) = 'T'.
gwa_itab2 = gwa_itab1-xyz(205).
APPEND gwa_itab2 TO gt_itab2.
ENDIF.
ENDLOOP.
please let me know if my question is not clear ..
thanks in advance and will give full points
Srinivas...
‎2008 Jun 19 5:14 PM
Hi Srini
Ahaha atlast i think you are at the point
follow this
data : it_excel type alsmex_tabline occurs 1 with header line.
data : l_file like rlgrap-filename.
l_file = p_file.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
FILENAME = l_file
I_BEGIN_COL = 1
I_BEGIN_ROW = 3
I_END_COL = 21
I_END_ROW = 9999
TABLES
INTERN = it_excel
EXCEPTIONS
INCONSISTENT_PARAMETERS = 1
UPLOAD_OLE = 2
OTHERS = 3.
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
Edited by: Chaitanya V Kumar Naru on Jun 19, 2008 6:15 PM
‎2008 Jun 19 5:22 PM
Hi chaithanya...
while executing it went to short dump and messages like below..
please confirm me if you went me send my proggram logic also.......
let me know if you wnat me to send my pgm
Short text
Exception condition "UPLOAD_OLE" raised.
What happened?
The current ABAP/4 program encountered an unexpected
situation.
Error analysis
A RAISE statement in the program "SAPLALSMEX" raised the exception
condition "UPLOAD_OLE".
Since the exception was not intercepted by a superior
program, processing was terminated.
Short description of exception condition:
For detailed documentation of the exception condition, use
Transaction SE37 (Function Library). You can take the called
function module from the display of active calls.
-
Trigger Location of Runtime Error
Program SAPLALSMEX
Include LALSMEXU01
Row 57
Module type (FUNCTION)
Module Name ALSM_EXCEL_TO_INTERNAL_TABLE
Source Code Extract
Line SourceCde
27 * Rückgabewert der Methode "clipboard_export "
28
29 * Makro für Fehlerbehandlung der Methods
30 DEFINE m_message.
31 case sy-subrc.
32 when 0.
33 when 1.
34 message id sy-msgid type sy-msgty number sy-msgno
35 with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
36 when others. raise upload_ole.
37 endcase.
38 END-OF-DEFINITION.
39
40
41 * check parameters
42 IF i_begin_row > i_end_row. RAISE inconsistent_parameters. ENDIF.
43 IF i_begin_col > i_end_col. RAISE inconsistent_parameters. ENDIF.
44
45 * Get TAB-sign for separation of fields
46 CLASS cl_abap_char_utilities DEFINITION LOAD.
47 ld_separator = cl_abap_char_utilities=>horizontal_tab.
48
49 * open file in Excel
50 IF application-header = space OR application-handle = -1.
51 CREATE OBJECT application 'Excel.Application'.
52 m_message.
53 ENDIF.
54 CALL METHOD OF application 'Workbooks' = workbook.
55 m_message.
56 CALL METHOD OF workbook 'Open' EXPORTING #1 = filename.
m_message.
58 * set property of application 'Visible' = 1.
58 * set property of application 'Visible' = 1.
59 * m_message.
60 GET PROPERTY OF application 'ACTIVESHEET' = worksheet.
61 m_message.
62
63 * mark whole spread sheet
64 CALL METHOD OF worksheet 'Cells' = h_cell
65 EXPORTING #1 = i_begin_row #2 = i_begin_col.
66 m_message.
67 CALL METHOD OF worksheet 'Cells' = h_cell1
68 EXPORTING #1 = i_end_row #2 = i_end_col.
69 m_message.
70
71 CALL METHOD OF worksheet 'RANGE' = range
72 EXPORTING #1 = h_cell #2 = h_cell1.
73 m_message.
74 CALL METHOD OF range 'SELECT'.
75 m_message.
76
‎2008 Jun 19 6:22 PM
hi
please leave the method use FM
define the file name as
data: it_file type standard table of ty_wa with header line.
regards
Edited by: Chaitanya V Kumar Naru on Jun 19, 2008 7:23 PM
‎2008 Jun 19 6:36 PM
HI RAJANIKANTH...
This is not BDC recorder code...
i am using BAPI in that i am using Methods for upload the data from presentation excell data to internal table...
anyway thanks for responding rajani...
Thanks in advance
Srinivas.......