Application Development 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:Β 

bdc

Former Member
0 Kudos

pls check n whats wrong in this . if i press f8 button it is going to shortdump. whats wrong in this code.

DATA : BEGIN OF itab OCCURS 0,

str(255),

END OF itab.

DATA : itab1 LIKE mara OCCURS 0 WITH HEADER LINE.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename = ' '

FILETYPE = 'ASC'

HAS_FIELD_SEPARATOR = 'X'

  • HEADER_LENGTH = 0

  • READ_BY_LINE = 'X'

  • DAT_MODE = ' '

  • IMPORTING

  • FILELENGTH =

  • HEADER =

tables

data_tab = itab1

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.

loop at itab.

if itab-str+0(5) = 'matnr'.

itab1-matnr = itab-str+7.

elseif itab-str+0(5) = 'mbrsh'.

itab1-mbrsh = itab-str+7.

elseif itab-str+0(5) = 'mtart'.

itab1-mtart = itab-str+7.

elseif itab-str+0(5) ='meins'.

itab1-meins = itab-str+7.

elseif itab-str+0(5) = '*****'.

append itab1.

clear itab1.

endif.

endloop.

loop at itab1.

if itab1-matnr <> ''.

insert into mara values itab1.

if sy-subrc = 0.

write πŸ˜• itab1-matnr."color 5.

else.

write : / itab1-matnr." color 6.

endif.

else.

write : / itab1-matnr." color 7.

endif.

endloop.

  • 1000 chemical medicines kg

*2000 mechanical spars kg

7 REPLIES 7

Former Member
0 Kudos

hi,

you failed to give file name in Gui_upload.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename = ' '

FILETYPE = 'ASC'

HAS_FIELD_SEPARATOR = 'X'

HEADER_LENGTH = 0

READ_BY_LINE = 'X'

DAT_MODE = ' '

IMPORTING

FILELENGTH =

HEADER =

tables

data_tab = itab1

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

regards,

pavan

Former Member
0 Kudos

Hi,

Can u paste the Dump Message what u r getting.

Revrt back,

regards,

Naveen

Former Member
0 Kudos

Hi,

Filename is empty.

Regards,

Nishant

Former Member
0 Kudos

error analysis.

a raise statement in the program 'cl_gui_frontend_services======cp' raised the exception condition "wrong_parameter".

since the exception was not intercepted by a superior program in the hierarchy, processing was terminated.

Former Member
0 Kudos

Hi Vali,

Before Calling GUI_UPLOAD we have to select the flat file as input.For that we have to write some code.I will send a sample code check it once ok..

data: gv_infile type string.

PARAMETERS: p_file LIKE rlgrap-filename.

CALL FUNCTION 'F4_FILENAME'

EXPORTING

program_name = syst-cprog

dynpro_number = syst-dynnr

  • FIELD_NAME = ' '

IMPORTING

file_name = p_file.

gv_infile = p_file.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename = gv_infile

filetype = 'ASC'

has_field_separator = 'X'.

GV_INFILE CONTAINS THE FLAT FILE I.E UPLOADED FILE.

Award points if helpful..

Kiran Kumar.G

+ Have a Nice Day..+

Former Member
0 Kudos

hi,

DATA : BEGIN OF itab OCCURS 0,

str(255),

END OF itab.

DATA : itab1 LIKE mara OCCURS 0 WITH HEADER LINE.

parameters : p_fname like rlgrap-filename default 'D:\Documents and Settings\czfnct\Desktop\ex.txt'.

data : v_fname type string.

move p_fname to v_fname.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename = v_fname

FILETYPE = 'ASC'

HAS_FIELD_SEPARATOR = 'X'

*

*HEADER_LENGTH = 0

*READ_BY_LINE = 'X'

*DAT_MODE = ' '

*IMPORTING

*FILELENGTH =

*HEADER =

tables

data_tab = itab " here u gave itab1 which is wrong

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.

loop at itab.

if itab-str+0(5) = 'matnr'.

itab1-matnr = itab-str+7.

elseif itab-str+0(5) = 'mbrsh'.

itab1-mbrsh = itab-str+7.

elseif itab-str+0(5) = 'mtart'.

itab1-mtart = itab-str+7.

elseif itab-str+0(5) ='meins'.

itab1-meins = itab-str+7.

elseif itab-str+0(5) = '***'.append itab1.

clear itab1.

endif.

endloop.

loop at itab1.

if itab1-matnr = ''.

insert into mara values itab1.

if sy-subrc = 0.

write πŸ˜• itab1-matnr."color 5.

else.

write : / itab1-matnr." color 6.

endif.

else.

write : / itab1-matnr." color 7.

endif.

endloop.

loop at itab1.

write : itab1-matnr.

endloop.

this program is running fine, but u r flat file doesn't contains 'MATNR', 'Mbrsh'. if i think that last two lines of u r question are flat file entries.

correct either u r logic or flat file.

regards,

pavan

Edited by: pavan kumar pisipati on Jan 9, 2008 7:32 AM

Former Member
0 Kudos

Hi Vali,

Please specify filename in GUI_UPLOAD

Regards,

Mohaiyuddin