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

data not uploading.....kindly check my coding

Former Member
0 Likes
2,704

Hi ABAPERs

The following coding is written to upload flat file data into database.But while debugging my code i found data is not coming to any of the internal table output is showing 0 record. What can be the reasons?

CODE :

****************

REPORT Zupload.

INCLUDE zbdc_include.

TABLES: vblb,vbsn.

DATA: itab_nag_mrp LIKE itab_nag OCCURS 0 WITH HEADER LINE.

DATA: BEGIN OF t_bdcdata OCCURS 0.

INCLUDE STRUCTURE bdcdata.

DATA: END OF t_bdcdata.

DATA: l_itmcd LIKE vbap-matnr,

l_pos LIKE vbap-posnr,

l_unit LIKE mara-meins.

DATA: l_totrec(10) TYPE n,

l_rejrec(10) TYPE n,

l_rejrec1(10) TYPE n,

l_correc(10) TYPE n.

DATA: w_vbeln LIKE vbap-vbeln.

*INTERNAL TABLES

DATA: i_err_itab_nag1 LIKE i_err_itab_nag OCCURS 0 WITH HEADER LINE.

*INTERNAL TABLE FOR ERROR MESSAGES

DATA: BEGIN OF t_err_mes OCCURS 0.

INCLUDE STRUCTURE bdcmsgcoll.

DATA: END OF t_err_mes.

  • WORK AREA

DATA: wa_err_itab_nag LIKE i_err_itab_nag,

wa1 TYPE vblb.

  • GLOBAL VARIABLE DECLARATION.

DATA:g_text LIKE t100-text,

g_lines TYPE i.

PARAMETERS :p_file TYPE rlgrap-filename OBLIGATORY

DEFAULT 'C:\Nagare\nagaretest.txt',

err_file TYPE rlgrap-filename OBLIGATORY

DEFAULT 'C:\Nagare\error.txt',

err_qty TYPE rlgrap-filename OBLIGATORY

DEFAULT 'C:\Nagare\error_qty.txt'.

SELECTION-SCREEN: END OF BLOCK blk2.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.

PERFORM f_get_file_name USING p_file.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR err_file.

PERFORM f_get_file_name USING err_file.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR err_qty.

PERFORM f_get_file_name USING err_qty.

AT SELECTION-SCREEN.

PERFORM f_check_file_exist USING p_file.

PERFORM f_check_file_exist USING err_file.

PERFORM f_check_file_exist USING err_qty.

START-OF-SELECTION.

l_totrec = 0.

PERFORM data_load.

CLEAR itab_nag.

LOOP AT itab_nag.

SELECT SINGLE matnr

posnr

INTO (l_itmcd,

l_pos)

FROM vbap

WHERE kdmat = itab_nag-itmcd

AND vbeln = itab_nag-vbeln.

w_vbeln = itab_nag-vbeln.

IF sy-subrc <> 0.

MOVE-CORRESPONDING itab_nag TO itab_err.

APPEND itab_err.

CLEAR itab_err.

CLEAR w_vbeln.

CONTINUE.

ENDIF.

SELECT SINGLE meins

INTO l_unit

FROM mara

WHERE matnr = l_itmcd.

PERFORM insert_sch_lines.

ENDLOOP.

PERFORM nagare_mrp_trigger.

DELETE ADJACENT DUPLICATES FROM i_err_itab_nag.

DELETE ADJACENT DUPLICATES FROM i_err_itab_nag1.

l_rejrec = 0.

DESCRIBE TABLE i_err_itab_nag LINES g_lines.

IF g_lines > 0.

PERFORM f_display_error_headings.

PERFORM f_diplay_error_report.

ENDIF.

DESCRIBE TABLE itab_err LINES l_rejrec.

DESCRIBE TABLE itab_err_qty LINES l_rejrec1.

l_rejrec = l_rejrec + l_rejrec1.

l_correc = l_totrec - l_rejrec.

WRITE: / 'Nagare Upload Status'.

WRITE: / ' '.

WRITE: / 'Total no of Records: ', l_totrec.

WRITE: / 'Total Records Uploded: ', l_correc.

WRITE: / 'Total Error Records: ', l_rejrec.

CLEAR itab_err.

IF itab_err[] IS NOT INITIAL.

DATA LOCAL2 TYPE STRING.

