Showing results for 
Search instead for 
Did you mean: 

Changing standard program for PO script--

Former Member
0 Kudos

Hi Guys,

I changed sapfm06p to zsapfm06p and changed the function group to zmedruck, till now every thing is fine.

now the actual problem is want to print a box after printing all items,at the end of last page.Ofcourse I might have done this by placing a window at end and give a condition to check last page or not.But it doesn't suit my requirement.

So I want to print from main window, i.e at the end in main window on last page.

So now I want to insert some code in Main program in FM : Zme_print_PO ,as there are so many includes in it, I just want to know what will be exact include to change for my requirement.

My question again in brief.. as I want to print some thing at end of main window in last page after all the texts,which Inculde in Zme_print_po will be apt to add my code,


Accepted Solutions (0)

Answers (2)

Answers (2)

Active Contributor
0 Kudos

In zsapfm06p, you will and include by name


Try to comment it and create a new include like this


In this include,Comment FM06PF02_AUSGABE_KOPF

and try to copy FM06PF02_AUSGABE_KOPF this to Z_FM06PF02_AUSGABE_KOPF

Now modify it according to your requirment.

Inside the LOOP try to use <b>AT LAST </b>. And print your new window..

***Message was edited by:

<b>I guess you are not that lazy to close this thread. I hope you close this thread. </b>

***Message was edited by:



Message was edited by:

Sai Ram Reddy Neelapu

Former Member
0 Kudos

Hi Sai ram,

I forget to say,my version is ECC 6.0.

In this version I can't find, waht u said in incude zfm06pe02.There are only two modules me_print_PO and ME_READ_PO_FOR_PRINTINg.

Almost I know everything how to solve,bur bcoz of lazyness I am expecting an answer from guys who work exclusively on PO script.

Any how after debugging standard sap ,I found point where I have to write the code.But later I saw there is an element LAST in Mian window, which exactly suit my requirement.

Hope this helps guys who come across this type of requirement.

Former Member
0 Kudos

You can write a external Subroutine to fetch the extra data into the script program

see the following sample code

How to call a subroutine form SAPscripts

The Form :





The report :

REPORT zkrpmm_perform_z1medruck .

DATA : BEGIN OF it_input_table OCCURS 10.


DATA : END OF it_input_table.

  • déclaration de la table output_table contenant les

variables exportées

DATA : BEGIN OF it_output_table OCCURS 0.


DATA : END OF it_output_table.

DATA : w_ebeln LIKE ekko-ebeln,

  • w_vbeln LIKE vbak-vbeln,

w_zcdffa LIKE vbak-zcdffa.







FORM cde_cent TABLES input output.

it_input_table[] = input[].

it_output_table[] = output[].

READ TABLE it_input_table INDEX 1.

MOVE it_input_table-value TO w_ebeln.



input = w_ebeln


output = w_ebeln.


INTO w_zcdffa

WHERE ebeln = w_ebeln.

it_output_table-name = 'CDECENT'.

MOVE w_zcdffa TO it_output_table-value.

MODIFY it_output_table INDEX 1.

output[] = it_output_table[].



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