cancel
Showing results for 
Search instead for 
Did you mean: 

Purchase Order printing by smartforms

Former Member
0 Kudos

Hi all

I am trying to print PO by Smartforms. Problem is that this has to be done copying standard program. How to go about it. I searched the forum and it talked about the driver program /BPR3PF/FM06P and preconfigured Smartform /BPR3PF/MMPO_L both of which I did not find in our system (ECC 6.0) We have an up and running Sapscript PO system, but our company needs some modifications and we are familiar only with Smartforms.....any help....broad outlines?

Thanks and best regards

Subin

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi ,

In PO Printing its calling the Script form .

details of the nace Configugaration will be

Driver Program -- SAPFM06P routine will be - ENTRY_NEU script form - MEDRUCK

if you want to convert it into Smartform u have to migrate that script form into Smartforms and do the following changes in the driver program .

REPORT Z_ SAPFM06P.

INCLUDE rvadtabl.

INCLUDE rle_print_forms.

START-OF-SELECTION.

PERFORM entry_neu USING space space.

FORM entry_neu USING return_code us_screen.

DATA: lf_retcode TYPE sy-subrc.

xscreen = us_screen.

PERFORM processing USING lf_retcode

us_screen.

IF lf_retcode NE 0.

return_code = 1.

ELSE.

return_code = 0.

ENDIF.

ENDFORM. "ENTRY_NEU

FORM processing USING cf_retcode proc_screen.

DATA: lf_fm_name TYPE rs38l_fnam.

DATA: ls_composer_param TYPE ssfcompop.

DATA: ls_recipient TYPE swotobjid.

DATA: ls_sender TYPE swotobjid.

DATA: ls_addr_key LIKE addr_key.

p_ebeln = nast-objky. u201C PO Number Assignment

PERFORM checkinput. u201C u2013 check the input value

PERFORM headerdata. u201C Fetching the header data

PERFORM itemdata. u201C Fetching the Item Data

PERFORM process. u201CFinal internal table Population

PERFORM call_sform. u201C caling the Smartform

endform. "processing

Regards ,

Rediez.

Former Member
0 Kudos

hi,

whether i copy all these code by compltely commenting all the availble codes or what??

Former Member
0 Kudos

hi ,

in standard po its calling the script . if u want change in to smartforms than u have to comment the related code .

in sample code what i have posted here u can write u r own logic in the perform statements

PERFORM checkinput. u201C u2013 check the input value

PERFORM headerdata. u201C Fetching the header data

PERFORM itemdata. u201C Fetching the Item Data

PERFORM process. u201CFinal internal table Population

PERFORM call_sform. u201C caling the Smartform

Regards,

Rediez.

Answers (4)

Answers (4)

Former Member
0 Kudos

In Standard PO  calling the script ,so the standard program SAPFM06P userful for script only

And if  u want change script  to smart forms then you need to add your driver program .

Steps to create Driver Program  :-

  • First create the create Z Program SAPFM06P like below(Subroutine Pool)

PROGRAM Zsapfm06P.

  TYPE-POOLS:    meein.

  INCLUDE RVADTABL.

  INCLUDE FM06P_CONST.

  INCLUDE Zfm06pe02.

  • Next step is to create Zfm06pe02.

*&---------------------------------------------------------------------*

*&  Include           ZFM06PE02

*&---------------------------------------------------------------------*

**

***************************************************************

form entry_neu using ent_retco ent_screen.

data: l_druvo like t166k-druvo,

       l_nast like nast,

       l_from_memory,

       l_doc type meein_purchase_doc_print.

* * Data Declaration for PO smartform Modification

DATA: fname TYPE rs38l_fnam,

       xkomk TYPE TABLE OF komk,

       gs_output TYPE ssfcompop,

       gs_dialog TYPE ssfctrlop.

       clear ent_retco.

       if nast-aende eq space.

            l_druvo = '1'.

       else.

            l_druvo = '2'.

       endif.

     call function 'ME_READ_PO_FOR_PRINTING'

         exporting ix_nast = nast

                   ix_screen = ent_screen

         importing ex_retco = ent_retco

                   ex_nast = l_nast

                      doc = l_doc

         changing cx_druvo = l_druvo

                  cx_from_memory = l_from_memory.

         check ent_retco eq 0.

             IF tnapr-sform NE ' '.

               CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

               EXPORTING formname = tnapr-sform

               IMPORTING fm_name = fname

               EXCEPTIONS

                   no_form = 1

                   no_function_module = 2

                   OTHERS = 3.

   IF sy-subrc EQ 0.

      gs_dialog-no_dialog = 'X'.

      gs_dialog-preview = 'X'.

      gs_output-tddest = 'LP01'.

      gs_output-tdnoprev = ' '.

      gs_output-tdnoprint = ' '.

      gs_output-tdimmed = 'X'.

      gs_output-tdnewid = 'X'.

      CALL FUNCTION fname

" modify the interface as per your needs

        EXPORTING control_parameters = gs_dialog

                  output_options = gs_output

                  user_settings = ' '

                  zxekko = l_doc-xekko

                  zxpekko = l_doc-xpekko

        TABLES l_xekpo = l_doc-xekpo

               l_xekpa = l_doc-xekpa

               l_xpekpo = l_doc-xpekpo

               l_xeket = l_doc-xeket

               l_xtkomv = l_doc-xtkomv

               l_xekkn = l_doc-xekkn

               l_xekek = l_doc-xekek

               l_xkomk = xkomk

        EXCEPTIONS formatting_error = 1

                   internal_error = 2

                   send_error = 3

                   user_canceled = 4

                   OTHERS = 5.

   ELSE.

         CALL FUNCTION 'ME_PRINT_PO'

             EXPORTING ix_nast = l_nast

                       ix_druvo = l_druvo

                       doc = l_doc

                     ix_screen = ent_screen

                  ix_from_memory = l_from_memory

                  ix_toa_dara = toa_dara

                  ix_arc_params = arc_params

                 ix_fonam = tnapr-fonam "HW 214570

             IMPORTING ex_retco = ent_retco.

    ENDIF.

