Skip to Content
0
Former Member
Mar 16, 2007 at 09:27 AM

enhancements

15 Views

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.