‎2014 May 15 9:54 AM
Hi to all!
In a smartform I have created a report with some table.
| id_num | name | number |
|---|---|---|
| 1 | tiger | 3 |
| 1 | tiger | 6 |
| 2 | leo | 2 |
But i need to change it design like this (table like in coois):
| id_num | name | number |
|---|---|---|
| 1 | tiger | 3 |
| 6 | ||
| 2 | leo | 2 |
I haven't any idea how to achieve this. Can you help me?
Thanks,
Alexander.
‎2014 May 15 10:00 AM
Hi Alex,
Have you tried the same in the sort parameter of the table placed in your smartforms? I think it will work with this. But usually in this scenario what I does is, I will pass the internal table to the smartform as you had shown in the second table from the program itself.
Regards,
Abijith
‎2014 May 15 10:22 AM
Abijith, thank you for your reply.
Yes, I sorted it, but didn't get required result.
‎2014 May 15 10:32 AM
Hi Alex,
Then try the second way that I had mentioned above. In your given example, you are having 3 fields as ID_NUM, NAME & NUMBER in your internal table. Waht you have to do is declare this internal table with these fields as type CHAR of required length. Then while populating the rows into this table, pass rows as you require to show in smartform. For example, if you want not to show ID_NUM & NAME for the rows which are same, append the rows with blank values to your internal table. Then you can show this table blindly in your smartform.
Regards,
Abijith
‎2014 May 15 10:47 AM
Create another work area (or maybe just 3 variables) where you save the last record. If the value of the field is identical to the field value in in the work area of the last record, then hide it. apply this logic to first 3 fields and this should meet the requirement.
right click and you can add program lines / conditions etc.
‎2014 May 15 10:52 AM
HI Alexander,
LOOP AT ITAB INTO WA_ITAB.
READ TABLE ITAB TRANSPORITNG NO FIELDS INDEX SY-INDEX - 1 ID_NUM = WA_ITAB-ID_NUM NAME = WA_ITAB-NAME. " WILL definitely FAIL FOR FIRST LOOP
IF SY-SUBRC = 0.
WA_ITAB-ID_NUM = ''.
WA_ITAB-NAME = ''.
MODIFY ITAB FROM WA_ITAB TRANSPORITNG ID_NUM NAME INDEX SY-INDEX.
ENDIF.
ENDLOOP.
Regards,
Philip.
‎2014 May 15 1:02 PM
U need to correct this while appending the results to the final table.
While u are collecting fields :
id_num
name
number
and then appending to the it_final table.
At the point before each append perform a read table it_final, If sy-subrc = 0 .
Means there is already an entry in that clear id_num and name from the workarea and then append.
If you want detail coding please give me a message.. else if you understood i am glad.
‎2014 May 16 8:24 AM
Hi Alexander,
i have one alternative method. definitely you will print the value with help of table only in smartforms. please use the use the two table line in main area. store the values of id num and name in two temp variables .
in program line provide the condition
if id number and name is same the name text elements should not print.
Revert back if u faces any difficulties.
Regards,
Thangam.P
‎2014 May 19 12:54 PM
Hi, eventually i create the following (like Philip Davy said):
READ TABLE itab TRANSPORITNG NO FIELDS
INDEX SY-INDEX - 1.
ID_NUM = WA_ITAB-ID_NUM.
NAME = WA_ITAB-NAME.
IF SY-SUBRC = 0.
WA_ITAB-ID_NUM = ''.
WA_ITAB-NAME = ''.
MODIFY ITAB FROM WA_ITAB INDEX SY-INDEX TRANSPORITNG ID_NUM NAME.
ENDIF.
It is searching the same line, but can't make it clear.
‎2014 May 19 1:08 PM
Hi Alex,
Solution is simple.
Declare a temp internal table (TEMP_TAB)of required structure of data you are displaying.
In the smartform loop where you are displaying data at the end append work area to temp internal table (TEMP_TAB).
At the beginning of display, write another program lines to check whether the TEMP_TAB is filled with
item or not,if it is filled then it is already printed and skip display by keeping conditions for id_num and name ELSE print the ID_NUM and NAME.
regards,
Harish B