ELSE.

     CALL FUNCTION 'ME_PRINT_PO'

         EXPORTING ix_nast = l_nast

                   ix_druvo = l_druvo

                   doc = l_doc

                   ix_screen = ent_screen

                   ix_from_memory = l_from_memory

                  ix_toa_dara = toa_dara

                  ix_arc_params = arc_params

                  ix_fonam = tnapr-fonam "HW 214570

          IMPORTING ex_retco = ent_retco.

ENDIF.

endform.

***********************************************************

  • So After creating Driver program attach the program using NACE.

     Details of the nace Config as follow

  Driver Program  -- ZSAPFM06P routine will be  - ENTRY_NEU  script form -  ZMM_Purchase_Order(SF)


Former Member
0 Kudos

HI,

Smart form for PO is /SMB40/MMPO_L.

PO driver program is written to support only SAPSCRIPT.

So if you want to assign smartform in NACE,

you should take a Zcopy of the driver program SAPFM06P with its include FM06PE02 as ZFM06PE02.

And give the zprogram against the driver program field in NACE.

Then you need to replace the entry_nue subroutine in ZFM06PE02 with the below code.

form entry_neu using ent_retco ent_screen. 
data: l_druvo like t166k-druvo,
      l_nast like nast,
      l_from_memory, 
      l_doc type meein_purchase_doc_print.

 * Data Declaration for PO smartform Modification 
DATA: fname TYPE rs38l_fnam, 
      xkomk TYPE TABLE OF komk, 
      gs_output TYPE ssfcompop,
      gs_dialog TYPE ssfctrlop. 
      clear ent_retco. 

      if nast-aende eq space. 
           l_druvo = '1'. 
      else. 
           l_druvo = '2'. 
      endif.

    call function 'ME_READ_PO_FOR_PRINTING' 
        exporting ix_nast = nast 
                  ix_screen = ent_screen 
        importing ex_retco = ent_retco 
                  ex_nast = l_nast 
                     doc = l_doc 
        changing cx_druvo = l_druvo 
                 cx_from_memory = l_from_memory.
                
        check ent_retco eq 0. 
            IF tnapr-sform NE ' '. 
              CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME' 
              EXPORTING formname = tnapr-sform 
              IMPORTING fm_name = fname 
              EXCEPTIONS 
                  no_form = 1 
                  no_function_module = 2 
                  OTHERS = 3.
  
  IF sy-subrc EQ 0. 
     gs_dialog-no_dialog = 'X'.
     gs_dialog-preview = 'X'.
     gs_output-tddest = 'LP01'. 
     gs_output-tdnoprev = ' '. 
     gs_output-tdnoprint = ' '.
     gs_output-tdimmed = 'X'. 
     gs_output-tdnewid = 'X'.
      
     CALL FUNCTION fname 
" modify the interface as per your needs
       EXPORTING control_parameters = gs_dialog 
                 output_options = gs_output 
                 user_settings = ' ' 
                 zxekko = l_doc-xekko 
                 zxpekko = l_doc-xpekko 
       TABLES l_xekpo = l_doc-xekpo 
              l_xekpa = l_doc-xekpa 
              l_xpekpo = l_doc-xpekpo 
              l_xeket = l_doc-xeket 
              l_xtkomv = l_doc-xtkomv 
              l_xekkn = l_doc-xekkn 
              l_xekek = l_doc-xekek 
              l_xkomk = xkomk 
       EXCEPTIONS formatting_error = 1 
                  internal_error = 2 
                  send_error = 3 
                  user_canceled = 4 
                  OTHERS = 5. 
  ELSE. 
        CALL FUNCTION 'ME_PRINT_PO' 
            EXPORTING ix_nast = l_nast 
                      ix_druvo = l_druvo 
                      doc = l_doc 
                    ix_screen = ent_screen 
                 ix_from_memory = l_from_memory 
                 ix_toa_dara = toa_dara 
                 ix_arc_params = arc_params 
                ix_fonam = tnapr-fonam "HW 214570 
            IMPORTING ex_retco = ent_retco. 
   ENDIF. 
ELSE. 
    CALL FUNCTION 'ME_PRINT_PO' 
        EXPORTING ix_nast = l_nast 
                  ix_druvo = l_druvo 
                  doc = l_doc 
                  ix_screen = ent_screen 
                  ix_from_memory = l_from_memory 
                 ix_toa_dara = toa_dara 
                 ix_arc_params = arc_params 
                 ix_fonam = tnapr-fonam "HW 214570 
         IMPORTING ex_retco = ent_retco. 
ENDIF. 
endform.

Former Member
0 Kudos

Hi

In order to Print PO , u Need to Goto Tcode -NACE and Select Application EF Purchase Order and in that select the OUTPUT TYPE NEU which will give the standard Driver Program and form name. which u can copy and modify ur smartform and the driver program based on ur Layout and The requirements

Surya

dennis_scoville4
Active Contributor
0 Kudos

The SAP BW forum is probably not the best place to pose this question. You might want to consider posting your question on the ABAP Development - Form Printing forum instead.