Skip to Content
0
Former Member
Jan 30, 2007 at 11:36 AM

in report i got one record instead of many records

17 Views

Hi friends

i have developed the mm report, inbound delivery and gr status,

in report output i got one record instead of many records

give me a solutions for that one

FORM SELECT_DATA.

SELECT AVBELN ABLDAT ALIFNR CNAME1 ALIFEX BMATNR BMATKL BLFIMG BMEINS BWERKS BARKTX BVGBEL BVGPOS BPOSNR

INTO CORRESPONDING FIELDS OF TABLE IT_LIKP_IDEL

FROM LIKP AS A

INNER JOIN LIPS AS B ON AVBELN = BVBELN

INNER JOIN LFA1 AS C ON ALIFNR = CLIFNR

WHERE B~WERKS IN S_WERKS

AND B~MATNR IN S_MATNR

AND B~MATKL IN S_MATKL

AND A~LIFNR IN S_LIFNR

AND A~BLDAT IN S_BLDAT.

READ TABLE IT_LIKP_IDEL INDEX 1.

IF SY-SUBRC = 0.

SELECT BELNR EBELN BUDAT BUZEI LFPOS LFBNR BWART EBELP FROM EKBE INTO CORRESPONDING FIELDS OF TABLE IT_EKBE_IDEL

FOR ALL ENTRIES IN IT_LIKP_IDEL

WHERE EBELN = IT_LIKP_IDEL-VGBEL

AND EBELP = IT_LIKP_IDEL-VGPOS+1(5) AND

( BWART = '101' OR BWART = '102' OR BWART = '103').

.

ENDIF.

ENDFORM. "SELECT_DATA

****************************************************************

  • FORM TO APPEND DATA INTO MAIN INTERNAL TABLE

*

****************************************************************

DATA : G_DATE(10) TYPE C,

G_DATE1(10) TYPE C.

&----


*& Form MAIN_DATA

&----


  • text

----


FORM MAIN_DATA.

LOOP AT IT_EKBE_IDEL WHERE BWART = '102'.

MOVE-CORRESPONDING IT_EKBE_IDEL TO IT_EKBE_IDEL1.

APPEND IT_EKBE_IDEL1.

DELETE IT_EKBE_IDEL .

ENDLOOP.

LOOP AT IT_EKBE_IDEL.

READ TABLE IT_EKBE_IDEL1 WITH KEY LFBNR = IT_EKBE_IDEL-BELNR LFPOS = IT_EKBE_IDEL-BUZEI.

IF SY-SUBRC = 0.

DELETE IT_EKBE_IDEL.

ENDIF.

ENDLOOP.

LOOP AT IT_LIKP_IDEL WHERE VGBEL = IT_EKBE_IDEL-EBELN AND VGPOS+1(5) = IT_EKBE_IDEL-EBELP.

IT_FINAL_IDEL-VBELN = IT_LIKP_IDEL-VBELN.

CONCATENATE IT_LIKP_IDEL-BLDAT6(2) IT_LIKP_IDEL-BLDAT4(2) IT_LIKP_IDEL-BLDAT+0(4)

INTO G_DATE SEPARATED BY '.'.

IT_FINAL_IDEL-BLDAT = G_DATE.

IT_FINAL_IDEL-LIFNR = IT_LIKP_IDEL-LIFNR.

IT_FINAL_IDEL-NAME1 = IT_LIKP_IDEL-NAME1.

IT_FINAL_IDEL-LIFEX = IT_LIKP_IDEL-LIFEX.

IT_FINAL_IDEL-MATNR = IT_LIKP_IDEL-MATNR.

IT_FINAL_IDEL-ARKTX = IT_LIKP_IDEL-ARKTX.

IT_FINAL_IDEL-LFIMG = IT_LIKP_IDEL-LFIMG.

CALL FUNCTION 'CONVERSION_EXIT_CUNIT_OUTPUT'

EXPORTING

INPUT = IT_LIKP_IDEL-MEINS

LANGUAGE = SY-LANGU

IMPORTING

  • LONG_TEXT =

OUTPUT = IT_LIKP_IDEL-MEINS

  • SHORT_TEXT =

EXCEPTIONS

UNIT_NOT_FOUND = 1

OTHERS = 2

.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

IT_FINAL_IDEL-MEINS = IT_LIKP_IDEL-MEINS.

LOOP AT IT_EKBE_IDEL WHERE EBELN = IT_LIKP_IDEL-VGBEL AND EBELP = IT_LIKP_IDEL-VGPOS+1(5).

IT_FINAL_IDEL-BELNR = IT_EKBE_IDEL-BELNR.

CONCATENATE IT_EKBE_IDEL-BUDAT6(2) IT_EKBE_IDEL-BUDAT4(2) IT_EKBE_IDEL-BUDAT+0(4)

INTO G_DATE1 SEPARATED BY '.'.

IT_FINAL_IDEL-BUDAT = G_DATE1.

IT_FINAL_IDEL-PTGR = IT_EKBE_IDEL-BUDAT - IT_LIKP_IDEL-BLDAT.

APPEND IT_FINAL_IDEL.

ENDLOOP.

CLEAR: IT_FINAL_IDEL, IT_LIKP_IDEL, IT_EKBE_IDEL.

ENDLOOP.

ENDFORM. "MAIN_DATA

Regards

ds