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

sales document flow

Former Member
0 Likes
1,779

hi sap

hw can i write a logic to relate vbak,likp,mkpf,vttk,vbrk to view document flow for sales order.

in display i need sales order number, delivery document,invoice doc,shipment doc, pgi doc.

pls help in step by step of start of selection.

\[removed by moderator\]

thanx in advance.

Edited by: Jan Stallkamp on Aug 6, 2008 2:26 PM

6 REPLIES 6
Read only

Former Member
0 Likes
1,208

Hi Sapna,

I am sending you a link which is a Pdf format file in which you have the Relationships between the tables in SAP in each module. Just scroll down to find SD tables.

http://www.abap.es/Descargas/TAB%20-%20Relacion%20de%20las%20tablas%20por%20modulos.PDF

Regards,

Swapna.

Read only

Former Member
0 Likes
1,208

hi,

you can link the sale order numer and the invoice number throughr the fileld

vbrk-vgbel = vbak-vbeln

and for delievery no

vbrk-aubel = likp-vbeln

and for invoice no

vbrk-vbeln

and for pgi doc no

form both mkpf and mseg

vbrp-matnr = mseg-matnr

vbrp-werks = mseg-werks

mkpf-budat = date.

Read only

0 Likes
1,208

Hi,

select the fields from table VBAK.

select vbeln from vbak into table i_vbak where condition.

write the select quirey for VBFA for etting the delivery nuber

select vbeln vbelv from vbfa into table i_vbfa

where vbelv = i_vbak-vbeln and vbtyp_n = 'J'.

in this select quirey you can get delivery number into field vbeln.

based on this delivery numer fetch the data from LIKP.

select vbeln from likp into table i_likp where vbeln = i_vbfa-vbeln.

again fetch the data from VBRK.

select vbeln knumv into table i_vbrk

from vbrk where vbeln = i_likp-vbeln.

KNUMV field is the common field from both MKPF and VBRK.

again select the data from MKPF basde on KNUMV.

select * from mkpf into table i_mkpf

where knumv = i_vbrk-knumv.

finally clu all these tables into one final internal table to display the data.

Regards.

Sriram.

Read only

Former Member
0 Likes
1,208

Hi Sapna.

I would like to suggest you that you to go through the sales document flow as per the refernce below:

This will develop your understanding towards the SD flow and hence, logic application would become easier.

