on 04-02-2007 10:52 AM
I have developed a form and now I want to run it on the Dev..... can you please tell me how to proceed.
Hi..,
now u did the correct thing...( question )..
After creating the form u need to create the print program for this form...
In this program .. u need to use three function modules..
check this program....
selection-screen begin of block blk with frame.
parameters:
p_actno(13) type c.
select-options:
s_date for sy-datum.
selection-screen end of block blk.
"----
Type declaration of the structure to hold transaction details *
"----
types:
begin of type_s_transaction,
date type d,
partics(10) type c,
curr(3) type c,
amount type p decimals 2,
end of type_s_transaction.
"----
Declaration of internal table and work area for transaction table *
"----
data :
t_transaction type standard table
of type_s_transaction
initial size 0.
data wa_transaction type type_s_transaction.
*" Data declarations...................................................
data :
w_date type d,
w_partcs(10) type c,
w_amount type p decimals 2,
w_total like w_amount,
w_curr(3) type c,
w_chkdate type d.
Populating internal table...
wa_transaction-date = '20010924'.
wa_transaction-partics = 'ATM'.
wa_transaction-amount = '1000.00'.
wa_transaction-curr = '$'.
append wa_transaction to t_transaction.
wa_transaction-date = '20010924'.
wa_transaction-partics = 'Cheque'.
wa_transaction-amount = '5000.75'.
wa_transaction-curr = '$'.
append wa_transaction to t_transaction.
wa_transaction-date = '20010928'.
wa_transaction-partics = 'ATM'.
wa_transaction-amount = '3000.00'.
wa_transaction-curr = '$'.
append wa_transaction to t_transaction.
wa_transaction-date = '20010928'.
wa_transaction-partics = 'Cheque'.
wa_transaction-amount = '4000.00'.
wa_transaction-curr = '$'.
append wa_transaction to t_transaction.
wa_transaction-date = '20011025'.
wa_transaction-partics = 'ATM'.
wa_transaction-amount = '5000.00'.
wa_transaction-curr = '$'.
append wa_transaction to t_transaction.
wa_transaction-date = '20011025'.
wa_transaction-partics = 'Cheque'.
wa_transaction-amount = '1500.00'.
wa_transaction-curr = '$'.
append wa_transaction to t_transaction.
wa_transaction-date = '20011025'.
wa_transaction-partics = 'ATM'.
wa_transaction-amount = '2000.00'.
wa_transaction-curr = '$'.
append wa_transaction to t_transaction.
Calling the open_form funtion module to start printing...
<b>call function 'OPEN_FORM'</b>
EXPORTING
FORM = 'YH640_060101' <i><--form name</i>
LANGUAGE = SY-LANGU
EXCEPTIONS
CANCELED = 1
DEVICE = 2
FORM = 3
OPTIONS = 4
UNCLOSED = 5
MAIL_OPTIONS = 6
ARCHIVE_ERROR = 7
INVALID_FAX_NUMBER = 8
MORE_PARAMS_NEEDED_IN_BATCH = 9
SPOOL_ERROR = 10
CODEPAGE = 11
OTHERS = 12.
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
loop at t_transaction into wa_transaction.
w_date = wa_transaction-date.
w_partcs = wa_transaction-partics.
w_amount = wa_transaction-amount.
w_curr = wa_transaction-curr.
<b> call function 'WRITE_FORM'</b>
EXPORTING
ELEMENT = 'DATA' <i><--- text elements , if u have defined </i>
FUNCTION = 'SET'
TYPE = 'BODY'
WINDOW = 'MAIN'
EXCEPTIONS
ELEMENT = 1
FUNCTION = 2
TYPE = 3
UNOPENED = 4
UNSTARTED = 5
WINDOW = 6
BAD_PAGEFORMAT_FOR_PRINT = 7
SPOOL_ERROR = 8
CODEPAGE = 9
OTHERS = 10.
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
w_chkdate = w_date.
add w_amount to w_total.
endloop. " Loop at t_transaction into...
Printing the total....
call function 'WRITE_FORM'
EXPORTING
ELEMENT = 'TOTAL'
FUNCTION = 'SET'
TYPE = 'BODY'
WINDOW = 'MAIN'
EXCEPTIONS
ELEMENT = 1
FUNCTION = 2
TYPE = 3
UNOPENED = 4
UNSTARTED = 5
WINDOW = 6
BAD_PAGEFORMAT_FOR_PRINT = 7
SPOOL_ERROR = 8
CODEPAGE = 9
OTHERS = 10.
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
Closing the form ...
<b>call function 'CLOSE_FORM'</b>
EXCEPTIONS
UNOPENED = 1
BAD_PAGEFORMAT_FOR_PRINT = 2
SEND_ERROR = 3
SPOOL_ERROR = 4
CODEPAGE = 5
OTHERS = 6.
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
<b>
reward if it helps u,,,
sai ramesh</b>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can run sap script from using foollwoing three FMs.
1. call function 'OPEN_FORM'
.
.
.
2. CALL FUNCTION 'WRITE_FORM'
.
.
.
3. CALL FUNCTION 'CLOSE_FORM'
.
.
.
execute this fms in driver program.
Jogdand M b
Award if helpful.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
68 | |
26 | |
9 | |
9 | |
7 | |
6 | |
4 | |
4 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.