‎2007 Apr 12 6:22 AM
Hi,
I am declaring an internal table using INCLUDE structure say MARA.On inclusion the internal table structure will include 'MANDT' field also.
Now I need to remove this MANDT column from internal table in the program.
Can we alter the structure of this internal table by removing any column at run time.!!
Please suggest.
Thanks,
Vipin
‎2007 Apr 12 6:28 AM
Hi.....
Just see this link...
it helps you a lot......
http://www.saptechnical.com/Tutorials/ABAP/DynamicInternaltable/DynamicInternalTable.htm
Reward points if useful......
Suresh.....
‎2007 Apr 12 6:31 AM
hi Vipin,
as per my understanding, it is not possible to delete it at runtime.
just try not to use that field at all while u r using that table for output.
i think it won't effect your output.
Please let me know the exact prob. ur getting while populating that internal table.
Regards
Praveen
‎2007 Apr 12 6:39 AM
Hi Praveen,
Actually after declaration I am uploading an excel file which doesn't contain this MANDT but contain all other fields . Now If i upload data will come into internal table in wrong sequence.
Therefore I need to exclude this MANDT field at runtime.Also It will help to write
a fine pretty good readable program.
Hope you got the problem.
Regards
Vipin
‎2007 Apr 12 6:47 AM
hi Vipin,
i feel u shud proceed like this:
just upload the file and after uploading it into file_tab, just populate it by truncating MANDT field.
t_file-field1 = file_tab-field1+0(3).
t_file-field2 = file_tab-field1+x(y)..
Try this way and let me know..
‎2007 Apr 12 6:53 AM
Hi,
I am using WS_UPLOAD function to upload file contents to internal table.
Thanks
Vipin
‎2007 Apr 12 6:57 AM
Hi,
Try this:
1. Do not use Include structure to delcare structure of itab use field list instead.
OR
2. if u dont want as above then , In excel add first column as MANDT, Upload excel, run following loop.
loop at itab.
itab-mandt =sy-mandt.
modify itab.
endloop.
Hope these are two best options for you.
Reward if helpful.
Jogdand M B
‎2007 Apr 12 7:00 AM
data: begin of file_tab.
include structure mara.
data: end of file_tab.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
CODEPAGE = ' '
FILENAME = ' '
FILETYPE = 'ASC'
HEADLEN = ' '
LINE_EXIT = ' '
TRUNCLEN = ' '
USER_FORM = ' '
USER_PROG = ' '
DAT_D_FORMAT = ' '
IMPORTING
FILELENGTH =
TABLES
data_tab = file_tab.
EXCEPTIONS
CONVERSION_ERROR = 1
FILE_OPEN_ERROR = 2
FILE_READ_ERROR = 3
INVALID_TYPE = 4
NO_BATCH = 5
UNKNOWN_ERROR = 6
INVALID_TABLE_WIDTH = 7
GUI_REFUSE_FILETRANSFER = 8
CUSTOMER_ERROR = 9
OTHERS = 10
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
now populate your desired table this way:
outtab-field1 = file-tab+3(x)....
try this way....
‎2007 Apr 12 6:38 AM
Hi,
That's why there are different means of declaring an internal Table;
So if you don't want MANDT field then deon't declare using Include structure,
We use this type of declation generally when we try to modify the table from an internal table.
Declare the internal table other way.
and why do you need all the table fields first up all?
So depending on our requirement we should use correct type of declaration of internal tables.
reward if useful
regards,
ANJI
‎2007 Apr 12 7:14 AM
Hi,
for that u have to create internal table with out using include structure.or enter 3 spaces in the flat file.
to create a structure follow these steps.go to se38.
press pattern->structured data object(radio button)->with fields from structure(radio button)->enter database table and press enter
select all check boxes except MANDT.AND PRESS COPY.it will ask u for structured data object.give the name with which u want to crete an internal table and press enter.
rgds,
bharat.