cancel
Showing results for 
Search instead for 
Did you mean: 

Subtotal with Table node not at page break but at end of <field1>

Former Member
0 Kudos

Hi

How do i acheive Subtotal with Table node not at page break but at end of each <field1> ?

With the built-in feature of Footer in table node we can get subtotal at page-break and at the paragraph-end .

<b>I am working on 4.6c version where Table node doesnt have Calculation tab .</b>

<b>Below is the SAPscript code to be converted to Smartforms</b>

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.

*&----


Regards

Jaman

Message was edited by:

ABAP Techie

Message was edited by:

ABAP Techie

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

use...

at end of <field1>.

endat.

Former Member
0 Kudos

Dear Ramesh

Could you please explain in details where / how do i use <i>at end of endat</i> ?

Regards

Jaman

Former Member
0 Kudos

Dear Jaman,

I can help you in converting the code. Here I am not able to attache the code of the SAMRTFORM. Pl. give me your email address and I will send you complete SMARTFORM.

Darshan Patel

Lead SAP Consultant.

HCL TECHNOLOGIES

Former Member
0 Kudos

Hi Darshan

sap.moni@gmail.com is my id . Kindly send that asap if possible the screen-shot of the Table node of ur Smartform..

Regards

jaman

Former Member
0 Kudos

hi u can achive this as follows..

declare 3 fields.. v_old, v_new, v_subtotal

create antothere line type(for sub totals and insert wht ever u want) in table main area.. in conditions give <b>v_old not equals to v_new</b>.

<b>main thing is now...</b>.

Create a program lines above the ?Subtotal line type.. in side that..

first time move the presnt field value to v_new, and v_old (because fist subtotals wilbe printedto avoid this) ....move the v_new to v_old.. and claculate the v_subtota here only.. Clear the v_subtotals when the value is printed,..

Please Close this thread.. when u r problem is solved

Reward if Helpful

Regards

Naresh Reddy K

Former Member
0 Kudos

Can somebody help me in converting this into Smartform ...

4.6c doesnt have Calculation tab in the table node !!!!

Given is the SapScript code to be converted into Smartform with Table node.