<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Report - SD module in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/report-sd-module/m-p/1797772#M342750</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am creating a report for SD module. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have to fetch the billing docs for a given date and find the open sales orders &amp;amp; print the report.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I could fetch the billing docs...open sales order for the given date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What is the relation (link) between the Billing and the sales orders. HOw will i find out that the Open sales order and the billing doc. belong to the sales order made by the customer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 23 Dec 2006 11:14:48 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-12-23T11:14:48Z</dc:date>
    <item>
      <title>Report - SD module</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/report-sd-module/m-p/1797772#M342750</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am creating a report for SD module. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have to fetch the billing docs for a given date and find the open sales orders &amp;amp; print the report.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I could fetch the billing docs...open sales order for the given date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What is the relation (link) between the Billing and the sales orders. HOw will i find out that the Open sales order and the billing doc. belong to the sales order made by the customer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 23 Dec 2006 11:14:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/report-sd-module/m-p/1797772#M342750</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-12-23T11:14:48Z</dc:date>
    </item>
    <item>
      <title>Re: Report - SD module</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/report-sd-module/m-p/1797773#M342751</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can use table VBFA to get the link between a sales order-delivery-billing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Total all the billing quantities for a given sale order, if the total = quantity in sales order, then no more delivery/billing can be made for that order.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Related tables....&lt;/P&gt;&lt;P&gt;VBAK   "Sales order header&lt;/P&gt;&lt;P&gt;VBAP   " SAles order item&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LIKP     "Delivery header&lt;/P&gt;&lt;P&gt;LIPS     "Delivery item&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;VBRK    "Billing header&lt;/P&gt;&lt;P&gt;VBRP    "Billing item.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 23 Dec 2006 11:24:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/report-sd-module/m-p/1797773#M342751</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-12-23T11:24:24Z</dc:date>
    </item>
    <item>
      <title>Re: Report - SD module</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/report-sd-module/m-p/1797774#M342752</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Apart from the info provided by Jithendra, you have to consider VBUK/VBUP for open sales orders.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I guess the report should be giving two outputs&lt;/P&gt;&lt;P&gt;1. Billing Docs for given date: Details from VBRK &amp;amp; VBRP where VBRK-ERDAT is the date on the selection screen.&lt;/P&gt;&lt;P&gt;2. Open Sales Orders: VBUK/VBUP ---&amp;gt;VBAK/VBAP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind Regards&lt;/P&gt;&lt;P&gt;Eswar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 23 Dec 2006 11:35:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/report-sd-module/m-p/1797774#M342752</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-12-23T11:35:29Z</dc:date>
    </item>
    <item>
      <title>Re: Report - SD module</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/report-sd-module/m-p/1797775#M342753</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In Table VBFA, make use of the fields..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1.VBELV       "Preceeding document number (order)&lt;/P&gt;&lt;P&gt;2.VBTYP_N   "document type( use for For orders)&lt;/P&gt;&lt;P&gt;3.VBELN       "Subsequent document number (billing)&lt;/P&gt;&lt;P&gt;4.VBTYP_V   "document type( use for For billing)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 23 Dec 2006 11:37:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/report-sd-module/m-p/1797775#M342753</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-12-23T11:37:00Z</dc:date>
    </item>
    <item>
      <title>Re: Report - SD module</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/report-sd-module/m-p/1797776#M342754</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Relation between a sales order and a Billing document ( Invoice ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After the sales order is processed then comes the stage of Delivery where the items under the sales order are processed , picked , packed and Pgi'ed (goods issue is completed) .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;once this is done then an Invoice (billing document number is generated for that delivery )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is the Sequence.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For ur understanding goto VF03 and give an invoice number as input and hit an enter.&lt;/P&gt;&lt;P&gt;Now in the screen at the left top corner in the select Document Flow (shift+F7) and click that .. This will show u the status of the sales order /delivery /invoice number.&lt;/P&gt;&lt;P&gt;sales order in VBAK---item VBAP&lt;/P&gt;&lt;P&gt;delivery      in LIKP  ---iteM LIPS&lt;/P&gt;&lt;P&gt;Invoice       in VBRK---item VBRP&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;in order to capture the sales order as open or closed ..&lt;/P&gt;&lt;P&gt;You need to proceed like &lt;/P&gt;&lt;P&gt;take the sales order number and goto table VBUK and input the sales order number and check for field VBUK-GBSTK NE C &lt;/P&gt;&lt;P&gt;if its C then its Closed else if it is A or B then its open .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;GBSTK--is the overall processing status for the order ..&lt;/P&gt;&lt;P&gt;U need to write a join for this or directly fetch the entry from table VBAKUK.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;here is a sample code to fetch the open orders at header and item level.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;execute the code to understand teh logic &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;REPORT ZEX2  MESSAGE-ID arc NO STANDARD PAGE HEADING.

