cancel
Showing results for 
Search instead for 
Did you mean: 

Reg: Data getting repeated in the table and displayed in the Smartorm.

Former Member
0 Kudos

Hello Experts,

Requirement is to display header data from kna1table and item data from two tables faglflexa and bsid.

Layout is something like this.

Name and Address is capture from KNA1.

Item Details from faglflexa and BSID based on one condition, UMSKZ ne 'X' and 'Y' for the respective KUNNR from KNA1. First Item table.I have taken a separate internal table from print program

Item Details from BSID only based on one condition, UMSKZ eq 'X' and 'Y' for the respective KUNNR from KNA1. Second Item table. I have taken a separate internal table from print program

Calculation based on faglflexa and BSID table on one condition,UMSKZ ne 'X' and 'Y' for the respective KUNNR from KNA1. Third t Item table. Data from the first internal table

The complete thing should be displayed on Smartform for one Customer (kunnr). Then should go to the next customer.

I have a written a code like this, For Example.

loop at kna1 into w_kna1.

Used Table1 in smartform and give a loop to display the item details based on first internal table.

display itemdetails

Used Table2 in smartform and give a loop to display the item details based on second internal table.

display itemdetails.

Used Template to display the item details to display the item details based on first internal table.

endloop.

Now my problem is table 1 is coming fine. table 2 data is getting repeated for all the customers based on 1st customer data, how should i clear the workarea after every customer.

Similar pbm for the template which i'm using.

Please help me on this.

Thanks in advance.

Abdur Rafique

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

U create another Final Internal Table for items, which should contains all the fields of 2 tables. Now, move the 2 tables data (faglflexa, BSID) into this Final Internal table. Import this table to Smartforms.

In smartform, first loop of Internal table 'KNA1' and then LOOP the Final Internal table for Item details..

Hope it helps!!

Rgds,

Pavan

Former Member
0 Kudos

Hi Vishnu,

Thanks for replying. I cant use one single table to display the output. There are several conditions in two tables.

I have corrected the error of repetition data. Logic i will mention it below.

loop at kna1 into wa_kna1.

for header data " this is main table

loop at item_1 into wa_item_1. " for first item table

Data displayed.

loop at item_2 into wa_item_2. " for 2nd item table

Data displayed.

endloop. " for 2nd item table

data calculation based on first item table.

endloop. " this is for first item table

endloop." this is for 2nd item table.

The data which is there in the 2nd item table should display data based on the kna1 loop. Data is displaying properly but not in 1 table, say for example.

kunnr- 1000010

there are 9 items.

All the 9 items should be in 1 table. But here it is displaying 1 item in 1 table till 9 items in 9 tables.

I need to club all the 9 items in 1 table.

One more doubt is 2 items have same belnr (document number) i need to club this and add the wmbtr field and then display as 1 record.

So final records in 2nd item table should be 8 not 9.

Can you please help me on this.

Thanks in advance.

Abdur Rafique

sudhir_manjarekar2
Participant
0 Kudos

hi,

its clear that you have header table kna1 and its detail table.

so for header table in smartform have main loop under main area.

Under this main loop mention your Row1 under this declare Cell1, under it declare heder text what you want from kna1 header table.

Now under Cell1 declare Loop for detail table. Under that loop declare you detail text and in condition tab of that detail text mention your condition for header table. for e.g det_kna1-kunnr = hed_kna1-kunnr.

its easy to dispay header detail combination data in smartforms.

Regards

SUDHIR