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

I have a problem with smartforms.

Former Member
0 Likes
1,478

Hello.
I have a problem with smartforms.
I need to sort items in invoice by lowerst price to high, and i need to merge duplicate items.
Someone can help me?

1 ACCEPTED SOLUTION
Read only

0 Likes
1,451

Hi,

    If you are using report/print/driver program, then before passing the data to smartform, you can sort the values and pass. if not, after consuming the data into smartform, as told by vijaykrishna you can add the code node and write a code to sort the values before displaying.

Cheers!!

Rita

10 REPLIES 10
Read only

VijayaKrishnaG
Active Contributor
0 Likes
1,451

Hi, Sorting has to be done in the report level itself or in Smartform insert Code node and write the logic in that.

Regards,

Vijay

Read only

0 Likes
1,452

Hi,

    If you are using report/print/driver program, then before passing the data to smartform, you can sort the values and pass. if not, after consuming the data into smartform, as told by vijaykrishna you can add the code node and write a code to sort the values before displaying.

Cheers!!

Rita

Read only

Former Member
0 Likes
1,451

IF cf_retcode = 0.

* select print data

     PERFORM get_data USING    ls_print_data_to_read

                      CHANGING ls_addr_key

                               ls_dlv-land

                               ls_bil_invoice

                               cf_retcode.

This is the place where can i sort?

Read only

0 Likes
1,451

Hi,

actually the code you posted is not good enough to tell you is that the place to sort or not.

As of my understanding, in the mentioned sub-routine you are fetching the data. If so, you can sort the table as per your requirement after the Perform statement as table will be filled in Routine. If not, you need to post the appropriate code by mentioning that where have you written.

Regards,

Vijay

Read only

0 Likes
1,451

Hi,

    I think you are talking about the structure "ls_bill_invoice" in the perform statement. if you are passing the same to smartform, then you can sort the same after perform statement or within "Form Endform".

   I stil have so many doubts. Can you please post the code where you want to sort and merge the duplicates.. would like to know what does that perform get data does according to you.

  To make it simple, just sort the internal table which has data in it before passing to smartform. You will be passing the data to smartform using " Call Function <formname>" check in that part of code.

Read only

0 Likes
1,451

As for the merging of the duplicates you can use DELETE ADJACENT DUPLICATES FROM itable COMPARING ALL FIELDS after sorting the internal table you pass to the smartform. It will leave you with only the rows that are unique.

Regards,

Noa

Read only

0 Likes
1,451

Since this is for an invoice, I would guess that the lines might include quantity and total amount.  In that case, merging the lines isn't solved by deleting adjacent duplicates; you would need to COLLECT the entries into a separate itab in order to get correct total quantity and amount per item.

Jim

Read only

VenkatRamesh_V
Active Contributor
0 Likes
1,451

Hi,

View the image.

Creating loop you can add the fields for sorting.

Hope it helpful,

Regards,

VenkatRamesh

Read only

Sijin_Chandran
Active Contributor
0 Likes
1,451

As replied earlier the best thing would be do summation and processing in the Driver program itself.

Are you using a Standard Driver program ?

Read only

Former Member
0 Likes
1,451

LOOP AT ls_bil_invoice-it_price INTO ls_price.

       APPEND ls_price TO lt_price.

     ENDLOOP.

clear ls_bil_invoice-it_price[].

     SORT lt_price

     ascending BY netwr.

     LOOP at lt_price into ls_price.

       ls_price-itm_number = sy-tabix + 10.

       append ls_price to ls_bil_invoice-it_price.

       endloop.


This is source code for sort, now i need only merging.