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: 

What causes the dump here ??

former_member210563
Participant
0 Kudos

Hi,

I have the code below and it dumps right at the CONCATENATE after the LOOP. Am I using the wrong methods ?

AT SELECTION-SCREEN ON VALUE-REQUEST FOR filename.

CALL METHOD cl_gui_frontend_services=>file_open_dialog

EXPORTING

multiselection = abap_false

file_filter = '*.xls'

default_extension = 'xls'

CHANGING

file_table = retfiletable

rc = retrc

user_action = retuseraction.

READ TABLE retfiletable INTO filename INDEX 1.

START-OF-SELECTION.

DATA l_filename TYPE string.

l_filename = filename.

CALL METHOD cl_gui_frontend_services=>gui_upload

EXPORTING

filename = l_filename

has_field_separator = abap_true

CHANGING

data_tab = iimport.

CHECK iimport IS NOT INITIAL.

DELETE FROM zcs_student.

COMMIT WORK AND WAIT.

DATA: temp_id TYPE zcs_student_id,

found_id TYPE boolean,

id_counter(2) TYPE n.

LOOP AT iimport ASSIGNING <wa_input>.

**DUMP* CONCATENATE <wa_input>-lname <wa_input>-fname+0(2) INTO temp_id.

found_id = abap_false.

id_counter = 0.

WHILE found_id = abap_false.

TRANSLATE temp_id TO UPPER CASE.

READ TABLE istudents TRANSPORTING NO FIELDS WITH KEY student_id = temp_id.

IF sy-subrc = 0.

id_counter = id_counter + 1.

CONCATENATE <wa_input>-lname <wa_input>-fname+0(2) INTO temp_id.

temp_id+8(2) = id_counter.

CONDENSE temp_id NO-GAPS.

ELSE.

found_id = abap_true.

ENDIF.

ENDWHILE.

APPEND INITIAL LINE TO istudents ASSIGNING <wa_student>.

<wa_student>-student_id = temp_id.

<wa_student>-first_name = <wa_input>-fname.

<wa_student>-last_name = <wa_input>-lname.

DATA: random TYPE REF TO cl_abap_random.

DATA: seed TYPE i.

DATA: gpa TYPE i.

seed = cl_abap_random=>seed( ).

random = cl_abap_random=>create( seed ).

<wa_student>-credit_hrs = random->intinrange( low = 0 high = 150 ).

gpa = random->intinrange( low = 1000 high = 4000 ).

<wa_student>-gpa = gpa / 1000.

CLEAR random.

ENDLOOP.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

What is the dump description...also check the error analysis part in the dump to check what needs to be corrected..

Thanks

Naren

9 REPLIES 9

Former Member
0 Kudos

Hi,

What is the dump description...also check the error analysis part in the dump to check what needs to be corrected..

Thanks

Naren

0 Kudos

Please paste the initial page of dump here.

May be you can try this way


LOOP AT iimport ASSIGNING <wa_input>.

assign component 'LNAME' of structure <wa_input> to <fs1>.
assign component 'FNAME' of structure <wa_input> to <fs2>.

CONCATENATE <fs1> <fs2>+0(2) INTO temp_id.

0 Kudos

The error analysis says:

Error analysis

An exception occurred that is explained in detail below.

The exception, which is assigned to class 'CX_SY_RANGE_OUT_OF_BOUNDS', was not

caught and

therefore caused a runtime error.

The reason for the exception is:

In the running program "ZCS_STUDENTS_GENERATE", part of a string was about to

be accessed

with an explicitly specified length.

However, this length (2) exceeded the current length of the string

(1).

This kind of access is illegal.

0 Kudos

Apparently fname is declared as a single char but you are trying to get a lenght (2) higher than that

0 Kudos

> However, this length (2) exceeded the current length of the string

> (1).

is your -fname have value for all the records in the internal table ?

Former Member
0 Kudos

Which dump code is displayed when running this?

maybe check the data type of <wa_input>-lname and <wa_input>-fname, if they are integer they cannot concatenate. Or if fname is 1 character long, doing fname+0(2) is out of bounds.

Edited by: Julio Almeida on Jul 22, 2008 4:00 PM

Former Member
0 Kudos

Hi,

You wanted to get the first two characters...<wa_input>-fname+0(2) ..but the length of the field is less than that.

Thanks

Naren

0 Kudos

Hi,

Both fname and lname are type string....

former_member210563
Participant
0 Kudos

ok