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

How to append error message in internal table

Former Member
0 Likes
2,021

Hi All,

I am reading one text file into an internal table using GUI_UPLOAD. Now in few lines there are some errors.

I want to concatenate those errors in front of respected lines and download the file again using GUI_DOWNLOAD.

Can anyone tell me how to concatenate infront of that line only.

After reading in internal table my data in internal table is like this-

1DEFFERAL  20080215 121212                                                      
2            601191111A00000000110Hunter, Donald                AY           
2            601201111A00000000000Hunter, Donald                AY        "Suppose m getting any error in this line it shd append here
2            601211111A00000000120Ammons, Bernadette            AY              
2            601221111A00000000130Karels, Michael               AY              
2            601231111A00000000240Lawrence, Helen               AY               
2            601241111A00000000280Brady, Jennifer               AY                
2            601281111A00000000145Kagel, Camille                AY               
2            601291111A00000001567Roedel, Kathryn               AY               
2            601301111A00000000123Stepanyan, Henrick            AY               
2            601311111A00000001456Sanders, Harlan               AY               
2            700077024A00000001156Sanders, Harlan               AY               
9DEFFERAL  20080215 121212000000014

1 REPLY 1
Read only

Former Member
0 Likes
781

Im not sure if I understood your question correctly.

But let me try.

Either you add another column (for messages) to your internal table or increase the length of the last field to hold the new text (message) to be appended.

Doing a looping at that internal table:

(Let's say you add one more column to your itab - field 'message')

LOOP AT i_tab.

IF error is encountered

i_tab-message = 'This is the error message'.

ENDIF.

MODIFY i_tab INDEX sy-index.

ENDLOOP.

(Or you just want to append the message at the last column of your itab, let's say your last column is field 'comment')

LOOP AT i_tab.

IF error is encountered

CONCATENATE i_tab-comment 'This is the error message' INTO i_tab-comment SEPARATED BY SPACE.

ENDIF.

MODIFY i_tab INDEX sy-index.

ENDLOOP.