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

Run Time Error

Former Member
0 Likes
1,437

Hi,

Its going to short dump on execution of code.

there are two internal tables t_tab1, t_tab2 having the same work area.

fld1,fld2,fl3. t_tab1 having 3 records.

i am inserting the contents of t_tab1 into t_tab2. and then looping t_tab2 to display contents.

+ INSERT LINES OF t_tab1 FROM 1TO 2 INTO t_tab2 .+

its going to dump. Can i know the reason..

Regards,

Mdi.Deeba

10 REPLIES 10
Read only

Former Member
0 Likes
1,354

Please paste your code here so that we can analyse the problem.

Regards,

Nitin.

Read only

0 Likes
1,354

TYPES:
  BEGIN OF type_s_programmer,
    name(15) TYPE c,                   " Name of the Programmer
    dob      TYPE d,                   " 	Date of birth	
    prof(10) TYPE c,                   " Proficiency
    marks1 TYPE i,
    marks TYPE i,                   " Marks Scored
  END OF type_s_programmer.

*" Data declarations...................................................
*"--------------------------------------------------------------------*
* Declaration of Field String 'fs_prog'                               *
*"--------------------------------------------------------------------*
DATA:
      fs_prog TYPE type_s_programmer.

*"--------------------------------------------------------------------*
* Declaration of Programmer DEtails table to hold the Data            *
*"--------------------------------------------------------------------*
DATA:
  t_prog LIKE
STANDARD TABLE
      OF fs_prog WITH NON-UNIQUE KEY name
      INITIAL SIZE 6,

  t_prog2 LIKE
  SORTED TABLE
        OF fs_prog WITH UNIQUE KEY name
        INITIAL SIZE 10.

*"Macro Definition....................................................
DEFINE prog.
  clear fs_prog.
  fs_prog-name = &1.
  fs_prog-dob = &2.
  fs_prog-prof = &3.
  fs_prog-marks1 = &4.
  fs_prog-marks = &5.
  append fs_prog  to t_prog.
END-OF-DEFINITION.

*"-------------------------------------------------------------------*
*                Populating Data Into Programmer Information Table   *
*"-------------------------------------------------------------------*
prog 'ALTAF'	 '19610207'	 'CLIPPER' '40' '50'.
prog 'ANAND'	 '19661204'	 'PASCAL'  '50' '60'.
prog 'JULIANA' '19683101'	 'COBOL'   '20' '40'.
prog 'KAMALA'	 '19683010'	 'C'       '70' '26'.
prog 'MARY'	 '19702406'	 'CPP'     '30' '20'.
prog 'NELSON'	 '19851109'   'COBOL'    '60' '59'.

APPEND INITIAL LINE TO t_prog.

CLEAR fs_prog.
fs_prog-name = 'XYZ'.
fs_prog-dob =  '19001812'.
fs_prog-prof = 'c++'.
fs_prog-marks = 61.
APPEND fs_prog TO t_prog SORTED BY marks.
SORT t_prog.


INSERT LINES OF t_prog  FROM 3 TO 10 INTO  t_prog2.


*"-------------------------------------------------------------------*
*    Displaying Data Of Programmer Details Table                     *
*"-------------------------------------------------------------------*
WRITE:/20
        'Name of the Programmer'(001),space,
        'Date of birth'(002),space,
        'Proficiency'(003),
        'Marks Scored'(004).
NEW-LINE.
WRITE:/18 space.
ULINE (53).

LOOP AT t_prog2 INTO fs_prog.
  WRITE:/
         fs_prog-name UNDER text-001,
         (10) fs_prog-dob  UNDER text-002,
         fs_prog-prof UNDER text-003,
         fs_prog-marks     UNDER text-004,
          fs_prog-marks1 .

ENDLOOP.
Read only

0 Likes
1,354

..

Edited by: Dwarakanath Sankarayogi on Feb 5, 2009 1:19 PM

Read only

0 Likes
1,354

I think U have only 6 entries in the internal table where as UR trying to write as below .. and UR getting

dump.(from 3 to 10)

INSERT LINES OF t_prog FROM 3 TO 10 INTO t_prog2.

Read only

0 Likes
1,354

Hi,

Use this code:


INSERT LINES OF t_prog  FROM 3 TO 6 INTO TABLE t_prog2.

instead of


INSERT LINES OF t_prog  FROM 3 TO 6 INTO  t_prog2.

This helps u.

Thanks.

Read only

Former Member
0 Likes
1,354

Can you show the code what you have written.

Thanks,

Ibrahim

Read only

Former Member
0 Likes
1,354

Hi,

Insert statement will raise an exception when "A line to be inserted would cause a duplicate entry in tables with a unique table key ".

Check whether you are trying to insert duplicate rows with the same key field values.

Instead you can use Modify statement inpalce of Insert .

Regards,

Dwaraka.S

Edited by: Dwarakanath Sankarayogi on Feb 5, 2009 12:56 PM

Read only

Former Member
0 Likes
1,354

Hi,

Please find the Code Below.

Its working fine..

DATA:

BEGIN OF t_tab1 OCCURS 0,

fld1 TYPE i,

fld2 TYPE i,

fld3 TYPE i,

END OF t_tab1.

DATA:

BEGIN OF t_tab2 OCCURS 0,

fld1 TYPE i,

fld2 TYPE i,

fld3 TYPE i,

END OF t_tab2.

t_tab1-fld1 = '1'.

t_tab1-fld2 = '1'.

t_tab1-fld3 = '1'.

APPEND t_tab1.

CLEAR t_tab1.

t_tab1-fld1 = '2'.

t_tab1-fld2 = '2'.

t_tab1-fld3 = '2'.

APPEND t_tab1.

CLEAR t_tab1.

t_tab1-fld1 = '3'.

t_tab1-fld2 = '3'.

t_tab1-fld3 = '3'.

APPEND t_tab1.

CLEAR t_tab1.

INSERT lines of t_tab1 INTO table t_tab2.

LOOP AT t_tab2.

write:

/ t_tab2-fld1,

t_tab2-fld2,

t_tab2-fld3.

ENDLOOP.

Hope this is helpful.

Thanks

Kalyan.b

Read only

0 Likes
1,354

Hi,

try like this.

Append lines of itab1 to itab2.

Read only

Former Member
0 Likes
1,354

HI BRO....

INSERT LINES OF t_tab1 FROM 1TO 2 INTO t_tab2

INSTEAD USE

INSERT LINES OF t_tab1 FROM 1TO 2 INTO TABLE t_tab2

REGARDS