Skip to Content

The standard configuration for SAP PP shop floor control output paperwork, accessed via IMG or OPK8, has not been changed to benefit from the introduction of Smartforms (ECC6 EHP 0). This restricts use to SapScript, which, although capable of providing the functionality to design your own outputs has some restrictions. One of the key restrictions we encountered was the requirement to have a printer capable of printing barcodes in order to add these to the outputs whereas with Smartforms you can print barcodes on any printer as it is sent as a graphic. That in addition to the fact that Smartforms are far easier to design and customise drove me to look for a way of configuring SAP to allow Smartforms.

The configuration of the production outputs requires the setting of a print program and a print form. In our system, and probably most others, the print program retrieves the print information from memory, retrieves the corresponding production order information and outputs it to the various sections of the SapScript form.

Solution

In order to avoid making any changes/enhancements to the standard SAP checks in config (OPK8) for SapScripts I chose to create my Smartform with the same name as the old SapScript form. This form name is retrieved in the print program (see later) and so taking this approach means that I don’t have to hardcode the Smartform name in the print program. If in the future I want to switch to another Smartform I only need to change the config and if it is a completely new name I simply need to also create an empty SapScript form with the same name.

The new print program retrieves the print data in the same way as the old print program.

  call function ‘CO_PRINT_IMPORT_DATA’
exceptions
memory_id_ppt_not_exist
= 1
memory_id_ppi_not_exist
= 2
memory_id_pps_not_exist
= 3
others                  = 4.
check sysubrc = 0.

call function ‘CO_PRINT_GET_INFO_LIST’
importing
print_co_exp  
= print_co
print_opts_exp
= print_opts
exceptions
others         = 0.

The code above brings back details of what production order to print, which document is to be printed (Production order, GR, GR label etc.) and which form is to be used for the output. The form name being passed is that set in OPK8 which in our case refers to the Smartform and also the dummy SapScript form. The print options being passed are as used for SapScripts rather than the format for the standard interface for Smartforms. Many of these have the same name so you can either move the corresponding fields to the Smartform interface and map the remaining ones, or, simply add structure ITCPO to the Smartform interface and then access the information in the Smartform from there.

The remaining processing that has to be done in the print program is to retrieve the function module for the Smartform and then call the Smartform.

The format of the form name being passed in the print information is that of a SapScript so it is necessary to save that to a local variable with the format of a Smartform name in order to be able to retrieve the function module for the Smartform.

  lf_formname = print_coforml.


Next get the Smartform function module name.

  call function ‘SSF_FUNCTION_MODULE_NAME’
exporting
formname                
= lf_formname
*     VARIANT                  = ‘ ‘
*     DIRECT_CALL              = ‘ ‘
importing
fm_name                 
= lf_fmname
exceptions
no_form                 
= 1
no_function_module      
= 2
others                   = 3
.
if sysubrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif

Now call the Smartform


call function lf_fmname
exporting
output_options
= ps_opt
print_co
= print_co
print_opts
= print_opts.

In my code above I am simply passing the print options and print information to the Smartform and doing all the processing within the Smartform itself. I have done this so that I should be able to use the same print program to call Smartforms for all the production outputs although I haven’t made that change yet.

Within the Smartform itself, the data for the production order is retrieved using the function modules below. The use of these was taken from the old print program and so that is the best place to start when developing your own Smartform.

Production order header

  call function ‘CO_PRINT_GET_ORD’
exporting
aufnr_imp       
= print_coaufnr
flg_prtbl_opr   
= ‘X’
flg_prtbl_sop   
= ‘X’
flg_prtbl_cmp   
= ‘X’
flg_prtbl_prt   
= ‘X’
changing
caufvd_p_tab_exp
= gt_caufvd
exceptions
entry_not_found 
= 1
others           = 2.
check sysubrc = 0.

Production order sequence

  call function ‘CO_PRINT_GET_SEQ’
exporting
caufvd_p_imp   
gs_caufvd
*         AFVGD_P_IMP     =
*         RESBD_P_IMP     =
*         AFFHD_P_IMP     =
*         FLG_NO_REFRESH  =
flg_prtbl_opr  
= ‘X’
flg_prtbl_sop  
= ‘X’
flg_prtbl_cmp  
= ‘X’
flg_prtbl_prt  
= ‘X’
changing
affld_p_tab_exp
gt_affld
exceptions
entry_not_found
= 1
too_many_params
= 2
others          = 3.

Production order item

  call function ‘CO_PRINT_GET_ITEM’
exporting
caufvd_p_imp   
= gs_caufvd
posnr_imp      
= ‘0001’
changing
afpod_p_tab_exp
= gt_afpod
exceptions
entry_not_found
= 1
others          = 2.

Production order final product serial number

  call function ‘CO_PRINT_GET_INFO_SEROB’
exporting
*         CAUFVD_P_IMP      =
afpod_p_imp      
= gs_afpod
changing
rserob_tab_exp   
= gt_rserob
exceptions
entry_not_found  
= 1
imp_param_missing
= 2
too_many_params  
= 3
others            = 4.

Production order operations

  call function ‘CO_PRINT_GET_OPR’
exporting
*            CAUFVD_P_IMP    =
affld_p_imp    
= gs_affld
*            SAFVGD_P_IMP    =
*            RESBD_P_IMP     =
*            AFFHD_P_IMP     =
*            FLG_NO_REFRESH  =
flg_chk_ctrlkey
= print_copsteu
*            FLG_PRTBL_SOP   =
*            FLG_PRTBL_CMP   =
*            FLG_PRTBL_PRT   =
changing
afvgd_p_tab_exp
= gt_afvgd
exceptions
entry_not_found
= 1
too_many_params
= 2
others          = 3.

Production order operation components

  call function ‘CO_PRINT_GET_CMP’
exporting
*            CAUFVD_P_IMP    =
*            AFFLD_P_IMP     =
afvgd_p_imp    
= gs_afvgd
*            FLG_NO_REFRESH  =
changing
resbd_p_tab_exp
= pt_resbd[]
exceptions
entry_not_found
= 1
too_many_params
= 2
others          = 3.

To report this post you need to login first.

7 Comments

You must be Logged on to comment or reply to a post.

  1. ram ramesh

    Negative Sign is not printing for Component Quantity when we are using the CO_PRINT_GET_CMP function module to get the operation Components. Because operation component has the domain MENGV13 (includes Sign) where as the field BDMNG in RESBD_P structure has the domain MENG(No sign). is there any alternative to print the negative sign also.

    (0) 
    1. John Cameron Post author

      Hi Ram,

      In the RESBD_P structure there is the field SHKZG which indicates whether the value is positive or negative. It’s worth remembering this approach to positive and negative as it’s used a lot within FICO.

      Regards,

      John

      (0) 
  2. Brahim Boukobba

    Hi John,

    on opk8 i want to replace the sapscript form PSFC_STD_LAYOUT by a personalized  smartform, do i have to make this change on the print program PSFCCONF or i create a new print program and put this code on it

    regards

    (0) 
    1. John Cameron

      Hi Brahim,

      The quickest and easiest way to achieve the output would be to hard code the Smartform name into the print program but I wouldn’t recommend it. If you use the functions ‘CO_PRINT_IMPORT_DATA’ & ‘CO_PRINT_GET_INFO_LIST’ you will get the formname as set in OPK8 in “PRINT_CO-FORM1”.

      However you do this you will need to write your own custom print program to call the Smartform.


      Hope this helps.


      Regards,

      John



      (0) 

Leave a Reply