local2 = err_file.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

FILENAME = local2

FILETYPE = 'DAT'

TABLES

DATA_TAB = itab_err[]

EXCEPTIONS

FILE_WRITE_ERROR = 1

NO_BATCH = 2

GUI_REFUSE_FILETRANSFER = 3

INVALID_TYPE = 4

NO_AUTHORITY = 5

UNKNOWN_ERROR = 6

HEADER_NOT_ALLOWED = 7

SEPARATOR_NOT_ALLOWED = 8

FILESIZE_NOT_ALLOWED = 9

HEADER_TOO_LONG = 10

DP_ERROR_CREATE = 11

DP_ERROR_SEND = 12

DP_ERROR_WRITE = 13

UNKNOWN_DP_ERROR = 14

ACCESS_DENIED = 15

DP_OUT_OF_MEMORY = 16

DISK_FULL = 17

DP_TIMEOUT = 18

FILE_NOT_FOUND = 19

DATAPROVIDER_EXCEPTION = 20

CONTROL_FLUSH_ERROR = 21

OTHERS = 22

.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

WRITE: / 'Duplicate Error File Saved in: ', err_file.

ENDIF.

CLEAR itab_err_qty.

IF itab_err_qty[] IS NOT INITIAL.

DATA LOCAL1 TYPE STRING.

local1 = err_qty.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

FILENAME = local1

FILETYPE = 'DAT'

TABLES

DATA_TAB = itab_err_qty[]

EXCEPTIONS

FILE_WRITE_ERROR = 1

NO_BATCH = 2

GUI_REFUSE_FILETRANSFER = 3

INVALID_TYPE = 4

NO_AUTHORITY = 5

UNKNOWN_ERROR = 6

HEADER_NOT_ALLOWED = 7

SEPARATOR_NOT_ALLOWED = 8

FILESIZE_NOT_ALLOWED = 9

HEADER_TOO_LONG = 10

DP_ERROR_CREATE = 11

DP_ERROR_SEND = 12

DP_ERROR_WRITE = 13

UNKNOWN_DP_ERROR = 14

ACCESS_DENIED = 15

DP_OUT_OF_MEMORY = 16

DISK_FULL = 17

DP_TIMEOUT = 18

FILE_NOT_FOUND = 19

DATAPROVIDER_EXCEPTION = 20

CONTROL_FLUSH_ERROR = 21

OTHERS = 22

.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

FORM data_load.

DATA: l_nagno LIKE vbep-aeskd,

l_qty LIKE vbep-wmeng.

DATA LOCAL TYPE STRING.

local = p_file.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

FILENAME = local

FILETYPE = 'ASC'

TABLES

DATA_TAB = itab_main_nag1

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.

ENDIF.

IF NOT itab_main_nag1 IS INITIAL.

LOOP AT itab_main_nag1.

CONDENSE itab_main_nag1-time.

CONDENSE itab_main_nag1-itmcd.

CONDENSE itab_main_nag1-qty.

CONDENSE itab_main_nag1-gate.

CONDENSE itab_main_nag1-a11.

CONDENSE itab_main_nag1-nagno.

itab_main_nag-nagdt = itab_main_nag1-nagdt.

itab_main_nag-time = itab_main_nag1-time.

itab_main_nag-itmcd = itab_main_nag1-itmcd.

itab_main_nag-qty = itab_main_nag1-qty.

itab_main_nag-gate = itab_main_nag1-gate.

itab_main_nag-a11 = itab_main_nag1-a11.

itab_main_nag-nagno = itab_main_nag1-nagno.

APPEND itab_main_nag.

ENDLOOP.

ENDIF.

DATA: l_vbeln LIKE vbap-vbeln.

PERFORM change_date_time_format.

SORT itab_data_nag BY itmcd.

LOOP AT itab_data_nag.

itab_nag-nagdt = itab_data_nag-nagdt.

itab_nag-time = itab_data_nag-time.

itab_nag-itmcd = itab_data_nag-itmcd.

itab_nag-qty = itab_data_nag-qty.

itab_nag-gate = itab_data_nag-gate.

itab_nag-a11 = itab_data_nag-a11.

itab_nag-nagno = itab_data_nag-nagno.

APPEND itab_nag.

ENDLOOP.

LOOP AT itab_data_nag.

ON CHANGE OF itab_data_nag-itmcd.

