‎2008 May 23 5:12 PM
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.
‎2008 May 23 5:17 PM
hi,
Check out if the enhancement is assigned to a project and is activated or not ... for that go to MODACT table and pass the enhancement name in the member to get the project ... go to CMOD and activate the project giving the project name in it ..now place a break point in the include program to know what went wrong in the debug mode ...
Regards,
Santosh
‎2008 May 23 8:04 PM
I have ran thru the debugger all the way until it displays the billing document. the billing document displays all of the line items. when I clicked on one of the fields on the line item and do the technical display, it shows that the field is coming from the VBRP table. when I save the record, the line items disappear. when I check the VBRP table, the line item records are not there. when I go to display the saved billing document, all that is displayed it the header record. none of the line items are displayed.
does anyone have any ideas on why this would happen?
thanks...
‎2008 May 23 8:57 PM
If the exit is implemented for each line, then why are you modifying a table?
That would mean it modifies it a lot.
Also, check what happens if you comment this parts
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.
Maybe the changes are messing with the standard
‎2008 May 23 9:11 PM
we are modifing the table to total the lines that are created for the batch split process. the totals are added to the main line and the batch split lines are removed from the table. this way, the billing document only has the main lines and not the lines containing the batch split information.
I will try your suggestion and let you know
thanks for the info
‎2008 May 30 4:23 PM
Hello
we have found out that the path we were taking was not correct. the condition tab of the billing document was not getting populated after coding the fix. we are looking into other wasys to handle this and also checking for OSS notes that address this issue
thanks for all of the help on this