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,550

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

1) The statament AT NEW <FIELD> runs when a value of a field at the right of <FIELD> is changed. All values of these fields are replace by '*'.

For example:

FIELD1 FIELD2 FIELD3 FIELD4 FIELD5

A B C D E

A B C D E

A C C D E

A C C D E

AT NEW FIELD3

It runs on first loop, becouse header line was initial and runs on 3rd row, becouse in the first and second rows the field1 and field2 have the same values A B.

It's as if the systems saw a string created concatenating the values of all fields at the left of FIELD3, so it says:

- First loop: string = FIELD1 + FIELD2 + FIELD3 = ABC

=> ABC <> initial => AT NEW runs

- Second loop: string = FIELD1 + FIELD2 + FIELD3 = ABC

- Third loop: string = FIELD1 + FIELD2 + FIELD3 = ACC

=> ACC <> ABC => AT NEW runs

.....

When it is in AT NEW/ENDAT the header line is

- First loop: ABC**

- Third loop: ACC**

So you should save the values of fields at the right of <FIELD> in a workarea before going into AT NEW/ENDAT:

MOVE ITAB TO WA.

AT NEW...

  • Here don't read ITAB but WA

ENDAT.

2) You can use event AT END OF <FIELD> instead of AT NEW, it runs when the last value is changed.

For example:

- First loop: string = FIELD1 + FIELD2 + FIELD3 = ABC

- Second loop: string = FIELD1 + FIELD2 + FIELD3 = ABC

AT END OF FIELD3 runs

- Third loop: string = FIELD1 + FIELD2 + FIELD3 = ACC

.....

So, when you are in the event AT END, the data of customer,that are in header line of table, are data you have to print.

If you this event you should update your code as:

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

FORMNAME = P_FORM

IMPORTING

FM_NAME = FM_NAME

EXCEPTIONS

NO_FORM = 1

NO_FUNCTION_MODULE = 2

OTHERS = 3.

LOOP AT FINAL_ACCITAB.

IF FINAL_ACCITAB-ZSORTGROUP <> SORT.

SORT = FINAL_ACCITAB-ZSORTGROUP.

IF NOT E_SSFCOMPOP IS INITIAL.

  • After first time dialog doesn't open

SSFCTRLOP_OPEN-NO_DIALOG = 'X'.

ENDIF.

IF FL_OPEN = 'X'.

CALL FUNCTION 'SSF_CLOSE'.

ENDIF.

CALL FUNCTION 'SSF_OPEN'

EXPORTING

USER_SETTINGS = SPACE

OUTPUT_OPTIONS = E_SSFCOMPOP

CONTROL_PARAMETERS = SSFCTRLOP_OPEN

IMPORTING

JOB_OUTPUT_OPTIONS = SSFCRESOP

EXCEPTIONS

.........................

  • Block open and close of smartform in FM

SSFCTRLOP-NO_OPEN = 'X'.

SSFCTRLOP-NO_CLOSE = 'X'.

  • Now you can place here the piece of code where you load

  • the parameters you move to smartforms.

INSERT FINAL_ACCITAB INTO TABLE T_CUSTOMER.

  • Remember: when you execute a print, you are printin the data of previous customer,

  • so here save his parameters:

ZTOTALAMOUNT = ....

SCAN_NUMBER = ....

E_DATE = .....

.............

AT END advertiser.

CALL FUNCTION FM_NAME

..............

  • After printing data, clear them.

REFRESH T_CUSTOMER.

CLEAR: ZTOTALAMOUNT, .......

ENDAT.

ENDLOOP.

It doesn't need to write the code to print last customer, now you can print all into LOOP/ENDLOOP

Max

Message was edited by: max bianchi

Message was edited by: max bianchi

43 REPLIES 43
Read only

0 Likes
4,032

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,032

Yes.

Read only

0 Likes
4,032

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,032

Hi Vinu,

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

Regards,

Srinivas