Skip to Content
0
Former Member
Dec 05, 2005 at 12:46 PM

select statement

24 Views

Hi to all,

Can anyone correct the select statement ....it is activating but in Debugging there is no entries in ITAB

...

*&----


*& Report ZGTB_REPORT *

*& *

&----


*& *

*& *

&----


REPORT ZGTB_REPORT .

TABLES: MARD, /UPM/GTB10.

DATA: BEGIN OF ITAB OCCURS 0,

EXTMATLGRP TYPE /UPM/GTB10-EXTMATLGRP,

LAGERORT TYPE /UPM/GTB10-LAGERORT,

MATERIAL TYPE /UPM/GTB10-MATERIAL,

LAGERPLATZ TYPE /UPM/GTB10-LAGERPLATZ,

BESCHREIBUNG TYPE /UPM/GTB10-BESCHREIBUNG,

VIN TYPE /UPM/GTB10-VIN,

HERSTELLER TYPE /UPM/GTB10-HERSTELLER,

VCOLOR TYPE /UPM/GTB10-VCOLOR,

KILOMETER TYPE /UPM/GTB10-KILOMETER,

ENOTIZ TYPE /UPM/GTB10-ENOTIZ,

NETPR TYPE /UPM/GTB11-NETPR,

BEDAT TYPE EKKO-BEDAT,

LABST TYPE /UPM/GTB10-QUANTITY,

MATNR LIKE /UPM/GTB10-MATERIAL,

END OF ITAB.

DATA: BEGIN OF ITAB1 OCCURS 0,

MATNR TYPE MARD-MATNR,

LABST TYPE MARD-LABST,

END OF ITAB1.

*DATA: LABST LIKE MARD-LABST,

  • MATNR LIKE MARD-MATNR.

*DATA: P_FNAME TYPE RLGRAP-FILENAME.

*******************************SELECT OPTION*************************

PARAMETERS: P_FNAME LIKE rlgrap-filename

DEFAULT 'c:\temp' OBLIGATORY. " File Nameselect

**************************SELECT*************************************

START-OF-SELECTION.

SELECT MATNR LABST from MARD into table ITAB1 WHERE LABST GT 0.

LOOP AT ITAB1.

CLEAR /UPM/GTB10.

SELECT * FROM /UPM/GTB10 INTO CORRESPONDING FIELDS OF TABLE ITAB WHERE

MATERIAL = ITAB1-MATNR.

append itab.

ENDLOOP.

***********************OPEN DATASET***********************************

OPEN DATASET P_FNAME IN TEXT MODE ENCODING DEFAULT FOR OUTPUT.

IF SY-SUBRC = 0.

LOOP AT ITAB.

TRANSFER ITAB TO P_FNAME.

ENDLOOP.

ENDIF.

CLOSE DATASET P_FNAME.

IF SY-SUBRC = 0.

ENDIF.

***********************************CALL FUNCTION GUI DOWNLOAD*********

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

  • BIN_FILESIZE =

FILENAME = 'P_FNAME'

FILETYPE = 'ASC'

  • APPEND = ' '

  • WRITE_FIELD_SEPARATOR = ' '

  • HEADER = '00'

  • TRUNC_TRAILING_BLANKS = ' '

  • WRITE_LF = 'X'

  • IGNORE_CERR = ABAP_TRUE

  • REPLACEMENT = '#'

  • WRITE_BOM = ' '

  • TRUNC_TRAILING_BLANKS_EOL = 'X'

  • IMPORTING

  • FILELENGTH =

TABLES

DATA_TAB = ITAB

  • FIELDNAMES =

EXCEPTIONS

FILE_WRITE_ERROR = 1

NO_BATCH = 2

  • GUI_REFUSE_FILETRANSFER = 3

  • INVALID_TYPE = 4

  • NO_AUTHORITY = 5

  • UNKNOWN_ERROR = 6

  • HEADER_NOT_ALLOWED = 7

  • OTHERS = 22

.

IF SY-SUBRC <> 0.

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

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

ENDIF.

Thanks in advance,

raju.