Skip to Content
0
Former Member
May 23, 2008 at 04:12 PM

help with code in customer exit

139 Views

Hello

I am having a problem with the code below. we have implemented a customer exit V50PSTAT and the function exit EXIT_SAPLV50P_001. the code deals with intercompany billing documents and batch split records. the description of the code is listed in the exit. the problem is that the detail lines for the billing are not getting created in the VBRP table. I am not sure why they are not getting created. I would like if someone could please take a look at this code and let me know if there is something that is missing or coded incorrectly. thank you in advance for any help

&----


*& Include ZXV50U07

&----


----


  • Title : Batch Split items for inter-company billing document *

  • Author/Userid: Sumit Prasad/SPARASD *

  • Date : 05/19/2008 *

  • SAP Release : ECC 5.0 *

  • Heat Ticket : 79664 *

  • Description : This Userexit is implemented and gets executed from *

  • VF01 or VF04 for inter-company billing document(NLCC).*

  • It gets executed for each line item on billing document

  • It adds the quantity, Net Value and cost for billing *

  • document when there is batch split to the main item. *

----


----


  • Revision History:

----


  • Ver No.| Date | Author | Tr No. | Description *

----


  • 00001 | 05/19/2008 | SPRASAD | C1DK906152 | Initial Coding *

----


  • Data Declaration

CONSTANTS: c_vf01(4) TYPE c VALUE 'VF01',

c_vf04(4) TYPE c VALUE 'VF04',

c_nlcc(4) TYPE c VALUE 'NLCC'.

DATA: v_lin TYPE i.

DATA: wa_xvbrp LIKE vbrp,

wa_vbrp LIKE vbrp.

DATA: t_vbrp TYPE vbrp OCCURS 0.

FIELD-SYMBOLS: <fs_xvbrp> TYPE ANY TABLE.

  • Check to see

CHECK ( sy-tcode EQ c_vf01 OR

sy-tcode EQ c_vf04 ) AND

  • sy-uname EQ 'SPRASAD' AND

is_likp-lfart EQ c_nlcc.

*break sprasad.

  • Get internal table from upper program SAPLV60A

ASSIGN ('(SAPLV60A)xvbrp[]') TO <fs_xvbrp>.

  • Check to make sure above assignment was sucessfull else do not execute logic in this Userexit

IF sy-subrc EQ 0.

  • Move field symbol to local internal table

t_vbrp[] = <fs_xvbrp>.

  • Get last row of the internal table into work area wa_vbrp

LOOP AT t_vbrp INTO wa_vbrp.

ENDLOOP.

  • Check if the last row has batch split item

IF wa_vbrp-vgpos CP '9*'.

  • Loop though each item in the table to add quantity to main item

LOOP AT t_vbrp INTO wa_xvbrp.

  • Check to see Bath item belongs to which main item

IF wa_xvbrp-vbeln = wa_vbrp-vbeln AND

wa_xvbrp-posnr = wa_vbrp-aupos.

  • Add Quantity, New Value and Cost

wa_xvbrp-fkimg = wa_xvbrp-fkimg + wa_vbrp-fkimg.

wa_xvbrp-netwr = wa_xvbrp-netwr + wa_vbrp-netwr.

wa_xvbrp-wavwr = wa_xvbrp-wavwr + wa_vbrp-wavwr.

  • Modify the internal table

MODIFY TABLE t_vbrp FROM wa_xvbrp.

ELSEIF wa_xvbrp-vgpos CP '9*'.

  • If current row in loop is batch split item remove from the internal table

DELETE t_vbrp.

ENDIF.

ENDLOOP.

  • Overwrite the field symbol with the local internal table

  • which will overwrite the sap's internal table for Billing document.

<fs_xvbrp> = t_vbrp[].

ENDIF.

ENDIF.