2013 Dec 05 4:28 AM
Hello,
I had a problem in printing multiple document in one spool request and the issue was solved, Now in the select option if i give "From" "To" numbers( Eg 50000002 to 50000005) the printing is done and if i give only one document number the print does not trigger.
Please find the code
w_cnt2 = sy-tabix.
case w_cnt2.
when 1.
control_parameters-no_open = space .
control_parameters-no_close = 'X' .
when w_cnt .
control_parameters-no_open = 'X' .
control_parameters-no_close = space .
when others.
control_parameters-no_open = 'X' .
control_parameters-no_close = 'X' .
endcase.
Kindly help.
Regards,
Sam.
2013 Dec 06 4:48 AM
I hope you use Select Option in your selection screen .
Case 1# If you pass "From and To" then your documents printing successfully.
Case 2# If you pass only From then your document not printing .
Pass both From and To as same document number and check document is printed
successfully or Not .
Example :
Regard's
Smruti
2013 Dec 05 5:10 AM
Hi,
If there is only one doc no in the selection screen, append the same low value to TO (HIGH) field also in the program.
Regards,
Josh
2013 Dec 05 5:13 AM
Hi Samuel
I would suggest you to debug your program may be the control is not going to the place where you are printing
Nabheet
2013 Dec 05 10:30 AM
Hi Nabheet,
When iam able to print more than one doc, i dont understand why only one doc does not get printed.
Do you want me to post the entire code snippet.
Regards,
Sam.
2013 Dec 05 10:32 AM
Hi Samuel
It looks like you have some sort of counter or stuff which you are using in your code. Can you please paste only the loop endloop stuff inside which printing is happening
Nabheet
2013 Dec 06 3:36 AM
Hi Nabheet,
Please refere the below code.
LOOP at it_main INTO wa_main.
w_cnt2 = sy-tabix.
case w_cnt2.
when 1.
control_parameters-no_open = space .
control_parameters-no_close = 'X' .
when w_cnt .
control_parameters-no_open = 'X' .
control_parameters-no_close = space .
when others.
control_parameters-no_open = 'X' .
control_parameters-no_close = 'X' .
endcase.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = 'ZVOUCHER1'
IMPORTING
fm_name = fname
EXCEPTIONS
NO_FORM = 1
NO_FUNCTION_MODULE = 2
OTHERS = 3.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION fname"'/1BCDWB/SF00000143'
EXPORTING
CONTROL_PARAMETERS = control_parameters
doc_no = wa_main-belnr
co_code = wa_main-bukrs
period = wa_main-gjahr
EXCEPTIONS
FORMATTING_ERROR = 1
INTERNAL_ERROR = 2
SEND_ERROR = 3
USER_CANCELED = 4
OTHERS = 5
.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
ENDLOOP.
Regards,
Sam.
2013 Dec 06 4:56 AM
Hi Sam
Its not working becuase the system is expectiong for the last call
NO_OPEN = 'X'.
NO_CLOSE = SPACE .
But since your loop has only one line only first case statement is processed not the abvoe mentioned.
Do one thing just before the loop do a
Describe table it_main lines lv_lines.
LOOP at it_main INTO wa_main.
w_cnt2 = sy-tabix.
case w_cnt2.
when 1.
if lv_lines ne 1.
control_parameters-no_open = space .
control_parameters-no_close = 'X' .
else.
control_parameters-no_open = 'X' .
control_parameters-no_close = space .
endif.
when w_cnt .
control_parameters-no_open = 'X' .
control_parameters-no_close = space .
when others.
control_parameters-no_open = 'X' .
control_parameters-no_close = 'X' .
endcase.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = 'ZVOUCHER1'
IMPORTING
fm_name = fname
EXCEPTIONS
NO_FORM = 1
NO_FUNCTION_MODULE = 2
OTHERS = 3.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION fname"'/1BCDWB/SF00000143'
EXPORTING
CONTROL_PARAMETERS = control_parameters
doc_no = wa_main-belnr
co_code = wa_main-bukrs
period = wa_main-gjahr
EXCEPTIONS
FORMATTING_ERROR = 1
INTERNAL_ERROR = 2
SEND_ERROR = 3
USER_CANCELED = 4
OTHERS = 5
.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
ENDLOOP.
2013 Dec 06 5:46 AM
Nabheet,
Describe statement is already there and i tried the case statement as per your coding but it dint work.
Regards,
Sam.
2013 Dec 05 6:22 AM
Hi,
It's seems to be problem of sy-tabix. where you are getting the count. Please check the field.
w_cnt2 = sy-tabix.
Thanks,
Kiran
2013 Dec 06 4:48 AM
I hope you use Select Option in your selection screen .
Case 1# If you pass "From and To" then your documents printing successfully.
Case 2# If you pass only From then your document not printing .
Pass both From and To as same document number and check document is printed
successfully or Not .
Example :
Regard's
Smruti
2013 Dec 06 5:33 AM
Hi Smruti,
I tried as per your method and it din't work.
Regards,
sam.
2013 Dec 06 5:38 AM
2013 Dec 06 6:06 AM
2013 Dec 06 6:15 AM
Change as below
if lv_lines ne 1.
control_parameters-no_open = space .
control_parameters-no_close = 'X' .
else.
control_parameters-no_open = space .
control_parameters-no_close = space .
endif.
2013 Dec 06 6:46 AM
Hi Nabheet,
Excellent!
Thank you so much. The issue has been solved.
Thanks all for all your support.
Regards,
Sam.