03-16-2007 9:27 AM
hi i am doing an enhancement in which the user will enter g/l acc,profitcenetr,cost center in transaction fb50 and this exit which is aatched to a validation rule in ggb1 wiill check whetere the gl acc eneterd is valid for the correponding profit center and coste center.when i am trying to enter the data in fb50 it is saying that the value in costcenter and profit center has to be deleted and then it is getting posted.can u help me.
here is my sample code:
DATA:lv_hkont TYPE bseg-hkont.
DATA: FLAG VALUE ''.
DATA: g_prctr1 like bseg-prctr,
g_kostl1 like bseg-kostl.
TYPES:BEGIN OF gt_cstctr,
hkont TYPE bseg-hkont, "G/L account
prctr TYPE bseg-prctr, "Profit center
kostl TYPE bseg-kostl, "Cost center
END OF gt_cstctr.
TYPES:BEGIN OF gt_prtctr,
hkont type bseg-hkont, "G/L account
prctr type bseg-prctr, "Profit center
kostl type bseg-kostl, "Cost center
END OF gt_prtctr.
&*************************************************************************&
*************declaring the internal tables and work area******************&
&*************************************************************************&
DATA: gi_cstctr TYPE TABLE OF gt_cstctr.
DATA: gi_prtctr TYPE TABLE OF gt_prtctr.
DATA: gw_cstctr type gt_cstctr.
DATA: gw_prtctr type gt_prtctr.
******************************************************************************
******************************************************************************
lv_hkont = bseg-HKONT.
g_kostl1 = bseg-kostl.
*g_prctr1 = bseg-prctr.
SELECT hkont
FROM bseg
INTO
TABLE gi_cstctr
WHERE
kostl = bseg-kostl.
SELECT hkont
FROM bseg
INTO
TABLE gi_prtctr
WHERE
prctr = bseg-prctr.
LOOP AT gi_cstctr INTO gw_cstctr.
IF gw_cstctr-hkont = lv_hkont.
MESSAGE s000(YTESTCLASS) with lv_hkont .
FLAG = 'X'.
EXIT.
ENDIF.
ENDLOOP.
IF FLAG = ''.
MESSAGE s001(YTESTCLASS) with lv_hkont.
ENDIF.
LOOP AT gi_prtctr into gw_prtctr .
IF gw_prtctr-hkont = lv_hkont.
MESSAGE s000(YTESTCLASS) with lv_hkont .
FLAG = 'X'.
EXIT.
ENDIF.
ENDLOOP.
IF FLAG = ''.
MESSAGE s002(YTESTCLASS) with lv_hkont.
ENDIF.
03-16-2007 9:32 AM
Hi,
You have set all your MESSAGE statements using S option. this will not stop the processing of the document. Instead if you want to stop the processing of the Doc, set the MESSAGE with type E.
regards,
Mahesh
03-16-2007 9:41 AM
Hay
Ur code is very good its very perfect.
Just make changes in message type in place of <b>S</b> use <b>E</b> (if u want to halt ther)
**Please reward suitable points***
With Regards
Navin Khedikar