1 2 Previous Next 23 Replies Latest reply on Jan 8, 2016 1:48 AM by 1567114

    SET_PRINT_OPTIONS copies set to 1 not executing

    1567114

      Hello,

       

      Pleas assist me as I am not getting the below scenario to replicate

       

      I am submitting a Concurrent program using PL/SQL Procedure .I want the NUM_COPIES to set 1 dynamically.

       

      I am using

       

      lc_boolean := fnd_request.set_print_options

      (

        printer      =>'ASD12345',

        style        =>'ASD12345_Zebra',

        copies       =>1);

       

      But its not getting fired in the printer.

       

      Please help to approach NUM_COPIES to 1 using set_print_options through PL/SQL

        • 1. Re: SET_PRINT_OPTIONS copies set to 1 not executing
          PamNL

          Do you submit your concurrent program right after? I usually use this .. what is your entire code?

           

          v_print_opt := fnd_request.set_print_options
                            ( PRINTER        => l_printer
                            , STYLE          => NULL
                            , COPIES         => l_nr_copies
                            , SAVE_OUTPUT    => TRUE
                            , PRINT_TOGETHER => 'N'
                            );



          l_request_id := fnd_request.submit_request

          ( application => l_application_short_name
          , program     => l_conc_prog_name
          , start_time  => sysdate
          , sub_request => false
          , argument1   => l_param1
          , argument2   => l_param2
          , ...
          ); 

          • 2. Re: SET_PRINT_OPTIONS copies set to 1 not executing
            1567114

            Hello,

             

            I have this format of code which is already registered in Concurrent program.


            I tried calling in the below procedure by passing the copies parameter set to 1 using set_print_options but its not getting fired.

             

            create or replace PROCEDURE

            FREE_TXT_LBL (

            errbuf      OUT VARCHAR2,

            retcode     OUT NUMBER,

            P_FREE_TEXT IN VARCHAR2

            )

            IS

            V_XML CLOB;

            lc_boolean boolean;

            program_concurrent_program_id NUMBER := NULL;

            request_concurrent_program_id NUMBER := NULL;

            l_user_id NUMBER;

            l_application_id NUMBER;

            l_responsibility_id NUMBER;

            BEGIN

            fnd_profile.get ('USER_ID', l_user_id);

            fnd_profile.get ('RESP_ID', l_responsibility_id);

            fnd_profile.get ('RESP_APPL_ID', l_application_id);

             

             

            apps.fnd_global.apps_initialize (l_user_id, l_responsibility_id,l_application_id);

             

            SELECT 

            '<?xml version="1.0" encoding="UTF-8" standalone="no"?>' ||

            XMLSERIALIZE(

                                DOCUMENT

                                XMLELEMENT(

                                            "labels",

                                            XMLATTRIBUTES(

                                                          'E:FREETXTL.ZPL' AS "_FORMAT",

                                                          '1' AS "_QUANTITY",

                                                          'Z1234567' AS "_PRINTERNAME",

                                                          'LBL103' AS "_JOBNAME"

                                                        ),

                                            XMLAGG(

                                                  XMLELEMENT("label",

                                                              XMLELEMENT("variable",

                                                                        XMLATTRIBUTES(

                                                                                     -- 'FREE_TEXT' AS "name"

                                                                                     '$$FREETXT$$' AS "name"

                                                                                      ),

                                                                        P_FREE_TEXT

                                                                        )

                                                                )

                                                  )

                                          )

                                INDENT SIZE = 2

                                ) AS XMLCOLUMN

            INTO

            v_xml

            FROM

              DUAL    ;

            fnd_file.put_line(fnd_file.output,v_xml);      

            dbms_output.put_line('The File Generated'||v_xml);    

            lc_boolean := apps.fnd_request.set_print_options

            (

              printer      =>'Z1234567',

              style        =>'Z1234567_Zebra',

              copies       =>1,

              save_output => TRUE,

              print_together => 'N');

             

             

            COMMIT; 

             

            END;

            • 3. Re: SET_PRINT_OPTIONS copies set to 1 not executing
              PamNL

              Ok, but are you trying to set the print count for a program that is already running? So you call your procedure from the program where you want to set the printing count to 1?

              Or do you first call your program and THEN submit a program?

              Because the latter is how it works.

               

              Step 1: Set print options.

              Step 2: Submit request using fnd_request.submit_request and commit

               

              Now the print options are set for the program in 2.

              In your example I can't see if you submit a program AFTER setting the print options or whether your program is already running ...

              • 4. Re: SET_PRINT_OPTIONS copies set to 1 not executing
                1567114

                Hello,

                 

                Thank for the guidance.

                 

                As per your question "So you call your procedure from the program where you want to set the printing count to 1?" Its Yes.

                 

                In my case the program is already been registered as a Concurrent Program Executable as Stored Procedure from where its called.

                 

                Thanks

                • 5. Re: SET_PRINT_OPTIONS copies set to 1 not executing
                  PamNL

                  Ok and so you submit your program (your stored procedure), then you execute that part of the code, but it will not set the print option for the concurrent program that is running at that moment, only for new concurrent programs you submit from within your stored procedure.

                  If you want to set the print option dynamically you should make a new program to set the print option, THEN submit the other request and now your print option for your second request is set.

                   

                  I don't think I'm getting it very well across :-), but what I mean is that you cannot set the print option for a program that is already running.

                  So if you submit your program which is a stored procedure (and registered as executable etc) you should have set the print option before you submitted it.

                  If you want to set it programmatically you create a program that sets the print option, then submits a request and for that new request the print option is set ... so you get

                   

                  executable 1: stored procedure that sets print option and submits executable 2.

                  executable 2: stored procedure to produce XML

                  • 6. Re: SET_PRINT_OPTIONS copies set to 1 not executing
                    1567114

                    Hello,

                     

                    Thanks for the workaround

                     

                    But if I go by the below steps which one I should called as part of Concurrent program?The 2nd one or the 1st one i.e executables?Do I need to create 2 separate

                    Concurrent program to achieve this?

                     

                    If you want to set it programmatically you create a program that sets the print option, then submits a request and for that new request the print option is set ... so you get

                     

                    executable 1: stored procedure that sets print option and submits executable 2.

                    executable 2: stored procedure to produce XML

                    • 7. Re: SET_PRINT_OPTIONS copies set to 1 not executing
                      PamNL

                      Well you need to if you want to set the print option dynamically for a program you are about to run (not a programming that is running now). So in that case you would need the first program to set the option and submit the second one.

                       

                      You would submit executable 1, which does something like

                       

                      set print option

                      submit request 2

                       

                      Here request 2 is your original program that produces the XML. Now the print option is set by the first executable.

                       

                      So program 1 is submitted and will be something like

                       

                      procedure submit_free_txt_lbl (errbuf out varchar2, retcode out number, p_free_text in varchar2)

                      is

                      begin

                      lc_boolean := apps.fnd_request.set_print_options

                      (

                        printer      =>'Z1234567',

                        style        =>'Z1234567_Zebra',

                        copies       =>1,

                        save_output => TRUE,

                        print_together => 'N');

                       

                      l_request_id := fnd_request.submit_request

                      (

                        'XXX'

                      , 'FREE_TXT_LBL'

                      , sysdate

                      , false

                      , p_free_text

                      );

                       

                      COMMIT; 

                       

                       

                      end;

                       

                       

                      And that submits your original program which is now something like

                       

                      create or replace PROCEDURE

                      FREE_TXT_LBL (

                      errbuf      OUT VARCHAR2,

                      retcode     OUT NUMBER,

                      P_FREE_TEXT IN VARCHAR2

                      )

                      IS

                      V_XML CLOB;

                      lc_boolean boolean;

                      program_concurrent_program_id NUMBER := NULL;

                      request_concurrent_program_id NUMBER := NULL;

                      l_user_id NUMBER;

                      l_application_id NUMBER;

                      l_responsibility_id NUMBER;

                      BEGIN

                      fnd_profile.get ('USER_ID', l_user_id);

                      fnd_profile.get ('RESP_ID', l_responsibility_id);

                      fnd_profile.get ('RESP_APPL_ID', l_application_id);

                       

                       

                      apps.fnd_global.apps_initialize (l_user_id, l_responsibility_id,l_application_id);

                       

                      SELECT 

                      '<?xml version="1.0" encoding="UTF-8" standalone="no"?>' ||

                      XMLSERIALIZE(

                                          DOCUMENT

                                          XMLELEMENT(

                                                      "labels",

                                                      XMLATTRIBUTES(

                                                                    'E:FREETXTL.ZPL' AS "_FORMAT",

                                                                    '1' AS "_QUANTITY",

                                                                    'Z1234567' AS "_PRINTERNAME",

                                                                    'LBL103' AS "_JOBNAME"

                                                                  ),

                                                      XMLAGG(

                                                            XMLELEMENT("label",

                                                                        XMLELEMENT("variable",

                                                                                  XMLATTRIBUTES(

                                                                                               -- 'FREE_TEXT' AS "name"

                                                                                               '$$FREETXT$$' AS "name"

                                                                                                ),

                                                                                  P_FREE_TEXT

                                                                                  )

                                                                          )

                                                            )

                                                    )

                                          INDENT SIZE = 2

                                          ) AS XMLCOLUMN

                      INTO

                      v_xml

                      FROM

                        DUAL    ;

                      fnd_file.put_line(fnd_file.output,v_xml);      

                      dbms_output.put_line('The File Generated'||v_xml);    

                       

                       

                      END;

                      • 8. Re: SET_PRINT_OPTIONS copies set to 1 not executing
                        1567114

                        Thanks a lot Pam.

                         

                        Just one clarification Do i need to add the 2nd Request Concurrent program to the Request Group or is it the First one which submitted need to be.

                         

                        Thanks once again

                        • 9. Re: SET_PRINT_OPTIONS copies set to 1 not executing
                          Bashar.

                          Request groups are used to allow end users to see and submit the requests.

                          Only add the request that will be submitted by the end users directly.

                           

                          Regards,

                          Bashar

                          • 10. Re: SET_PRINT_OPTIONS copies set to 1 not executing
                            PamNL

                            In this case the first program submits the second one programmatically, so no .. your user still submits the request (but now it's a different one than previously) and not a set. The first request will submit the second one automatically (the original request the user submitted in your previous scenario). The user should in that case check the output of the second request that is automatically submitted and not the first ..

                            • 11. Re: SET_PRINT_OPTIONS copies set to 1 not executing
                              1567114

                              Hello Pam,

                               

                              I did what you suggested but its going in Loops(The request Ids is increasing in submitting the program) and nothing is getting printed.(Attached Screenshot)

                               

                              I submitted the 1st Request only where the 2nd request Program been called

                               

                              Here's the case done:

                               

                              1st Request:

                               

                              create or replace PROCEDURE

                              FREE_TXT_LBL (

                              errbuf      OUT VARCHAR2,

                              retcode     OUT NUMBER,

                              P_FREE_TEXT IN VARCHAR2

                              )

                              IS

                              V_XML CLOB;

                              lc_boolean boolean;

                              program_concurrent_program_id NUMBER := NULL;

                              request_concurrent_program_id NUMBER := NULL;

                              l_user_id NUMBER;

                              l_application_id NUMBER;

                              l_responsibility_id NUMBER;

                              BEGIN

                              --fnd_profile.get ('USER_ID', l_user_id);

                              --fnd_profile.get ('RESP_ID', l_responsibility_id);

                              --fnd_profile.get ('RESP_APPL_ID', l_application_id);

                               

                               

                              --apps.fnd_global.apps_initialize (l_user_id, l_responsibility_id,l_application_id);

                               

                               

                              lc_boolean := apps.fnd_request.set_print_options

                              (

                                printer      =>'Z1234567',

                                style        =>'Z1234567_Zebra',

                                copies       =>1,

                                save_output => TRUE,

                                print_together => 'N');

                               

                               

                              --COMMIT;

                               

                               

                              IF lc_boolean THEN

                               

                               

                              request_concurrent_program_id := apps.fnd_request.submit_request

                              (application => 'INV',

                              program => 'FREE_TXT_CALL_LBL',

                              description => 'Free Text Label Caller',

                              start_time => SYSDATE,

                              sub_request => FALSE,

                              argument1=>P_FREE_TEXT);

                              COMMIT;

                               

                               

                              END IF;

                               

                              END;

                               

                              2nd Request:

                               

                              create or replace PROCEDURE

                              FREE_TXT_CALL_LBL (

                              errbuf      OUT VARCHAR2,

                              retcode     OUT NUMBER,

                              P_FREE_TEXT IN VARCHAR2

                              )

                              IS

                              V_XML CLOB;

                              lc_boolean boolean;

                              program_concurrent_program_id NUMBER := NULL;

                              request_concurrent_program_id NUMBER := NULL;

                              l_user_id NUMBER;

                              l_application_id NUMBER;

                              l_responsibility_id NUMBER;

                              BEGIN

                              fnd_profile.get ('USER_ID', l_user_id);

                              fnd_profile.get ('RESP_ID', l_responsibility_id);

                              fnd_profile.get ('RESP_APPL_ID', l_application_id);

                               

                               

                              apps.fnd_global.apps_initialize (l_user_id, l_responsibility_id,l_application_id);

                               

                              SELECT

                              '<?xml version="1.0" encoding="UTF-8" standalone="no"?>' ||

                              XMLSERIALIZE(

                                                  DOCUMENT

                                                  XMLELEMENT(

                                                              "labels",

                                                              XMLATTRIBUTES(

                                                                            'E:FREETXTL.ZPL' AS "_FORMAT",

                                                                            '1' AS "_QUANTITY",

                                                                            'Z1234567' AS "_PRINTERNAME",

                                                                            'LBL103' AS "_JOBNAME"

                                                                          ),

                                                              XMLAGG(

                                                                    XMLELEMENT("label",

                                                                                XMLELEMENT("variable",

                                                                                          XMLATTRIBUTES(

                                                                                                       -- 'FREE_TEXT' AS "name"

                                                                                                       '$$FREETXT$$' AS "name"

                                                                                                        ),

                                                                                          P_FREE_TEXT

                                                                                          )

                                                                                  )

                                                                    )

                                                            )

                                                  INDENT SIZE = 2

                                                  ) AS XMLCOLUMN

                              INTO

                              v_xml

                              FROM

                                DUAL    ;

                              fnd_file.put_line(fnd_file.output,v_xml);   

                              dbms_output.put_line('The File Generated'||v_xml); 

                               

                               

                              END;

                               

                              Please assist

                               

                              Thanks

                              • 12. Re: SET_PRINT_OPTIONS copies set to 1 not executing
                                PamNL

                                "I submitted the 1st Request only where the 2nd request Program been called"

                                 

                                That should not be necessary. The first program should have submitted your second program automatically.

                                Can you print a log message to see what happens?

                                 

                                request_concurrent_program_id := apps.fnd_request.submit_request

                                (application => 'INV',

                                program => 'FREE_TXT_CALL_LBL',

                                description => 'Free Text Label Caller',

                                start_time => SYSDATE,

                                sub_request => FALSE,

                                argument1=>P_FREE_TEXT);

                                COMMIT;

                                 

                                fnd_file.put_line (fnd_file.log,'Second request submitted with id ' || request_concurrent_program_id);

                                 

                                That should not be 0, otherwise it's not submitting it ...

                                • 13. Re: SET_PRINT_OPTIONS copies set to 1 not executing
                                  1567114

                                  Hello,

                                   

                                  The Attached Screenshot which I had posted previously shows the 2nd Request is been called but multiple times.

                                   

                                  Free Text Label Caller (Free Text Label Caller)--2nd Request

                                   

                                  Is there something I missed:(Means I used IF lc_boolean )

                                   

                                  lc_boolean := apps.fnd_request.set_print_options

                                  (

                                    printer      =>'Z1234567',

                                    style        =>'Z1234567_Zebra',

                                    copies       =>1,

                                    save_output => TRUE,

                                    print_together => 'N');

                                   

                                   

                                  --COMMIT;

                                   

                                   

                                  IF lc_boolean THEN

                                   

                                   

                                  request_concurrent_program_id := apps.fnd_request.submit_request

                                  (application => 'INV',

                                  program => 'FREE_TXT_CALL_LBL',

                                  description => 'Free Text Label Caller',

                                  start_time => SYSDATE,

                                  sub_request => FALSE,

                                  argument1=>P_FREE_TEXT);

                                  COMMIT;

                                   

                                   

                                  END IF;

                                  • 14. Re: SET_PRINT_OPTIONS copies set to 1 not executing
                                    PamNL

                                    Mmm thats weird indeed. Can you add some fnd_putline in it to see what it does? It doesnt make sense it submits it multiple times unless the first program is submitted multiple times.

                                    1 2 Previous Next