on 03-12-2007 6:08 PM
Has anyone used SmartForms in their production order packet? I want to have barcodes and material-related graphics from SE78 included in the production order packet and I know SmartForms is the way to go to avoid special DIMM chips, etc. Unfortunately, the pre-configured smartforms does not include anything for the PP Job Packet. Before I attempt to convert the Operation Overview portion to SmartForms on my own, I am wondering if anyone has done this and what pitfalls I may find.
Thanks,
Tim
Tim! I would like to talk to you about how you got barcodes to print using SMARTFORMS. We up up on the latest version all around 640 Final Release / SAP ECC 6.0.
If I read OSS note 645158 correctly we should already have the capability to print barcode without further need for firmware if we use SMARTFORMS.
Looking at SE73, it appears the only sytem barcode that will work is C128.
I used to test printers for barcode capability using SO10 SAPSCRIPT-BARCODETEST AFTER installing DIMM chips just to make sure all is OK with upgraded printers. I now find myself in a new company where upgrading printers is not an option due to costs. Therfore I would prefer all the barcode types work.
How did you do it? my BASIS folks here are too green to help me much but I have a hunch it can not be that tough.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Michael,
Run transaction SE73.
Select radio button for System Bar Codes, push change which brings you to Font Maintenance: Change System Bar Codes.
Notes:
If the fonts shown are not highlighted, they are the old technology (SAPScript and bardimm/simm is necessary).
If the fonts shown are highlighted, they are the new technology (Smartforms with no bardimm necessary).
Click on Create to create a new font (using new barcode technology).
For example:
Barcode Name: ZBAR39
Short Text: 3 of 9 barcode
Notes:
Only the following barcode types are supported with SmartForms:
Code 39, Code 128, Interleaved 2 of 5, PDF 417 and Code 93. What's nice is you can size these however you want. You can also set the barcode alignment such as normal, rotated, inverted and bottom up.
In our example, select radio button for Code 39 and choose normal alignment on next screen. Also, when time - you may want to clear out the field for Mod43 Check Digit.
Notes:
When you get a little practice with this, you can practice with the size / ratio fields.
You will now be prompted to save your barcode in a transport and you should be done with font maintenance for now.
Next you need to create a SmartStyle.(Tcode: SmartForms).
Create a paragraph format. For this example, we'll create Paragraph ZC with alignment Centered, Font Size 24. Nothing else is needed for now.
Next create a Character Form: For this example, we'll create Character Form: ZB. On the standard settings tab, you should be able to pull down on the list of barcodes and now see your ZBAR39 barcode listed. Simply pull that in. For consistency, you can also set your font to 24 point.
Now finally to the SmartForm itself.
IMPORTANT: Remember to use the SmartStyle you created.
Then simply write out your barcode.
ZC <ZB>&ZBARCODE-VALUE&</>
Hope this helps! Assign points please.
Tim
Closing. Rewrite in SmartForms complete.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
SAP does not provide this, at least not right now, in the pre-configured smart forms download. Because I wanted to integrate this with OPK8 configuration, I took the standard PPPRSTEU print program and copied it to ZPPRSTEU. Then, everywhere it wrote out to SAPScript, I added either a structure or internal table to store the information. After all write_form statements were replaced, I had my structures and tables to define the interface to Smart Forms. I was careful to replace all write_forms statements, even though I didn't need them all so that the program is robust enough for others that may want to use it down the road. The SmartForm itself simply uses what it needs as that is very specificy to the company needing it.
I have already found it very easy to maintain and we have bitmap images, barcodes, etc without needing special DIMM chips, etc. It appears to be very stable. The OPK8 configuration integrates seamlessly with the print program as it still is the same basic code.
If you have any other questions, feel free to email me. Here is teh code even though it is very specific to my needs. This code is an example of PPPROBJU copied to ZPPROBJ7_SMART but the idea is the same.
*---------------------------------------------------------------------*
* *
* PPS-Print: Object-List *
* *
*---------------------------------------------------------------------*
************************************************************************
* M O D I F I C A T I O N L O G *
* *
* OMH Configuration Notes: *
* ------------------------ *
* ZOR1 is our Make to Stock Production order type. *
* ZOR2 is Make to Order. *
* ZOR7 is a production order type we use for blocking time for press *
* maintenance. It will generally have a routing but not a BOM. *
* *
* Date Programmer Request # Description *
*----------------------------------------------------------------------*
* mm/dd/yyyy xxxxxxxxxxxxxxx xxxxxxxxxx Initial Version *
* 04/12/2007 Tim Stadler DV1K913769 Initial Version *
************************************************************************
report zpprobj1_smart message-id co.
*---------------------------------------------------------------------*
* *
* PPS-Print: Object list (Objektübersicht *
* *
*---------------------------------------------------------------------*
* DATA-Statements general
include zppcoincl.
data: itab_tdr2 like sfc_itab occurs 0 with header line.
* DATA-Statements specific for production orders
include codrgt10.
* Work area (primary)
types: begin of ty_w,
mhr type afvgd-vgw01,
lhr type afvgd-vgw01,
setup type afvgd-vgw01,
mhr_units type afvgd-vge01,
lhr_units type afvgd-vge01,
setup_units type afvgd-vge01,
atnam type cabn-atnam,
counter type i,
end of ty_w.
data: w type ty_w.
* Constants
constants: begin of c,
one type i value '1',
end of c.
* Work area (secondary)
types: begin of ty_wa,
arbpl type afvgd-arbpl,
arbpl1 type afvgd-arbpl,
rueck type afvgd-rueck,
rueck1 type afvgd-rueck,
arbpl2 type afvgd-arbpl,
rueck2 type afvgd-rueck,
page type i,
new_page(1) type c,
check1 type afvgd-arbpl,
check2 type afvgd-arbpl,
check0 type afvgd-arbpl,
end of ty_wa.
data: wa type ty_wa.
* Sales Order Header
data: w_vbak type vbak.
* Work area (temporary)
types: begin of ty_temp,
zzpph type p decimals 0,
zzcycle type p decimals 0,
zzesmng type p decimals 3,
end of ty_temp.
data: w_temp type ty_temp.
* Watermark / Graphics
data: w_wmg type zpprobj1_wmg.
* Misc fields
data: z_matl_object type thead-tdname,
sw-page(1) type c.
* Component weight percentage calculations
types: begin of ty_wghtp,
tot type esmng,
pct type p decimals 2,
pct_char(6) type c,
aufst type resb-aufst,
aufwg type resb-aufwg,
end of ty_wghtp.
data: wght type ty_wghtp.
* Weight
types: begin of ty_wght,
aufst type resb-aufst,
aufwg type resb-aufwg,
tot type esmng,
end of ty_wght.
data: ts_wght type sorted table of ty_wght
with unique key aufst aufwg,
t_wght type standard table of ty_wght,
w_wght type ty_wght.
* Control Parameters
data: w_control type ssfctrlop,
w_ssfcompop type ssfcompop.
* Smartform Function Name
types: begin of ty_zw,
fm_name type rs38l_fnam,
end of ty_zw.
data: zw type ty_zw.
* Transfer structure for dependencies for SFC configurations
data: t_sfc_conf type table of zpprobj1_vc,
w_sfc_conf type zpprobj1_vc,
char_tab type table of sfc_conf with header line.
* Operations
data: t_opers type table of zpprobj1_opers,
w_opers type zpprobj1_opers.
* Components
data: t_comps type table of zpprobj1_comp,
w_comps type zpprobj1_comp.
* Options (Option List)
data: t_opts type table of zpprobj1_options,
w_opts type zpprobj1_options.
* entry to print
perform print_sub.
*---------------------------------------------------------------------*
* FORM PRINT_SUB *
*---------------------------------------------------------------------*
form print_sub.
* Document-tables
include lcodrinc.
loop at itab_tdr where object = obj-pos
or object = obj-sop
or object = obj-mat
or object = obj-fhm
and aufnr = print_co-aufnr. "New 3.0
exit.
endloop.
check sy-subrc is initial.
loop at itab_tdr where object = obj-alt
and aufnr = print_co-aufnr. "New 3.0
* Save Indextable of header
itab_ord = itab_tdr.
loop at caufvd_tab where aufnr = itab_ord-aufnr.
* fill DDIC-Structure of header from internal table
caufvd = caufvd_tab.
* Clear custom fields and tables
clear: w_wmg, w_opts, w_comps, w_opers, w_sfc_conf, w_wght,
z_matl_object, w_temp, w_vbak, w, wa, zw.
refresh: t_opts, t_opers, t_comps, t_sfc_conf, t_wght,
it_charac_tab, ts_wght.
* Get position
loop at afpod_tab where aufnr eq caufvd-aufnr and
posnr eq '0001'.
afpod = afpod_tab.
exit.
endloop.
* read material-view and fill short-text
perform read_mat using caufvd-werks caufvd-matnr msfcv.
* store material-short-text
move msfcv-maktx to print_co-ktext.
perform get_header.
perform coll_order_logic.
* print material memo text at the top
if caufvd-werks(1) = '4'.
perform material_memo.
endif.
* print info's of order-header
perform lg01_header.
* print info's of operations
perform lg01_vorgang.
****************************************************
* Prepare for SmartForm Printing
****************************************************
case print_co-lstid.
* Operation Overview
when 'LV01'.
perform print_smartform using 'Z_SF_PP_OMH_1'.
* Product Sign-Off
when 'LG02'.
perform print_smartform using 'Z_SF_PP_OMH_2'.
* Options List
when 'LK01'.
perform build_options_list.
if t_opts[] is initial.
message s315(zt) with 'No options to print'(200).
else.
perform print_smartform using 'Z_SF_PP_OMH_3'.
endif.
endcase.
endloop.
endloop.
endform. "print_sub
*---------------------------------------------------------------------*
* FORM LG01_HEADER *
*---------------------------------------------------------------------*
form lg01_header.
data: flg_pr.
if caufvd-prodnet ne space. "New 3.0
perform prodnet_info.
endif.
* Watermark and textkey logic
clear: w_wmg.
* Keys for various texts
concatenate sy-mandt caufvd-aufnr into w_wmg-prodkey.
w_wmg-kdaufkey = caufvd-kdauf_aufk.
concatenate caufvd-kdauf_aufk caufvd-kdpos_aufk
into w_wmg-kdaufposkey.
concatenate sy-mandt caufvd-plnty caufvd-plnnr
caufvd-plnal caufvd-zaehl into w_wmg-routekey.
* Watermark logic
if caufvd-werks+0(1) = '4'. " ORBIS
w_wmg-vbeln = caufvd-kdauf_aufk.
w_wmg-posnr = caufvd-kdpos_aufk.
if caufvd-kdauf_aufk is initial
and not caufvd-lead_aufnr is initial.
select single kdauf kdpos from aufk
into (w_wmg-vbeln, w_wmg-posnr)
where aufnr = caufvd-lead_aufnr.
endif.
if not w_wmg-vbeln is initial.
select single cmgst from vbuk
into w_wmg-cmgst
where vbeln = w_wmg-vbeln.
if w_wmg-cmgst = 'B' or w_wmg-cmgst = 'C'.
w_wmg-crd = 'X'.
endif.
if w_wmg-crd is initial.
select single mvgr4 from vbap
into w_wmg-mvgr4
where vbeln = w_wmg-vbeln
and posnr = w_wmg-posnr.
if w_wmg-mvgr4 = 'WFA'.
w_wmg-art = 'X'.
endif.
endif.
if w_wmg-crd is initial
and w_wmg-art is initial.
select single lifsk from vbak
into w_wmg-lifsk
where vbeln = w_wmg-vbeln
and lifsk = 'OC'.
if sy-subrc = 0.
w_wmg-blk = 'X'.
else.
clear: w_wmg-lifsk.
select single lifsp from vbep
into w_wmg-lifsk
where vbeln = w_wmg-vbeln
and posnr = w_wmg-posnr
and lifsp = 'OC'.
if sy-subrc = 0.
w_wmg-blk = 'X'.
endif.
endif.
endif.
endif.
endif.
* if configuration given
if not caufvd-cuobj is initial.
* get print code of configuration.
clear: inob.
call function 'CUCB_GET_OBJECT'
exporting
instance = caufvd-cuobj
importing
inob = inob
exceptions
invalid_instance = 1
others = 2.
check sy-subrc eq 0.
loop at charac_tab3 where cuobj = caufvd-cuobj.
clear: ksml.
select abtei from ksml into ksml-abtei up to 1 rows
where clint = inob-clint and
imerk = charac_tab3-atinn.
endselect.
if sy-subrc eq 0.
move-corresponding charac_tab3 to charac_tab2.
charac_tab2-abtei = ksml-abtei.
append charac_tab2.
endif.
endloop.
sfc_conf-atbez = 'Config code 1:'.
* print code 1 = production order header
refresh: t_sfc_conf, it_charac_tab.
loop at charac_tab2 where cuobj = caufvd-cuobj.
check charac_tab2-abtei ca '1'.
check not charac_tab2-atwtb co '0. '.
check not charac_tab2-atwtb co 'No '.
while charac_tab2-atbez(1) eq ' '.
shift charac_tab2-atbez left.
endwhile.
move-corresponding charac_tab2 to it_charac_tab.
append it_charac_tab.
endloop.
perform prep_print_config.
endif.
* new with 3.0: print production note
perform print_prod_note.
endform. "lg01_header
*---------------------------------------------------------------------*
* FORM LG01_VORGANG *
*---------------------------------------------------------------------*
form lg01_vorgang.
data: flag_avotx.
* reset work areas
clear: affld, afvgd, resbd, affhd, wa-page, wa-new_page.
clear: wa-arbpl, wa-arbpl1, wa-arbpl2.
clear: wa-check0, wa-check1, wa-check2.
clear: sw-page, w_opers, w_comps.
refresh: t_opers, t_comps.
loop at itab_tdr where object = obj-pos
or object = obj-sop
or object = obj-mat
or object = obj-fhm
and aufnr = itab_ord-aufnr.
if itab_tdr-object = obj-pos
or itab_tdr-object = obj-sop.
index_vrg = sy-tabix.
else.
check itab_tdr-aplzl <> afvgd-aplzl.
index_vrg = sy-tabix - 1.
endif.
clear flag_avotx.
* save entry
itab_vrg = itab_tdr.
* new-sequence ?
if affld-plnfl ne itab_tdr-aplfl.
* sequence-informations
read table affld_tab index itab_tdr-index_plfl.
check sy-subrc = 0.
check affld_tab-flg_loe is initial.
* fill DDIC-Structure
affld = affld_tab.
perform pppr_get_tables using drpart-seq.
if affld-flgat eq const-kz_sta.
* CALL FUNCTION 'WRITE_FORM'
* EXPORTING
* element = 'SEQ_STAMM'
* window = 'MAIN'.
else.
* print infos of parallel/alternative sequences
* CALL FUNCTION 'WRITE_FORM'
* EXPORTING
* element = 'SEQ_MAIN'
* window = 'MAIN'.
* CALL FUNCTION 'WRITE_FORM'
* EXPORTING
* element = 'SEQ_DETAIL'
* window = 'MAIN'.
endif.
* print sequence-text
if not affld-txtsp is initial.
* built textkey of sequence
call function 'CO_ZK_TEXTKEY_AFFL'
exporting
aplzl = affld-aplzl
aufpl = affld-aufpl
importing
ltsch = stxh-tdname.
* print text
* CALL FUNCTION 'WRITE_FORM'
* EXPORTING
* element = 'SEQ_TEXT'
* window = 'MAIN'.
elseif not affld-ltxa1 is initial.
* eventually short-text
* CALL FUNCTION 'WRITE_FORM'
* EXPORTING
* element = 'SEQ_LTXA1'
* window = 'MAIN'.
endif.
endif.
* Read operation by index in document-table
read table afvgd_tab index itab_tdr-index_plpo.
check sy-subrc = 0.
check afvgd_tab-flg_loe is initial.
* fill DDIC-structure
afvgd = afvgd_tab.
* Suboperation ?
if not itab_tdr-index_sopr is initial.
read table afvgd_tab index itab_tdr-index_sopr.
afvgd = afvgd_tab.
endif.
* Steuerschlüssel des Vorgangs verproben wenn gewünscht
x_field = const-flg_yes.
if not print_co-psteu is initial.
call function 'CO_DR_STEUS_CHK'
exporting
afvgd_imp = afvgd
plnaw = caufvd-plnaw
vrgd = const-flg_yes
caufvd_imp = caufvd " Added by Tim 2/3/2003
importing
print = x_field.
endif.
* get the press numbers and confirmation numbers
case afvgd-arbpl.
when '4F' or '5F'.
move afvgd-arbpl to wa-arbpl.
move afvgd-rueck to wa-rueck.
when '4R' or '5R'.
move afvgd-arbpl to wa-arbpl1.
move afvgd-rueck to wa-rueck1.
when others.
if afvgd-arbpl ne space.
move afvgd-arbpl to wa-arbpl2.
move afvgd-rueck to wa-rueck2.
endif.
endcase.
check x_field eq const-flg_yes.
* read tables of operation
perform pppr_get_tables using drpart-opr.
* get workcenter
clear rcr01.
loop at work_tab
where arbid eq afvgd-arbid and werks eq afvgd-werks.
rcr01 = work_tab.
exit.
endloop.
* get activities with workcenter and operation
perform get_activity using afvgd rcr01 ttl_activ afvgd-mgvrg.
clear: w_opers, w_temp.
move-corresponding afvgd to w_opers.
move-corresponding ttl_activ to w_opers.
* Calculate cycle time
if w_opers-bmsch ne 0.
w_temp-zzcycle = 3600 / w_opers-bmsch.
endif.
* Urbana wants to modify the cycle time printed on the operation
* overview for molding work centers as part of a 6 sigma project.
* The following code accomplishes their requirement.
if caufvd-werks = '4003' and
( rcr01-matyp = 'ZSP' or rcr01-matyp = 'ZDP' ).
if w_temp-zzcycle le 60.
w_temp-zzcycle = w_temp-zzcycle - 2.
elseif w_temp-zzcycle gt 60 and w_temp-zzcycle le 120.
w_temp-zzcycle = w_temp-zzcycle - 3.
elseif w_temp-zzcycle gt 120.
w_temp-zzcycle = w_temp-zzcycle - 5.
endif.
if w_temp-zzcycle lt 0.
w_temp-zzcycle = 0.
endif.
endif.
move: w_temp-zzcycle to w_opers-zzcycle.
* Calculate pieces per hour
if ttl_activ-acti2 gt 0.
w_temp-zzpph = afvgd-mgvrg / ttl_activ-acti2.
move: w_temp-zzpph to w_opers-zzpph.
endif.
append w_opers to t_opers.
* CALL FUNCTION 'WRITE_FORM'
* EXPORTING
* element = 'OPR_MAIN'
* window = 'MAIN'.
* get infos of components and FHM
refresh comp_tab.
refresh fhm_tab.
tabix = index_vrg.
* Bis zum nächsten Vorgang, der nächsten Folge oder dem nächsten Auftrag
do.
tabix = tabix + 1.
read table itab_tdr index tabix.
if sy-subrc <> 0 or itab_tdr-aufnr ne itab_ord-aufnr.
exit.
else.
case itab_tdr-object.
when obj-alt.
exit.
when obj-seq.
exit.
when obj-pos.
exit.
when obj-mat.
if itab_tdr-aplzl <> afvgd-aplzl.
exit.
endif.
read table resbd_tab index itab_tdr-index_plmz.
check resbd_tab-flg_loe is initial.
if sy-subrc eq 0.
comp_tab = resbd_tab. append comp_tab.
endif.
when obj-fhm.
if itab_tdr-aplzl <> afvgd-aplzl.
exit.
endif.
read table affhd_tab index itab_tdr-index_plfh.
if sy-subrc eq 0.
fhm_tab = affhd_tab. append fhm_tab.
endif.
when others.
endcase.
endif.
enddo.
* Zugeordnete Materialien vorhanden ?
describe table comp_tab lines tabix.
if not tabix is initial.
perform mat_info_to_opr.
endif.
* Zugeordnete FHM's vorhanden ?
describe table fhm_tab lines tabix.
if not tabix is initial.
perform fhm_info_to_opr.
endif.
endloop.
* call function 'WRITE_FORM' " Nur in PSFC-Formular zulässig
* exporting
* element = 'END_MAIN'
* window = 'MAIN'.
endform. "lg01_vorgang
*---------------------------------------------------------------------*
* FORM READ_MAT *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
form read_mat using plant material matview structure msfcv.
* Aus Tabelle der Materialstämme den betreffenden Eintrag auslesen
clear matview.
* Bei Nichtlager oder Textposition natürlich kein Materialstamm
check not plant is initial and not material is initial.
loop at mv_tab where werks eq plant and matnr eq material.
move-corresponding mv_tab to matview.
move-corresponding mv_tab to mc29s.
exit.
endloop.
endform. "read_mat
*---------------------------------------------------------------------*
* FORM MAT_INFO_TO_OPR. *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
form mat_info_to_opr.
* Title of material-list (line already printed at operation
* We need to get the grand total weight and the percentate
* contribution of each material.
clear wght.
perform get_total_weight changing wght-tot
wght-aufst
wght-aufwg.
* write header of pick-list
* CALL FUNCTION 'WRITE_FORM'
* EXPORTING
* element = 'MAT_HEADLINE'
* window = 'MAIN'.
* if components should be printed orderer by ...
sort comp_tab by
aobar aufst aufwg baust "order of ITAB
posnr matnr rspos.
loop at comp_tab.
* fill DDIC-Structure of material
resbd = comp_tab.
* read tables of component
perform get_components.
* Calculate the % weight for each component
clear: wght-pct, wght-pct_char, w_wght.
if comp_tab-meins = 'LB'.
if resbd-aufst is initial and resbd-aufwg is initial.
move wght-aufst to resbd-aufst.
move wght-aufwg to resbd-aufwg.
endif.
read table t_wght into w_wght with key
aufst = resbd-aufst
aufwg = resbd-aufwg
binary search.
if sy-subrc = 0 and w_wght-tot gt 0.
wght-pct = ( comp_tab-esmng / w_wght-tot ) * 100.
move wght-pct to wght-pct_char.
condense wght-pct_char.
endif.
endif.
* print data of material
* Comment out phantom check. Instead do it in smart forms routine
* as we need the phantom parts for drawing design graphic
* if resbd-dumps ne 'X'.
clear: w_comps.
w_comps-zzvornr = w_opers-vornr.
move-corresponding resbd to w_comps.
w_comps-pct_char = wght-pct_char.
if resbd-shkzg = 'S'.
w_comps-zzsign = '-'.
endif.
clear: w_temp-zzesmng.
w_temp-zzesmng = resbd-esmng.
w_comps-zzesmng = w_temp-zzesmng.
select single bismt from mara
into w_comps-bismt
where matnr = resbd-matnr.
append w_comps to t_comps.
* endif.
* CALL FUNCTION 'WRITE_FORM'
* EXPORTING
* element = 'MAT_INFO'
* window = 'MAIN'.
* material text given ?
* IF NOT resbd-ltxsp IS INITIAL.
*
* CALL FUNCTION 'CO_ZK_TEXTKEY_RESB'
* EXPORTING
* rsnum = resbd-rsnum
* rspos = resbd-rspos
* rsart = resbd-rsart
* IMPORTING
* ltsch = stxh-tdname.
* CALL FUNCTION 'WRITE_FORM'
* EXPORTING
* element = 'MAT_TEXT'
* window = 'MAIN'.
* ENDIF.
* reset sign according to SHKZG
if resbd-shkzg eq 'S'.
resbd-bdmng = - resbd-bdmng.
resbd-menge = - resbd-menge.
resbd-erfmg = - resbd-erfmg.
endif.
endloop.
* at end of list print a line
* CALL FUNCTION 'WRITE_FORM'
* EXPORTING
* element = 'LINE'
* window = 'MAIN'.
endform. "mat_info_to_opr
*---------------------------------------------------------------------*
* FORM FHM_INFO_TO_OPR. *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
form fhm_info_to_opr.
* Title of material-list (line already printed at operation
* write header of pick-list
* NOTE: FHM* routines for PRT's
* Since time constraint in place and since ORBIS does not use PRT's
* this was not coded during first go-round.
* Research sapscript form: ZPSFC_OBJT-LIST1 to see how the
* header and line information is output.
***** Construction !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
* CALL FUNCTION 'WRITE_FORM'
* EXPORTING
* element = 'FHM_HEADLINE'
* window = 'MAIN'.
***** Construction !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
* if components should be printed orderer by ...
* SORT FHM_TAB BY .....
loop at fhm_tab.
* fill DDIC-Structure of material
affhd = fhm_tab.
* PRT deleted?
check affhd-loekz is initial.
* read tables of component
perform pppr_get_tables using drpart-fhm.
* must the PRT-allocation be printed?
if not print_co-psteu is initial.
check not tcf10-xdruck is initial.
endif.
* print data of material
***** Construction !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
* CALL FUNCTION 'WRITE_FORM'
* EXPORTING
* element = 'FHM_INFO'
* window = 'MAIN'.
***** Construction !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
** material text given ?
* IF NOT affhd-txtsp IS INITIAL.
*
* CALL FUNCTION 'CO_ZK_TEXTKEY_AFFH'
* EXPORTING
* aufpl = affhd-aufpl
* mandt = sy-mandt
* pzlfh = affhd-pzlfh
* IMPORTING
* ltsch = stxh-tdname.
*
* CALL FUNCTION 'WRITE_FORM'
* EXPORTING
* element = 'FHM_TEXT'
* window = 'MAIN'.
* ENDIF.
endloop.
* at end of list print a line
* CALL FUNCTION 'WRITE_FORM'
* EXPORTING
* element = 'LINE'
* window = 'MAIN'.
endform. "fhm_info_to_opr
*---------------------------------------------------------------------*
* FORM GET_ACTIVITY *
*---------------------------------------------------------------------*
form get_activity using operation structure afvgd
work_center structure rcr01
activity structure ttl_activ
quantity.
data: begin of structure,
aufpl like afvc-aufpl,
aplzl like afvc-aplzl.
data: field like ttl_activ.
data: end of structure.
clear activity.
check not operation-arbid is initial
and not work_center-arbid is initial.
read table ttl_tab
with table key aufpl = operation-aufpl
aplzl = operation-aplzl.
if sy-subrc is initial.
structure = ttl_tab. activity = structure-field.
endif.
endform. "get_activity
*---------------------------------------------------------------------*
* FORM PRINT_PROD_NOTE *
*---------------------------------------------------------------------*
* Print Production Note if Customer Order is given *
*---------------------------------------------------------------------*
form print_prod_note.
data: begin of t occurs 0.
include structure tline.
data: end of t.
data idord like tco09-idord. " S11K135155
data objec like tco09-objec. " S11K135155
check not afpod-kdauf is initial and afpod-fhwtx ne space.
clear stxh-tdname.
* save contents of TCO09 " S11K135155
move tco09-objec to objec. " S11K135155
move tco09-idord to idord. " S11K135155
* MOVE afpod-kdauf TO stxh-tdname.
* MOVE afpod-kdpos TO stxh-tdname+10(6).
* MOVE 'VBBP' TO tco09-objec.
* MOVE '0006' TO tco09-idord.
** Production-Memo existing ?
* CALL FUNCTION 'READ_TEXT'
* EXPORTING
* language = sy-langu
* id = tco09-idord
* name = stxh-tdname
* object = tco09-objec
* TABLES
* lines = t
* EXCEPTIONS
* id = 01
* language = 02
* name = 03
* not_found = 04
* object = 05
* reference_check = 06.
*
* IF sy-subrc IS INITIAL.
* CALL FUNCTION 'WRITE_FORM'
* EXPORTING
* element = 'PROD_NOTE'
* window = 'MAIN'.
* ENDIF.
* restore contents of TCO09 " S11K135155
move objec to tco09-objec. " S11K135155
move idord to tco09-idord. " S11K135155
endform. "print_prod_note
*---------------------------------------------------------------------*
* FORM PRODNET_INFO *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
form prodnet_info.
* Print info of collective order
* leading order ?
if caufvd-maufnr eq space.
else.
* fill DDIC-structure PPPRCOLORD of upper operation
loop at colord_tab where aufnr = caufvd-aufnr.
ppprcolord = colord_tab.
exit.
endloop.
endif.
endform. "prodnet_info
include codrgett.
include codrgeth.
*&---------------------------------------------------------------------*
*& Form material_memo
*&---------------------------------------------------------------------*
form material_memo.
* This won't work for Mentor becuase they don't
* have the text element defined in the sapscript
check caufvd-werks ne '4005'.
check caufvd-werks ne '4009'.
clear: z_matl_object.
move caufvd-plnbez to z_matl_object.
move caufvd-werks to z_matl_object+19.
endform. " material_memo
*&---------------------------------------------------------------------*
*& Form coll_order_logic
*&---------------------------------------------------------------------*
form coll_order_logic.
* for collective orders, get the sales order number & object number
* attached to the highest level order.
if caufvd-prodnet eq 'X' and
caufvd-lead_aufnr ne caufvd-aufnr.
select single kdauf kdpos kdein from afpo
into (afpod-kdauf,afpod-kdpos,afpod-kdein)
where aufnr = caufvd-lead_aufnr and
posnr = 1.
select single cuobj from afko into caufvd-cuobj
where aufnr = caufvd-lead_aufnr.
select single kunnr from vbak into w_vbak-kunnr
where vbeln = afpod-kdauf.
select single name1 from kna1 into afpod-name1
where kunnr = w_vbak-kunnr.
call function 'CE_C_INIT'.
call function 'CUD0_CONFIGURATION_INITIALIZER'.
call function 'VC_I_GET_CONFIGURATION'
exporting
instance = caufvd-cuobj
tables
configuration = char_tab
exceptions
instance_not_found = 01
no_characteristics = 02.
clear charac_tab3. refresh charac_tab3.
loop at char_tab.
move-corresponding char_tab to charac_tab3.
charac_tab3-cuobj = caufvd-cuobj.
append charac_tab3.
endloop.
else.
charac_tab3[] = charac_tab[].
endif.
endform. " coll_order_logic
*&---------------------------------------------------------------------*
*& Form get_total_weight
*&---------------------------------------------------------------------*
form get_total_weight changing p_tot
p_aufst_def
p_aufwg_def.
data: tmp_nopath(1) type c,
tmp_lines type i.
refresh: ts_wght[], t_wght[].
clear: tmp_nopath, tmp_lines.
loop at comp_tab.
check comp_tab-meins = 'LB'.
p_tot = p_tot + comp_tab-esmng.
clear w_wght.
read table ts_wght into w_wght with key aufst = comp_tab-aufst
aufwg = comp_tab-aufwg
binary search.
if sy-subrc = 0.
w_wght-tot = w_wght-tot + comp_tab-esmng.
modify table ts_wght from w_wght transporting tot.
else.
w_wght-aufst = comp_tab-aufst.
w_wght-aufwg = comp_tab-aufwg.
w_wght-tot = comp_tab-esmng.
insert w_wght into table ts_wght.
* get the values used to reset the blank ones later
if p_aufst_def is initial and not comp_tab-aufst is initial.
move comp_tab-aufst to p_aufst_def.
move comp_tab-aufwg to p_aufwg_def.
endif.
if comp_tab-aufst is initial.
tmp_nopath = 'X'.
endif.
endif.
endloop.
describe table ts_wght lines tmp_lines.
if tmp_nopath = 'X' and tmp_lines gt 2.
* This means there are manually added component (no path/level)
* are there are at least two other path/level combinations in
* the BOM, in this case, we want to treat the manually added
* components as separate entities so turn off the no path ind
clear: tmp_nopath, p_aufst_def, p_aufwg_def.
endif.
loop at ts_wght into w_wght.
if tmp_nopath = 'X'. "combine the manually added components
if w_wght-aufst is initial and w_wght-aufwg is initial.
move p_aufst_def to w_wght-aufst.
move p_aufwg_def to w_wght-aufwg.
endif.
endif.
collect w_wght into t_wght.
endloop.
endform. " get_total_weight
*&---------------------------------------------------------------------*
*& Form prep_print_config
*&---------------------------------------------------------------------*
form prep_print_config .
data: w-line_max like sy-tabix.
data: w-line_max2 like sy-tabix.
data: w-line_1 like sy-tabix.
data: w-line_2 like sy-tabix.
describe table it_charac_tab lines w-line_max.
check w-line_max gt 0.
w-line_max2 = w-line_max / 2.
w-line_2 = w-line_max2 + 1.
w-line_1 = 1.
do.
clear: w_sfc_conf,*sfc_conf.
read table it_charac_tab index w-line_1.
if sy-subrc = 0.
move: it_charac_tab-atinn to w_sfc_conf-atinn1,
it_charac_tab-atnam to w_sfc_conf-atnam1,
it_charac_tab-atbez to w_sfc_conf-atbez1,
it_charac_tab-atwrt to w_sfc_conf-atwrt1,
it_charac_tab-atwtb to w_sfc_conf-atwtb1.
endif.
read table it_charac_tab index w-line_2.
if sy-subrc = 0.
move: it_charac_tab-atinn to w_sfc_conf-atinn2,
it_charac_tab-atnam to w_sfc_conf-atnam2,
it_charac_tab-atbez to w_sfc_conf-atbez2,
it_charac_tab-atwrt to w_sfc_conf-atwrt2,
it_charac_tab-atwtb to w_sfc_conf-atwtb2.
endif.
append w_sfc_conf to t_sfc_conf.
* call function 'WRITE_FORM'
* exporting
* element = 'CONFIG_LINE'
* window = 'MAIN'.
add 1 to w-line_1. add 1 to w-line_2.
if ( w-line_1 > w-line_max2 ).
exit.
endif.
enddo.
endform. " prep_print_config
*&---------------------------------------------------------------------*
*& Form print_smartform
*&---------------------------------------------------------------------*
form print_smartform using value(p_0403).
clear: zw-fm_name.
call function 'SSF_FUNCTION_MODULE_NAME'
exporting
formname = p_0403
importing
fm_name = zw-fm_name
exceptions
no_form = 1
no_function_module = 2
others = 3.
if sy-subrc ne 0.
raise print_error.
endif.
** Map control parameters
clear: w_control.
** Map print parameters
call function 'CO_DR_PR_OPT_FILL'
exporting
prt_co = print_co
importing
pr_opt = pr_options.
clear: w_ssfcompop.
move-corresponding pr_options to w_ssfcompop.
w_ssfcompop-tdnewid = 'X'.
w_ssfcompop-tdfinal = 'X'.
w_ssfcompop-tdcopies = print_co-copys.
* Do not present smartforms popup
w_control-no_dialog = 'X'.
w_control-preview = pr_options-tdpreview.
****************************************************
* PRINT Production SmartForm
****************************************************
call function zw-fm_name
exporting
control_parameters = w_control
output_options = w_ssfcompop
cv = caufvd
t001w = t001w
mattext = psfc_head-mattext
z_matl_object = z_matl_object
w_wmg = w_wmg
tables
t_cv = caufvd_tab
t_sfc_conf = t_sfc_conf
t_opers = t_opers
t_comps = t_comps
t_opts = t_opts
exceptions
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
others = 5.
endform. " print_smartform
*&---------------------------------------------------------------------*
*& Form build_options_list
*&---------------------------------------------------------------------*
form build_options_list .
clear: w_opts.
refresh: t_opts.
loop at t_comps into w_comps
where xloek is initial
and dumps is initial.
loop at it_charac_tab
where atwrt = w_comps-matnr.
clear: w-atnam.
case it_charac_tab-atnam.
when 'OMH_IDPLATES1'.
w-atnam = 'OMH_IDPLATE1_LOCS'.
when 'OMH_IDPLATES2'.
w-atnam = 'OMH_IDPLATE2_LOCS'.
when 'OMH_LABEL_CARD_HOLDER1'.
w-atnam = 'OMH_HOLDER1_LOCS'.
endcase.
check w-atnam is not initial.
loop at it_charac_tab where atnam = w-atnam.
clear: w_opts.
move-corresponding w_comps to w_opts.
move: it_charac_tab-atinn to w_opts-atinn,
it_charac_tab-atnam to w_opts-atnam,
it_charac_tab-atwtb to w_opts-atwtb,
it_charac_tab-atwrt to w_opts-atwrt.
collect w_opts into t_opts.
endloop.
endloop.
endloop.
sort t_opts by atwtb matnr.
delete adjacent duplicates from t_opts comparing atwtb matnr.
* Adjust options based on component value
* Example: If 4 locations, then divide quantity by 4...
loop at t_opts into w_opts.
clear: w-counter.
loop at t_comps into w_comps
where matnr = w_opts-matnr.
add c-one to w-counter.
endloop.
if w-counter ge c-one.
w_opts-zzesmng = w_opts-zzesmng / w-counter.
modify t_opts from w_opts.
endif.
endloop.
endform. " build_options_list
User | Count |
---|---|
81 | |
10 | |
10 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.