Communication structure KOMKBV3 is used for Billing document requirements
If you see the field you need to develop your output control requirement is missing, create a new append structure for example ZAKOMKBV3 and add your fields..
For example here we have added a new field ZZSERVICE_MATERIAL here.
Function module KOMKBV3_FILL - Subroutine USEREXIT_KOMKBV3_FILL in Include RVCOMFZZ is used to fill the communication structure.
Here in the subroutine we will write the code to check if the material in billing document is a service material or not.
if com_vbrp_tab is not INITIAL. select count(*) FROM mara FOR ALL ENTRIES IN com_vbrp_tab WHERE matnr = com_vbrp_tab-matnr and
mtart = 'DIEN'. if sy-subrc eq 0.
com_kbv3-ZZSERVICE_MATERIAL = abap_true. else.
com_kbv3-ZZSERVICE_MATERIAL = abap_false. endif. endif.
Now in the requirement subroutine we can write the following code to restrict the output for non-service materials.
if komkbv3-zzservice_material = abap_false. sy-subrc = 4. endif.
Sometimes when the requirement subroutine is transported to QA or PRD you may need to regenerate them using the program RV80HGEN.