Quantcast
Channel: SCN : All Content - All Communities
Viewing all articles
Browse latest Browse all 8800

Detailing Function Module SD_COLLECTIVE_RUN_EXECUTE

$
0
0

The main objective of this document is to explain in detail what goes on inside function module SD_COLLECTIVE_RUN_EXECUTE.

This is one of the most important function modules in SD Billing.

Hopefully this will help you to find out where an issue is being originated.

 

1. Function SD_COLLECTIVE_RUN_EXECUTE

 

When the billing is performed via:

 

  • VF04 and Save
  • VF04 and DisplayBillList and Collective Billing Document
  • VF06

 

The system will call the function module SD_COLLECTIVE_RUN_EXECUTE

 

sdcol.JPG

 

The following are important parts of the source code in this function:

 

FUNCTION SD_COLLECTIVE_RUN_EXECUTE.

...

  MAX_DOCUMENTS = 1000.

  CALL CUSTOMER-FUNCTION '009'

       TABLES

            CT_VKDFIF = V60P_INPUT_VKDFIF

       CHANGING

            CD_MAX_DOCUMENTS = MAX_DOCUMENTS         ---> Userexit to change MAX_DOCUMENTS

...

  SORT V60P_INPUT_VKDFIF BY KUNNR VKORG V_FKART V_FKDAT SORTKRI

                            FKDAT FKART VBELN.

  CALL CUSTOMER-FUNCTION '010'

       TABLES

            CT_VKDFIF = V60P_INPUT_VKDFIF                        ---> Userexit to change sort criteria

...

  LOOP AT V60P_INPUT_VKDFIF WHERE SELKZ NE SPACE.    ---> Loop at documents to be billed

    ON CHANGE OF V60P_INPUT_VKDFIF-KUNNR OR

                 V60P_INPUT_VKDFIF-VKORG OR

                 V60P_INPUT_VKDFIF-V_FKART.                        ---> If sold-to party or sales organization or billing type changes

      IF COUNTER > 0.                                                          ---> If true then call billing function

        PERFORM RV_INVOICE_CREATE         

...

        CLEAR COUNTER.                                                      ---> Initialize COUNTER

        REFRESH XKOMFK.

      ENDIF.

    ENDON.

    ADD 1 TO COUNTER.                                                      ---> Increase COUNTER

...

    IF COUNTER > MAX_DOCUMENTS.   "maximale Anzahl Belege    ---> If MAX_DOCUMENTS reached

      PERFORM RV_INVOICE_CREATE                                 ---> Call billing function

       ...

      CLEAR COUNTER.                                                        ---> Initialize COUNTER

...

  ENDLOOP.

...

  IF COUNTER <> 0.                                                            ---> After the loop bill the last documents that remained after the last change

    CLEAR SY-CALLD.

    PERFORM RV_INVOICE_CREATE                                   ---> Call billing function

...

 

 

For other important function modules in SD Billing please check:

 


Viewing all articles
Browse latest Browse all 8800

Trending Articles