Skip to Content
0
Former Member
Aug 02, 2007 at 09:45 AM

Regarding report

15 Views

Hi Experts

I am fetching data from Table vbak ,vbap, konv and i am not getting the output.This is my coding.

TABLES:VBAP,VBAK,KONV.

DATA KNUMV LIKE VBAK-KNUMV.

DATA:BEGIN OF ITAB OCCURS 0,

KUNNR LIKE VBAK-KUNNR,

VBELN LIKE VBAK-VBELN,

POSNR LIKE VBAP-POSNR,

MATNR LIKE VBAP-MATNR,

NETPR LIKE VBAP-NETPR,

BSTDK LIKE VBAK-BSTDK,

KNUMV LIKE VBAK-KNUMV,

END OF ITAB.

DATA PTAB LIKE KONV OCCURS 0 WITH HEADER LINE.

DATA : BEGIN OF FTAB OCCURS 0 ,

KUNNR LIKE VBAK-KUNNR,

VBELN LIKE VBAK-VBELN,

POSNR LIKE VBAP-POSNR,

MATNR LIKE VBAP-MATNR,

NETPR LIKE VBAP-NETPR,

BSTDK LIKE VBAK-BSTDK,

KBETR LIKE KONV-KBETR,

KNTYP LIKE KONV-KNTYP,

KNUMV LIKE VBAK-KNUMV,

END OF FTAB.

PARAMETER P_KUNNR LIKE VBAK-KUNNR OBLIGATORY.

SELECT-OPTIONS D_DATE FOR VBAK-BSTDK.

SELECT AKUNNR AVBELN AERDAT BPOSNR BMATNR BNETPR INTO CORRESPONDING FIELDS OF TABLE ITAB FROM VBAK AS A INNER JOIN VBAP AS B ON

( AVBELN = BVBELN ) WHERE KUNNR = P_KUNNR AND BSTDK IN D_DATE.

SELECT KBETR KNTYP FROM KONV INTO CORRESPONDING FIELDS OF TABLE PTAB FOR ALL ENTRIES IN ITAB WHERE KNUMV = ITAB-KNUMV.

MOVE-CORRESPONDING ITAB TO FTAB.

MOVE-CORRESPONDING PTAB TO FTAB.

LOOP AT FTAB.

WRITE :/ FTAB-KUNNR, FTAB-VBELN, FTAB-POSNR, FTAB-MATNR, FTAB-NETPR, FTAB-BSTDK, FTAB-KBETR, FTAB-KNTYP.

ENDLOOP.