SELECT SINGLE vbap~vbeln

INTO l_vbeln

FROM vbap JOIN vbak ON vbapvbeln = vbakvbeln

WHERE kdmat EQ itab_data_nag-itmcd AND auart = 'YDS'.

IF sy-subrc EQ 0.

LOOP AT itab_nag WHERE itmcd EQ itab_data_nag-itmcd.

itab_nag-vbeln = l_vbeln.

MODIFY itab_nag.

ENDLOOP.

ELSE.

CLEAR wa_err_itab_nag.

MOVE-CORRESPONDING itab_data_nag TO wa_err_itab_nag.

PERFORM f_error_message.

ENDIF.

ENDON.

ENDLOOP.

CLEAR itab_nag.

DESCRIBE TABLE itab_nag LINES l_totrec.

LOOP AT itab_nag.

SELECT SINGLE aeskd

wmeng

INTO (l_nagno,

l_qty)

FROM vbep

WHERE aeskd = itab_nag-nagno.

IF sy-subrc = 0.

IF l_qty = itab_nag-qty.

MOVE-CORRESPONDING itab_nag TO itab_err.

DELETE itab_nag.

APPEND itab_err.

ELSE.

MOVE-CORRESPONDING itab_nag TO itab_err_qty.

DELETE itab_nag.

APPEND itab_err_qty.

ENDIF.

ENDIF.

ENDLOOP.

CLEAR itab_err.

CLEAR itab_err_qty.

ENDFORM. "Data_Load

FORM insert_sch_lines.

DATA: wa TYPE vbep.

DATA: l_row LIKE vbep-etenr.

DATA: l_kwmeng LIKE vbap-kwmeng,

l_lsmeng LIKE vbap-lsmeng,

l_kbmeng LIKE vbap-kbmeng,

l_klmeng LIKE vbap-klmeng,

l_brgew LIKE vbap-brgew,

l_ntgew LIKE vbap-ntgew.

l_row = 0.

SELECT MAX( etenr )

INTO l_row

FROM vbep

WHERE vbeln = w_vbeln

AND posnr = l_pos.

l_row = l_row + 1.

wa-vbeln = w_vbeln.

wa-posnr = l_pos.

wa-etenr = l_row.

wa-ettyp = 'L1'.

wa-lfrel = 'X'.

wa-edatu = itab_nag-nagdt.

wa-ezeit = itab_nag-time.

wa-wmeng = itab_nag-qty.

wa-bmeng = itab_nag-qty.

wa-vrkme = l_unit.

wa-lmeng = itab_nag-qty.

wa-meins = l_unit.

wa-bdart = '05'.

wa-plart = '0'.

wa-aeskd = itab_nag-nagno.

wa-sernr = itab_nag-gate.

wa-prgrs = '1'.

wa-tddat = itab_nag-nagdt.

wa-mbdat = itab_nag-nagdt.

wa-lddat = itab_nag-nagdt.

wa-wadat = itab_nag-nagdt.

wa-cmeng = itab_nag-qty.

wa-abart = '2'.

wa-umvkz = '1'.

wa-umvkn = '1'.

wa-verfp = 'X'.

wa-bwart = '601'.

wa-mbuhr = itab_nag-time.

wa-tduhr = itab_nag-time.

wa-lduhr = itab_nag-time.

wa-wauhr = itab_nag-time.

INSERT vbep FROM wa.

IF sy-subrc <> 0.

MOVE-CORRESPONDING itab_nag TO itab_err.

APPEND itab_err.

CLEAR itab_err.

ELSE.

SELECT SINGLE kwmeng

lsmeng

kbmeng

klmeng

INTO (l_kwmeng,

l_lsmeng,

l_kbmeng,

l_klmeng)

FROM vbap

WHERE vbeln = w_vbeln

AND posnr = l_pos.

l_kwmeng = l_kwmeng + itab_nag-qty.

l_lsmeng = l_lsmeng + itab_nag-qty.

l_kbmeng = l_kbmeng + itab_nag-qty.

l_klmeng = l_klmeng + itab_nag-qty.

SELECT SINGLE brgew

ntgew

INTO (l_brgew,

l_ntgew)

FROM mara

WHERE matnr = l_itmcd.

l_brgew = l_brgew * l_kwmeng.

