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

input data for custom print program for smartforms

Former Member
0 Likes
2,964

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

1 ACCEPTED SOLUTION
Read only

marius_greeff
Active Participant
2,033

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.

10 REPLIES 10
Read only

Former Member
0 Likes
2,033

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

Read only

marius_greeff
Active Participant
2,034

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.

Read only

0 Likes
2,033

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

Read only

arindam_m
Active Contributor
0 Likes
2,033

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

Read only

nabheetscn
SAP Champion
SAP Champion
0 Likes
2,033

From MIGO to DRIVER program  NAST will hold the key of document posted...Then you can fetch your data.

Read only

Former Member
2,033

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.

Read only

0 Likes
2,033

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

Read only

0 Likes
2,033

Check NAST and NACE settings

Read only

0 Likes
2,033

This message was moderated.

Read only

0 Likes
2,033

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.