cancel
Showing results for 
Search instead for 
Did you mean: 

Smartform - Loop issue not printing correctly

Former Member
0 Kudos

Hi,

In smartforms -Main Window - I created like this

1.Loop Statement - This will loop - ITAB1

TEXT statement - ITAB1-ADRNR - (prints the address)

within the loop

ITEM_DATA (item data) table. - This will Loop ITAB2 - where ADRNR = ITAB1-ADRNR

This supposed to put line items which are having ADRNR from ITAB1

But my program is printing in wrong way..

it is printing

ADDRESS1 - ITAB1-ADRNR - correct

ITEM DATA - from ITAB2- related to ADRNR (if it has only 1 record) - correct

ADDRESS2-ITAB1-ADRNR - correct

ITEM DATA - from ITAB2 - where ADRNR = ITAB1ADRNR - if this condition satisfies more than 1 record

supposed to print all the records - but instead it is printing always the first record - wrong

Ex- if 3 records has the same ADRNR of ITAB1 in ITAB2 - it is actually printing 3 times the first satisfying record - Wrong

Can anyone please tell me what is the issue?

Thanks for your time.

Kevin

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Solved my self.

Thanks for all.

madhu_vadlamani
Active Contributor
0 Kudos

Hi Kelvin,

What is the business requirement.Do you need to print address of customers or vendors.

Regards,

Madhu.

Former Member
0 Kudos

Hi,

I have to print form for sales order with based on Shipping address and corresponding item records

If I have more than 1 shipping address -

Then need to print items based on that..

SHP address 1

corresponding item records

SHP address 2

Corresponding item records.

Thanks,

Kevin.

former_member320332
Contributor
0 Kudos

Hi Kevin,

Instead of 2 loops for printing data you can first prepare the data to be printed in smartform in one internal table.

Copy your ITAB2 in one temporaray internal table ITAB3 and delete the records from this table ITAB3 where ADRNR <> ITAB1-ADRNR.

sort this ITAB3 by ADRNR.

And now you can pass this ITAB3 to your main window table with condition of priniting ADRNR only at AT NEW event of table

which you can give in table properties.

Thanks,

Pawan

Former Member
0 Kudos

Hi,

I created like this..

ITAB1 - complete data

ITAB2 - unique records based on ADRNR

1. LOOP ITAB2

Print Address - ITAB2-ADRNR

ITEM DATA(header and line items)

I have given table name in DATA loop section

- loop ITAB1 - where ADRNR = ITAB2-ADRNR

But in item data it is printing the same line item repetedly .

Any comments?

Thanks for ur time.