on 08-11-2008 2:13 PM
User has a requirement that whenever they create credit/debit memo with reference to an order, the quantity(VBAP-ZMENG) and net value(VBAP-NETWR) fields should come in as 0. I'm thinking of including a code that forces those fields to be 0 however I'm not sure if i should add it to the existing include program or create a new routine and add it to that. For reference i'm adding include program as i don't know where exactly should i add this code in the program.
Please advise.
FORM DATEN_KOPIEREN_151.
IF CVBAP-POSNR IS INITIAL.
MESSAGE A247 WITH '151'.
ENDIF.
Fields which are copied
ENHANCEMENT-POINT DATEN_KOPIEREN_151_01 SPOTS ES_SAPFV45C.
$$-Start: DATEN_KOPIEREN_151_01----
$$
ENHANCEMENT 25 /SAPMP/FDE_SD_SAPFV45C. "active version
*MILL 0016 01 WZ Merkmale in der SD-Pos. eingabebereit
copy of global-local structure
VBAP-MILL_SE_GPOSN = CVBAP-MILL_SE_GPOSN.
ENDENHANCEMENT.
$$-End: DATEN_KOPIEREN_151_01----
$$
VBAP-MATWA = CVBAP-MATWA.
VBAP-MATKL = CVBAP-MATKL.
VBAP-ARKTX = CVBAP-ARKTX.
VBAP-BWTAR = CVBAP-BWTAR.
VBAP-PRODH = CVBAP-PRODH.
VBAP-PMATN = CVBAP-PMATN.
VBAP-MEINS = CVBAP-MEINS.
VBAP-VRKME = CVBAP-VRKME.
VBAP-UMVKZ = CVBAP-UMVKZ.
VBAP-UMVKN = CVBAP-UMVKN.
IF NOT VBAP-VKGRU EQ VKGRU_REP_REPARATURANFO.
VBAP-VKGRU = CVBAP-VKGRU.
ENDIF.
VBAP-VKAUS = CVBAP-VKAUS.
IF NOT CVBAP-GRKOR IS INITIAL
AND VBAP-GRKOR IS INITIAL.
VBAP-GRKOR = CVBAP-GRKOR.
ENDIF.
VBAP-FMENG = CVBAP-FMENG.
VBAP-ATPKZ = CVBAP-ATPKZ.
VBAP-RKFKF = CVBAP-RKFKF.
VBAP-SPART = CVBAP-SPART.
VBAP-WAERK = CVBAP-WAERK.
IF NOT CVBAP-PRCTR IS INITIAL.
VBAP-PRCTR = CVBAP-PRCTR.
ENDIF.
VBAP-ANZSN = CVBAP-ANZSN.
VBAP-SERAIL = CVBAP-SERAIL.
ENHANCEMENT-POINT DATEN_KOPIEREN_151_10 SPOTS ES_SAPFV45C.
$$-Start: DATEN_KOPIEREN_151_10----
$$
ENHANCEMENT 61 OI0_COMMON_SAPFV45C. "active version
Copy Exchange Data SO3K002011 JAQ
PERFORM COPY_EXCHANGE_DATA. "SO3K002011 JAQ
IS-Oil enhancement - default pipeline fields SO3K002011 CEF
MOVE-CORRESPONDING CVBAP TO OIC_PIPE. "so3k120207
MOVE-CORRESPONDING CVBAP TO OID_EX. "so3k120207
MOVE-CORRESPONDING OIC_PIPE TO VBAP. "so3k120207
MOVE-CORRESPONDING OID_EX TO VBAP. "so3k120207
Manual conditions and multiple ship-to's in contracts "SO4K003766 RKS
if cvbpa-kunnr eq kuwev-kunnr. "SO6K001141 RKS
if not cvbap-oic_dland1 is initial and "SO6K001141 RKS
not cvbap-oic_dregio is initial and "SO6K001141 RKS
not cvbap-oic_dcounc is initial and "SO6K001141 RKS
not cvbap-oic_dcityc is initial. "SO6K001141 RKS
KUWEV-LAND1 = CVBAP-OIC_DLAND1. "SO4K003766 RKS
KUWEV-REGIO = CVBAP-OIC_DREGIO. "SO4K003766 RKS
KUWEV-COUNC = CVBAP-OIC_DCOUNC. "SO4K003766 RKS
KUWEV-CITYC = CVBAP-OIC_DCITYC. "SO4K003766 RKS
endif. "SO6K001141 RKS
endif. "SO6K001141 RKS
Triggering Item Category Redetermination while still "SO4K003766 RKS
on SAPMV45A 101 and not yet in the PBO of screen 423 "SO4K003766 RKS
IF TVAK-UEVOR+0(3) = 'OID'. "SO4K003766 RKS
OID_ISOIL = 'X'. "SO4K003766 RKS
ENDIF. "SO4K003766 RKS
is-oil enhancement - copy drc details from reference "SO3K002019 JRE
VBAP-OIDRC = CVBAP-OIDRC. "SO3K002019 JRE
VBAP-OIC_DRCTRY = CVBAP-OIC_DRCTRY. "SO3K002019 JRE
VBAP-OIC_DRCREG = CVBAP-OIC_DRCREG. "SO3K002019 JRE
VBAP-OIMETIND = CVBAP-OIMETIND. "SO3K002019 JRE
VBAP-OIWAP = CVBAP-OIWAP. "SO3K002019 JRE
VBAP-OISLF = CVBAP-OISLF. "SO3K002019 JRE
VBAP-OIPSDRC = CVBAP-OIPSDRC. "SO3K002019 JRE
*is-oil enhancement - copy ref. gross/net pricing rule "SO3K012126 GJK
VBAP-OIGNRULE = CVBAP-OIGNRULE. "SO3K012126 GJK
CLEAR VBAP-OIBYPASS. "SO3K003030 JAQ
is-oil enhancement: copy contract header restrictions "SO3K015566 AC
PERFORM COPY_RESTRICTIONS_ITEM. "SO3K015566 AC
*is-oil enhancement - copy contract number if not initial and current
doc is not a contract
PERFORM OICONTR_DETERMINE(SAPMV45A) USING CVBAP-VGBEL "SO4K000089 VB
CVBAP-VGPOS
VBAP-OICONTNR
VBAP-OIC_KMPOS.
perform oij_copy_tsw_data. "SO7K022351 YS
ENDENHANCEMENT.
$$-End: DATEN_KOPIEREN_151_10----
$$
Fields that are copied when the sold-to parties are the same.
The sold-to is read from the reference document
CVBPA = SPACE.
CVBPA-PARVW = PARVW_AG.
READ TABLE CVBPA.
IF SY-SUBRC = 0 AND " kein Musterauftrag
CVBPA-KUNNR = KUAGV-KUNNR.
VBAP-KDMAT = CVBAP-KDMAT.
For delivery orders, no max./min. delivery tolerances
IF CVBAK-VBKLT NE VBKLT_LP_AUSL_AUFT AND
VBAK-VBKLT NE VBKLT_AUSL_AUFT.
VBAP-UEBTK = CVBAP-UEBTK.
VBAP-UEBTO = CVBAP-UEBTO.
VBAP-UNTTO = CVBAP-UNTTO.
ENDIF.
VBAP-CHSPL = CVBAP-CHSPL.
IF VBAP-FAKSP = SPACE.
VBAP-FAKSP = CVBAP-FAKSP.
ENDIF.
VBAP-ANTLF = CVBAP-ANTLF.
Component supplier's partial delivery flags are not copied (D)
IF CVBAK-ABDIS IS INITIAL.
VBAP-KZTLF = CVBAP-KZTLF.
ENDIF.
VBAP-LPRIO = CVBAP-LPRIO.
IF CVBAK-VSBED = VBAK-VSBED AND
NOT CVBAP-VSTEL IS INITIAL.
VBAP-VSTEL = CVBAP-VSTEL.
VBAP-ROUTE = CVBAP-ROUTE.
ENDIF.
ENDIF.
Fields which are copied only to quotations
IF VBAK-VBTYP = CHARB.
VBAP-GRPOS = CVBAP-GRPOS.
ENDIF.
Fields that are copied only to contracts, credit and debit memos
In 3.0 also to quotations (Example: Service contract in service
quotation)
IF VBAK-VBTYP = CHARG OR
VBAK-VBTYP = CHARK OR
VBAK-VBTYP = CHARL OR
VBAK-VBTYP = CHARB OR
VBAK-VBTYP = CHARF.
VBAP-ZWERT = CVBAP-ZWERT.
Create a credit or debit request. No schedule lines allowed.
IF TVAP-ETERL = SPACE.
IF CVBAK-VBTYP CN 'DKLG'. " Aus Belegen mit Auftragsmenge
VBAP-ZMENG = CVBAP-ORFMNG.
VBAP-ZIEME = CVBAP-VRKME.
VBAP-UMZIZ = CVBAP-UMVKZ.
VBAP-UMZIN = CVBAP-UMVKN.
ELSE.
VBAP-ZMENG = CVBAP-ORFMNG. " Aus Belegen ohne Auftragsmenge
VBAP-ZIEME = CVBAP-ZIEME.
VBAP-UMZIZ = CVBAP-UMZIZ.
VBAP-UMZIN = CVBAP-UMZIN.
ENDIF.
ENDIF.
ENDIF.
Credit and debit requests, returns
IF VBAK-VBTYP CA VBTYP_ANFO OR
VBAK-VBTYP CA VBTYP_RETO.
VBAP-KZVBR = CVBAP-KZVBR.
VBAP-KZBWS = CVBAP-KZBWS.
ENDIF.
IF NOT CVBAP-PS_PSP_PNR IS INITIAL.
VBAP-PS_PSP_PNR = CVBAP-PS_PSP_PNR.
ENDIF.
Copy the business area
VBAP-GSBER = CVBAP-GSBER.
Copy the order number
VBAP-AUFNR = CVBAP-AUFNR.
Target quantity in the scheduling agreement
IF VBAK-VBTYP = CHARE.
VBAP-ZMENG = CVBAP-ZMENG.
VBAP-ZIEME = CVBAP-ZIEME.
VBAP-UMZIZ = CVBAP-UMZIZ.
VBAP-UMZIN = CVBAP-UMZIN.
ENDIF.
IF NOT CVBAP-KMPMG IS INITIAL.
VBAP-KMPMG = CVBAP-KMPMG.
ENDIF.
FM data of the reference document is copied in the following
Data : ls_cobl type cobl,
g_t_fmii1 like fmii1 occurs 0 with header line,
ls_FMII1 type FMII1,
lv_vbeln type vbak-vbeln,
lv_objnr type fmii1-objnr,
ls_vbak type vbak,
ls_vbap type vbap,
ls_vbkd type vbkd.
ls_vbak = cvbak.
ls_vbap = cvbap.
ls_vbkd = cvbkd.
get coding block of the reference document
PERFORM cobl_fuellen(sapfv45p) USING ls_vbak
ls_vbap
ls_vbkd
ls_cobl.
take FM objects of the reference doc. to g_t_fmii1 and send to memory
ACTYP is in background mode
CALL FUNCTION 'FM_CO_ASS_INPUT_MAINTAIN_SD'
EXPORTING
I_COBL = ls_cobl
I_VBAK = ls_vbak
I_VBAP = ls_vbap
I_ACTYP = 'B'.
get the object number of reference doc.
PERFORM sd_get_objnr(saplfrc4) USING
ls_vbap-vbeln
ls_vbap-posnr
CHANGING
lv_objnr.
get the object number of the current doc.
PERFORM sd_get_objnr(saplfrc4) USING
vbap-vbeln
vbap-posnr
CHANGING
ls_fmii1-objnr.
replace the new objnr. with the old one.
IMPORT g_t_fmii1 FROM MEMORY ID 'HHMSD'.
modify g_t_fmii1 from ls_fmii1
transporting objnr where objnr = lv_objnr.
EXPORT g_t_fmii1 TO MEMORY ID 'HHMSD'.
consignment issue => copy CUOBJ for material variant
otherwise if the the variant was reconfigured it will
lose its value assignment because it will be overwritten
with the material master value assignment
IF vbap-sobkz = 'W' AND
NOT maepv-cuobj IS INITIAL.
vbap-cuobj = cvbap-cuobj.
ENDIF.
ENDFORM.
*eject
Hi,
You can put this at ABAP development forum and they can provide correct response.
Regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Posted this thread in ABAP forum.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
108 | |
12 | |
11 | |
6 | |
5 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.