Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

SD DOCUMENT FLOW REPORT PROBLEM

Former Member
0 Likes
946

Hi,

I am writing a SD document flow report which captures data from quotation, sales order, fulfillment order and finally invoice.The problem is, for example, if there is more than 1 invoice against a particular sales order, the report is capturing only 1 invoice details and ignoring the rest.How to solve this problem.Pls suggest.

Thanks in advance.

Anand Gupta.

8 REPLIES 8
Read only

Former Member
0 Likes
860

Hi,

I think in u r report u r READing invoice tabel to get the invoice. But Loop the invoice table, then u will get all values..

Kiran...

Read only

Former Member
0 Likes
860

u have to process ur data by looping on invoice.

means

Loop at IT_VBRP.

READ TABLE IT_VBAK.....

READ TABLE IT_VBAP-------

.

.

.

.

ENDLOOP.

Read only

0 Likes
860

Hi,

Thanks for ur help.But suppose in cases of sales orders, where there are no invoices, those Sales orders would not be captured if I loop using invoice.Pls suggest

Thanks and regards

Anand

Read only

0 Likes
860

Hi,

In this case, when you are looping over the sales order, select all the invoices from the subsequent document and put the document type as M. You will get all the invoices.

Shouldnt be a problem. All you need to do is loop it accordingly

Thanks,

Babu Kilari

Read only

0 Likes
860

Hi,

Thanks, can u pls elaborate it, if possible.to be exact I m looping on invoices not sales orders. then how open SO's would be picked.

Regards

ANAND

Read only

0 Likes
860

hi,

to find open SO .... u have to calculate pending order qty . then wherever the pending order qty should be greate than 0. that is open SO .


******************************************************
*       Fill Pending and Delivered Quantity          *
******************************************************
        it_final-kwmeng = it_vbap-kwmeng.                   "order quantity
    SELECT *
                 from vbup
                 into table it_vbup
                 where vbeln = it_vbap-vbeln
                 and posnr = it_vbap-POSNR.

    READ TABLE IT_VBUP WITH KEY VBELN = IT_VBAP-VBELN POSNR = IT_VBAP-POSNR.
    IF SY-SUBRC EQ 0.
      IT_FINAL-lv_status = IT_VBUP-LFSTA.
    ENDIF.
    SELECT *
                 from vbfa
                 into table it_vbfa
                 where VBELV = it_vbap-vbeln
                 and POSNV = it_vbap-posnr.

    loop at it_vbap into wa_vbap where vbeln = it_vbak-vbeln.

      MOVE-CORRESPONDING wa_vbap to it_VBAPVB.
      append it_VBAPVB.

    endloop.

    loop at it_vbEp where vbeln = it_vbak-vbeln.

      MOVE-CORRESPONDING it_vbep to IT_VBEPVB.
      append it_VBEPVB.

    ENDLOOP.

    CALL FUNCTION 'RV_SCHEDULE_CHECK_DELIVERIES'
      EXPORTING
        fbeleg                        = it_vbap-vbeln
        fposnr                        = it_vbap-Posnr
*   FVERRECHNUNG                  = ' '
*   FS073_ALT                     = ' '
*   IF_NO_SORT                    = ' '
      tables
        fvbfa                         = it_vbfa
        fvbup                         = it_vbup
        fxvbep                        = it_VBEPVB
*   FVBLB                         =
        fvbap                         = it_VBAPVB
     EXCEPTIONS
       FEHLER_BEI_LESEN_FVBUP        = 1
       FEHLER_BEI_LESEN_FXVBEP       = 2
       OTHERS                        = 3
              .
    IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    LOOP AT it_VBEPVB WHERE POSNR = IT_VBAP-POSNR.
      IT_FINAL-KWMENG_d = IT_FINAL-KWMENG_d + it_VBEPVB-VSMNG. " COMPUTE DELIVERY QTY
    ENDLOOP.
    IT_FINAL-KWMENG_p = IT_FINAL-KWMENG - IT_FINAL-KWMENG_d.  "COMPUTE pENDING QTY
    free : IT_VBEPVB[] , it_VBAPVB[] , it_vbup[] ,it_vbFA[].
    "    APPEND FINAL DATA

Read only

0 Likes
860

Hi,

Thanks, but problem not yet solved.

Thanks and regards

Anand

Read only

0 Likes
860

plz describe more...where exactly the roblem.