‎2006 Jan 06 6:25 AM
Hi,
I am using GUI_UPLOAD to upload the file from presentation server to my internal table. My problem is that the one of the records of testfile is 3000 in length. The internal table is not showing all the data from the testfile. is there any limitation to the record length of an internal table??
DATA: FILENAME(100) VALUE 'C:\testfile.txt',
G_FILE TYPE STRING.
DATA: BEGIN OF T_DATATAB OCCURS 0,
LINE(3000) type c,
END OF T_DATATAB.
G_FILE = FILENAME.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = G_FILE
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = ' '
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
CHECK_BOM = ' '
IMPORTING
FILELENGTH =
HEADER =
TABLES
DATA_TAB = T_DATATAB
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
NO_AUTHORITY = 6
UNKNOWN_ERROR = 7
BAD_DATA_FORMAT = 8
HEADER_NOT_ALLOWED = 9
SEPARATOR_NOT_ALLOWED = 10
HEADER_TOO_LONG = 11
UNKNOWN_DP_ERROR = 12
ACCESS_DENIED = 13
DP_OUT_OF_MEMORY = 14
DISK_FULL = 15
DP_TIMEOUT = 16
OTHERS = 17
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Regards,
SB
‎2006 Jan 06 6:28 AM
Hi
if you are in 5.0 Version , you can give upto 32,000 chars.
if that is the case you can give.
thanks
vijay
‎2006 Jan 06 6:30 AM
i checked in 4.7 also,
if you give type lchr and you can give upto 32000.
data: text(32000) type lchr.
you can use.
vijay
‎2006 Jan 06 6:34 AM
Well if i am not wrong it is 4.7 , but still would like to from where do i get the version??
‎2006 Jan 06 6:36 AM
Hi again,
1. goto the menu :
SYSTEM-->STATUS
2. A new window will puopup
3. There will be a button besdies COMPONENT VERSION.
4. Press this button.
5. And u will get the different versions installed
of different software components ,
along with support package information
6. SAP_APPL
This is to be seen.
SAP_APPL means SAP Applications
(Logistics and Accounting)
7. SAP_HR is usually a different component.
regards,
amit m.
Message was edited by: Amit Mittal
Message was edited by: Amit Mittal
‎2006 Jan 06 6:36 AM
if you go to menu <b>SYSTEM->STATUS</b>
there you can see the popup , in that check the component version.
in 4.7 you use lchr instead of type c
thanks
vijay
‎2006 Jan 06 6:30 AM
Hi SB,
1. virtually for practical purposes there is no limit to the
length of internal table.
2. In ur case u can take it more than 3000 also.
3. It all depends upon the number of fields and their lengths.
4. Each record in text file is separated by ENTER / Line Carriage.
Check out the record which is not getting uploaded.
It must be more in length, or format may not be proper.
regards,
amit m.
‎2006 Jan 06 6:47 AM
I was trying to get each line of the testfile as 1 record in the internal table. I am actually doing this for testing. I am uploading a file from presentation server to an internal table and then writing to the application server by using the command Open dataset for output .
Once I am able to send the correct testfile to the application server my second step in to read the application server file and submit it to RFBIBL00.
from your reply it looks that I should declare my internal exactly to the way the data in the testfile.txt.
so I tried using this
DATA: BEGIN OF T_DATATAB.
include structure bgr00.
include structure bbkpf.
include structure bbseg.
include structure bbtax.
data: END OF T_DATATAB.
But this gives an error saying the t_datatab-stype is already declared.
‎2006 Jan 06 6:55 AM
hi,
are you imitating lsmw direct input program.
don't include the all structures. only use the required fields which you are going to populate.,
thanks
vijay
check the below code..
*&---------------------------------------------------------------------*
*& Report Z__DIRECT__MAT___CREAT *
*& *
*&---------------------------------------------------------------------*
*& *
*& *
*&---------------------------------------------------------------------*
REPORT Z__DIRECT__MAT___CREAT .
INCLUDE Z_INCLUDE_MAT_CREAT.
************************************************************************
* SELECTION SCREEN
************************************************************************
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-002.
PARAMETERS:P_FILE LIKE RLGRAP-FILENAME OBLIGATORY.
SELECTION-SCREEN END OF BLOCK B1 .
************************************************************************
* AT SELECTION SCREEN
************************************************************************
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
PROGRAM_NAME = SYST-CPROG
DYNPRO_NUMBER = SYST-DYNNR
FIELD_NAME = 'P_FILE'
IMPORTING
FILE_NAME = P_FILE.
****************************************************
*START-OF-SELECTION
****************************************************
START-OF-SELECTION.
****************************************************
*Perform to upload the data from Presentation Server
****************************************************
V_FILE = P_FILE.
PERFORM UPLOAD_DATA.
*****************************************************
*Transfer the Data to the structure BGR00 BMMH1 BMM00
*****************************************************
PERFORM CONVERT_0000. " BGR00
PERFORM POPULATE_DATA CHANGING BMM00.
PERFORM POPULATE_DATA CHANGING BMMH1.
**Looping the flat file data and updating the structures BMM00 & BMMH1
LOOP AT MATERIAL_MASTER.
*Writing the Data to the Application Server in a proper Format
OPEN DATASET C_ZTEST FOR APPENDING IN TEXT MODE ENCODING
DEFAULT.
****************************************************
*Transfer the Data to the structure BMM00
****************************************************
PERFORM CONVERT_0002. " BMM00
****************************************************
*Transfer the Data to the structure BMMh1
****************************************************
PERFORM CONVERT_0003. " BMMH1
**Closing the dataset after transfering the data
CLOSE DATASET C_ZTEST.
ENDLOOP. "Endloop of MATERIAL_MASTER
****************************************************
*END-OF-SELECTION
****************************************************
END-OF-SELECTION.
**Calling the Direct Input Program to Create the material
SUBMIT RMDATIND WITH %%%_R_P = C_X
WITH %%%_PHY = C_ZTEST
WITH SPERR = C_N.*&---------------------------------------------------------------------*
*& Include Z_INCLUDE_MAT_CREAT *
*&---------------------------------------------------------------------*
**Tables Used To Create the Material
TABLES:
BGR00,
BMM00,
BMMH1.
DATA:C_ZTEST(60) type c,
C_X TYPE C,
C_N TYPE C,
V_file type string.
C_ZTEST = 'Ztest.lsmw.conv'(001).
C_X = 'X'(003).
C_N = 'N'(004).
**FILED SYMBOLS
FIELD-SYMBOLS: <F> .
**Structure to Hold the Flat File
data:
begin of LSMW_MATERIAL_MASTER,
MATNR(018) type C, "Material number
MTART(004) type C, "Material type
MBRSH(001) type C, "Industry sector
WERKS(004) type C, "Plant
MAKTX(040) type C, "Material description
DISMM(002) type C, "Extra Field Added In the Program as it is required
MEINS(003) type C, "Base unit of measure
MATKL(009) type C, "Material group
SPART(002) type C, "Division
LABOR(003) type C, "Lab/office
PRDHA(018) type C, "Product hierarchy
MSTAE(002) type C, "X-plant matl status
MTPOS_MARA(004) type C, "Gen item cat group
BRGEW(017) type C, "Gross weight
GEWEI(003) type C, "Weight unit
NTGEW(017) type C, "Net weight
GROES(032) type C, "Size/Dimensions
MAGRV(004) type C, "Matl grp pack matls
BISMT(018) type C, "Old material number
WRKST(048) type C, "Basic material
PROFL(003) type C, "DG indicator profile
KZUMW(001) type C, "Environmentally rlvt
BSTME(003) type C, "Order unit
VABME(001) type C,
EKGRP(003) type C, "Purchasing group
XCHPF(001) type C, "Batch management
EKWSL(004) type C, "Purchasing key value
WEBAZ(003) type C, "GR processing time
MFRPN(040) type C, "Manufacturer part number
MFRNR(010) type C, "Manufacturer number
VPRSV(001) type C, "Price control indicator
STPRS(015) type C, "Standard price
BWPRH(014) type C, "Commercial price1
end of LSMW_MATERIAL_MASTER.
**InternalTable to HOld the Flat File Data
DATA:
BEGIN OF MATERIAL_MASTER OCCURS 0.
INCLUDE STRUCTURE LSMW_MATERIAL_MASTER.
DATA:
END OF MATERIAL_MASTER.
*&--------------------------------------------------------------------*
*& Form upload_data From Presentation Server
*&--------------------------------------------------------------------*
FORM UPLOAD_DATA.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = V_FILE
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X'
* HEADER_LENGTH = 0
* READ_BY_LINE = 'X'
* DAT_MODE = ' '
* CODEPAGE = ' '
* IGNORE_CERR = ABAP_TRUE
* REPLACEMENT = '#'
* IMPORTING
* FILELENGTH =
* HEADER =
TABLES
DATA_TAB = MATERIAL_MASTER
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
NO_AUTHORITY = 6
UNKNOWN_ERROR = 7
BAD_DATA_FORMAT = 8
HEADER_NOT_ALLOWED = 9
SEPARATOR_NOT_ALLOWED = 10
HEADER_TOO_LONG = 11
UNKNOWN_DP_ERROR = 12
ACCESS_DENIED = 13
DP_OUT_OF_MEMORY = 14
DISK_FULL = 15
DP_TIMEOUT = 16
OTHERS = 17
.
IF SY-SUBRC = 0.
DELETE MATERIAL_MASTER INDEX 1.
ENDIF.
ENDFORM. "upload_data
*&--------------------------------------------------------------------*
*& Updating the BGR00 Structure
*&--------------------------------------------------------------------*
FORM CONVERT_0000. " BGR00
**Opening the Data Set to write the data to Application Server
OPEN DATASET C_ZTEST FOR OUTPUT IN TEXT MODE ENCODING DEFAULT
.
MOVE: '0' TO BGR00-STYPE,
'ZTEST' TO BGR00-GROUP,
SY-MANDT TO BGR00-MANDT,
SY-UNAME TO BGR00-USNAM,
'X' TO BGR00-XKEEP,
'/' TO BGR00-NODATA.
*Transefering the Data To the Application Server File
TRANSFER BGR00 TO C_ZTEST.
*Closing the Dataset after Transfer
CLOSE DATASET C_ZTEST.
ENDFORM. "convert_0001
*&--------------------------------------------------------------------*
*& Updating BMM00 Structure
*&--------------------------------------------------------------------*
FORM CONVERT_0002. " BMM00
* --- BMM00-STYPE
BMM00-STYPE = '1'.
* --- BMM00-TCODE
BMM00-TCODE = 'MM01'.
* --- BMM00-MATNR
IF NOT MATERIAL_MASTER-MATNR IS INITIAL.
BMM00-MATNR = MATERIAL_MASTER-MATNR.
ELSE.
BMM00-MATNR = '/'.
ENDIF.
* --- BMM00-MBRSH
IF NOT MATERIAL_MASTER-MBRSH IS INITIAL.
BMM00-MBRSH = MATERIAL_MASTER-MBRSH.
ELSE.
BMM00-MBRSH = '/'.
ENDIF.
* --- BMM00-MTART
IF NOT MATERIAL_MASTER-MTART IS INITIAL.
BMM00-MTART = MATERIAL_MASTER-MTART.
ELSE.
BMM00-MTART = '/'.
ENDIF.
* --- BMM00-WERKS
IF NOT MATERIAL_MASTER-WERKS IS INITIAL.
BMM00-WERKS = MATERIAL_MASTER-WERKS.
ELSE.
BMM00-WERKS = '/'.
ENDIF.
BMM00-XEIB1 = 'X'. " BMM00-xeib1 = '/'.
BMM00-XEIE1 = 'X'. " BMM00-xeie1 = '/'.
BMM00-XEIK1 = 'X'. " BMM00-xeik1 = '/'.
**Transfer the data to the Application Server File
TRANSFER BMM00 TO C_ZTEST.
ENDFORM. "convert_0002
*&--------------------------------------------------------------------*
*& UPdating BMMH1 Structure
*&--------------------------------------------------------------------*
FORM CONVERT_0003. " BMMH1
* --- BMMH1-STYPE
BMMH1-STYPE = '2'.
* --- BMMH1-MEINS
IF NOT MATERIAL_MASTER-MEINS IS INITIAL.
BMMH1-MEINS = MATERIAL_MASTER-MEINS.
ELSE.
BMMH1-MEINS = '/'.
ENDIF.
* --- BMMH1-MAKTX
IF NOT MATERIAL_MASTER-MAKTX IS INITIAL.
BMMH1-MAKTX = MATERIAL_MASTER-MAKTX.
ELSE.
BMMH1-MAKTX = '/'.
ENDIF.
* --- BMMH1-MATKL
IF NOT MATERIAL_MASTER-MATKL IS INITIAL.
BMMH1-MATKL = MATERIAL_MASTER-MATKL.
ELSE.
BMMH1-MATKL = '/'.
ENDIF.
* --- BMMH1-BISMT
IF NOT MATERIAL_MASTER-BISMT IS INITIAL.
BMMH1-BISMT = MATERIAL_MASTER-BISMT.
ELSE.
BMMH1-BISMT = '/'.
ENDIF.
* --- BMMH1-LABOR
IF NOT MATERIAL_MASTER-LABOR IS INITIAL.
BMMH1-LABOR = MATERIAL_MASTER-LABOR.
ELSE.
BMMH1-LABOR = '/'.
ENDIF.
* --- BMMH1-WRKST
IF NOT MATERIAL_MASTER-WRKST IS INITIAL.
BMMH1-WRKST = MATERIAL_MASTER-WRKST.
ELSE.
BMMH1-WRKST = '/'.
ENDIF.
* --- BMMH1-BRGEW
IF NOT MATERIAL_MASTER-BRGEW IS INITIAL.
BMMH1-BRGEW = MATERIAL_MASTER-BRGEW.
ELSE.
BMMH1-BRGEW = '/'.
ENDIF.
* --- BMMH1-NTGEW
IF NOT MATERIAL_MASTER-NTGEW IS INITIAL.
BMMH1-NTGEW = MATERIAL_MASTER-NTGEW.
ELSE.
BMMH1-NTGEW = '/'.
ENDIF.
* --- BMMH1-GEWEI
IF NOT MATERIAL_MASTER-GEWEI IS INITIAL.
BMMH1-GEWEI = MATERIAL_MASTER-GEWEI.
ELSE.
BMMH1-GEWEI = '/'.
ENDIF.
* --- BMMH1-GROES
IF NOT MATERIAL_MASTER-GROES IS INITIAL.
BMMH1-GROES = MATERIAL_MASTER-GROES.
ELSE.
BMMH1-GROES = '/'.
ENDIF.
* --- BMMH1-SPART
IF NOT MATERIAL_MASTER-SPART IS INITIAL.
BMMH1-SPART = MATERIAL_MASTER-SPART.
ELSE.
BMMH1-SPART = '/'.
ENDIF.
* --- BMMH1-BSTME
IF NOT MATERIAL_MASTER-BSTME IS INITIAL.
BMMH1-BSTME = MATERIAL_MASTER-BSTME.
ELSE.
BMMH1-BSTME = '/'.
ENDIF.
* --- BMMH1-EKWSL
IF NOT MATERIAL_MASTER-EKWSL IS INITIAL.
BMMH1-EKWSL = MATERIAL_MASTER-EKWSL.
ELSE.
BMMH1-EKWSL = '/'.
ENDIF.
* --- BMMH1-EKGRP
IF NOT MATERIAL_MASTER-EKGRP IS INITIAL.
BMMH1-EKGRP = MATERIAL_MASTER-EKGRP.
ELSE.
BMMH1-EKGRP = '/'.
ENDIF.
* --- BMMH1-XCHPF
IF NOT MATERIAL_MASTER-XCHPF IS INITIAL.
BMMH1-XCHPF = MATERIAL_MASTER-XCHPF.
ELSE.
BMMH1-XCHPF = '/'.
ENDIF.
* --- BMMH1-WEBAZ
IF NOT MATERIAL_MASTER-WEBAZ IS INITIAL.
BMMH1-WEBAZ = MATERIAL_MASTER-WEBAZ.
ELSE.
BMMH1-WEBAZ = '/'.
ENDIF.
IF NOT MATERIAL_MASTER-DISMM IS INITIAL.
BMMH1-DISMM = MATERIAL_MASTER-DISMM.
ELSE.
BMMH1-DISMM = '/'.
ENDIF.
* --- BMMH1-VPRSV
IF NOT MATERIAL_MASTER-VPRSV IS INITIAL.
BMMH1-VPRSV = MATERIAL_MASTER-VPRSV.
ELSE.
BMMH1-VPRSV = '/'.
ENDIF.
BMMH1-VERPR = '/'.
* --- BMMH1-STPRS
IF NOT MATERIAL_MASTER-STPRS IS INITIAL.
BMMH1-STPRS = MATERIAL_MASTER-STPRS.
ELSE.
BMMH1-STPRS = '/'.
ENDIF.
* --- BMMH1-BWPRH
IF NOT MATERIAL_MASTER-BWPRH IS INITIAL.
BMMH1-BWPRH = MATERIAL_MASTER-BWPRH.
ELSE.
BMMH1-BWPRH = '/'.
ENDIF.
* --- BMMH1-PRDHA
IF NOT MATERIAL_MASTER-PRDHA IS INITIAL.
BMMH1-PRDHA = MATERIAL_MASTER-PRDHA.
ELSE.
BMMH1-PRDHA = '/'.
ENDIF.
* --- BMMH1-VABME
IF NOT MATERIAL_MASTER-VABME IS INITIAL.
BMMH1-VABME = MATERIAL_MASTER-VABME.
ELSE.
BMMH1-VABME = '/'.
ENDIF.
* --- BMMH1-MAGRV
IF NOT MATERIAL_MASTER-MAGRV IS INITIAL.
BMMH1-MAGRV = MATERIAL_MASTER-MAGRV.
ELSE.
BMMH1-MAGRV = '/'.
ENDIF.
* --- BMMH1-KZUMW
IF NOT MATERIAL_MASTER-KZUMW IS INITIAL.
BMMH1-KZUMW = MATERIAL_MASTER-KZUMW.
ELSE.
BMMH1-KZUMW = '/'.
ENDIF.
* --- BMMH1-MFRNR
IF NOT MATERIAL_MASTER-MFRNR IS INITIAL.
BMMH1-MFRNR = MATERIAL_MASTER-MFRNR.
ELSE.
BMMH1-MFRNR = '/'.
ENDIF.
* --- BMMH1-MFRPN
IF NOT MATERIAL_MASTER-MFRPN IS INITIAL.
BMMH1-MFRPN = MATERIAL_MASTER-MFRPN.
ELSE.
BMMH1-MFRPN = '/'.
ENDIF.
BMMH1-MPROF = '/'.
* --- BMMH1-MSTAE
IF NOT MATERIAL_MASTER-MSTAE IS INITIAL.
BMMH1-MSTAE = MATERIAL_MASTER-MSTAE.
ELSE.
BMMH1-MSTAE = '/'.
ENDIF.
* --- BMMH1-PROFL
IF NOT MATERIAL_MASTER-PROFL IS INITIAL.
BMMH1-PROFL = MATERIAL_MASTER-PROFL.
ELSE.
BMMH1-PROFL = '/'.
ENDIF.
* --- BMMH1-MTPOS_MARA
IF NOT MATERIAL_MASTER-MTPOS_MARA IS INITIAL.
BMMH1-MTPOS_MARA = MATERIAL_MASTER-MTPOS_MARA.
ELSE.
BMMH1-MTPOS_MARA = '/'.
ENDIF.
**Transfer the Data to Application Server File
TRANSFER BMMH1 TO C_ZTEST.
ENDFORM. "convert_0003
*&---------------------------------------------------------------------*
*& Form POPULATE_DATA
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* <--P_BLF text
*----------------------------------------------------------------------*
FORM POPULATE_DATA CHANGING P_BLF.
DATA: L_NUM TYPE I.
DO.
L_NUM = L_NUM + 1.
ASSIGN COMPONENT L_NUM OF STRUCTURE P_BLF TO <F>.
IF SY-SUBRC <> 0.
EXIT.
ENDIF.
MOVE BGR00-NODATA TO <F>.
ENDDO.
ENDFORM. " POPULATE_DATA
‎2006 Jan 06 6:59 AM
HI SB,
1. Declaring in this way,
may have duplicate fields,
hence, the error.
2. The important thing is
WHICH FIELDS, AND IN WHAT SEQUENCE,
does the text file contains ?
3. In that same sequence,
should we delcare the internal table,
for uploading purpose.
Regards,
amit m.
‎2006 Jan 06 7:05 AM
that is where I am getting stuck ... I am using RFBIBL00 and my testfile has the structures of BGR00, BBKPF,BBSEG,BBTAX ... and other way to get my testfile (complete file) to application server
‎2006 Jan 06 7:10 AM
Hi,
1. CG3Z
use the above tcode.
for transferring file from presentation server
to application server.
regards,
amit m.
‎2006 Jan 06 7:14 AM
Hi SB,
in that case you can go for CG3z transaction as suggested by Amit.
mention the path of application server it will upload to application server.
thanks
vijay
‎2006 Jan 06 7:20 AM
Hi Amit ,
even this tcode is tranferring the same amount of data as with my GUI_UPLOAD... I am not getting all the fields of BBSEG table...
‎2006 Jan 06 7:27 AM
Hi again,
1. How is your text file ?
Is it TAB Separated ?
In fact make sure it is TAB Separated.
2. Also make sure there is this TAB field sepaarator
in between the fields of BBSEG
in the text file.
If it is not there, then it will consider
the whole line as ONE FIELD only.
3. It seems to be the problem in the format
of the text file data. Nothing else.
regards,
amit m.
‎2011 Mar 16 4:48 AM