‎2013 Nov 12 6:50 PM
Hi,
I will be needing to write an ABAP program to serve as a print program which will call a Smartform.
I understand how data flows from the print program to the smartform, but I do not understand how data will flow INTO the print program from the higher level process.
In this case the user executes a MIGO which eventually kicks off my print program. How do I receive the data from the MIGO into my program?
Hope that makes sense...thanks.
Andy
‎2013 Nov 12 8:13 PM
You can take a look at the any one of the SAP Standard print program SAPM07DR used in MIGO.
The main routines starts something like this,
SELECT SINGLE * FROM mkpf WHERE mblnr = nast_key-mblnr
AND mjahr = nast_key-mjahr.
SELECT SINGLE * FROM mseg WHERE mblnr = mkpf-mblnr
AND zeile = nast_key-zeile
AND mjahr = mkpf-mjahr.
It will vary based on what you would like to print. You can get the standard print program from your function team. They should know where to set it up in config.
‎2013 Nov 12 7:36 PM
Hi.
Put a break on your print program and check all the Local variables that are available. There you get all the info that need to pass to the smartforms.
Regards
Miguel
‎2013 Nov 12 8:13 PM
You can take a look at the any one of the SAP Standard print program SAPM07DR used in MIGO.
The main routines starts something like this,
SELECT SINGLE * FROM mkpf WHERE mblnr = nast_key-mblnr
AND mjahr = nast_key-mjahr.
SELECT SINGLE * FROM mseg WHERE mblnr = mkpf-mblnr
AND zeile = nast_key-zeile
AND mjahr = mkpf-mjahr.
It will vary based on what you would like to print. You can get the standard print program from your function team. They should know where to set it up in config.
‎2013 Nov 14 2:14 PM
Thank you all very much...very informative.
NACE and MSEG and MKPF is what I needed to know.
Thanks again for all of the help.
Andy
‎2013 Nov 13 1:33 AM
Hi,
In the configuration of the output determination via:
SPRO-Materials Management -Inventory Management and Physical Inventory - Output Determination.
You can map the driver program and the Smartform. Then either in the driver program can have all the selections or you can code all the selections in Smartform after taking in the basic document number that you process.
Also another option would be SAPScript as some standard would be available and change it to suite you requirement. You can check any existing mapping via:
SPRO-Materials Management -Inventory Management and Physical Inventory - Output Determination-Assign Forms and Programs.
Cheers,
Arindam
‎2013 Nov 13 5:34 AM
From MIGO to DRIVER program NAST will hold the key of document posted...Then you can fetch your data.
‎2013 Nov 13 10:39 AM
For example, for a purchase order :
I configure the output message in NACE : I give the program name and the routine name (a FORM routine in the program)
This routine should have 2 parameters :
-ent_retco type subrc, which is the return code that you have to update at the end of your routine to inform the standard calling program. If everything is ok in your routine, then you can return ''.
-ent_screen type c, which indicates if you are in print preview mode ('X'=print preview)
In my print program, I include RVADTABL, as in the standard. Then the structure NAST is available. At runtime, the structure is filled with correct values, then I can use NAST-OBJKY to get the PO number. (and then I select all data from ekpo...).
This is the starting point to retrieve all data needed.
‎2013 Nov 13 12:16 PM
Thank you all very, very much for your input.
I am going to begin work on this today and I will report back as to how it worked out.
This information is very valuable...thank you...I'll be in touch.
Andy
‎2013 Nov 13 7:13 PM
‎2013 Nov 14 5:40 AM
‎2013 Nov 14 11:01 AM
Hi Andy,
I hope you have understood the flow. In case you haven't, please read on.
Case - Standard SAP Script - MEDRUCK.
All the forms need an 'Output Type' associated with it. Once the 'Output Type'(NEU) is created it needs to be configured in 'NACE' transaction. This configuration acts as a binding and calls the bound Program/driver program(SAPFM06P). Within the driver program we have various subroutines/forms, one amongst those acts as the entry subroutine or the subroutine where the control is transferred for the first time always inside the driver program(ENTRY_NEU). Now you can have your custom code and achieve any output.
Attached is reference screenshot -
BR.