l_ntgew = l_ntgew * l_kwmeng.

UPDATE vbap

SET kwmeng = l_kwmeng

lsmeng = l_lsmeng

kbmeng = l_kbmeng

klmeng = l_klmeng

brgew = l_brgew

ntgew = l_ntgew

WHERE vbeln = w_vbeln

AND posnr = l_pos.

  • Insert Entry in VBLB Table

SELECT SINGLE * FROM vblb WHERE vbeln EQ w_vbeln

AND posnr EQ l_pos

AND abart EQ '2'.

IF sy-subrc NE 0.

wa1-vbeln = w_vbeln.

wa1-posnr = l_pos.

wa1-abart = '2'.

wa1-labnk = 'NAGARE JIT'.

wa1-abrdt = itab_nag-nagdt.

wa1-abhor = itab_nag-nagdt.

wa1-erdat = sy-datum.

wa1-erzei = sy-uzeit.

wa1-ernam = sy-uname.

INSERT vblb FROM wa1.

ENDIF.

ENDIF.

FREE wa.

ENDFORM. "Insert_Sch_Lines

FORM f_error_message .

LOOP AT t_err_mes WHERE msgtyp = 'E' OR msgtyp = 'S'.

CALL FUNCTION 'FORMAT_MESSAGE'

EXPORTING

id = t_err_mes-msgid

lang = 'E'

no = t_err_mes-msgnr

v1 = t_err_mes-msgv1

v2 = t_err_mes-msgv2

v3 = t_err_mes-msgv3

v4 = t_err_mes-msgv4

IMPORTING

msg = g_text

PERFORM f_error_data.

ENDFORM. " f_error_message

FORM f_error_data.

APPEND wa_err_itab_nag TO i_err_itab_nag1.

wa_err_itab_nag-etext = g_text.

APPEND wa_err_itab_nag TO i_err_itab_nag.

ENDFORM. " f_error_data

FORM f_display_error_headings .

DATA: n TYPE i.

SKIP.

WRITE:/50 ' Error Report of Nagare Upload' COLOR COL_NEGATIVE.

DESCRIBE TABLE i_err_itab_nag1 LINES n.

WRITE:/50 'No. of failed records of Nagare Upload:',n.

SKIP.

WRITE:/40 'The following records failed during update:'.

WRITE:/ sy-uline(250).

ENDFORM. " f_display_error_headings

FORM f_diplay_error_report .

LOOP AT i_err_itab_nag.

WRITE:/ i_err_itab_nag.

ENDLOOP.

ENDFORM. " f_diplay_error_report

FORM change_date_time_format .

LOOP AT itab_main_nag.

REPLACE '-' WITH ' ' INTO itab_main_nag-nagdt.

REPLACE '-' WITH ' ' INTO itab_main_nag-nagdt.

CALL FUNCTION 'CONVERSION_EXIT_IDATE_INPUT'

EXPORTING

input = itab_main_nag-nagdt

IMPORTING

output = itab_data_nag-nagdt.

itab_data_nag-itmcd = itab_main_nag-itmcd.

itab_data_nag-qty = itab_main_nag-qty.

itab_data_nag-gate = itab_main_nag-gate.

itab_data_nag-a11 = itab_main_nag-a11.

itab_data_nag-nagno = itab_main_nag-nagno.

APPEND itab_data_nag.

ENDLOOP.

ENDFORM. " change_date_time_format

FORM nagare_mrp_trigger .

LOOP AT itab_nag.

ON CHANGE OF itab_nag-vbeln.

itab_nag_mrp-vbeln = itab_nag-vbeln.

itab_nag_mrp-nagdt = itab_nag-nagdt.

APPEND itab_nag_mrp.

ENDON.

ENDLOOP.

LOOP AT itab_nag_mrp.

REFRESH i_bdcdata.

CLEAR i_bdcdata.

PERFORM bdc_dynpro USING 'SAPMV45A' '0125'.

PERFORM bdc_field USING 'BDC_CURSOR'

'VBAK-VBELN'.

PERFORM bdc_field USING 'BDC_OKCODE'

=uer1.

PERFORM bdc_field USING 'VBAK-VBELN'

itab_nag_mrp-vbeln.

PERFORM bdc_dynpro USING 'SAPMV45A' '4001'.

PERFORM bdc_field USING 'BDC_OKCODE'

