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

Values are repeated for every Document No.

Former Member
0 Likes
1,444

Hi all,

In my ALV Report, value are repeating for all document number.

for ex. there are 10 document No's in my Report, when I execute my Report, all amount are coming same. The amount which I have entered for First Document, the same value is coming for rest of the documents.

How I can get the exact value for every particular document.

Thanks

Devinder.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,323

Hi Devinder,

Looks like the issue is in populating the Final internal table which you are passing to the ALV.

You would have retrieved all the data from different tables into many internal tables. Then you would be looping over the main internal table to Append a final internal table.

Check the logic over there... are you reading the same record again & appending it in final internal table ??

Thanks,

Best regards,

Prashant

Hi all,

In my ALV Report, value are repeating for all document number.

for ex. there are 10 document No's in my Report, when I execute my Report, all amount are coming same. The amount which I have entered for First Document, the same value is coming for rest of the documents.

How I can get the exact value for every particular document.

Thanks

Devinder.

12 REPLIES 12
Read only

GauthamV
Active Contributor
0 Likes
1,323

Check if you have cleared the workarea from where that value is captured in the loop.

Read only

Former Member
0 Likes
1,323

Hi,

IF I clear workarea, either all values become "0" or only First row will come with correct values, rest of others will come '0'.

Thanks

Devinder

Read only

Former Member
0 Likes
1,323

Hi,

In debugging mode, check the final internal table values before ALV display.

Regards

Vinod

Read only

Former Member
0 Likes
1,323

Paste your code here.

Regards,

Sai Prasad

Read only

Former Member
0 Likes
1,323

Hi Vinod,

My final table is itab1... and I have noticed while debugging , first values is only coming for another documents. that means.. the values which is coming for Document No. 1, the same values are repeating for another Document No. also..

Thanks

Devinder

Read only

Former Member
0 Likes
1,323

Hi,

Check the logic used for populating the final internal table. As mentioned by Gautham, the problem might be related to

Clearing of Work area before inserting the record into internal table.

Regards

Vinod

Read only

Former Member
0 Likes
1,323

Hi Sai,

Code is given below :

*clear wa_bseg.

LOOP AT ITAB_BSEG INTO WA_BSEG.

clear wa_bseg.

CASE WA_BSEG-KTOSL.

WHEN 'KBS'.

WA-DMBTR1 = WA_BSEG-DMBTR.

WHEN 'JSS'.

WA-DMBTR2 = WA_BSEG-DMBTR.

WHEN 'JSE'.

WA-DMBTR3 = WA_BSEG-DMBTR.

WHEN 'JSH'.

WA-DMBTR4 = WA_BSEG-DMBTR.

ENDCASE.

*clear wa_bseg.

ENDLOOP.

WA-DMBTR = "ABS( WA-WT_QSSHH ) +

ABS( WA-WT_QSFHH ) +

ABS( WA-J_1ISURAMT ) +

ABS( WA-WT_QBSHH ) +

ABS( WA-DMBTR1 ) +

ABS( WA-DMBTR2 ) +

ABS( WA-DMBTR3 ) +

ABS( WA-DMBTR4 ).

*clear wa_bseg.

MODIFY ITAB1 FROM WA .

Read only

Former Member
0 Likes
1,323

Hi,

It seems final internal table is populated after the LOOP. Do you need only one record in the output ? As per the code, only last record of itab_bseg is populated to final internal table.

Regards

Vinod

Read only

Former Member
0 Likes
1,323

Modify the itab1 table inside the loop.

Regards,

Sai Prasad

Read only

0 Likes
1,323

Hi,

Check your code, you are clearing the WA_BSEG values at first it self.

LOOP AT ITAB_BSEG INTO WA_BSEG.
* clear wa_bseg.           " Comment it here, you are clearing the workarea value before processing
                                                

CASE WA_BSEG-KTOSL.
WHEN 'KBS'.
WA-DMBTR1 = WA_BSEG-DMBTR.
WHEN 'JSS'.
WA-DMBTR2 = WA_BSEG-DMBTR.
WHEN 'JSE'.
WA-DMBTR3 = WA_BSEG-DMBTR.
WHEN 'JSH'.
WA-DMBTR4 = WA_BSEG-DMBTR.
ENDCASE.

WA-DMBTR = "ABS( WA-WT_QSSHH ) +
ABS( WA-WT_QSFHH ) +
ABS( WA-J_1ISURAMT ) +
ABS( WA-WT_QBSHH ) +
ABS( WA-DMBTR1 ) +
ABS( WA-DMBTR2 ) +
ABS( WA-DMBTR3 ) +
ABS( WA-DMBTR4 ).


MODIFY ITAB1 FROM WA .  " or APPEND wa TO itab1.

CLEAR : wa_bseg, WA.

ENDLOOP.

Regards

Bala Krishna

Read only

Former Member
0 Likes
1,324

Hi Devinder,

Looks like the issue is in populating the Final internal table which you are passing to the ALV.

You would have retrieved all the data from different tables into many internal tables. Then you would be looping over the main internal table to Append a final internal table.

Check the logic over there... are you reading the same record again & appending it in final internal table ??

Thanks,

Best regards,

Prashant

Read only

Former Member
0 Likes
1,323

Hi

Add the additions 'INDEX' and 'TRANSPORTING...' in ur MODIFY statement.

Regards

Senthil