Problem in declaring internal table
hai experts ,
i am new to web dynpro abap .. my problem is i want to declare a internal table for a table using the web dynpro code wizard .. i found many threads regarding that .. but for mee its not working .. many of them posted that get_static_attributes_table method will solve the problem .. but i used the method in the wizard but it saying that method does not exist ..pls solve the problem ..
say where to enter the method in the wizard ..
thanks & kind regards
chinnaiya
Hi Chinnaiya,
Your post isnt that clear as to what you intend to do. Do you intend to just create an internal table declaration which would be able to hold your context nodes data or do you wish to use the get_static_attributes method to fetch all your tables data into this internal table?
If you want to just declare an internal table which can hold the data then you would have to do it manually. You can't generate your internal table declaration using the code wizard. Suppose your context nodes name is SFLIGHT then you can use the below syntax to declare a table & work area respectively.
DATA: lt_sflight TYPE wd_this->elements_sflight, " Internal table
wa_sflight TYPE wd_this->element_sflight. " Work area
For each node <node> of a controller context, a structure type element_<node> is implicitly generated in the interface IF_<ctrl>. The structure fields correspond to the attributes a node element consists of. Similarly for each node <node> of a controller context, a standard table type elements_<node> is implicitly generated in the interface IF_<ctrl>. The line type of this table is element_<node>. This constant can be used to
type an internal table that can hold the attributes of multiple node elements. So as how said here you can even declare the work area and internal table like shown below in your MAIN view:
DATA: lt_sflight TYPE if_main=>elements_sflight, " internal table
wa_sflight TYPE if_main=>element_sflight. " work area
But the disadvantage of this approach as how pointed out by Thomas in 1 of this earlier threads is that this coding works fine only for this particular view. If you copy the same code and try to use it in another view say VIEW1 then it wouldn't work as the interface name would have changed from if_main to if_view1. So its suggested to use the earlier approach.
Regards,
Uday
Similar Messages
-
Problem in processing internal table
Hi All,
Im facing some problem with an internal table with header.
This is Xvbkd with heaer line.
Header 100 0000000049 000010 EXW China
1 100 0000000049 000000 CIF HK
2 100 0000000049 000010 CIF HK
3 100 0000000049 000020 CIF HK
Now I want modify the internal table of 2nd record. The data above has modified in the header.but not reflected in the body.
Here is my code:
SELECT SINGLE inco1 inco2
INTO (knvv-inco1, knvv-inco2)
FROM knvv
WHERE kunnr EQ w_shipto
AND vkorg EQ vbak-vkorg
AND vtweg EQ vbak-vtweg
AND spart EQ vbak-spart.
IF sy-subrc EQ 0 AND
knvv-inco1 NE space or
knvv-inco2 NE space.
MOVE: knvv-inco1 TO wa_xvbkd-inco1,
knvv-inco2 TO wa_xvbkd-inco2.
READ table xvbkd with key vbeln = xvbap-vbeln
posnr = xvbap-posnr.
IF sy-subrc = 0.
xvbkd-inco1 = wa_xvbkd-inco1.
xvbkd-inco2 = wa_xvbkd-inco2.
modify table xvbkd from wa_xvbkd transporting inco1 inco2.
endif.
ENDIF.
Requirement: is the 2nd record(item 10) in above internal table has to reflect the change with EXW and China.
Pls help me with ur valuable suggestions.
Regards,
Priyatry,
SELECT SINGLE inco1 inco2
INTO (knvv-inco1, knvv-inco2)
FROM knvv
WHERE kunnr EQ w_shipto
AND vkorg EQ vbak-vkorg
AND vtweg EQ vbak-vtweg
AND spart EQ vbak-spart.
IF sy-subrc EQ 0 AND
knvv-inco1 NE space or
knvv-inco2 NE space.
MOVE: knvv-inco1 TO xvbkd-inco1,
knvv-inco2 TO xvbkd-inco2.
READ table xvbkd with key vbeln = xvbap-vbeln
posnr = xvbap-posnr.
IF sy-subrc = 0.
modify xvbkd index sy-tabix.
endif.
ENDIF.
Regards,
John
Edited by: jvanpelt on Jul 16, 2010 9:36 AM -
Simple command to refresh data of all declared internal tables & variables!
Hi All,
I have declared many internal tables & variables in my program in declaration include.
Is there any Simple command which can refresh data of all declared internal tables & variables!
Instead of clearing & refreshing each i.table & variable i want to use single command to refresh data.
Is this possible!
Thanks in advance.
Thanks,
Deep.CLEAR: lv_field1,
lv_field2,
lt_itab1[],
lt_itab2[].
ONE simple command (CLEAR), can initialize fields, workareas, field-symbols,.... and internal tables. -
why do we declare internal tables in this way
TYPES: BEGIN OF ty_t501t,
END OF ty_t501t.
DATA: gt_list1 TYPE STANDARD TABLE OF ty_list1,
why not this
DATA: BEGIN OF ITAB OCCURS 0,
END OF ITAB.Hi,
Declaring internal table with a header line decreases performance.
Its better to have internal table without header line and a work area to work with it.
Its improves performance.
Also wen u work with internal table with header line it creates confusion that whether ur working with the header line or body of the internal table.
Also declaring internal table with header line is obsolete one.
LOOP AT ITAB----
>Working with header line.(Confusion whether ur referring header or body of internal table)
LOOP AT ITAB INTO WA------>Working with internal table widout header line and an work area
Regards,
Lakshman.
Edited by: Lakshman N on Aug 14, 2009 7:25 AM -
HR abap : how to declare internal table to fetch data from 0585 infotype
Hi all ,
I am able to fetch the data from pa0585 infotype for set of employee no , but the problem is as the fields in pa0585 (like Contr to ULIP , NSC , Medical Treatment,Contribution to Certain Pension Funds so on ..) will be changed dynamically and will be displayed based on the amount value in descending order iam not able to store the values of the fileds into internal table . I dont understand how to declare the internal table ..Please help in if u have solved this kind of problem.
I shld get the output in this way ...
Emp No Name Medical treatment Contr to ULIP ....... so on
101 abc 10000 150000 .......so on
102 xyz 12000 150000 .......so on
My header shld be fixed and I shld display values in this way .... I can use write statement to display directly .
Thanks ....Hi
Decalre INFOTYPE
Goto SE37 - Find FM -
READINFOTYPE* -
How to declare internal table in SMARTFORM
Hi experts,
I have an Internal table in my program and I want to declare in the smartform as well. How and where can I declare? Should I use global definitions and tpyes tab? How can I pass the content of the internal table to the smartform?Click Global Defiitions
In TYPES :
TYPES : BEGIN OF gty_add,
name1 TYPE ad_name1, " name1
city1 TYPE ad_city1, " City
country TYPE adrc-country, "Coutnry
post_code1 TYPE ad_pstcd1, " post code
street TYPE ad_street, " street
house_num1 TYPE ad_hsnm1, " house number
tel_number TYPE ad_tlnmbr1," tele number
END OF gty_add.
In Global DATA
GT_ADD TYPE TABLE OF GTY_ADD ( Internal table)
WA_ADD TYPE GTY_ADD ( work area) -
Problem creating an internal table dynamically
Hi,
I'm trying to create an internal table dynamically as i would be able to determine the structure of the table based on the user input.
I've used the sample code from this forum ...
REPORT ZRICH_0003 .
type-pools: slis.
field-symbols: <dyn_table> type standard table,
<dyn_wa>,
<dyn_field>.
data: alv_fldcat type slis_t_fieldcat_alv,
it_fldcat type lvc_t_fcat.
type-pools : abap.
data : it_details type abap_compdescr_tab,
wa_details type abap_compdescr.
data : ref_descr type ref to cl_abap_structdescr.
data: new_table type ref to data,
new_line type ref to data,
wa_it_fldcat type lvc_s_fcat.
selection-screen begin of block b1 with frame title text.
parameters: p_table(30) type c.
selection-screen end of block b1.
Get the structure of the table.
ref_descr ?= cl_abap_typedescr=>describe_by_name( p_table ).
it_details[] = ref_descr->components[].
loop at it_details into wa_details.
clear wa_it_fldcat.
wa_it_fldcat-fieldname = wa_details-name .
wa_it_fldcat-datatype = wa_details-type_kind.
wa_it_fldcat-inttype = wa_details-type_kind.
wa_it_fldcat-intlen = wa_details-length.
wa_it_fldcat-decimals = wa_details-decimals.
append wa_it_fldcat to it_fldcat .
endloop.
Create dynamic internal table and assign to FS
call method cl_alv_table_create=>create_dynamic_table
exporting
it_fieldcatalog = it_fldcat
importing
ep_table = new_table.
assign new_table->* to <dyn_table>.
Create dynamic work area and assign to FS
create data new_line like line of <dyn_table>.
assign new_line->* to <dyn_wa>.
<b>* Select Data from table.
select * into table <dyn_table> from
(p_table).</b>
Write out data from table.
loop at <dyn_table> into <dyn_wa>.
do.
assign component sy-index of structure <dyn_wa> to <dyn_field>.
if sy-subrc <> 0.
exit.
endif.
if sy-index = 1.
write:/ <dyn_field>.
else.
write: <dyn_field>.
endif.
enddo.
endloop.
I'm able to get the structure of the table that i want, but when i'm trying to select data from the table into this internal table..as highlighted in the sample code above..i'm getting a short dump...saying that ' the database table is 600 bytes wide but the internal table is only 576 bytes wide.
The internal table is declared as
field-symbols: <dyn_table> type standard table..
Could anyone please tell me how to rectify this.
Thanks in advance,
Harsha.Hi Smitha,
I'm building the internal table by getting the structure using the method
cl_abap_typedescr=>describe_by_name( p_table ).
where p_table is the table name determined dynamically..
Now using this structure, i'm building an internal table by calling the method
call method cl_alv_table_create=>create_dynamic_table
I've checked all the fields after the internal table has been created .. and it contains all the fields of the table that i'm supplying initially..
But when i read data into that internal table, it gives me that dump..I've described it in this post earlier.
Any more suggestions would be very helpful.
Thanks,
Harsha -
How to declare internal table in BADI with variable name beginning with 0..
Gurus,
How to declare an internal table within a BADI. I have to implement a BADI UC_TASK_CUSTOM for BCS to BW load and there i have to declare an internal table like:
TYPES: BEGIN OF t_cube_data,
0cs_version TYPE /bi0/oics_version,
0sem_cgcomp TYPE /bi0/oisem_cgcomp,
bcs_vers TYPE /bic/oibcs_vers,
bcs_lcus TYPE /bic/oibcs_lcus,
bcs_ldch TYPE /bic/oibcs_ldch,
bcs_invcom TYPE /bi0/oibcs_invcom,
bcs_litem TYPE /bic/oibcs_litem,
bcs_llob TYPE /bic/oibcs_llob,
bcs_lmay TYPE /bic/oibcs_lmay,
0move_type TYPE /bi0/oimove_type,
pcompany TYPE /bi0/oipcompany,
bcs_lprg TYPE /bic/oibcs_lprg,
figlxref3 TYPE /bic/oifiglxref3,
fiscyear TYPE /bi0/oifiscyear,
fiscper3 TYPE /bi0/oifiscper3,
fiscvarnt TYPE /bi0/oifiscvarnt,
curkey_gc TYPE /bi0/oicurkey_gc,
unit TYPE /bi0/oiunit,
cs_trn_gc TYPE /bi0/oics_trn_gc,
cs_trn_qty TYPE /bi0/oics_trn_qty,
END OF t_cube_data
But with this declaration it gives a error saying that u cannot have a variable beginning with 0...like 0cs_version....
but i have to do it for my functionality to wrk...
Please help me do it....
how can i declare a internal table that allows me to have variable names that start with 0....
Please help....Its URGENT....
Thanks
SamMurali,
I need to have 0 before the variable name in the declaration of the internal table....how can i attain that....
Please suggest...
Thanks
Sam -
Problem in returning internal table from FM in ABAP Objects
Hi All,
I have to return an internal table from one of the FM i created in the controller class (_IMPL) of a view.
The problem here is, the internal table i m getting here
is of type to a structure!.
but i have to return it as type ref to DATA, which cant be assigned directly.
Now, my question is.. How can i convert ..
internal table type structure
to
internal table type ref to DATA.
Thanks and Regards,
sudeep v d.Hi Sudeep.
Can you see if something like this works for you?
DATA: dref type ref to DATA.
FIELD-SYMBOL: <fs> type ANY.
LOOP AT <internaltable> INTO <structure>
ASSIGN "<component_name>" component of <structure> TO <fs>
CREATE DATA dref type <structure>.
dref->* = <fs>.
ENDLOOP. -
Problem in displaying internal table contents to excel(color)
Hello Gurus!!!!!
The code is given below :-
*& Module pool ZDEMO_DOWNLD1
PROGRAM ZDEMO_DOWNLD1.
*& Module USER_COMMAND_0100 INPUT
text
MODULE USER_COMMAND_0100 INPUT.
DATA : f_name(120) type c,
f_name1(120) type c.
case sy-ucomm.
when 'ATTACH'.
CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
DEF_FILENAME = ' '
DEF_PATH = ' '
MASK = ' '
MODE = ' '
TITLE = ' '
IMPORTING
FILENAME = f_name
RC =
EXCEPTIONS
INV_WINSYS = 1
NO_BATCH = 2
SELECTION_CANCEL = 3
SELECTION_ERROR = 4
OTHERS = 5
*f_name = DEF_FILENAME.
f_name1 = f_name.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
endcase.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Module STATUS_0100 OUTPUT
text
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'xxxxxxxx'.
SET TITLEBAR 'xxx'.
type-pools ole2.
data: h_excel type ole2_object, " Excel object
h_mapl type ole2_object, " list of workbooks
h_map type ole2_object, " workbook
h_zl type ole2_object, " cell
h_f type ole2_object, " font
h_interior type ole2_object. " Color
*tables: spfli.
DATA: ls_emp TYPE zpm_emp_det,
lt_emp TYPE zpm_emp_det OCCURS 0,
l_projectname TYPE zpm_emp_item_det-project_name,
l_projectname_last TYPE zpm_emp_item_det-project_name,
l_empid TYPE zpm_emp_item_det-empid,
l_empid_last TYPE zpm_emp_item_det-empid.
DATA: l_projectname_key TYPE lvc_nkey,
l_role_of_emp_key TYPE lvc_nkey,
l_last_key TYPE lvc_nkey.
DATA : lt_project_main TYPE TABLE OF zsach_pm ,
ls_project_main TYPE zsach_pm,
lt_project TYPE zsach_pm OCCURS 0,
ls_project TYPE zsach_pm.
internal table for excel headings
DATA : BEGIN OF lt_project_ex OCCURS 0,
line(50) TYPE c,
END OF lt_project_ex.
DATA: lt_project1 TYPE zsach_pm OCCURS 0,
ls_project1 TYPE zsach_pm.
DATA : lt_project_temp TYPE zsach_pm OCCURS 0 ,
ls_project_temp TYPE zsach_pm.
DATA: lt_project2 TYPE zsach_pm OCCURS 0,
ls_project2 TYPE zsach_pm.
TYPES: BEGIN OF st_username,
username TYPE zuser_names-username,
END OF st_username.
DATA: it_tab TYPE TABLE OF st_username,
wa_tab TYPE st_username.
data : lt_project_excel like zsach_pm occurs 0 with header line.
*DATA: f_name TYPE string.
data h type i.
table of flights
data: it_spfli like spfli occurs 10 with header line.
*& Event START-OF-SELECTION
SELECT empid
project_name
role_of_emp
competancy
manager
price_category
rate_per_hour
first_day_pro
last_day_pro
ckey
FROM zpm_emp_item_det
INTO CORRESPONDING FIELDS OF TABLE lt_project.
LOOP AT lt_project INTO ls_project.
ENDLOOP.
SELECT projectid project_name client begin_date end_date
FROM zpm_project_det
INTO CORRESPONDING FIELDS OF TABLE lt_project_temp FOR ALL ENTRIES IN lt_project
WHERE project_name = lt_project-project_name.
LOOP AT lt_project_temp INTO ls_project_temp.
MODIFY lt_project FROM ls_project_temp TRANSPORTING
projectid project_name client begin_date end_date
WHERE project_name = ls_project_temp-project_name.
ENDLOOP.
SELECT empid
employee_name
designation
employee_type
date_of_joining
FROM zpm_emp_head_det
INTO CORRESPONDING FIELDS OF TABLE lt_project1 FOR ALL ENTRIES IN lt_project
WHERE empid = lt_project-empid.
LOOP AT lt_project1 INTO ls_project1.
MODIFY lt_project FROM ls_project1 TRANSPORTING
empid
employee_name
designation
employee_type
date_of_joining
WHERE empid = ls_project1-empid.
ENDLOOP.
tell user what is going on
call function 'SAPGUI_PROGRESS_INDICATOR'
exporting
PERCENTAGE = 0
text = text-007
exceptions
others = 1.
start Excel
create object h_excel 'EXCEL.APPLICATION'.
perform err_hdl.
set property of h_excel 'Visible' = 1.
perform err_hdl.
tell user what is going on
call function 'SAPGUI_PROGRESS_INDICATOR'
exporting
PERCENTAGE = 0
text = text-008
exceptions
others = 1.
get list of workbooks, initially empty
call method of h_excel 'Workbooks' = h_mapl.
perform err_hdl.
add a new workbook
call method of h_mapl 'Add' = h_map.
perform err_hdl.
tell user what is going on
call function 'SAPGUI_PROGRESS_INDICATOR'
exporting
PERCENTAGE = 0
text = text-009
exceptions
others = 1.
output column headings to active Excel sheet
perform fill_cell using 1 1 1 'Project ID'(001).
perform fill_cell using 1 2 1 'Emp ID'(002).
perform fill_cell using 1 3 1 'Project Name'(003).
perform fill_cell using 1 4 1 'Client'(004).
perform fill_cell using 1 5 1 'Begin Date'(005).
perform fill_cell using 1 6 1 'End Date'(006).
perform fill_cell using 1 7 1 'Role of Employee'(007).
perform fill_cell using 1 8 1 'Module / Competancy'(008).
perform fill_cell using 1 9 1 'Employee name'(009).
perform fill_cell using 1 10 1 'Price Category'(010).
perform fill_cell using 1 11 1 'Rate P/H'(011).
perform fill_cell using 1 12 1 '1st day in project'(012).
perform fill_cell using 1 13 1 'Last day in project'(013).
perform fill_cell using 1 14 1 'Currency'(014).
perform fill_cell using 1 15 1 'Manager'(015).
perform fill_cell using 1 16 1 'Emp Type'(016).
perform fill_cell using 1 17 1 'Designation'(017).
perform fill_cell using 1 18 1 'Joining Date'(018).
perform fill_cell using 1 19 1 'Last Date'(019).
loop at lt_project into ls_project.
*lt_project_excel[] = lt_project[].
endloop.
copy flights to active EXCEL sheet
h = sy-tabix + 1.
*perform fill_cell1 using h 1 0 ls_project-PROJECTID.
*perform fill_cell1 using h 2 0 ls_project-EMPID.
*perform fill_cell1 using h 3 0 ls_project-PROJECT_NAME.
*perform fill_cell1 using h 4 0 ls_project-client.
*perform fill_cell1 using h 5 0 ls_project-BEGIN_DATE.
*perform fill_cell1 using h 6 0 ls_project-END_DATE.
*perform fill_cell1 using h 7 0 ls_project-ROLE_OF_EMP.
*perform fill_cell1 using h 8 0 ls_project-COMPETANCY.
*perform fill_cell1 using h 9 0 ls_project-EMPLOYEE_NAME.
*perform fill_cell1 using h 10 0 ls_project-PRICE_CATEGORY.
*perform fill_cell1 using h 11 0 ls_project-RATE_PER_HOUR.
*perform fill_cell1 using h 12 0 ls_project-FIRST_DAY_PRO.
*perform fill_cell1 using h 13 0 ls_project-LAST_DAY_PRO.
*perform fill_cell1 using h 14 0 ls_project-CKEY.
*perform fill_cell1 using h 15 0 ls_project-MANAGER.
*perform fill_cell1 using h 16 0 ls_project-EMPLOYEE_TYPE.
*perform fill_cell1 using h 17 0 ls_project-DESIGNATION.
*perform fill_cell1 using h 18 0 ls_project-DATE_OF_JOINING.
*perform fill_cell1 using h 19 0 ls_project-LAST_WORKING_DAT.
perform fill_cell1 using h 1 0 lt_project_excel-PROJECTID.
perform fill_cell1 using h 2 0 lt_project_excel-EMPID.
perform fill_cell1 using h 3 0 lt_project_excel-PROJECT_NAME.
perform fill_cell1 using h 4 0 lt_project_excel-client.
perform fill_cell1 using h 5 0 lt_project_excel-BEGIN_DATE.
perform fill_cell1 using h 6 0 lt_project_excel-END_DATE.
perform fill_cell1 using h 7 0 lt_project_excel-ROLE_OF_EMP.
perform fill_cell1 using h 8 0 lt_project_excel-COMPETANCY.
perform fill_cell1 using h 9 0 lt_project_excel-EMPLOYEE_NAME.
perform fill_cell1 using h 10 0 lt_project_excel-PRICE_CATEGORY.
perform fill_cell1 using h 11 0 lt_project_excel-RATE_PER_HOUR.
perform fill_cell1 using h 12 0 lt_project_excel-FIRST_DAY_PRO.
perform fill_cell1 using h 13 0 lt_project_excel-LAST_DAY_PRO.
perform fill_cell1 using h 14 0 lt_project_excel-CKEY.
perform fill_cell1 using h 15 0 lt_project_excel-MANAGER.
perform fill_cell1 using h 16 0 lt_project_excel-EMPLOYEE_TYPE.
perform fill_cell1 using h 17 0 lt_project_excel-DESIGNATION.
perform fill_cell1 using h 18 0 lt_project_excel-DATE_OF_JOINING.
perform fill_cell1 using h 19 0 lt_project_excel-LAST_WORKING_DAT.
*endloop.
disconnect from Excel
*CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
DOCUMENT_DATA =
PUT_IN_OUTBOX = ' '
SENDER_ADDRESS = SY-UNAME
SENDER_ADDRESS_TYPE = 'B'
COMMIT_WORK = ' '
IMPORTING
SENT_TO_ALL =
NEW_OBJECT_ID =
SENDER_ID =
TABLES
PACKING_LIST =
OBJECT_HEADER =
CONTENTS_BIN =
CONTENTS_TXT =
CONTENTS_HEX =
OBJECT_PARA =
OBJECT_PARB =
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
*IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
*ENDIF.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
free object h_excel.
perform err_hdl.
ENDMODULE. " STATUS_0100 OUTPUT
FORM FILL_CELL *
sets cell at coordinates i,j to value val boldtype bold *
form fill_cell using i j bold val.
call method of h_excel 'Cells' = h_zl exporting #1 = i #2 = j.
perform err_hdl.
set property of h_zl 'Value' = val .
perform err_hdl.
get property of h_zl 'Font' = h_f.
perform err_hdl.
set property of h_f 'Bold' = bold .
perform err_hdl.
SET PROPERTY OF h_f 'ColorIndex' = 11 .
perform err_hdl.
endform.
*& Form fill_cell1
text
-->P_H text
-->P_1 text
-->P_0 text
-->P_IT_SPFLI_CARRID text
form fill_cell1 using i j bold val.
call method of h_excel 'Cells' = h_zl exporting #1 = i #2 = j.
perform err_hdl.
set property of h_zl 'Value' = val .
perform err_hdl.
get property of h_zl 'Font' = h_f.
perform err_hdl.
set property of h_f 'Bold' = bold .
perform err_hdl.
SET PROPERTY OF h_f 'ColorIndex' = 14 .
perform err_hdl.
endform. " fill_cell1
*& Form ERR_HDL
outputs OLE error if any *
--> p1 text
<-- p2 text
form err_hdl.
if sy-subrc <> 0.
write: / 'Error in OLE-Automation:'(010), sy-subrc.
stop.
endif.
endform. " ERR_HDL
Entire excel file is displayed ,but the problem is I want to display the excel file in one shot i.e not <b>line by line</b>
Kindly suggest if there is any keyword or FM to display the contents in excel using internal table.
It should not take much time. Just by executing code , the contents of internal table should be displayed.
Helpful answers will be rewarded
Thanks,
SachinHi Kavitha,
maybe it's not sophisticated enough for your requirement, but I found function XXL_FULL_API easy to use. This will give same functionality as 'download' button in ALV-Grid display.
Regards,
Christian -
Declare Internal Table in Code or in Data Dictionary...Opinions needed?
Is it better to define your internal table and all of its fields in a begin of/end of declaration stmt in your code's data definitions. Or, is it better to create a structure in the Data Dictionary, which means one line of code in your program? Why does one choose the method they prefer?
I am thinking it is best to declare in Data Dictionary, especially since ABAP is now leaning towrds objects. However, I am seeing a lot of field by field definitions in programs. I am very interested in how most programmers accomplish this and why.
Thank-YouI would say that if the internal table is to be used in more than one program, then I would create a structure and/or table type in the ABAP dictionary. If it is to be used in just one program, then I would define it locally.
Regards,
Rich Heilman -
Problem while exporting internal table to memory id using EXPORT
Hi friends,
Iam facing a following problem.
I have 4 line items in my va01 tcode.
now when i give material number and quantity and hit enter the processing for that line item starts.
iam moving that current line item to a internal table lt_vbap in userexit_check_vbap.
now for the 2nd line item also i have to move to internal table lt_vbap.
but my problem is that in internal table lt_vbap iam not getting all the line items.
every time the current line item is being processed the the previous line items are being refreshed.
from lt_vbap internal table.
how can i export internal table.
code
move vbap to lt_vbap.
append lt_vbap.
export lt_vbap to memory id 'ZXYZ'.>
Prakash Pandey wrote:
> Hi Priyanka,
>
> The internal table lt_vbap will always be empty unless you import it from the Memory ID (in your case ZXYX).
>
> Use the code this way:
>
> IMPORT lt_vbap FROM MEMORY ID 'ZXYX'.
>
> move vbap to lt_vbap.
>
> append lt_vbap.
>
> export lt_vbap to memory id 'ZXYZ'.
>
> Regards,
> Prakash Pandey
The memory id shud be same in both cases -
Structure of the context for declaring internal table
Hi,
Can we use the structure of the context for declaring the internal ?
-SidHi Sid,
You can use the above element_ & elements_ notation to define workarea & internal table similar to your context. But the disadvantage of this approach as how pointed out by Thomas in 1 of his earlier threads is that this coding would work fine only for that particular view. If you copy the same code from your view input_view and try to use it in another view say VIEW1 then it wouldn't work as the interface name would have changed from if_input_view to if_view1. So its suggested to use the below approach:
DATA: lt_main TYPE wd_this->elements_node_vbak, " Internal table
wa_main TYPE wd_this->element_node_vbak. " Work area
Try go through this excellent [article|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/60730016-dbba-2a10-8f96-9754a865b814]. It would help you understand what all you need to know about working with the context & its attributes.
Regards,
Uday -
Problem populating an internal table
Hello,
I am having a problem with filling an internal table. I cannot seem to grasp this and I struggle with this in every program. I am attaching pieces of my program so that maybe someone can help me. I have a selection screen that I populate with dates. if the dates are populated, I want to use these dates for the selection. If the dates are initial, I want to read an entry from the TVARV table and populate the dates that will used in the selection. I tried various code statements and I cannot get it to work. i get messages like "is a table without a header line and therefore has no component "LOW" or other messages similar to this. I would like that if the s_udate is populated, I could fill the tvarv table and not have to call the form.
also if anyone has some documentation on working with internal tables without header lines (I think I read in here that internal tables without header lines is the way to go ), could you please include that as well so that I could try to understand how this suppose to work
thanks in advance for the help
TYPES: BEGIN OF ty_tvarv_date,
low TYPE tvarv_val, "start date
high TYPE tvarv_val, "end date
END OF ty_tvarv_date.
TYPES: ty_t_tvarv_date TYPE STANDARD TABLE OF ty_tvarv_date INITIAL SIZE 0,
DATA it_tvarv_date TYPE STANDARD TABLE OF ty_tvarv_date INITIAL SIZE 0.
SELECTION-SCREEN BEGIN OF BLOCK a WITH FRAME TITLE text-001.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 2(22) text-002.
SELECT-OPTIONS s_udate FOR sy-datlo.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK a.
PERFORM select_date_tvarv CHANGING it_tvarv_date.
PERFORM select_data643_mseg USING it_tvarv_date
it_zfi_gl_subcontrk[]
CHANGING it_mseg643.
<b>*******************************************************************</b>
FORM select_date_tvarv CHANGING p1_it_tvarv_date TYPE ty_t_tvarv_date.
IF s_udate IS INITIAL.
SELECT low high
FROM tvarv
INTO TABLE p1_it_tvarv_date
WHERE name EQ 'Z_SUBCONTRK_DATES'.
IF sy-subrc NE 0.
IF sy-batch IS INITIAL.
MESSAGE i899 WITH text-027.
LEAVE LIST-PROCESSING.
ELSE.
MESSAGE e899 WITH text-027.
ENDIF.
ENDIF.
ELSE.
MOVE s_udate to p1_it_tvarv_date.
MOVE s_udate-low(8) to p1_it_tvarv_date-low.
MOVE s_udate-high(8) to p1_it_tvarv_date-high.
ENDIF.
ENDFORM. " FORM SELECT_DATE_TVARV
<b>*******************************************************************</b>
FORM select_data643_mseg USING p1_tvarv_date TYPE ty_t_tvarv_date
p1_zfi_gl_subcontrk TYPE ty_t_zfi_gl_subcontrk
CHANGING p1_it_mseg TYPE ty_t_mseg643.
DATA: wa_tvarv_date type ty_tvarv_date.
READ TABLE p1_tvarv_date INTO wa_tvarv_date INDEX 1.
SELECT abukrs awerks amatnr aerfmg a~erfme
akostl abwart amblnr awempf acharg akzbew algort bbudat
FROM mseg AS a INNER JOIN mkpf AS b ON amblnr EQ bmblnr
AND b~budat <= wa_tvarv_date-high
AND b~budat >= wa_tvarv_date-low
INTO TABLE p1_it_mseg
FOR ALL ENTRIES IN p1_zfi_gl_subcontrk
WHERE a~bukrs EQ p1_zfi_gl_subcontrk-bukrs_from
AND a~werks EQ p1_zfi_gl_subcontrk-werks_from
AND a~wempf EQ p1_zfi_gl_subcontrk-werks_to643
AND a~matnr EQ p1_zfi_gl_subcontrk-matnr
AND a~bwart EQ'643'.
IF sy-subrc NE 0.
IF sy-batch IS INITIAL.
MESSAGE i899 WITH text-027.
LEAVE LIST-PROCESSING.
ELSE.
MESSAGE e899 WITH text-027.
ENDIF.
ENDIF.
ENDFORM. " FORM SELECT_DATA643_MSEGIn tables with header line, you need not define an explicit work area.
System will create a so-called work area, which is called header line.
This header line is like any other work area. the difference is that it can be accessed using internal table name. A record will be by default read into header line in a READ statement.
For ex,
READ TABLE p1_tvarv_date INTO wa_tvarv_date INDEX 1.
Here you used to read the 1st record into wa_tvarv_date.
But after making it table with header line you can use
READ TABLE p1_tvarv_date INDEX 1.
This will move the data to header line and it can be accessed by name p1_tvarv_date.
See the code below.
TYPES: BEGIN OF ty_tvarv_date,
low TYPE tvarv_val, "start date
high TYPE tvarv_val, "end date
END OF ty_tvarv_date.
TYPES: ty_t_tvarv_date TYPE STANDARD TABLE OF ty_tvarv_date INITIAL SIZE 0,
DATA it_tvarv_date TYPE STANDARD TABLE OF ty_tvarv_date <b>WITH HEADER LINE INITIAL</b> SIZE 0.
SELECTION-SCREEN BEGIN OF BLOCK a WITH FRAME TITLE text-001.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 2(22) text-002.
SELECT-OPTIONS s_udate FOR sy-datlo.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK a.
PERFORM select_date_tvarv CHANGING it_tvarv_date.
PERFORM select_data643_mseg USING it_tvarv_date
it_zfi_gl_subcontrk[]
CHANGING it_mseg643.
FORM select_date_tvarv CHANGING p1_it_tvarv_date TYPE ty_t_tvarv_date.
IF s_udate IS INITIAL.
SELECT low high
FROM tvarv
INTO TABLE p1_it_tvarv_date
WHERE name EQ 'Z_SUBCONTRK_DATES'.
IF sy-subrc NE 0.
IF sy-batch IS INITIAL.
MESSAGE i899 WITH text-027.
LEAVE LIST-PROCESSING.
ELSE.
MESSAGE e899 WITH text-027.
ENDIF.
ENDIF.
ELSE.
MOVE s_udate to p1_it_tvarv_date.
MOVE s_udate-low(8) to p1_it_tvarv_date-low.
MOVE s_udate-high(8) to p1_it_tvarv_date-high.
ENDIF.
ENDFORM. " FORM SELECT_DATE_TVARV
FORM select_data643_mseg USING p1_tvarv_date TYPE ty_t_tvarv_date
p1_zfi_gl_subcontrk TYPE ty_t_zfi_gl_subcontrk
CHANGING p1_it_mseg TYPE ty_t_mseg643.
<b>READ TABLE p1_tvarv_date INDEX 1.</b>
SELECT abukrs awerks amatnr aerfmg a~erfme
akostl abwart amblnr awempf acharg akzbew algort bbudat
FROM mseg AS a INNER JOIN mkpf AS b ON amblnr EQ bmblnr
<b>AND b~budat <= p1_tvarv_date-high
AND b~budat >= p1_tvarv_date-low</b>
INTO TABLE p1_it_mseg
FOR ALL ENTRIES IN p1_zfi_gl_subcontrk
WHERE a~bukrs EQ p1_zfi_gl_subcontrk-bukrs_from
AND a~werks EQ p1_zfi_gl_subcontrk-werks_from
AND a~wempf EQ p1_zfi_gl_subcontrk-werks_to643
AND a~matnr EQ p1_zfi_gl_subcontrk-matnr
AND a~bwart EQ'643'.
IF sy-subrc NE 0.
IF sy-batch IS INITIAL.
MESSAGE i899 WITH text-027.
LEAVE LIST-PROCESSING.
ELSE.
MESSAGE e899 WITH text-027.
ENDIF.
ENDIF.
ENDFORM. " FORM SELECT_DATA643_MSEG -
Problem in convering internal table to CSV file
Hi,
Iam converting internal table data to CSV format with the code given below.
LOOP AT it_details_final INTO wa_details_final.
CLEAR : t_attachment.
CONSTANTS : c_sep TYPE c VALUE ','.
CONCATENATE wa_details_final-wf_rectype
wa_details_final-wf_bankn
wa_details_final-wf_znme1
wa_details_final-wf_rzawe
wa_details_final-wf_lifnr
wa_details_final-wf_chect
wa_details_final-wf_rwbtr
wa_details_final-wf_chkladat
cl_abap_char_utilities=>newline
INTO t_attachment SEPARATED BY c_sep.
APPEND t_attachment.
CLEAR t_attachment.
ENDLOOP.
Problem is ,data in one of the fields contain comma ( , ).
So, data after comma is getting shifted to the adjacent cell.
Please help me
Thanks & Regards,
SravanthiHello,
Try this perform
the ignorefields variable is used if you dont want a particular field in the output. You can ignore it for now
DATA: p_ignoredfields(1024).
CONSTANTS : const_sep TYPE c VALUE ','.
* itab to store data ready to be sent to csv file
DATA: BEGIN OF wa_csvdata,
line(4096),
END OF wa_csvdata.
DATA: gt_csvdata LIKE TABLE OF wa_csvdata.
*& Form CONVERT_TO_CSV
* text
FORM convert_to_csv TABLES lt_datatab USING value(p_ignoredfields).
FIELD-SYMBOLS: <wa_datatab> TYPE ANY.
FIELD-SYMBOLS: <wa_field> TYPE ANY.
* character variable incase table fields are of a diff type (ie: int)
DATA: lv_data TYPE string.
* set to X if the no data has been put into the csv workarea
DATA: flag_firstcol TYPE xflag.
* move the structure one character to the right since first char
* is position 0 in SAP
SHIFT p_ignoredfields BY 1 PLACES RIGHT.
REFRESH gt_csvdata.
CLEAR wa_csvdata.
LOOP AT lt_datatab ASSIGNING <wa_datatab>.
flag_firstcol = 'X'.
DO.
* one by one assign each position of the structure to the field
ASSIGN COMPONENT sy-index OF STRUCTURE <wa_datatab> TO <wa_field>.
IF sy-subrc <> 0.
EXIT.
ELSE.
* if the current field needs to be ignored then continue the do loop
IF p_ignoredfields+sy-index(1) = '.'.
CONTINUE.
ENDIF.
* we use lv_data since concatenate fails for integer types
lv_data = <wa_field>.
* remove commas in the data
WHILE sy-subrc = 0.
REPLACE const_sep WITH '' INTO lv_data.
ENDWHILE.
* if this data belongs to the first non ignored column
IF flag_firstcol = 'X'.
wa_csvdata = lv_data.
flag_firstcol = ''.
ELSE.
CONCATENATE wa_csvdata const_sep lv_data INTO wa_csvdata.
ENDIF.
ENDIF.
ENDDO.
APPEND wa_csvdata TO gt_csvdata.
CLEAR wa_csvdata.
ENDLOOP.
ENDFORM. " CONVERT_TO_CSV
Maybe you are looking for
-
IPhone 6 Trade-In Promotion Code That Works
Okay, loads of posts about not getting the promotional amount and so on. I am in the same boat EXCEPT I haven't shipped my old iPhone back yet. I have been on the phone with Verizon three times trying to figure out how to get the trade-in page on the
-
Hi Team, I'm currently working on a configuration entailing WLC and ISE where the customer wants a single SSID,and wants his wireless clients to authenticate successfully if they pass a registry key compliance. Additionally, they want clients to rec
-
PARTNERS! Please VOTE for a VIDEO KEYNOTE.
Partners! Please help me and VOTE here with your reply to ask the BC TEAM and the person who is in charge TO MAKE AN ALL INCLUSIVE VIDEO KEYNOTE with suggested topics like: - Our Place in the Creative Cloud Economy. How is this going to benefit us, c
-
I am working with a client who is investigating the integration between WLW and their preexisting source control system, PVCS. I have installed the Visual Studio Source control Provider for WLW and can get most of the way through the setup. However,
-
I can't get lightroom on my computer!
I've just joined and subscribed to the photoshop and lightroom package for students and teachers. I have downloaded Photoshop with no problems but I can't download Lightroom to my computer. Anyone know why?