'=PFEI'.

PERFORM bdc_field USING 'BDC_CURSOR'

'VBAP-POSNR(01)'.

PERFORM bdc_field USING 'RV45A-VBAP_SELKZ(01)'

'X'.

PERFORM bdc_dynpro USING 'SAPMV45A' '4003'.

PERFORM bdc_field USING 'BDC_OKCODE'

'=SICH'.

PERFORM bdc_field USING 'BDC_CURSOR'

'RV45Z-ABHOR'.

CALL FUNCTION 'CONVERSION_EXIT_PDATE_OUTPUT'

EXPORTING

input = itab_nag_mrp-nagdt

IMPORTING

output = itab_nag_mrp-nagdt.

perform bdc_field using 'VBLB-ABRDT'

itab_nag_mrp-nagdt.

PERFORM bdc_field USING 'RV45Z-ABHOR'

itab_nag_mrp-nagdt.

CALL TRANSACTION 'VA32' USING i_bdcdata MODE 'A'

UPDATE 'S'.

ENDLOOP.

ENDFORM. " nagare_mrp_trigger

33 REPLIES 33
Read only

Former Member
0 Likes
2,603

hi, go to debug mode and try to find out what happens. look if ws_upload is called, what's with sy-subrc and what's with header line.

Read only

Former Member
0 Likes
2,603

ANNU SINGH

I THINK U MIGHT HAVE PROBLEM IN UR UPLOAD FUNCTION MODULE.

TRY CHANGING THE FILE TYPE IN WS_UPLOAD TO 'DAT'... SOMETHING LIKE THIS.

CALL FUNCTION 'WS_UPLOAD'

EXPORTING

  • CODEPAGE = ' '

filename = p_file

filetype = 'DAT'

  • HEADLEN = ' '

  • LINE_EXIT = ' '

  • TRUNCLEN = ' '

  • USER_FORM = ' '

  • USER_PROG = ' '

  • DAT_D_FORMAT = ' '

  • IMPORTING

  • FILELENGTH =

TABLES

data_tab = itab_main_nag1

EXCEPTIONS

conversion_error = 1

file_open_error = 2

file_read_error = 3

invalid_type = 4

no_batch = 5

unknown_error = 6

invalid_table_width = 7

gui_refuse_filetransfer = 8

customer_error = 9

no_authority = 10

OTHERS = 11

.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

LET ME KNOW IF THIS WORKS.

Read only

Former Member
0 Likes
2,603

Hi Annu,

These FMs ws_upload and ws_download are obsolete in the newer versions. Try using GUI_UPLOAD and GUI_DOWNLOAD.

Regards,

Sai

Read only

0 Likes
2,603

Hi Sai

I tried GUI_UPLOAD but now its giving run time error

"An exception occurred that is explained in detail below.

The exception, which is assigned to class 'CX_SY_DYN_CALL_ILLEGAL_TYPE', was

not caught in

procedure "DATA_LOAD" "(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 call to the function module "GUI_UPLOAD" is incorrect:

The function module interface allows you to specify only

fields of a particular type under "FILENAME".

The field "P_FILE" specified here is a different

field type "

Read only

0 Likes
2,603

ANNU

IF U R GETTING RUNTIME ERROR IN GUI UPLOAD ITS BCOS U HAVE PASSED THE P_FILE DIRECTLY. U SHOULD USE ONLY DATA OBJECT OF TYPE STRING IN UR FILE NAME PART IN GUI_UPLOAD.

TRY USING IT LIKE THIS.

DATA LOCAL TYPE STRING.

local = file.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename = local

filetype = 'ASC'

TABLES

data_tab = I_TABLE.

THIS WILL SOLVE UR RUNTIME ERROR.

Read only

0 Likes
2,603

ANNU

IF U R GETTING RUNTIME ERROR IN GUI UPLOAD ITS BCOS U HAVE PASSED THE P_FILE DIRECTLY. U SHOULD USE ONLY DATA OBJECT OF TYPE STRING IN UR FILE NAME PART IN GUI_UPLOAD.

TRY USING IT LIKE THIS.

DATA LOCAL TYPE STRING.

local = P_FILE.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename = local

filetype = 'ASC'

TABLES

data_tab = I_TABLE.

THIS WILL SOLVE UR RUNTIME ERROR.

Read only

