Excel attachment contains only 1st row of Internal Table.
Hello,
I have designed a Vendor Ledger report and want to send the same as an excel attachment. I have made use of function module SO_NEW_DOCUMENT_ATT_SEND_API1 wherein I pass the parameters.
The program works perfectly fine as I am receiving email along with the excel attachment. Also, the excel attachment opens without any errors. Also, the alignment of columns and data is perfect.
But the problem is if my internal table is having 10 rows, I get only the first row of the internal table in the excel sheet.
I also put a break point just before calling the function module to send email, I could see that the internal table which contains the attachment is having all 10 rows.
I really don't know what's going wrong in this.
Request you to please help.
Regards,
Danish.
Hi,
Hi this is my code. Also, one thing I found that if i remove the Report Name i.e. "Vendor Ledger" , I get more than 1 row in my excel sheet. I feel there is some problem with the document size attributes.
* Header for exception report
CONCATENATE 'CC' 'Vendor' 'Stat' 'Name' 'Doc.No' 'FY' 'DDate' 'PDate'
'AssNo.' 'Doc.Tp' 'G/L' 'LAmt' 'LCurr' 'DAmt'
'D/C' 'Cl.Doc' 'TaxCd' 'TaxAmt'
INTO it_attachment SEPARATED BY
cl_abap_char_utilities=>horizontal_tab.
CONCATENATE cl_abap_char_utilities=>cr_lf it_attachment INTO it_attachment.
APPEND it_attachment.
* Split Internal table data using horizontal tab.
CLEAR it_main.
LOOP AT it_main.
CLEAR: lc_amt, dc_amt, tax_amt.
lc_amt = it_main-lc_amount.
dc_amt = it_main-amt_doccur.
tax_amt = it_main-w_tax_base.
CONCATENATE it_main-comp_code
it_main-vendor
it_main-status
it_main-name1
it_main-doc_no
it_main-fisc_year
it_main-doc_date
it_main-pstng_date
it_main-alloc_nmbr
it_main-doc_type
it_main-sp_gl_ind
lc_amt
it_main-loc_currcy
dc_amt
it_main-db_cr_ind
it_main-clr_doc_no
it_main-w_tax_code
tax_amt
INTO it_attachment SEPARATED BY
cl_abap_char_utilities=>horizontal_tab.
CONCATENATE cl_abap_char_utilities=>cr_lf it_attachment INTO it_attachment.
APPEND it_attachment.
ENDLOOP.
* Create Mail Body and Attachment.
psubject = 'Vendor Ledger'.
lv_message = 'Dear Sir/Madam,'.
APPEND lv_message TO it_message.
lv_message = ' '.
APPEND lv_message TO it_message.
lv_message = 'Attachment contain Vendor Ledger for Testing.'.
APPEND lv_message TO it_message.
lv_message = ' '.
APPEND lv_message TO it_message.
lv_message = ' '.
APPEND lv_message TO it_message.
lv_message = 'This is a System Generated Mail. Please do not reply.'.
APPEND lv_message TO it_message.
**Perform for populating mail characteristic info
CLEAR gd_doc_data.
* Populate the subject/generic message attributes
gd_doc_data-obj_langu = sy-langu.
READ TABLE it_attachment INDEX w_cnt.
gd_doc_data-doc_size = 1.
gd_doc_data-obj_name = 'Danish'. "'SAPRPT'.
gd_doc_data-obj_descr = psubject.
gd_doc_data-sensitivty = 'F'.
* Describe the body of the message
CLEAR it_packing_list.
REFRESH it_packing_list.
it_packing_list-transf_bin = space.
it_packing_list-head_start = 1.
it_packing_list-head_num = 0.
it_packing_list-body_start = 1.
DESCRIBE TABLE it_message LINES it_packing_list-body_num.
it_packing_list-doc_size = it_packing_list-body_num * 255.
it_packing_list-doc_type = 'RAW'.
APPEND it_packing_list.
**Describe the attachment info
CLEAR it_packing_list.
it_packing_list-transf_bin = 'X'.
it_packing_list-head_start = 1.
it_packing_list-head_num = 1.
it_packing_list-body_start = 1.
DESCRIBE TABLE it_attachment LINES it_packing_list-body_num.
it_packing_list-doc_type = 'XLS'.
it_packing_list-obj_name = 'File'.
it_packing_list-obj_descr = 'File'.
it_packing_list-doc_size = it_packing_list-body_num * 255.
APPEND it_packing_list.
REFRESH it_receivers.
CLEAR it_receivers.
it_receivers-receiver = 'Email Address'.
it_receivers-rec_type = 'U'.
it_receivers-com_type = 'INT'.
APPEND it_receivers.
**Function Module to send mail
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = gd_doc_data
put_in_outbox = 'X'
commit_work = 'X'
TABLES
packing_list = it_packing_list
contents_bin = it_attachment
contents_txt = it_message
receivers = it_receivers
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
OTHERS = 8.
Regards,
Danish.
Similar Messages
-
Determine Number of rows in Internal Table
Hi,
I have defined my internal table as follows:
TYPES : BEGIN OF ABC_KEY,
FIELD1(2) TYPE C,
FIELD2(1) TYPE C,
FIELD3(8) TYPE N,
END OF ABC_KEY.
DATA: itab1 TYPE TABLE OF ABC_KEY
WITH KEY FIELD1,
wa_lines_1 LIKE LINE OF itab1.
How can I retrieve the number of rows in Internal Table?
Thanks.
Regards,
bw_newbieYou can define the number of rows of the internal table using the DESCRIBE itab command .
As the rest have already stated a sample code snippet .
For more info type in DESCRIBE in your prgram and click on (F1) by placing the cursor on DESCRIBE .
You will find more options as to how you can use the DESCRIBE command according to your requirement .
Thanks ,
Hari -
Import only the rows of emp table from Test into emp table of Prod
hi,
Test Instance:
=========
I have a table "emp". I want to take export of it.
Prod Instance:
=========
Table with name "emp" already exists.
I want to import only the rows of emp table from Test Instance into emp table of Prod Instance.
regards,
charanCharan,
Set the import command IGNORE=Y
Importing into Existing Tables
http://download.oracle.com/docs/cd/B19306_01/server.102/b14215/exp_imp.htm#i1023662
Regards,
Hussein -
Hi,
we use the FM SO_NEW_DOCUMENT_ATT_SEND_API1 to send a report as txt attachment. The problem is that the attachment in the email contains only the first character of the origin text. But the atttachment in the transaction SOST has definitely more content (although not all as it should be... but this is another problem)
Has anybody an idea what's wrong? We use ECC6. Before ECC6 we doesn't have that problem.
Thanks and regards, Susanne
Here is the content:
DATA: begin of contents_bin occurs 0, "before ECC6
line(132) type c,
end of contents_bin.
t_contents_bin_soliti1 TYPE TABLE OF solisti1 WITH HEADER LINE. "with ECC6
CLEAR t_pack.
REFRESH t_pack.
* Receiver:
TRANSLATE p_output TO UPPER CASE.
SELECT SINGLE * FROM ypruser INTO w_user
WHERE rusid = p_output.
t_receiver-rec_id = w_user-rusid.
t_receiver-receiver = w_user-email.
t_receiver-rec_type = 'U'.
APPEND t_receiver.
* Document content:
* Attachment content:
CLEAR: wa_len, length, h_len.
DESCRIBE TABLE contents_bin LINES lineno2.
READ TABLE contents_bin INDEX lineno2 INTO wa_len.
length = STRLEN( wa_len ).
obj_descr = w_filename.
t_pack-transf_bin = 'X'.
t_pack-head_start = 1.
t_pack-head_num = 1.
t_pack-body_start = 1.
t_pack-body_num = lineno2.
t_pack-doc_size = ( ( lineno2 - 1 ) * 255 ) + length.
t_pack-doc_type = 'TXT'.
t_pack-obj_name = 'Attachment'.
t_pack-obj_descr = obj_descr.
t_pack-obj_langu = 'E'.
APPEND t_pack.
* Header data (fill table object_header):
object_header = 'WP01_List.txt'.
APPEND object_header.
t_contents_bin_soliti1[] = contents_bin[]. "with ECC6
w_commit_work = 'X'.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = document_data
put_in_outbox = ' '
commit_work = w_commit_work
TABLES
packing_list = t_pack
object_header = object_header
contents_bin = t_contents_bin_soliti1
contents_txt = t_content
receivers = t_receiver
EXCEPTIONSThanks for your very helpful hint. So I saw that I could use the BCS cause we have ECC 6. This is much more easier. The txt attachment was then ok but the format of data was wrong. Finally I used these code line http://wiki.sdn.sap.com/wiki/display/Snippets/SendMailhavingMultipleFilesasAttachmentusingobjectorientedtechnique to solve it.
-
Email Excel attachment with a BOLD row
hi!
My requirement is that data in an internal table should be sent as an attachment in an email. There are a few records in the internal table which needs to be in bold(i have the logic to figure out whichones). I am using the below FM .
CALL FUNCTION 'SO_OBJECT_SEND'
EXPORTING
object_hd_change = wa_object_hd
object_type = 'RAW'
TABLES
objcont = i_text
receivers = i_recv
packing_list = i_packing_list
att_cont = i_att
Does any body have any idea how to bold a few records in the excel attachment?
I appreciate your suggestions.
Thanks,
manasa
Message was edited by:
manasaHi Manasa,
The Code below is for sending Excel attachment in email. Not sure for BOLD...
You can copy and paste the following codes and execute..
Hope this will help you..
TYPE-POOLS: truxs.
DATA t5 LIKE t005t OCCURS 0 WITH HEADER LINE.
START-OF-SELECTION.
SELECT * INTO TABLE t5
FROM t005t
WHERE spras = sy-langu.
DATA wa_data TYPE truxs_t_text_data.
CALL FUNCTION 'SAP_CONVERT_TO_TXT_FORMAT'
EXPORTING
i_line_header = 'X'
TABLES
i_tab_sap_data = t5
CHANGING
i_tab_converted_data = wa_data
EXCEPTIONS
conversion_failed = 1
OTHERS = 2.
DATA stmp(4096) TYPE c.
DATA itmp TYPE i.
LOOP AT wa_data INTO stmp.
itmp = STRLEN( stmp ).
stmp+itmp = cl_abap_char_utilities=>cr_lf.
MODIFY wa_data FROM stmp.
ENDLOOP.
PERFORM send_email.
*& Form send_email
FORM send_email .
DATA docs LIKE docs OCCURS 0 WITH HEADER LINE.
DATA excelsize TYPE i.
DATA excel LIKE solisti1 OCCURS 0 WITH HEADER LINE.
DATA doc LIKE sodocchgi1.
DATA excelln TYPE i.
DATA int_objpack LIKE sopcklsti1 OCCURS 2 WITH HEADER LINE.
DATA int_objhead LIKE solisti1 OCCURS 2 WITH HEADER LINE.
DATA int_objtext LIKE solisti1 OCCURS 0 WITH HEADER LINE.
DATA int_reclist LIKE somlreci1 OCCURS 1 WITH HEADER LINE.
DATA bodyln LIKE sy-tabix.
DATA output_data TYPE ssfcrescl.
excel[] = wa_data[].
excel table sizes
DESCRIBE TABLE excel LINES excelln.
Body Email
int_objtext-line = 'Test Body'.
APPEND int_objtext.
DESCRIBE TABLE int_objtext LINES bodyln.
READ TABLE int_objtext INDEX bodyln.
CLEAR doc.
doc-doc_size = ( bodyln - 1 ) * 255 + STRLEN( int_objtext ).
doc-obj_name = ' '.
doc-sensitivty = 'P'.
doc-proc_syst = sy-sysid.
doc-proc_clint = sy-mandt.
CLEAR: int_objpack, int_objpack[].
int_objpack-transf_bin = ' '.
int_objpack-head_start = 1.
int_objpack-head_num = 0.
int_objpack-body_start = 1.
int_objpack-body_num = bodyln.
int_objpack-doc_type = 'RAW'.
int_objpack-obj_descr = 'Test'.
APPEND int_objpack.
CLEAR: int_objhead, int_objhead[].
int_objhead = 'Attachment'.
APPEND int_objhead.
int_objpack-transf_bin = 'X'.
int_objpack-head_start = 1.
int_objpack-head_num = 0.
int_objpack-body_start = 1.
int_objpack-body_num = excelln.
int_objpack-doc_size = excelsize.
int_objpack-doc_type = 'XLS'.
int_objpack-obj_name = 'excel'.
int_objpack-obj_descr = 'test.xls'. "File name
APPEND int_objpack.
Set Receiver
int_reclist-receiver = 'SAPUSER'.
int_reclist-rec_type = 'B'.
int_reclist-notif_del = 'X'.
int_reclist-notif_read = 'X'.
int_reclist-notif_ndel = 'X'.
int_reclist-express = 'X'.
APPEND int_reclist.
doc-obj_descr = 'Report in Excel'.
Sending Email
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = doc
put_in_outbox = 'X'
commit_work = 'X'
TABLES
packing_list = int_objpack
object_header = int_objhead
contents_bin = excel
contents_txt = int_objtext "Body
receivers = int_reclist
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
OTHERS = 8.
ENDFORM. " send_email
Note:
- If you are using FM SAP_CONVERT_TO_TXT_FORMAT you will not be able to execute this program in the background.
- dont forget to change 'SAPUSER' to your SAP user ID
- you can check the email by using tcode 'SBWP'.
Reward points if this Helps.
Manish -
ALV - How to set selected rows into internal table
Hi all,
I am tying to set with an 'X' flag the selected rows in my ALV using an internal table that contains all rows showed.
More exactly I have tried to follow these steps.
1) I have added the filed SEL (type SEL) to my ALV structure zrt_bo_slabsend and I defined my internal table in this way
DATA: gt_report TYPE STANDARD TABLE OF zrt_bo_slabsend,
gw_report TYPE zrt_bo_slabsend.
2) I have set gw_layo-box_fname = 'SEL' to gw_layo (ALV layout)
Pressing the "delete button" that I have insert on the top of the ALV, I intercept correctly my user command and I call a form (named "delete_lines") where I have this abap code
FORM delete_lines.
DATA: l_subrc LIKE sy-subrc,
lw_grid_settings LIKE lvc_s_glay.
gw_layo-box_fname = 'SEL'.
"set field name to store row selection
gw_layo-edit = 'X'. "makes whole ALV table editable
gw_layo-zebra = 'X'.
gv_repid = sy-repid.
call function 'REUSE_ALV_GRID_DISPLAY_LVC'
exporting
i_callback_program = gv_repid
i_callback_pf_status_set = gc_status
i_callback_user_command = gc_user_command
is_layout_lvc = gw_layo
it_fieldcat_lvc = gw_fkat
i_grid_settings = lw_grid_settings
i_save = 'X'
is_variant = variant
it_events = gt_events
TABLES
t_outtab = gt_report
EXCEPTIONS
program_error = 1
OTHERS = 2.
LOOP AT gt_report ASSIGNING <report> WHERE SEL = 'X'.
DELETE gt_report.
ENDLOOP.
ENDFORM.
I'd like to select many rows in my ALV report, than by pressing the delete button I'd like to see a refresh of my ALV, without the selected rows. I want to save it only at the end of my action, only by pressing the save button.
Any suggestion about the abap code will be well appreciated.
Thanks in advance for your kind help.
Regards.
GiovanniHi Giovanni,
I am using the method:-
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
EXPORTING
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER =
* I_BUFFER_ACTIVE =
I_CALLBACK_PROGRAM = gd_REPID
I_CALLBACK_PF_STATUS_SET = 'UDIT'
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
* I_CALLBACK_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_END_OF_LIST = ' '
* I_STRUCTURE_NAME =
* I_BACKGROUND_ID = ' '
I_GRID_TITLE = 'Mainatin cell entry'
* I_GRID_SETTINGS =
IS_LAYOUT_LVC = GS_LAYOUT
IT_FIELDCAT_LVC = I_FIELDCAT[]
* IT_EXCLUDING =
* IT_SPECIAL_GROUPS_LVC =
* IT_SORT_LVC =
* IT_FILTER_LVC =
* IT_HYPERLINK =
* IS_SEL_HIDE =
I_DEFAULT = 'X'
* I_SAVE = 'X'
* IS_VARIANT =
IT_EVENTS =
IT_EVENT_EXIT =
* IS_PRINT_LVC =
* IS_REPREP_ID_LVC =
I_SCREEN_START_COLUMN = 30
I_SCREEN_START_LINE = 14
I_SCREEN_END_COLUMN = 120
I_SCREEN_END_LINE = 25
* IT_EXCEPT_QINFO_LVC =
* I_HTML_HEIGHT_TOP =
* I_HTML_HEIGHT_END =
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
* ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = IT_ZCP_DEMAND_SYS1
* EXCEPTIONS
* PROGRAM_ERROR = 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.
I have made five buttons on my toolbar (add, delete, save, back, exit).
Kindly tell me how can I catch the sy-ucomm of these buttons.
NOTE: this FM is written inside an user-exit, so I cannot make forms.
Thanks in advance. -
How to add a row in internal table at first row
Hi All,
I need to add a row in an internal table which already has some contents.I want to add this row in the first row.
Please advice.
Thanks in advance.You mean - you want to replace the 1st record in the internal table. or you want to sum the new values to the existed record.
If you want to replace - then you can use as
read table itab index 1.
if sy-subrc = 0.
itab-f1 = 'new value'.
modify itab index sy-tabix.
endif.
Regards,
Satya -
How to add a group of rows in internal table
Hi champs,
I have some requirement.
I have one internal table which contain 4 columns .out of which 3 has some numeric value and first has some letters e.g A ,B,C etc.
Now suppose i have 20 rows in itab in which 10 are A 5 are B and 5 are C .Now as column 3 has numeric values i need to get the total of column 3 for all A ,B and C .
How to solve this problem.Please guid me.
thanks in advance
JhonHi,
Check the following code:
DATA: BEGIN OF LINE,
COL1 TYPE C,
COL2 TYPE I,
COL3 TYPE I,
END OF LINE.
DATA ITAB LIKE HASHED TABLE OF LINE
WITH UNIQUE KEY COL1 COL2.
LINE-COL1 = 'A'.
DO 3 TIMES.
LINE-COL2 = SY-INDEX.
LINE-COL3 = SY-INDEX ** 2.
INSERT LINE INTO TABLE ITAB.
ENDDO.
LINE-COL1 = 'B'.
DO 3 TIMES.
LINE-COL2 = 2 * SY-INDEX.
LINE-COL3 = ( 2 * SY-INDEX ) ** 2.
INSERT LINE INTO TABLE ITAB.
ENDDO.
SORT ITAB.
LOOP AT ITAB INTO LINE.
WRITE: / LINE-COL1, LINE-COL2, LINE-COL3.
AT END OF COL1.
SUM.
ULINE.
WRITE: / LINE-COL1, LINE-COL2, LINE-COL3.
SKIP.
ENDAT.
AT LAST.
SUM.
ULINE.
WRITE: / LINE-COL1, LINE-COL2, LINE-COL3.
ENDAT.
ENDLOOP.
Regards,
Bhaskar -
How to convert rows of internal table to columns of another internal table?
Hi,
Experts,
test_data.xls:
one two three four five
one two three four
one two three
one two
one
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
FILENAME = 'c:/test_data.xls'
I_BEGIN_COL = '1'
I_BEGIN_ROW = '1'
I_END_COL = '10'
I_END_ROW = '10'
TABLES
INTERN = it_tab
EXCEPTIONS
INCONSISTENT_PARAMETERS = 1
UPLOAD_OLE = 2
OTHERS = 3
output:
0001 0001 one
0001 0002 two
0001 0003 three
0001 0004 four
0001 0005 five
0002 0001 one
0002 0002 two
0002 0003 three
0002 0004 four
0003 0001 one
0003 0002 two
0003 0003 three
0004 0001 one
0004 0002 two
0005 0001 one
but i want this format:
one two three four five
one two three four
one two three
one two
one
i don't want this type of output display i want to display in ABAP report as in file format how can i achieve this post some ideas on it.
Thank U,
Shabeer ahmed.Hi,
Use this piece of code :
parameters: p_flname type rlgrap-filename.
data:
li_filecontent type standard table of alsmex_tabline ,
lwa_filecontent type alsmex_tabline ,
lv_begin_col type i value 1,
lv_begin_row type i value 1,
lv_end_col type i value 17,
lv_end_row type i value 65000,
li_fieldlist type lvc_t_fcat,
li_data type ref to data,
dy_line type ref to data.
field-symbols:<dyntable> type standard table,
<fs_data> type ref to data,
<fs_1>,
<dyn_wa>,
<dyn_field>.
*Transfer excel file contents to internal table
call function 'ALSM_EXCEL_TO_INTERNAL_TABLE'
exporting
filename = p_flname
i_begin_col = lv_begin_col
i_begin_row = lv_begin_row
i_end_col = lv_end_col
i_end_row = lv_end_row
tables
intern = li_filecontent
exceptions
inconsistent_parameters = 1
upload_ole = 2
error_message = 3
others = 4.
if sy-subrc = 0.
*Creating the list of fields in the table
perform f_create_tab_field tables li_fieldlist using 'BUKRS' 4 .
perform f_create_tab_field tables li_fieldlist using 'ZPOC_KUNNR' 10 .
perform f_create_tab_field tables li_fieldlist using 'RANL' 13.
perform f_create_tab_field tables li_fieldlist using 'ZPEDAT' 10 .
perform f_create_tab_field tables li_fieldlist using 'KWERT' 15 .
perform f_create_tab_field tables li_fieldlist using 'BONUS' 2 .
perform f_create_tab_field tables li_fieldlist using 'WAERS' 5 .
perform f_create_tab_field tables li_fieldlist using 'ZVAL' 15 .
perform f_create_tab_field tables li_fieldlist using 'ZQTY' 15 .
perform f_create_tab_field tables li_fieldlist using 'KMEIN' 3 .
assign li_data to <fs_data>.
*CREATING INTERNAL TABLE TO store data
call method cl_alv_table_create=>create_dynamic_table
exporting
it_fieldcatalog = li_fieldlist
importing
ep_table = <fs_data>
exceptions
generate_subpool_dir_full = 1
others = 2.
if sy-subrc = 0.
assign <fs_data>->* to <fs_1>.
assign <fs_1> to <dyntable>.
Create dynamic work area and assign to FS
create data dy_line like line of <dyntable>. " creating a line type of the table just created above
assign dy_line->* to <dyn_wa>. " creating the work area with reference to the line type
loop at li_filecontent into lwa_filecontent.
assign component lwa_filecontent-col "accessing corresponding field in the field catalog
of structure <dyn_wa> to <dyn_field>. "and assigning this field to a field symbol
if sy-subrc = 0.
<dyn_field> = lwa_filecontent-value. " filling value for this field
endif.
at end of row.
append <dyn_wa> to <dyntable>.
clear <dyn_wa>.
endat.
clear lwa_filecontent.
endloop.
i_input_file[] = <dyntable>.
endif.
elseif sy-subrc <> 0.
message s027 display like c_error with text-001.
stop.
endif.
form f_create_tab_field tables p_li_fieldlist structure lvc_s_fcat
using p_fname
p_lenght.
data:lwa_fieldlist type lvc_s_fcat.
lwa_fieldlist-fieldname = p_fname.
lwa_fieldlist-intlen = p_lenght.
append lwa_fieldlist to p_li_fieldlist.
clear lwa_fieldlist.
endform. " F_CREATE_TAB_FIELD
Regards,
Dev. -
Regarding Select query to select only 1000 records in Internal Table.
Hello Friends,
Please explain me to how to Select only 1000 records from data base table?
For Example
SELECT * INTO TABLE ITAB OR SELECT * INTO ITAB
FROM EKKO FROM EKKO
WHERE EBLEN IN S_EBLEN. WHERE EBLEN IN S_EBLEN
(Currently i am using) UP TO 1000 ROWS.
ENDSELECT. (I do not want to use)
In this case Internal table may be store more then 1000 records. But i want to select first 1000 records.
Please explain me.
Regards
AmitHi,
TABLES : ekko.
selection-screen begin of block b1 with frame title text_t01.
SELECT-OPTIONS: S_EBELN for ekko-EBELN.
selection-screen end of block b1.
DATA itab TYPE STANDARD TABLE OF ekko.
SELECT *
FROM ekko
INTO TABLE itab
UP TO 1000 ROWS
WHERE EBELN IN S_EBELN.
Thanks,
Sri. -
How to upload all excel files data from one folder into internal table.
Dear All,
I have one requirement, It is like I want to upload the frontend file data into my internal table, But here my scenario is;
If I have one folder ( Called : Temp) in my frontend system, in this folder ( Called : Temp) I have 100 excel files. In each excel file I have some 1000u2019s of entries. All these data of every file I want to take into my internal table.
If I have one file I can go for, CALL METHOD cl_gui_frontend_services=>file_open_dialog and then upload method to upload. But I want to take all these excel files from that folder at a time, is there any class or any thing is there..? plz help..
Thanks...
Edited by: satishsuri on Jan 11, 2011 9:33 AMHi satishsuri ,
You will have to use 3 methods together :
CALL METHOD cl_gui_frontend_services=>directory_browse "Browse the Directory
CALL METHOD cl_gui_frontend_services=>directory_list_files "Get all the files from the directory
CALL METHOD cl_gui_frontend_services=>gui_upload "Upload each file in a loop
Example:
TYPES: BEGIN OF ty_data,
line TYPE string,
END OF ty_data.
DATA: str_file TYPE string,
str_dir TYPE string,
it_file_table TYPE STANDARD TABLE OF file_info,
wa_file_table TYPE file_info,
v_count TYPE i,
it_data TYPE STANDARD TABLE OF ty_data,
wa_data TYPE ty_data.
CALL METHOD cl_gui_frontend_services=>directory_browse
CHANGING
selected_folder = str_dir.
CALL METHOD cl_gui_frontend_services=>directory_list_files
EXPORTING
directory = str_dir
CHANGING
file_table = it_file_table
count = v_count.
LOOP AT it_file_table INTO wa_file_table.
CONCATENATE str_dir wa_file_table-filename INTO str_file SEPARATED BY '\'.
CALL METHOD cl_gui_frontend_services=>gui_upload
EXPORTING
filename = str_file
filetype = 'ASC'
CHANGING
data_tab = it_data.
LOOP AT it_data INTO wa_data.
WRITE : / wa_data-line.
ENDLOOP.
ULINE.
ENDLOOP.
Regards,
Jovito -
Grouping of two rows of internal table
Hi all,
I am having a requirement in which I want to group two rows of an internal table and assign a pointer to the two rows.
This pointer variable will then be passed to ALV.
Help reqd.
regards.Hi Gaurav,
Hope the below code helps:
TYPES :BEGIN OF TY_ITAB2,
DATA(400),
END OF TY_ITAB2.
DATA: ITAB3 TYPE TY_ITAB2 OCCURS 0 WITH HEADER LINE
Loop at itab1.
ITAB3-DATA = ITAB1-LABEL.
APPEND ITAB3.
ITAB3-DATA = ITAB1-MATNR.
APPEND ITAB3.
endloop.
or
You can create a deep internal table. You can declare one Column as an internal table and store the NOTES in that Internal table for each row.
http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb366d358411d1829f0000e829fbfe/content.htm
you can check the example in the link
Kindly Reward Points If You Find The Reply Helpful.
Cheers,
Chaitanya. -
Grouping of rows of internal table.
Hi all,
I am having a requirement in which I want to group two rows of an internal table and assign a pointer to the two rows.
This pointer variable will then be passed to ALV.
Help reqd.
regards.hi,
AT - itab:
push F1 to look at the documentation for grouping
then assign the value to a field-symbol. -
Get Multiple Rows into internal Table using Webdynpro Alv Display ..
Hi guys ,
I need to find out the logic for getting all the selected rows into the internal table.
When i display the ALV Output on webdypro screen .
USer Selects multiple rows for further processing ..
Ineed to get all the rows selected by user into an internal table .
Please let me know how to achive this ...
Thanks in advance for quick reply
Regards
Saurabh GoelHi,
You need to use the method GET_SELECTED of IF_WD_CONTEXT_NODE to get the rows selected. Also ccheck for the paramters of that method, this retruns the element set.
This meets your requirement.
Regards,
Lekha. -
Looping the same answer from the 1st row in the table
I have a database with 3 tables: (1) employeeTable (2) cityTable (3)stateTable.
I reference the employee's city name and state code by each id number from the cityTable and stateTable.
My Employee table has about 10 records, 3 has an idcity and idstate input, the rest are blank.
(1st row) id 9 for Henderson, id 28 for NV (6th row) id 9 for Henderson, id 28 for NV, and (10th row) id 10 for Las Vegas, id 28 for NV
I run a query:
<cfquery datasource="dsnName" name="qEmployees">SELECT * FROM users ORDER BY lastName ASC</cfquery>
<cfquery datasource="dsnName" name="qState">SELECT code FROM states WHERE idstate=#qEmployees.idstate#</cfquery>
<cfquery datasource="dsnName" name="qCity">SELECT name FROM cities WHERE idcities=#qEmployees.idcity#</cfquery>
a run the table output:
<table>
<cfoutput query="qEmployees">
<tr>
<td>#qEmployees.lastName#, #qEmployees.firstName#</td>
<td>#qCity.name#</td>
<td width="40">#qState.code#</td>
<td width="60">#qEmployees.zipCode#</td>
</tr>
</cfoutput>
</table>
PROBLEM:
All 10 records output in the table as the same answer from the 1st row (Henderson, NV).
What's making this loop having the same answer from the 1st row and affects all the rows with blank info or different info?
I've been trying to figure this out for weeks and I hope the community can help me out. Thanks!As Dan rightly says, take a look into table joins; there's no point just giving you the answer as you'll just get stuck next time and these forums are to help people rather than to do their jobs for them.
What you're looking to do is a relatively simple join, so you shouldn't have to read up for long before you've mastered them. Plus your site will be significantly more efficient
Maybe you are looking for
-
BED value not appearing in J1IIN
Hi Experts, Currently I am into an implementation project and I am configuring CIN.My tax procedure is TAXINN. But after doing all the configuration, while doing J1IIN, BED value in invoice is not appearing in BED field (J1IIN Screen). However Edu Ce
-
New iPod touch stuck in charging mode
I just opened my iPod 5th gen, and I tried to charge it, but it just stays on the "charging" icon. And when it's not plugged in, it goes black. What do I do?
-
I matained master data by manual input,but in the query,I set a characteristic as a row,and several key figure as columns.The result are only key figures displayed,characteristic was empty.Why?Thanks for hints.
-
Cannout Mount NTFS volume, any help appreciated
Output of fdisk -l: Disk /dev/sdd: 16.2 GB, 16236150784 bytes, 31711232 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x713c9f02
-
Migrating Stickies content and Safari Reading List from Snow Leopard to Mavericks
I am about to upgrade from Snow Leopard to Mavericks but am concerned about maintaining the integrity of two collections of important material: the contents of hundreds of Stickies notes, and the collection of Reading List bookmarks in Safari. I want