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

'SXPG_COMMAND_EXECUTE' Program for Print

former_member307726
Participant
0 Likes
1,781

Dear Experts,

In my system it is created 'ZPRINT' external command in SM69, and below is the code.

CustomerZPRINTWindows NTcmd /c

CALL FUNCTION 'SXPG_COMMAND_EXECUTE'

       EXPORTING

         commandname                   = 'ZPRINT'

         additional_parameters         = lv_add_parameters "

         operatingsystem               = 'Windows NT'


when ever program is run, Print is getting printer. Please help me where I can find the logic for the above external command.


Thank in advance.


Regards,

Kumar

12 REPLIES 12
Read only

nikolayevstigneev
Contributor
0 Likes
1,616

Hi, Kumar!

I didn't get what's your problem.

You say that you have found ZPRINT in SM69 - it's the place where external commands are defined. You can find specific OS and OS command together with its parameters. What do you mean by command's logic?

You can find additional info on help portal.

Read only

0 Likes
1,616

Dear Nikolay Evstigneev,

Thank You for your Reply.

I want to know how it is getting printed after running the below code.Where I can see the logic or Print settings.

CALL FUNCTION 'SXPG_COMMAND_EXECUTE'

       EXPORTING

         commandname                   = 'ZPRINT'

         additional_parameters         = lv_add_parameters "

         operatingsystem               = 'Windows NT'

Regards,

Kumar

Read only

0 Likes
1,616

And what does SM69 say about the OS command and its parameters?

Read only

0 Likes
1,616

I'm sorry Nikolay.. I'm not under standing the actual concept.

Below is the code .. in my program.. Once we run the report it is getting printed.

Actual issue is.. it is always giving one print out, user need needs to print more than one..

I'm not sure where the logic written for this, how the ZPRINT command send the printer advice to Printer.. where will be printer settings.

REPLACE ALL OCCURRENCES OF '.pdf' IN lv_file_path WITH '.ps'.

     CONCATENATE ' -S' lv_printer '-P raw' lv_file_path INTO lv_add_parameters SEPARATED BY ' '.

     CALL FUNCTION 'SXPG_COMMAND_EXECUTE'

       EXPORTING

         commandname                   = 'ZPRINT'

         additional_parameters         = lv_add_parameters

         operatingsystem               = 'Windows NT'

Read only

0 Likes
1,616

I cannot guess what you're using in your system until you open SM69 and show what is written there for ZPRINT command in the field "Name of external program" as I've already asked you. It seems that it is some Windows utility that prints postscript. Maybe, Ghostscript or similar stuff (I haven't used it for ages).

Read only

0 Likes
1,616

Name of the external Program is showing as : cmd /c

Parameters of external program : lpr

lpr : Windows NT

Read only

0 Likes
1,616

So, that's the answer - you are running lpr utility through command line.

Syntax of lpr command can be found here. For more information about this utility feel free to ask Google

Read only

0 Likes
1,616

Dear Nikolay Evstigneev,

Thank you very muck for your Reply.

I have one final query..

If any settings needs to be changed in lpr utility,who will be the responsible team, I mean like SAP ABAP/BASIS or Microsoft team or any other..

Read only

0 Likes
1,616

I think as far as this external command is used in some custom development, Basis guys will say, "It's for developers" And it'll probably be maintained by developers with the help of MS team (if any) unless your teamlead finds some strong arguments against.

Read only

0 Likes
1,616

You can try to send the "gift" to the Basis by arguing safety risk associated with executing commands on the server.


Regards,

Raymond

Read only

0 Likes
1,616

Yep, safety is a good idea!

Read only

0 Likes
1,616

Thank to All..