0 Likes
2,603

Hi naveen runtime error is not coming but my output is same as it was coming before ...no difference is coming whethert i use WS_UPLOAD or GUI_UPLOAD

Read only

0 Likes
2,603

CAN U TELL ME WHAT IS UR REQUIREMENT AND WHAT IS ZBDC_INCLUDE....????

Read only

0 Likes
2,603

in my flat file i have last column as a number(e.g 20A005570557D14) .so basically for all materials i have to upload this numbers in database which will be used in dispatch. Flat file structure i have given at end of coding.

Read only

0 Likes
2,603

HI ANNU...

UR PROGRAM IS WORKING FINE.

I TRIED CHKING IN MY SYSTEM....

MY OUTPUT FLAT FILE IS

IAM GETTIN THE OUTPUT AS

N229 20-SEP-2007 18:00 85051M67K20-EEK 4 A1-6 A14 20J705570557A14

N229 20-SEP-2007 18:00 85051M67K10-EDU 4 A1-6 A14 20J705570565A14

N229 20-SEP-2007 07:10 85051M67K10-EDV 8 A1-6 A14 20J705570573A14

My output is :

Nagare Upload Status

Total no of Records: 0000000003

Total Records Uploded: 0000000000

Total Error Records: 0000000003

ERROR FLAT FILE AS

20070920 5051M67K10-EDU 4 A1-6 A14 7055 65A14

20070920 5051M67K10-EDV 8 A1-6 A14 7055 73A14

20070920 5051M67K20-EEK 4 A1-6 A14 7055 57A14

THE ONLY CHANGE I HAVE MADE WAS I COMMENTED UR "ZTIME_CONVERSION" FM....

Read only

0 Likes
2,603

Hi Naveen

I tried it after commenting this FM also as you did but in my system output is still same. Had you made any changes to your flat file also?

Read only

0 Likes
2,603

Hi i changed all ws_upload/download to GUI_Upload/Download .

In debugging GUI_UPLOAD itab_main_nag1 table not showing any record and SY_SUBRC is displaying 0 value.

kindly help me what is the problem here why in my case its showing no error file and no data uploading.

Thanks

Read only

Former Member
0 Likes
2,603

hi,

i think ur not giving location of the file in ur WS_UPLOAD. check that one and if ur having a path like this c:/document and settings..........

and try like this

declare a string variable and not a parameter abnd do like this.

data: ws_filepath type string.

parameters: p_filemame like rlgrap-filename.

ws_filename = p_filename.

and pass this ws_filename to WS_DOWNLOAD fm and debug n find the error where it occured.

if helpful reward some points.

with regards,

Suresh Aluri.

Read only

Former Member
0 Likes
2,603

one point should always be remebered is:

the input parameter file name should of type string.

declare liek this.

IN TABLES PARAMETER GIVE THE INTERNALTABLE NAME .

data : lv_infile type string.

lv_infile = p_file.

while you call the funtiion moduel gui_upload

import parameters

file_name = lv_infile

file_type = 'ASC'

HAS_FIELD_SEPARATRO = 'X'

TABLES = ITAB

Then you get the data into internal table.In case if you are still unable to down load into internal table check for sy-subrc.Most probably if there is no authorisation given to you then also you will this problem.Check for the sy-subrc value with that of the number in exception.In case of no authorisation then request basis personnel to give you access.Once you are done with it by my code give the feed back and if this works give me markks.

Regards

Anand

Read only

0 Likes
2,603

Hi anand

in my changed code with gui_upload function module i used string type data only only.

DATA LOCAL TYPE STRING.

local = p_file.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

FILENAME = local

FILETYPE = 'ASC'

TABLES

DATA_TAB = itab_main_nag1

and then passed local as file name parameter then also i am getting same result my sy-subrc is 0.

Read only

0 Likes
2,603

HI Anand

I tried with this also

I did it like this :

DATA LOCAL TYPE STRING.

local = p_file.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

FILENAME = local

  • FILETYPE = 'ASC'

But then also my output ws same.

I havent uncommented used HAS_FIELD_SEPARATRO = 'X'

Can this be the reason. IS this necessary to use it. I tried it ..by passing value to this parameter (HAS_FIELD_SEPARATRO = 'X') my program gives run time error

Read only

0 Likes
2,603

Run time error solved but my output is still ooooo.

