on 01-09-2007 11:06 AM
Hi All
I am working with 4.6 C Smartform Table node , How do i print the subtotal value of itab-lfimg just beginng of new Carton No printing (another field in itab) (similar to AT END OF cartno. ENDAT.) .
Please throw some light on this .
Thanks
Jaman
Hi,
You need to use calculation tab in table.
In table,create sort of begin and sort of end based on the field.This should be done in data tab.
In calculations
operation total
fieldname workarea-field
targetfieldname variable holding subtotal
time afterloop
reset sortcriterion
for fieldname pernr
In event on sort end,display the variable using text eleemnt.
Kindly reward points by clicking the star on the left of reply,if it helps.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
How can i achieve this following peice of code below with my TABLE node in Smartform ....
At end of each diff carton no ,,i want to print the subtotal of few fields as part of my final internal table being looped thru in the Table node .....
At the end of all records printed ,i need to print Grand total of those few feilds also ........Please guid..as i dont have CALCULATION tab with 4.6C version....
Below is the <b>SAPscript</b> code to be converted to Smartforms
LOOP AT restab.
AT NEW cartno.
ws-crt = ws-crt + 1.
ws-stotnw = 0.
ws-stotgw = 0.
READ TABLE icawn INTO cawn_wa WITH KEY
atwrt = restab-pck_code BINARY SEARCH.
IF sy-subrc = 0.
READ TABLE icawnt INTO cawnt_wa WITH KEY
atzhl = cawn_wa-atzhl BINARY SEARCH.
ENDIF.
ENDAT.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'ITEMS'
FUNCTION = 'SET'
TYPE = 'BODY'
window = 'MAIN'
IMPORTING
PENDING_LINES =
EXCEPTIONS
element = 1
function = 2
type = 3
unopened = 4
unstarted = 5
window = 6
bad_pageformat_for_print = 7
spool_error = 8
OTHERS = 9
.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ws-stotnw = ws-stotnw + restab-kcntgew.
ws-stotgw = ws-stotgw + restab-kcbrgew.
ws-totlfi = ws-totlfi + restab-lfimg.
AT END OF cartno.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'STOTAL'
FUNCTION = 'SET'
TYPE = 'BODY'
window = 'MAIN'
IMPORTING
PENDING_LINES =
EXCEPTIONS
element = 1
function = 2
type = 3
unopened = 4
unstarted = 5
window = 6
bad_pageformat_for_print = 7
spool_error = 8
OTHERS = 9
.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ws-gtotnw = ws-gtotnw + ws-stotnw.
ws-gtotgw = ws-gtotgw + ws-stotgw.
ENDAT.
ENDLOOP.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'GTOTAL'
FUNCTION = 'SET'
TYPE = 'BODY'
window = 'MAIN'
IMPORTING
PENDING_LINES =
EXCEPTIONS
element = 1
function = 2
type = 3
unopened = 4
unstarted = 5
window = 6
bad_pageformat_for_print = 7
spool_error = 8
OTHERS = 9
.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
*&----
Message was edited by:
ABAP SD/CRM
Message was edited by:
ABAP SD/CRM
Message was edited by:
ABAP SD/CRM
Message was edited by:
ABAP Techie<b></b>
Message was edited by:
ABAP Techie
Message was edited by:
ABAP Techie
Hi,
i havent gone thru the code but i wonderd as to y there is write_form in the logic.
u dont require any of there here .its a simple logic which says keep adding a variable till the end of a page and print it.
and at the start of new page page clear that variable explicitly and add with new values.
this is a quite simple logic and is applied everty where
hope u understand this.
Hi Abaper,
I'll give you simple solution but this is not optimal.. why iam telling this is i think u r facing dificulty id the logic told by jayanthi..
do as follow s Cteratemparary table.. move the output data into it. then clear the Out put table..
loop at the temparary table..
appent the temparaary table recorrd by record.
at end of the "fiied you reuire"
Sum.
append the onyt the the field witch you want to output table clear the restof the field.
end loop.
now you have the out put table with all the records and as well as the records with Total..
Print the new output table as it is.. it will display the REcords and the totals.
<b>Close this thread if when u r problem ise solved
Regards
Naresh Reddy K</b>
Hi,
Just add a programming lines node in the table node where u put the text node of that particular field finally u print it in the footer. U just need to write the logic in the programming lines.
sub = sub + <field>.
regards,
Aravind
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.