Tables :kna1,vbak.

SELECT-OPTIONS : so_vkorg FOR  vbak-vkorg OBLIGATORY, "sales area
                 so_vtweg FOR  vbak-vtweg OBLIGATORY,
                 so_spart FOR  vbak-spart,                                  
                 so_kunnr FOR  kna1-kunnr.                        "ur customer  


DATA : BEGIN OF sales_open OCCURS 0 ,
       vbeln LIKE vbak-vbeln,
       auart LIKE vbak-auart,
       kunnr LIKE kna1-kunnr,
       bstnk LIKE vbak-bstnk,
       lfstk LIKE vbuk-lfstk,
       fkstk LIKE vbuk-fkstk,
       gbstk LIKE vbuk-gbstk,
       END OF sales_open.

DATA : BEGIN OF itm_sales OCCURS 0,
       vbeln LIKE vbap-vbeln,
       posnr LIKE vbap-posnr,
       matnr LIKE vbap-matnr,
       kwmeng like vbap-kwmeng,
       lfsta LIKE vbup-lfsta,
       lfgsa LIKE vbup-lfgsa,
       fksta LIKE vbup-fksta,
       fksaa LIKE vbup-fksaa,
       gbsta LIKE vbup-gbsta,
       END OF itm_sales.
***
DATA : l_kunnr LIKE kna1-kunnr,
       l_vkorg LIKE vbak-vkorg,
       l_vtweg LIKE vbak-vtweg,
       l_spart LIKE vbak-spart.


DATA: v_statusl(20) TYPE c,
      v_statusb(20) TYPE c,
      v_statusf(20) TYPE c,
      v_statusg(20) TYPE c,
      v_status(20) TYPE c,
      v_field(1) TYPE c.

data : v_openqty like vbap-kwmeng.

**Selection Screen Validations.
AT SELECTION-SCREEN.
  PERFORM validations.
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  Validations
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  --&amp;gt;  p1        text
*  &amp;lt;--  p2        text
*----------------------------------------------------------------------*
FORM validations.

**Customer
  IF NOT so_kunnr[] IS INITIAL.
    SELECT SINGLE kunnr INTO l_kunnr
           FROM kna1
           WHERE kunnr IN so_kunnr.
    IF sy-subrc NE 0.
      MESSAGE e002 WITH text-005.
    ENDIF.
  ENDIF.
**Sales Organization
  IF NOT so_vkorg[] IS INITIAL.
    SELECT SINGLE vkorg INTO l_vkorg
           FROM tvko
           WHERE vkorg IN so_vkorg.
    IF sy-subrc NE 0.
      MESSAGE e003 WITH text-006.
    ENDIF.
  ENDIF.
**Distribution Channel
  IF NOT so_vtweg[] IS INITIAL.
    SELECT SINGLE vtweg INTO l_vtweg
            FROM tvkov
            WHERE   vkorg IN so_vkorg
             AND    vtweg IN so_vtweg.
    IF sy-subrc NE 0.
      MESSAGE e004 WITH text-007.
    ENDIF.
  ENDIF.
**Division
  IF NOT so_spart[] IS INITIAL.
    SELECT SINGLE spart INTO l_spart
            FROM tvta
            WHERE   vkorg IN so_vkorg
            AND     vtweg IN so_vtweg
            AND     spart IN so_spart.
    IF sy-subrc NE 0.
      MESSAGE e005 WITH text-008.
    ENDIF.
  ENDIF.