Read only

0 Likes
2,603

hi annu

pls see this

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename = v_file

filetype = 'ASC'

has_field_separator = 'X'

TABLES

data_tab = i_upload_file.

are using gui_upload that time

u write like that

p_file LIKE ibipparms-path

data : local is string ,

p_file to local.

check this ur write r not.

regards

kk.

Read only

0 Likes
2,603

HI kaumr kk

even this didnt work

Read only

0 Likes
2,603

hey

thats working because iam using this ok see this full coding ok

SELECTION-SCREEN BEGIN OF BLOCK bl2 WITH FRAME TITLE text-002 .

  • File to be uploaded (File Path)

PARAMETERS : p_file LIKE ibipparms-path . "OBLIGATORY

SELECTION-SCREEN END OF BLOCK bl2.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.

  • Select the file to upload

CALL FUNCTION 'F4_FILENAME'

EXPORTING

program_name = syst-cprog

dynpro_number = syst-dynnr

IMPORTING

file_name = p_file.

PERFORM f_upload_file.

FORM f_upload_file .

DATA: v_file TYPE string.

MOVE p_file TO v_file.

  • File upload

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename = v_file

filetype = 'ASC'

has_field_separator = 'X'

TABLES

data_tab = i_upload_file.

  • IF sy-subrc eq 0.

  • if the uplaod file in no values then delete the record

DELETE i_upload_file WHERE matgp IS INITIAL AND

werks IS INITIAL AND

matnr1 IS INITIAL AND

matnr2 IS INITIAL.

  • else.

  • MESSAGE e001(00) WITH text-m02.

  • ENDIF.

ENDFORM. " disp_data

this is defnately work ok

check it once.

kk.

Read only

hymavathi_oruganti
Active Contributor
0 Likes
2,603

hi, try debugging ur code.

put a break point at p_file.

see the path that is coming there.

instead of the fn module u used, try using KD_GET_FILENAME_ON_F4 at the

at selection-screen on value-request .

Read only

0 Likes
2,603

hi hyma

avunu adi kuda correct .

Read only

0 Likes
2,603

Hi Hymavathi

by debugging in p_file i am getting path of my flat file where it is stored in system.Any other suggestion that you can give me? what can be the other reasons that data uploading in others system, but i am still getting 0000 record uploading even after doing what you all suggested me.

Thanks

Read only

0 Likes
2,603

in debugging check the itab also.

u get values or not .

u get the values so its working .

regards

kk.

Read only

0 Likes
2,603

Hi experts

still waiting for helpful answers

Read only

0 Likes
2,603

Hi ANNU

I told you previously itself that your code is working fine...

I tried it before and checked it even now, iam getting datas into both the internal tables

itab_main_nag1 and itab_main_nag.

Everything is working....

My output was like this

Nagare upload status

Total no of records: 0000000003

Total records uploaded: 0000000000

Total error records 0000000003

and the error file downloaded was like this

20070920 5051M67K10-EDU 4 A1-6 A14 7055 65A14

20070920 5051M67K10-EDV 8 A1-6 A14 7055 73A14

20070920 5051M67K20-EEK 4 A1-6 A14 7055 57A14

Read only

0 Likes
2,603

hi naveen

wat version of sap are you working? even its working fine with my frnd who tried it in 4.7 but in my system its not working.. i am really surprised why its happening in my system ..when the same code is used in both cases output should be same ..but its not happening so.

Read only

0 Likes
2,603

I am using ECC 6

Its working fine....

Try to run your prog in some other systems that has ECC 6 installed

Read only

0 Likes
2,603

in my organisation i tried in other system also but its not showing any data uploaded.Cnt understand what am i lacking here in my system ...coding wise everyone say its perfect ...now wat else can be the reason?

Read only

Former Member
0 Likes
2,603

Hi Annu,

Please remove the 1st line from your file. Header text is not required in the file.

Once removed, upload the file & check.

Best regards,

Prashant

Read only

0 Likes
2,603

Hi Prashant

I am not using this header line in my flat file this i have written only here on sdn to understand what value is used for what field.

Read only

0 Likes
2,603

.

Read only

Former Member
0 Likes
2,603

i think rlgrap-filename is not supported by gui download. u go on to se37 and how the file name is defined. i just hope this i dont remember it in particular. sorry if i am wrong.