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
My idea is since each page will have the same materials right..
You have two options one as suggested above
IT_BIDDING contains all data with an addtional field MARK( to flag if PO has been printed).
IT_BIDDING1 = IT_BIDDING.
SORT IT_BIDDING1 BY MATNR.
DELETE ADJACENT DUPLICATES FROM IT_BIDDING1 COMPARING MATNR.
IT_BIDDING2 = IT_BIDDING.
SORT IT_BIDDING2 BY EBELN.
DELETE ADJACENT DUPLICATES FROM IT_BIDDING2 COMPARING EBELN.
DESCRIBE TABLE IT_BIDDING2 LINES LV_LINES.
"Since each page can have 3 po's.
LV_TOT_TIME(times smartform will be called)
LV_TOT_TIME = ( (LV_LINES/3) + LV_LINES MOD 3 ).
DO LV_TOT_TIME
( MARK THE PO'S DETAIL WHICH ARE SENT IN THIS CALL. )
CALL SMARTFORM
ENDSMARTFORM.
Second way you call smartform once and inside smartform in initialization you haven
DO LV_TOT_TIME.
LOOP AT IT_BIDDING1
APPEND IT_BIDDING1 TO IT_BIDDING3 " since 6 lines have to printed on each page and lets say we have
" 3 pages to be printed so we need 18 lines so that table containue the loop.
ENDLOOP.
Then
LOOP AT IT_BIDDING 3.
READ TABLE IT_BIDDING FOR MATNR TO GET EBELN DETAILS. Set the flag MARK so that next time you dont print it again
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 |