‎2005 Aug 29 7:34 PM
HI FOLKS,
I printing the statements using ABAP print program, and my objective is to print for a range of customers (which I input in the selection-options and give the range)
I have read these customer numbers into an ITAB and looping the data I am declaring the function module within the loop.
But, the entire data is printing in one statement which should not be the case, for each customer it should print different statements i.e for each customer it should print unique and not update the same statement.
How can i facilitate this ?
Thanks
vinu
‎2005 Aug 29 7:37 PM
‎2005 Aug 29 7:40 PM
‎2005 Aug 29 7:57 PM
this is what I have in the function module of the smartform
i entered the value 'X' in 'output options' in the exporting parameter section and got a runtime error.
now call the generated function module
call function fm_name
exporting
archive_index =
archive_parameters =
control_parameters =
mail_appl_obj =
mail_recipient =
mail_sender =
output_options =
user_settings = 'X'
ZTOTAL = ZTOTALAMOUNT
zscan_code = scan_number
zpartner = bpartner
z_bdate = e_date
zadnumber = adnumber
zadnumber1 = zzadnumber
zagencynumber = agencynumber
z_payment_terms = v_payment_terms
zzadname = adname1
zadname = adname
zagencyname = agencyname
zphone = bphone
zcreditgroup = zcredittext
z_bperiod = monthn
ztotalcredits = zappliedcredits1
ztotalbalance = zcurrenttotal
ZZEXTZIP = zzextensionzip
bookings = bookings
importing document_output_info =
job_output_info =
job_output_options =
tables
stribunecustomer = customer
accountdata = accitab
zcdatar = zcdata
zaging = agingdataitab
ZADDRESS = i_address_number
exceptions formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
others = 5.
Regards
santhosh
‎2005 Aug 29 8:06 PM
Did you do it like this...........
data: output_options type ssfcompop .
output_options-tdnewid = 'X'.
call function '/1BCDWB/SF00000002'
exporting
* ARCHIVE_INDEX =
* ARCHIVE_INDEX_TAB =
* ARCHIVE_PARAMETERS =
* CONTROL_PARAMETERS =
* MAIL_APPL_OBJ =
* MAIL_RECIPIENT =
* MAIL_SENDER =
output_options = output_options
* USER_SETTINGS = 'X'
Regards,
Rich Heilman
‎2005 Aug 29 8:17 PM
Hi,
Instead of selecting the data in program and calling the fm for each loop, call the smartforms just once and put all the select statements and other stuff in the smart forms in node PROGRAM LINES.
Then you loop thru this internal table in node LOOP and print the data for each table entry in the internal table.
Hope this helps you. Let me know if you need in detail.
Thanks
Vamsi
‎2005 Aug 29 8:08 PM
Hi Santhosh,
You need to have explicit page break whenever you find a new customer. Hope you are using the TABLE node for displaying the line items. But explicit page break (using COMMAND node) is not possible inside the TABLE node. The solution is using LOOP node. I think you are using an internal table for TABLE node. Copy the values in another internal table and take only unique customer number (use SORT and DELETE ADJUCENT DUPLICATES). Use this internal table in the LOOP node. The TABLE node will be inside the LOOP node.
So the LOOP node will loop through the unique customer number internal table and the TABLE node will loop through the items for the selected customer.
Hope this will help you. If you want to have different page numbers for each customer please go through this blog.
/people/vinod.chandran/blog/2005/08/23/using-final-window-in-smartforms
Another solution is to control this in the print program.
Instead of command node for page break you have to call the smartform for each customer passing the items for the selected customer. You need the unique internal table in the program.
Hope this will help you.
Thanks
Vinod
‎2005 Aug 29 8:17 PM
Working with this example program below, it generated 3 separate spool requests.
report zrich_0002 .
data: output_options type ssfcompop,
customers type ty_customers,
bookings type ty_bookings,
connections type ty_connections,
control type ssfctrlop.
control-no_dialog = 'X'.
output_options-tdnewid = 'X'.
do 3 times.
call function '/1BCDWB/SF00000002'
exporting
* ARCHIVE_INDEX =
* ARCHIVE_INDEX_TAB =
* ARCHIVE_PARAMETERS =
control_parameters = control
* MAIL_APPL_OBJ =
* MAIL_RECIPIENT =
* MAIL_SENDER =
output_options = output_options
* USER_SETTINGS = 'X'
customers = customers
bookings = bookings
connections = connections
* IMPORTING
* DOCUMENT_OUTPUT_INFO =
* JOB_OUTPUT_INFO =
* JOB_OUTPUT_OPTIONS =
* EXCEPTIONS
* FORMATTING_ERROR = 1
* INTERNAL_ERROR = 2
* SEND_ERROR = 3
* USER_CANCELED = 4
* OTHERS = 5
.
if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
enddo.
Regards,
Rich Heilman
‎2005 Aug 29 8:36 PM
hi vinod, I think you can help me out here, I am not following what you are saying?
Let me give you the body template of the print program.
Declaration part... itab,variables
.
.
.
select-options:s_custid for knc1-kunnr default 1.
.
.
.
select distinct kunnr xausz from knb1 into table customerperiod where
kunnr in s_custid.
<b>* list of business partners/customers *</b>
loop at customerperiod.
zzbusinesspartner = customerperiod-kunnr.
icode2 = customerperiod-xausz.
<b>***list of all the advertisers matching the business partners for which statements have to be printed on the form ****</b>
select distinct inserent regulierer from jhaga into table
customertotal where regulierer = zzbusinesspartner.
loop at customertotal.
zzadvertiser = customertotal-inserent.
THE BODY OF THE FORM IS POPULATED USING THE LINE ITEMS OF THE TABLE NODE OF THE SMART FORM ****
call function 'SSF_FUNCTION_MODULE_NAME'
exporting formname = p_form
variant = ' '
direct_call = ' '
importing fm_name = fm_name
exceptions no_form = 1
no_function_module = 2
others = 3.
if sy-subrc <> 0.
error handling
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
exit.
endif.
now call the generated function module
call function fm_name
.
.
.
.
if sy-subrc <> 0.
error handling
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
endselect.
endloop.
If I have to change in the smartform use said that the LOOP node has to be used, I have used an interntable 'accitab' into which i reading the lineitems and in the form looping that into a work area 'wa-accountdata' and displaying that into the form.
can you elaborate on that? that would help me to understand .
Thanks
Santhosh
‎2005 Aug 29 8:40 PM
‎2005 Aug 29 8:47 PM
Rich, my question is how can I give a specific number of spool requests when I cannot give the specific number of customers I am dealing with upfront.
Santhosh
‎2005 Aug 29 8:53 PM
‎2005 Aug 29 9:12 PM
it throws a runtime error.
The function module interface allows only to specify fields of a particular type under " OUTPUT_OPTIONS" this has a different field type.
santhosh
‎2005 Aug 29 9:19 PM
The structure for output_options should have structure 'ssfcompop'. Within this set parameter ssfcompop-tdnewid.
‎2005 Aug 29 8:25 PM
Hi,
As said in earlier mail. This can be handled in Print Program. Print program will extract data in Internal Table Sorted on Customer. Within loop set Print parameters & Call Function module. After call to Function module Set Parameter New Spool Id = 'X'.
But it has a smaller problem. You have to give 'Wait' for some seconds before starting new customer. This way it will generate seperate spools for seperate customers.
Mahindra