[Sales Document Flow Diagram|http://www.sap-basis-abap.com/sd/sap-sd-processing-flow.htm]

[SDN - Reference for SD document logic for flow|;

[SDN - Reference for creating a SD flow document |;

[SDN - Reference regarding invoice number displaying in non-invoice number list in document flow |;

Hope that's usefull.

Good Luck & Regards.

Harsh Dave

Read only

Former Member
0 Likes
1,208

Hi Sapna,

You can check this code... this will be helpful

Sales life cycle.

REPORT Z_SD_LC_REPS_S NO STANDARD PAGE HEADING
                        LINE-SIZE 130
                        LINE-COUNT 26(3).

TABLES :

       VBAK,
       VBAP,
       VBEP,
       LIKP,
       LIPS,
       MARA,
       MVKE,
       VBRK,
       TVLKT.

DATA : BEGIN OF I_SDLC OCCURS 0,
          VBELN LIKE VBAK-VBELN,
          AUDAT LIKE VBAK-AUDAT,
          VGBEL LIKE VBAK-VGBEL,
          VGBEL1 LIKE VBAK-VGBEL,
          MATNR LIKE VBAP-MATNR,
          BMENG LIKE VBEP-BMENG,
          NETPR LIKE VBAP-NETPR,
          LFDAT LIKE LIKP-LFDAT,
          FKDAT LIKE VBRK-FKDAT,
          AUART LIKE VBAK-AUART,
       END OF I_SDLC.


SELECT-OPTIONS: S_VBELN FOR VBAK-VBELN.

SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-TAT.

SELECT-OPTIONS: S_AUDAT FOR VBAK-AUDAT,
                S_VKORG FOR VBAK-VKORG,
                S_VTWEG FOR VBAK-VTWEG,
                S_SPART FOR VBAK-SPART.

SELECTION-SCREEN END OF BLOCK B1.


TOP-OF-PAGE.

WRITE : /20 ' REPORT ON COMPLETE SALES LIFE CYCLE IN A PARTICULAR SALES
AREA ' COLOR COL_HEADING.

ULINE.

WRITE: /5 'VBELN' ,
       15 'AUDAT' ,
       26 'MATNR' ,
       45 'BMENG' ,
       64 'NETPR' ,
       81 'LFDAT',
       92 'FKDAT' ,
       103 'AUART' ,
       108 'VGBEL',
       119 'VGBEL1'.

ULINE.

START-OF-SELECTION.

SELECT A~VBELN
       A~AUDAT
       A~AUART
       A~VGBEL
       B~MATNR
       B~NETPR
       C~BMENG
*       D~LFDAT
*       E~FKDAT
  INTO CORRESPONDING FIELDS OF TABLE I_SDLC  FROM
  ( ( VBAK AS A
  INNER JOIN VBAP AS B ON B~VBELN = A~VBELN )
  INNER JOIN VBEP AS C ON C~VBELN = A~VBELN AND B~POSNR = C~POSNR )
*  INNER JOIN LIKP AS D ON D~VBELN = A~VBELN )
*  INNER JOIN VBRK AS E ON E~VBELN = A~VBELN )
  WHERE A~VBELN IN S_VBELN AND
        A~AUDAT IN S_AUDAT AND
        A~VKORG IN S_VKORG AND
        A~VTWEG IN S_VTWEG AND
        A~SPART IN S_SPART AND
        A~AUART = 'ZZOR'.

LOOP AT I_SDLC.

   SELECT LFDAT INTO CORRESPONDING FIELDS OF I_SDLC
          FROM LIKP WHERE VBELN = I_SDLC-VBELN.

   SELECT FKDAT INTO CORRESPONDING FIELDS OF I_SDLC
          FROM VBRK WHERE VBELN = I_SDLC-VBELN.

   MODIFY I_SDLC INDEX SY-TABIX.

   ENDSELECT.

   ENDSELECT.

   SELECT VGBEL INTO I_SDLC-VGBEL1 FROM VBAK
         WHERE  VBELN = I_SDLC-VGBEL.
         "AND AUART = 'QT'.

    MODIFY I_SDLC INDEX SY-TABIX.

   ENDSELECT.



ENDLOOP.


END-OF-SELECTION.

LOOP AT I_SDLC.

AT NEW VBELN.

WRITE : /5 I_SDLC-VBELN.

ENDAT.

WRITE :/15 I_SDLC-AUDAT ,
       26 I_SDLC-MATNR ,
       45 I_SDLC-BMENG LEFT-JUSTIFIED,
       64 I_SDLC-NETPR LEFT-JUSTIFIED,
       81 I_SDLC-LFDAT ,
       92 I_SDLC-FKDAT ,
       103 I_SDLC-AUART,
       108 I_SDLC-VGBEL,
       119 I_SDLC-VGBEL1.

ENDLOOP.

END-OF-PAGE.

WRITE: /75 'PAGE:', SY-PAGNO.

regards

padma

Read only

Former Member
0 Likes
1,208

Hi Sapna,

You can get the Sales document flow in the table VBFA..

These are some of the documents regarding the sales flow:

http://www.sap-basis-abap.com/sd/sap-sd-processing-flow.htm

http://homepages.wmich.edu/~q4lee1/SAP%20Evaluation.htm

http://abaplovers.blogspot.com/2008/02/sales-document-flow.html

Hope this helps you.

Regards,

Chandra Sekhar