2013 Nov 11 7:59 AM
Hi all,
i have to make a smartform for bidding, now i have written code, and creates a smartforms,
Now the problem is "as there are so many line items for which the bidding is to be done,as
shownn in screenshot, now i have to sort these line items and take unique values, for that i have
done it". Now i have to take into consideration all the unique values of "ebeln", and to print its
corresponding values in order, i have two problem to sort out, how can i sort table it_bidding
which contains the screenshot values so that it will sort according to each line item and its values,
and the second problem is that i am using A3 page to print it, in which at a single time only
three sets of ebeln can be printed, and i wants to print it as many value of ebeln exist(when first three
sets get printed next set should print on next page and so on).
I have attached two screenshot, one contains set of values while debugging, and other
contains the bidding smartforms,in which 6000000004 and 6000000005 are values of ebeln.
(In simple words i wants to segregate my smartform based on ebeln)
Here is my code snippet, which i have used to finally segregating, but its not working
FORM CALL_SMARTFORMS.
it_bidding2[] = it_bidding[].
SORT it_bidding by ebeln matnr.
SORT it_bidding2 by ebeln matnr.
DELETE ADJACENT DUPLICATES FROM it_bidding COMPARING ebeln matnr.
LOOP AT it_bidding .
wa_temp-ebeln = it_bidding-ebeln.
wa_temp-matnr = it_bidding-matnr.
wa_temp-ebelp = it_bidding-ebelp.
APPEND wa_temp to it_temp.
ENDLOOP.
* SORT it_temp by ebeln matnr.
SORT it_temp by matnr .
DATA im TYPE I.
LOOP AT it_temp into wa_temp.
delete it_temp WHERE matnr = wa_temp-matnr.
LOOP AT it_bidding2 WHERE matnr = wa_temp-matnr.
if im eq 0.
wa_bid-ebeln = it_bidding2-ebeln.
wa_bid-ebelp = it_bidding2-ebelp.
wa_bid-EMATN = it_bidding2-EMATN.
wa_bid-menge = it_bidding2-menge.
wa_bid-TXZ01 = IT_BIDDING2-txz01.
wa_bid-KTMNG = IT_BIDDING2-ktmng.
wa_bid-MEINS = IT_BIDDING2-meins.
wa_bid-NETPR = IT_BIDDING2-netpr.
wa_bid-ZWERT = IT_BIDDING2-zwert.
wa_bid-MWSKZ = IT_BIDDING2-MWSKZ.
wa_bid-FREIGHT = IT_BIDDING2-FREIGHT.
wa_bid-DIS = IT_BIDDING2-DIS.
wa_bid-EXCISE = IT_BIDDING2-EXCISE.
wa_bid-tot_amt = IT_BIDDING2-tot_amt.
wa_bid-zterm = it_bidding2-zterm.
wa_bid-angdt = it_bidding2-angdt.
wa_bid-eindt = it_bidding2-eindt.
* wa_bid-gwldt = it_bidding2-gwldt.
wa_bid-txz5 = it_bidding2-txz5.
wa_bid-txz11 = it_bidding2-txz11.
wa_bid-txz21 = it_bidding2-txz21.
wa_bid-txz31 = it_bidding2-txz31.
wa_bid-vat1 = it_bidding2-vat.
wa_bid-name1 = it_bidding2-name1.
wa_bid-telf1 = it_bidding2-telf1.
wa_bid-telf2 = it_bidding2-telf2.
wa_bid-telfx1 = it_bidding2-telfx.
wa_bid-name2 = it_bidding2-name2.
im = 1.
ELSEIF im = 1.
wa_bid-ebeln1 = it_bidding2-ebeln.
wa_bid-ebelp1 = it_bidding2-ebelp.
wa_bid-NETPR1 = IT_BIDDING2-netpr.
wa_bid-ZWERT1 = IT_BIDDING2-zwert.
wa_bid-MWSKZ1 = IT_BIDDING2-MWSKZ.
wa_bid-FREIGHT1 = IT_BIDDING2-FREIGHT.
wa_bid-DIS1 = IT_BIDDING2-DIS.
wa_bid-EXCISE1 = IT_BIDDING2-EXCISE.
wa_bid-tot_amt1 = IT_BIDDING2-tot_amt.
wa_bid-zterm1 = it_bidding2-zterm.
wa_bid-angdt1 = it_bidding2-angdt.
wa_bid-eindt1 = it_bidding2-eindt.
* wa_bid-gwldt1 = it_bidding2-gwldt.
wa_bid-txz10 = it_bidding2-txz5.
wa_bid-txz12 = it_bidding2-txz11.
wa_bid-txz32 = it_bidding2-txz31.
wa_bid-vat2 = it_bidding2-vat.
wa_bid-name11 = it_bidding2-name1.
wa_bid-telf12 = it_bidding2-telf1.
wa_bid-telf22 = it_bidding2-telf2.
wa_bid-telfx2 = it_bidding2-telfx.
wa_bid-name22 = it_bidding2-name2.
ELSEIF im = 2.
wa_bid-ebeln2 = it_bidding2-ebeln.
wa_bid-ebelp2 = it_bidding2-ebelp.
wa_bid-NETPR2 = IT_BIDDING2-netpr.
wa_bid-ZWERT2 = IT_BIDDING2-zwert.
wa_bid-MWSKZ2 = IT_BIDDING2-MWSKZ.
wa_bid-FREIGHT2 = IT_BIDDING2-FREIGHT.
wa_bid-DIS2 = IT_BIDDING2-DIS.
wa_bid-EXCISE2 = IT_BIDDING2-EXCISE.
wa_bid-tot_amt2 = IT_BIDDING2-tot_amt.
wa_bid-zterm2 = it_bidding2-zterm.
wa_bid-angdt2 = it_bidding2-angdt.
wa_bid-eindt2 = it_bidding2-eindt.
* wa_bid-gwldt2 = it_bidding2-gwldt.
wa_bid-txz15 = it_bidding2-txz5.
wa_bid-txz13 = it_bidding2-txz11.
wa_bid-txz33 = it_bidding2-txz21.
wa_bid-vat3 = it_bidding2-vat.
wa_bid-name12 = it_bidding2-name1.
wa_bid-telf13 = it_bidding2-telf1.
wa_bid-telf23 = it_bidding2-telf2.
wa_bid-telfx3 = it_bidding2-telfx.
wa_bid-name23 = it_bidding2-name2.
ENDIF.
DELETE it_bidding2 WHERE ebeln = it_bidding2-ebeln AND matnr = it_bidding2-matnr.
ENDLOOP.
APPEND wa_bid to it_bid.
im = 0.
ENDLOOP.
Please help me in sorting this problem.
2013 Nov 11 8:08 AM
Hi Sanjeev
Can you please rephrase your question step by step and add screen shots with some comments like this is expected or what is expected then we will be able to help you out.
As far as in case you want to print 3 lines on one page you can triger a page break inside loop end loop of table in MAIN window once the count reaches 3
Nabheet
Dear Nabheet,
according to you now i have written these lines of code ,
in which i am getting unique PO no, but by sorting and deleting i looses line items, so how
will i match line item wise with main internal table it_bidding.
and if i sort and delete with ebeln ebelp, then i think it has not any advantage, the problem is still
not solved because in it_bidding5 if i will sort it by ebeln only, then i will looses line item .
Please tell me what can i do.
it_bidding1 = it_bidding .
SORT IT_BIDDING1 by ematn.
DELETE ADJACENT DUPLICATES FROM it_bidding1 COMPARING ematn.
it_bidding5[] = it_bidding[].
SORT it_bidding5 BY ebeln.
DELETE ADJACENT DUPLICATES FROM it_bidding5 COMPARING ebeln.
DESCRIBE TABLE it_bidding5 LINES LV_LINES.
LV_TOT_TIME = ( ( LV_LINES / 3 ) + LV_LINES MOD 3 ).
DO LV_TOT_TIME TIMES.
PERFORM CALL_SMARTFORMS.
ENDDO.
2013 Nov 15 10:39 AM
Please put a break point using BREAK <Username > statement in Smartform and check what is happening in debugging.. I believe since you have some small mistake..Please cehck in debugging whether this value is getting picked up
2013 Nov 15 10:45 AM
Dear Nabheet,
i have debug my code, and as i told you earlier that it is picking each values.
But during Modify and transporting it looses my value......
anyhow thanks a lot once again and let me see my code throughout.
2013 Nov 15 10:59 AM
Yeah just debug it its now a small issue:) let us know about your finding
| User | Count |
|---|---|
| 6 | |
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |