Application Development 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: 

Problem while creating the spool requests for multiple PO's

former_member569532
Participant
0 Kudos

Hi Experts,

I have a program to send the PO message output as an email to vendor.

When I create a spool requests for individual PO, it is working very well.

But, if I try to create the spool requests for 15 PO's ,spool request is created for only some PO's.

I am using FM to get the spool request number and I am calling these FM 's in loop.


CALL FUNCTION 'RSPO_FIND_SPOOL_REQUESTS'

           EXPORTING

             rqowner       = sy-uname

           TABLES

             spoolrequests = lt_spool

           EXCEPTIONS

             no_permission = 1

             OTHERS        = 2.



Kindly anyone advise how to solve this problem.


Thanks & Regards,

Anusha.B

2 REPLIES 2

Former Member
0 Kudos

Hi Anu,

First, you need get all lines from spool request by this FM 'RSPO_RETURN_ABAP_SPOOLJOB',

Then create a new spool request by FM 'RSPO_SR_OPEN ', put all lines into this new request by FM 'RSPO_SR_WRITE'.

code seems looks like below:

LOOP itab_po.

    CALL FUNCTION 'RSPO_RETURN_ABAP_SPOOLJOB'.

        TABLE    = sub_itab.

    APPEND all lines of sub_itab TO final_itab.

ENDLOOP.

CALL FUNCTION 'RSPO_SR_OPEN'

    importing = new_request.

CALL FUNCTION 'RSPO_SR_WRITE'

    exporting = new_request

    table       = final_itab.

regards,

Archer

0 Kudos

I have used the below function modules to create the spool.

call function 'ME_READ_PO_FOR_PRINTING'

        exporting

             ix_nast        = nast

             ix_screen      = ent_screen

        importing

             ex_retco       = ent_retco

             ex_nast        = l_nast

             doc            = l_doc

        changing

             cx_druvo       = l_druvo

             cx_from_memory = l_from_memory.

   check ent_retco eq 0.

   call function 'ME_PRINT_PO'

        exporting

             ix_nast        = l_nast

             ix_druvo       = l_druvo

             doc            = l_doc

             ix_screen      = ent_screen

             ix_from_memory = l_from_memory

             ix_toa_dara    = toa_dara

             ix_arc_params  = arc_params

             ix_fonam       = tnapr-fonam          "HW 214570

        importing

             ex_retco       = ent_retco.

If I print the PO individully ME_READ_PO_FOR_PRINTING returning ent_retco = 0.

But If I Print the 15 PO's for the same PO ME_READ_PO_FOR_PRINTING is returning ent_retco = 1.What I need to do to avoid this?Please advise.

Thanks,

Anusha.B