ENDFORM.                    " Validations

Top-of-page.
PERFORM sales_top_of_page.

Start-of-selection.
PERFORM sales_sel.


*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  sales_sel
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  --&amp;gt;  p1        text
*  &amp;lt;--  p2        text
*----------------------------------------------------------------------*
FORM sales_sel.

SELECT vbeln auart kunnr bstnk
     lfstk fkstk gbstk
     INTO TABLE sales_open
     FROM vbakuk
     WHERE vkorg IN so_vkorg
     AND   vtweg IN so_vtweg
     AND   spart IN so_spart
     AND   kunnr IN so_kunnr
     AND gbstk NE 'C'.

  LOOP AT sales_open.


    WRITE:/4 sy-vline,
           5 sales_open-vbeln HOTSPOT ON COLOR 2 INTENSIFIED OFF,
           16 sy-vline,
           17 sales_open-auart COLOR 2 INTENSIFIED OFF,
           27 sy-vline,
           28 sales_open-kunnr COLOR 2 INTENSIFIED OFF,
           40 sy-vline,
           41 sales_open-bstnk COLOR 2 INTENSIFIED OFF,
           55 sy-vline,
           56 sales_open-lfstk,
           76 sy-vline,
           77 sales_open-fkstk,
           96 sy-vline,
           97 sales_open-gbstk ,
           117 sy-vline.

    HIDE sales_open-vbeln .
  ENDLOOP.

ENDFORM.                    " sales_sel


*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  sales_top_of_page
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  --&amp;gt;  p1        text
*  &amp;lt;--  p2        text
*----------------------------------------------------------------------*
FORM sales_top_of_page.

  WRITE:/4 sy-uline(114),
     50 'OPEN SALES ORDERS' COLOR 7 INTENSIFIED ON .

  WRITE: /4 sy-vline,
          5 'SalesOrder' COLOR 1 ,
          16 sy-vline,
         17  'OrderType' COLOR 1,
         27  sy-vline,
         28  'Customer' COLOR 1,
         40  sy-vline,
         41  'PoNumber' COLOR 1,
         55  sy-vline,
         56  'Delivery Status' COLOR 1,
         76  sy-vline,
         77  'Billing Status' COLOR 1,
         96  sy-vline,
         97  'Processing Status' COLOR 1,
         117  sy-vline .
  WRITE:/4 sy-uline(114).

ENDFORM.                    " sales_top_of_page


AT LINE-SELECTION.

  SELECT       a~vbeln
               a~posnr
               a~matnr
               a~kwmeng
               b~lfsta
               b~lfgsa
               b~fksta
               b~fksaa
               b~gbsta
               INTO TABLE itm_sales
               FROM vbap AS a JOIN vbup AS b
               ON a~vbeln EQ b~vbeln
               AND a~posnr EQ b~posnr
               AND b~gbsta NE 'C'
               WHERE a~vbeln EQ sales_open-vbeln.


  IF NOT sales_open IS INITIAL.
    LOOP AT itm_sales.

      at end of vbeln .
      sum.
      v_openqty = itm_sales-kwmeng.

      endat.

      WRITE:/5  itm_sales-vbeln,
                itm_sales-posnr,
                itm_sales-matnr,
                itm_sales-kwmeng,
                itm_sales-lfsta,
                itm_sales-lfgsa,
                itm_sales-fksta,
                itm_sales-fksaa,
                itm_sales-gbsta.



    ENDLOOP.
  ENDIF.
 skip 2.
  write:/  'open Quantity for the order is ', v_openqty .&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in order to fetch the invoice number from sales order .. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;goto table VBFA and give the input as sales order number in Preceding document no(VBELV) and in the Document category of subsequent document (VBTYP_N) give it as caps 'M'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for fetching delivery from sales order same as above with vbtyp_n = 'J'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;vijay&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 23 Dec 2006 13:00:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/report-sd-module/m-p/1797776#M342754</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-12-23T13:00:11Z</dc:date>
    </item>
  </channel>
</rss>

