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,
materials are itself a line item, so a PO may have one or more materials as line item but we have to consider the unique materials
among all PO's.
and based on these unique materials i have to check that for a single materilal which PO have its
corresponding values....and these values should get printed in front of respective PO's.
for which i have written these code but not getting how to fetch respective values.
in it_bidding1 i get unique values of ematn, but in table it_bidding5 i gets values as shown in screenshot,
and my requirement i have told you that for each PO , if it has a materila among line items material then
its value should gets printed , otherwise it kept blank (e.g. if PO 6000000003 contains line item 20 then
it should print otherwise kept its field blank, and it only prints for those PO having a line item 20)
Hoping any good solution from your side.
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 ebelp.
DELETE ADJACENT DUPLICATES FROM it_bidding5 COMPARING ebeln ebelp.
DATA : im TYPE i.
LOOP AT it_bidding1 INTO wa_bidding1.
DELETE it_bidding1 WHERE ematn = wa_bidding1-ematn.
LOOP AT it_bidding5 WHERE ematn = wa_bidding1-ematn.
(just tell me how can i loop here so that i will get unique set of values for each PO. )
DELETE it_bidding5 WHERE ebeln = it_bidding5-ebeln AND ematn = it_bidding5-ematn.
ENDLOOP.
APPEND wa_bid to it_bid.
im = 0.
ENDLOOP.
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 |