Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

SMARTFORMS

Former Member
0 Likes
1,291

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

14 REPLIES 14
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
1,258

You are saying that it is putting all of the statements into one spool?

Regards,

Rich Heilman

Read only

0 Likes
1,258

Try putting an "X" in the TDNEWID field of the OUTPUT_OPTIONS parameter when calling the function module.

Regards,

Rich Heilman

Read only

0 Likes
1,258

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

Read only

0 Likes
1,258

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

Read only

0 Likes
1,258

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

Read only

Vinod_Chandran
Active Contributor
0 Likes
1,258

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

Read only

0 Likes
1,258

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

Read only

0 Likes
1,258

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

Read only

0 Likes
1,258

Santhosh, Are you saying that setting this flag is not working for you?

output_options-tdnewid = 'X'.

Regards,

Rich Heilman

Read only

0 Likes
1,258

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

Read only

0 Likes
1,258

I thought that you only need to have separate spool requests for each customer, right?

LOOP at customer_table. " Unique Customer Numbers

  • Call the smartforms function

  • and set the "new id" flag in the options

  • parameter.

ENDLOOP.

Is this not working?

Regards,

Rich Heilman

Read only

0 Likes
1,258

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

Read only

0 Likes
1,258

The structure for output_options should have structure 'ssfcompop'. Within this set parameter ssfcompop-tdnewid.

Read only

Former Member
0 Likes
1,258

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