Skip to Content
author's profile photo Former Member
Former Member

SAPSCRIPT - How to add few more fields to the Std PO Print Sapscript

Dear All,

Kindly help in modifying the SAP Standard script of PO printing as im very new to SAPSCRIPT programing.

My requirements are as follows.

1.Need to add field in the customer address area, CNPJ

CNPJ = (Select paval from T001Z for some cond...) + ( select J_1BBRANCH from

T001W for some cond...) + Function returns HR_BR_CGC_CHECK_DIGITS).

2.Need to add field in the PO Item display area, UnitPrice.

UnitPrice = ( Select KBETR from KONV where KONV-KNUMV=EKPO-KNUMV


3.Neet to add the company logo in the Title area.( how to include a logo to the script)


i went thru the coding and understand that we need to do the changes in the

ME_READ_PO_FOR_PRINTING and ME_PRINT_PO function modules.

But i dont know how to and where to add my coding ( as above given reqmt) in those func.modules, also im not sure abt how to do the changes in the SAPSCRIPT FORM LAYOUT-(Desing/Text)</b>


For this, I had copied , MEDRUCK as ZMEDRUCK,


FM06PE02 as ZFM06PE02,

did the NACE part and configured the ME23N Print Preview with the newly copied programs and form.




<b>Also im getting a declaration related error when trying to activating the ZME_PRINT_PO.</b>

Kindly guide me to solve the above given issues.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Oct 18, 2007 at 12:20 PM


    There are some Standard Sap Scripts in SAP. We cant directly execute them in scripts we have to use some T-codes and by giving some input to the required fields we can see the output printform.

    I will show one example. There are some Standard Sap Scripts such as MEDRUCK which is a standard Sap Script for Purchase Order and RVINVOICE01 for billing and so on...

    To see oupt of MEDRUCK go to T-code ME9F give purchase order number and execute select one number and click on dislplay messages button on application tool bar you can find the print form of MEDRUCK.

    You cannot change the Standard Sap Scripts but you can use Standard Sap Scripts and Copy them to userdefined Script and can make changes to them and replace standard Sap Script with usedefind script.

    Ex: Go to SE71,

    on menu bar u find Utilities->copy from Client. click on it u ll find new screen showing

    Form name:

    Source Clinet:

    Target Form:

    give Form name as usedefined form name EX: ZFORM1

    Source client as 000 and

    Target form as MEDRUCK.


    Now, the standard from MEDRUCK is copyied to your form ZFORM1.

    NOW, go to SE71 and give form name as ZFORM1 and do some changes to the form such as adding logo any thing. save and Activate.

    Now, you have done changes to the Form ZFORM1 and u have to replace your form with standard SAP Script.

    Go to NACE Transaction.

    on Applications select EF for purchase order and click Output types button on application tool bar.

    now select NEU as output types dobule click on Processing Routines.

    now click on Change option on application tool bar and on right side u find MEDRUCK in form place replace MEDRUCK with ZFORM1 and SAVE.

    go back twice and now go to T-code ME9F give the purchase order number and execute and select one option and click on display messges button .

    you will find the changes that you have done in ZFORM1. so we cant chage the standard Sap Scripts by copying the Standard Sap Scripts we can chage and replace with our forms.

    Goto the respective Window and change the code accordingly

    like LOGO, in MAIN WINDOW conditions data etc



    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 18, 2007 at 01:03 PM

    Copy MEDRUCK as ZMEDRUCK is right for first step.

    for requirement 1, I would just add a PERFORM form IN PROGRAM z_program code block into the script at the appropriate point where the extra field is required, and use this form to read the extra field required. This is much more maintainable than copying lots of SAP code.

    For Requirement 2 - I think you will find that standard program already supplies unit price field to the script - you just have to add it in the right place in the form. Standard driver programs have lots of fields they provide to the form that are available but not used. Use the Insert program field menu option to get a popup based on the print program global data from which you can select what you need.

    For requirement 3 there are two options - load the image into SAP as a bitmap and use the sapscript BITMAP command to include it in a window, or upload it as a TIFF file into a standard text and use the sapscript INCLUDE command to add it into the window. Best idea is to place logo in its own window as text and graphics in same window do not always wrap as you would expect.

    The big disadvantage of copying SAP programs and functions as you have suggested is that future SAP notes and patches will only be applied to the original and not to your copies, and this becomes a real pain to sort out as time goes by. Sometimes it is not avoidable, but I think your requirements do not need this level of modification.

    Sorry if these explanations are a bit short - there should be plenty of examples of all 3 in the SDN forums. Try searching for them, or post further questions.


    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.