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

appearance in smartforms

Former Member
0 Likes
1,116

Hi to all!

In a smartform I have created a report with some table.

id_numnamenumber
1tiger3
1tiger6
2leo2

But i need to change it design like this (table like in coois):

id_numnamenumber
1tiger3
6
2leo2

I haven't any idea how to achieve this. Can you help me?

Thanks,

Alexander.

9 REPLIES 9
Read only

former_member196651
Contributor
0 Likes
1,072

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

Read only

0 Likes
1,072

Abijith, thank you for your reply.

Yes, I sorted it, but didn't get required result.

Read only

former_member196651
Contributor
0 Likes
1,072

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

Read only

gaurab_banerji
Active Participant
0 Likes
1,072

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.

Read only

philipdavy
Contributor
0 Likes
1,072

HI Alexander,

  • If I understood you correctly, you have to delete the field values of the duplicating lines, but still have to display in the table format with blank values and number field.
  • What you can do that is that, you can loop through your internal table (sorted by id_num) and delete the values when the just before work area values(index - 1) duplicates with present. For that you could some thing like.


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.

Read only

Former Member
0 Likes
1,072

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.

Read only

thangam_perumal
Contributor
0 Likes
1,072

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

Read only

0 Likes
1,072

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.

Read only

Former Member
0 Likes
1,072

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