Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

help with table

Former Member
0 Likes
1,514

Hello,

I am not sure what is happening with my program. I have a table

<b> DATA: begin of header_line occurs 0,

line(50) type c,

end of header_line.</b>

I have code

<b>header_line-line = 'Customer '.

append header_line.

header_line-line = 'Company code '.

append header_line.

header_line-line = 'Sales organization '.

append header_line.

header_line-line = 'Distribution channel'.

append header_line.

.

.

.</b>

I fill the header line and append 214 times. when I look at my tab delimited file, It only creates 213 columns. I am not sure why the last column is not printing. I have commented out one of the lines in the middle of the group and the last line prints. I am not sure if there is a limit of columns that can be created or if I need to increase my table. If anyone knows how to correct this, can you please let me know.

thanks in advance for the help.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,425

This might be a logic error in the code you have written for putting it in the file. Can you post the code you have used?

- Guru

17 REPLIES 17
Read only

Former Member
0 Likes
1,426

This might be a logic error in the code you have written for putting it in the file. Can you post the code you have used?

- Guru

Read only

0 Likes
1,425

it is 1366 lines. do you want me to post the entire program or just a certain section

Read only

0 Likes
1,425

just the section where you are copying the table to the file.

- Guru

Read only

0 Likes
1,425

Hi,

Try increasing the table size....but it would b better if u could paste atleast some part of the code.

Regards,

Mukul

Read only

0 Likes
1,425

Guru,

sorry for the confusion but I am still not sure what you are asking for. I have a section when I do the append 214 times. I then call

ALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

filename = l_path

write_field_separator = 'X'

TABLES

<b>fieldnames = header_line</b> data_tab = it_extract_data

I am getting all of the data but just not the headings

Read only

0 Likes
1,425

Mukul,

How do you increase the table size. what do I have to add to the table

DATA: begin of header_line occurs 0,

line(50) type c,

end of header_line.

Read only

0 Likes
1,425

Got your problem. You are not usign the FM correctly.

1. For heading , First you use GUI_DOWNLOAD and pass only the internal table header_line( IT having the header)

2. Then again use GUI_DOWNLOAD for the internal table it_extract_data.

This will work.

- Guru

Reward points for helpful answers

Read only

0 Likes
1,425

Hi Timothy,

Did you check your header_line internal table in debugging before calling the FM 'GUI_DOWNLOAD'? otherwise, comment out fielnames and just use data_tab and check like

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

filename = l_path

write_field_separator = 'X'

TABLES

data_tab = header_line

<b>*fieldnames = header_line</b>

Vivek

Read only

0 Likes
1,425

again sorry for the confusion

my code is

ALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

filename = l_path

write_field_separator = 'X'

TABLES

fieldnames = header_line

data_tab = it_extract_data

whenI bolded the line, I must have screwed up.

should I still call the GUI_DOWNLOAD twice?

Read only

0 Likes
1,425

yes.

First

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

filename = l_path

write_field_separator = 'X'

TABLES

data_tab = header_line.

Second

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

filename = l_path

write_field_separator = 'X'

TABLES

data_tab = it_extract_data.

- Guru

Read only

0 Likes
1,425

I changed my program to call it twice. I did not get any header line at all.

Read only

0 Likes
1,425

Ok do the following check.

1. Have you used the same FM as I mentioned above.

2. If so. Comment out the second FM and execute your program to make sure that the header is downloaed. You can check the file after execution. You should see the header alone. The data will not appear as the code for this is commented.

3. Comment the first Fm and uncomment the second. you shoudl see teh data alone without header.

4. If all the steps above are workign fine then make sure that you are calling the second FM in append mode rather than in overwrite mode.

Perform all these and let me know.

- Guru

Read only

0 Likes
1,425

I think you are calling the function correctly. Do you have 214 columns in it_extract_data?

Rob

Read only

0 Likes
1,425

I commented out the second FM and only processed the header line. I do not have the second FM setup for append. I will check on how to set that up. when the FM processed the header line, it did not put the column headings on one line but instead put in one column. so I have all 214 lines of data. I don't know if this is because we did not use the "fieldnames" parameter.

Read only

0 Likes
1,425

I believe this to be your problem. I ran:


DATA: BEGIN OF itab OCCURS 0,
        f1(10),
        f2(10),
*       f3(10),
      END   OF itab.

DATA: BEGIN OF names OCCURS 0,
        f1(50),
      END   OF names.

names-f1 = '1'.
APPEND names.

names-f1 = '2'.
APPEND names.

names-f1 = '3'.
APPEND names.

itab-f1 = 'A'.
itab-f2 = 'B'.
APPEND itab.

CALL FUNCTION 'GUI_DOWNLOAD'
  EXPORTING
    filename              = 'c:temptestn.dbf'
    write_field_separator = 'X'
  TABLES
    data_tab              = itab
    fieldnames            = names.

And got two columns, but when I uncommented f3 in itab, I got them all.

Rob

Read only

0 Likes
1,425

All,

I looked thru the code again and found that I had a column heading in the middle of the group that should not have been coded. since there were 213 columns of data it must only print 213 column headings. that is why the last one was not printing. I have remove the heading that is in error and everything is working correctly.

I am very sorry for wasting everyone's time on this.

I want to thank all of you for trying to help me figure this out.

Read only

0 Likes
1,425

Please close the thread.

- Guru