Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member

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 sy-subrc = 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_co-forml.


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 sy-subrc <> 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_co-aufnr
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 sy-subrc = 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_co-psteu
*            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.

7 Comments
Labels in this area