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,
as per as your instruction i have changed my code as shown below
(it_bidding contains all data).
Now according to you
it_bidding2[] = it_bidding[].
SORT it_bidding2 BY ematn.
DELETE ADJACENT DUPLICATES FROM it_bidding2 COMPARING ematn.
it_bidding5[] = it_bidding[].
SORT it_bidding5 BY ebeln.
DELETE ADJACENT DUPLICATES FROM it_bidding5 COMPARING ebeln.
WHILE LV_FLAG NE 'X'.
LOOP AT it_bidding5.
IF SY-SUBRC = 4.
EXIT.
ENDIF.
DELETE it_bidding5 INDEX sy-tabix.
APPEND it_bidding5 TO it_bid2_temp.
ENDLOOP.
IF SY-SUBRC NE 0.
LV_FLAG = 'X'.
ENDIF.
PERFORM CALL_SMARTFORMS.
FORM CALL_SMARTFORMS.
DATA : TLINES TYPE I.
DESCRIBE TABLE it_bid LINES TLINES.
IF TLINES GT 2.
sform = 'ZST_MM_SF_PURCHASE1'.
ELSE.
sform = 'ZST_MM_SF_PURCHASE'.
ENDIF.
*ENDLOOP.
EXPORT it_bid FROM it_bid TO MEMORY ID 'ZZ_BID'.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
FORMNAME = sform
* VARIANT = ' '
* DIRECT_CALL = ' '
IMPORTING
FM_NAME = fname
* EXCEPTIONS
* NO_FORM = 1
* NO_FUNCTION_MODULE = 2
* OTHERS = 3
.
IF SY-SUBRC <> 0.
ENDIF.
CALL FUNCTION fname
TABLES
it_head = it_head
it_bidding1 = it_bidding1
it_bidding = it_bidding.
it_bidding2 = it_bidding2.
it_bid2_temp = it_bid2_temp.
IF sy-subrc <> 0.
ENDIF.
ENDFORM.
Now according to you, i have to write these code lines inside smartform or inside calling of my smartform ?
Please clear it, thanks a lot in advance
Smartform coding
for each line of IT_BID1(MAIN table)
Read table it_bid2_temp index 1. To get first PO number whose detail to be printed.
bsaed on PO number from IT_BID2_TEMP and material from IT_BID1
read the detail from IT_BID.
Read table it_bid2_temp index 2. To get second PO number whose detail to be printed.
bsaed on PO number from IT_BID2_TEMP and material from IT_BID1
read the detail from IT_BID.
Read table it_bid2_temp index 3 To get third PO number whose detail to be printed.
bsaed on PO number from IT_BID2_TEMP and material from IT_BID1
read the detail from IT_BID.
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 |