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

creating different spool requests based on sorting -part II

Former Member
0 Likes
4,571

hi folks,

Now I have added the group field to 'accitab' and as mentioned I have another itable (same as 'accitab') called 'final_accitab where I have the recrods for all the customers and their corresponding group types too.

something like this..

customernumber ........ sortgroup

1000001 1

1000001 1

1000001 1

1000012 1

1000012 1

1000112 1

.

.

.

.

10000002 2

10000002 2

10000002 2

.

.

.

.

10000003 3 and so on

Now I have to print the customers based on the sorting therefore I should be passing the records of all the customers that come under a common sort type into one spool request,( I think that way!!) and how to do that ?

ii)how to print separate statements for each customer

for the same sort within the same spool request.

Thanks in advance

Vinu

I think it should works, try:

DATA:E_SSFCOMPIN TYPE SSFCOMPIN,

SORT LIKE FINAL_ACCITAB-ZSORTGROUP,

FL_OPEN,

T_CUSTOMER LIKE STANDARD TABLE OF FINAL_ACCITAB.

  • Fill structure E_SSFCOMPIN with print parameters, if

  • you don't know them open dialog:

  • You can get user parameters:

SELECT SINGLE * FROM USR01 INTO W_USR01 WHERE BNAME = SY-UNAME.

E_SSFCOMPIN-TDDEST = W_USR01-SPLD.

IF W_USR01-SPDB = 'G'.

E_SSFCOMPIN-TDIMMED = 'X'.

ENDIF.

E_SSFCOMPIN-TDNEWID = 'X'.

IF W_USR01-SPDA = 'D'.

E_SSFCOMPIN-TDDELETE = 'X'.

ENDIF.

  • Open dialog

E_SSFCOMPIN-DIALOG = 'X'.

.

  • Block opening and closing in FM of smartforms

DATA: SSFCTRLOP LIKE SSFCTRLOP

SSFCTRLOP-NO_OPEN = 'X'.

SSFCTRLOP-NO_CLOSE = 'X'.

LOOP AT FINAL_ACCITAB.

IF FINAL_ACCITAB-ZSORTGROUP <> SORT.

SORT = FINAL_ACCITAB-ZSORTGROUP.

IF FL_OPEN = 'X'.

CALL FUNCTION 'SSF_CLOSE'.

ENDIF.

CALL FUNCTION 'SSF_OPEN'

EXPORTING

INPUT = E_SSFCOMPIN

EXCEPTIONS

ERROR = 1

OTHERS = 2.

IF SY-SUBRC = 0.

FL_OPEN = 'X'.

  • Only first time it opens dialog

CLEAR E_SSFCOMPIN-DIALOG.

ENDIF.

AT NEW ZADVERTISER.

IF NOT T_CUSTOMER[] IS INITIAL.

  • now call the generated function module

CALL FUNCTION FM_NAME

EXPORTING

  • archive_index =

  • archive_parameters =

control_parameters = SSFCTRLOP

  • mail_appl_obj =

  • mail_recipient =

  • mail_sender =

  • output_options = 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 = T_CUSTOMER

ZCDATAR = ZCDATA

ZAGING = AGINGDATAITAB

ZADDRESS = I_ADDRESS_NUMBER

EXCEPTIONS FORMATTING_ERROR = 1

INTERNAL_ERROR = 2

SEND_ERROR = 3

USER_CANCELED = 4

OTHERS = 5.

REFRESH T_CUSTOMER.

ENDIF.

ENDAT.

INSERT FINAL_ACCITAB INTO TABLE T_CUSTOMER.

ENDLOOP.

IF SY-SUBRC = 0.

  • Print data of last customer

IF NOT T_CUSTOMER[] IS INITIAL.

CALL FUNCTION FM_NAME

EXPORTING

  • archive_index =

  • archive_parameters =

  • control_parameters = control

  • mail_appl_obj =

  • mail_recipient =

  • mail_sender =

  • output_options = 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 = T_CUSTOMER

ZCDATAR = ZCDATA

ZAGING = AGINGDATAITAB

ZADDRESS = I_ADDRESS_NUMBER

EXCEPTIONS FORMATTING_ERROR = 1

INTERNAL_ERROR = 2

SEND_ERROR = 3

USER_CANCELED = 4

OTHERS = 5.

CALL FUNCTION 'SSF_CLOSE'.

  • After printing data, clear the customer table

REFRESH T_CUSTOMER.

ENDIF.

ENDIF.

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

43 REPLIES 43
Read only

0 Likes
4,053

Printer names are case sensitive. Have you checked that?

Srinivas

Message was edited by: Srinivas Adavi

Also, I see that you marked this as answered, but I don't see any points given to Max, who has helped you a lot on this issue. Please reward him for his efforts.

Read only

0 Likes
4,053

Yes.

Read only

0 Likes
4,053

Hi Vinu

I agree with Srinivas: check the name of device, are you sure it's Xerox1?

You can try to transfer the name of that printer by dialog (FM SSF_OPEN) and then check the name in debug.

Max

Read only

Former Member
0 Likes
4,053

Hi Vinu,

I saw that you rewarded Max for his effort. I apologize for missing it.

Regards,

Srinivas