cancel
Showing results for 
Search instead for 
Did you mean: 

how to apply sorting in smart-forms ?

Former Member
0 Kudos

hi ,

i created a smart-forms , I have 1 header for header data and another header for item data,

i want sort header data as per item data..

but it did not coming in proper way,

my output is coming this type ..

!~~~~~~~~~~~~~~~~~~~~~~~~~~~  !

! PO NO      PO type         Date           !   < -----PO header 1

!~~~~~~~~~~~~~~~~~~~~~~~~~~~  !

!  item-no    material no     Quantity     !  <------item header 2               

!~~~~~~~~~~~~~~~~~~~~~~~~~~~  !

!  3000006      NB           22.11.2007   !     <----- PO Output         

!~~~~~~~~~~~~~~~~~~~~~~~~~~~  !

!   10               2022              kg           !      <------ item output

!~~~~~~~~~~~~~~~~~~~~~~~~~~~  !

!  3000006      NB           22.11.2007   !  

!~~~~~~~~~~~~~~~~~~~~~~~~~~~  !

!   20               2024              kg           ! 

!~~~~~~~~~~~~~~~~~~~~~~~~~~~~!

but i want this type of output ?

how to sort for this type ?

!~~~~~~~~~~~~~~~~~~~~~~~~~~~  !

! PO no          PO type       Date          !  < ------PO header 1

!~~~~~~~~~~~~~~~~~~~~~~~~~~~  !

! item-no        material no   Quantity    !  <-----item header 2               

!~~~~~~~~~~~~~~~~~~~~~~~~~~~  !

!  3000006         NB      22.11.2007     !   <----- PO Output     

!~~~~~~~~~~~~~~~~~~~~~~~~~~~  !

!  10             2022            kg                !   <---- item output 1

!  20             2024            kg                !   <---- item output 2

!  30             2026            kg                !    <---- item output 3

!~~~~~~~~~~~~~~~~~~~~~~~~~~~  !

how to sort this type ?

anyone can help me ?

Thank you.

sandeep

Accepted Solutions (0)

Answers (3)

Answers (3)

0 Kudos

Hi Sandeep,

It looks like you are printing the PO header details in BODY1 section inside the item loop.. My guess is it should be outside the item data loop.. That's why this is not working. Please try and see if this helps.

Because this is a forum to help everyone, I will try to keep my explanation generic so that it may help others too who are facing similar issues.. Your smart form Main area should be structured as shown below -

----------------------------------------------------------------------------------------------------------------------------------

Item table

Header Section -

Header Line (Title information like "Order Number", "Order Type"... )

Item line (Title information like "Item Number", "Quantity"... )

            Main Area Section –

                                Header Data Line (ebeln, bsart, ekorg …. Define each within individual Cells)

                                Item Data Loop (For all entries ebeln = wa-ebeln)

                                                Item Data Line (ebeln, ebelp, means,…. inside each individual cell)

                                End of Item Data Loop.

           Footer Section –

                                (Data as per requirement)

End of Item Table.

----------------------------------------------------------------------------------------------------------------------------------

Please like the post or mark as helpful/correct if this helped you.

Regards,
Navin

Former Member
0 Kudos

hi hari,

I understood your explanation and i did same things in my form. but still output is same

.. can you paste your smartform screenshot here ,because you told me your form is same as my form..

thanks

regards

sandeep patel

0 Kudos

Hi Sandeep,

Unfortunately, I will not be able to share that information without violating my company policy.

0 Kudos

Hi Sandeep,

Do not try to control this directly in the layout. Instead you will have to 2 internal structures - one for the PO header information and the other for the item information. You will then have to write a logic to loop through both these structures to fill this table.

The logic should look through the PO header table and print the PO header info in the Header Line of the output. The second loop inside the main area will loop through the item table (for every entry in the PO header table). And inside this loop you will fill in all the item information.

Hope this helps.

Regards,

Navin

Former Member
0 Kudos

hi Navin..

I followed your way , means  i put first loop at table for  header data and second loop at main area for item data then i have applied where condition for item data like ebeln = wa-ebeln.


please check here my screen shot ?

screen shot details

1,,, this loop for header data

2,, this loop for item data

3.. my final output is same means header data is coming properly but not coming correctly item data.

4.. my driver program internal table for item data, its showing 3 item record for one po number,  but my output is different from this..

0 Kudos

Hi Sandeep,

Don't you have 3 items for the first PO in your example? I have a similar setup for my client where the header loop prints the Packing material and the item loop prints all the items packed within the container.

Regards,

Navin

Former Member
0 Kudos

hi hari, I knew this logic working in your form , but why didn't work in my form because my coding is right,

and i think you didn't seem my item internal table properly.

please check again my last screenshots(item internal table),

I had PO header data(2 records)

like this...

ebeln      bsart     ekorg          bedat

300006    EC        3000          20001102

300007    EC        3000          20001102

check my  last screen shot, it have item data as per PO header data(6 records)

like this


ebeln       ebelp    means   netwr      menge   maktx

300006   0001     ST           52.99     1,000    high speed

300006   0002     ST           42.59     1,000    high material

300006   0003     ST           22.49     1,000    high speed

300007   0001     ST           22.39     1,000    iron core

300007   0002     ST           52.49     1,000    high speed

300007   0003     ST           62.39     1,000    high speed

Former Member
0 Kudos

Hi sandeep,

Maybe think about controlling the printing line. The variable, which is responsible for printing the PO Output. Before printing line with PO Output, you check the PO Output:

VAR = PO Output

IF True - do not print the PO Output, only item output 1,2,3;

IF False - print the PO Output;


Best regards

KT Developer