How to update whole external table(in ABAP dictionary) from internal table at once
Hi,
How can I update the content of the external table (in ABAP dictionary) from the content of internal table data at once. I created the internal tables with out the header line, with the work area. I tried UPDATE TARGET_EXTERNAL_TABLE FROM TABLE INTERNAL_TABLE. But it returns 4 for sy-subrc and did not work.
Thank you
Regards.
CHINTHAKA
Hi Feiyun Wu,
Thank you very much. Your code worked. Is there any way to replace the whole content of the external table from internal table data ?
Regards,
Chinthaka
Similar Messages
-
Fill data in table( on view ) dynamically from internal table
Hi,
How can I populate a table on view with data from an internal table?
Thanks,
RonitaHi,
if you have an internal table named xyz.
Then create a structure in se11 for this internal table.
Then create a node with this structure with cardinality 0:n
Navigate into method WDDOMODIFYVIEW of view MAIN_VIEW. Insert coding for:
- Create a new context node for the table
Hint: Use method Create_nodeinfo_from_struct of class Cl_wd_dynamic_tool.
- Remove old dynamic table IE element from view , if one exists. If it exists, it is a child of group GROUP_1 and has the name TESTTAB.
- Create a new UI element for a table named TESTTAB
- Create an internal table, fill it with the data from the database table and bind it to the newly created dynamic context node.
METHOD wddomodifyview .
DATA:
UI Elements
group_1 TYPE REF TO cl_wd_uielement_container,
new_tab TYPE REF TO cl_wd_table,
Context Nodes
dyn_node TYPE REF TO if_wd_context_node,
tabname_node TYPE REF TO if_wd_context_node,
Node Info
rootnode_info TYPE REF TO if_wd_context_node_info,
Data Reference (for internal table)
stru_tab TYPE REF TO data,
String (for table name)
tablename TYPE string.
FIELD-SYMBOLS:
<tab> TYPE table.
create context node ***************************************************************
get node info of context root node
rootnode_info = wd_context->get_node_info( ).
Get the name of the table to be created
tabname_node = wd_context->get_child_node( name = 'TABLE_DATA' ).
tabname_node->get_attribute( EXPORTING name = 'NAME' IMPORTING value = tablename ).
translate tablename to upper case.
create sub node named TEST1 of structure (tablename)
cl_wd_dynamic_tool=>create_nodeinfo_from_struct(
parent_info = rootnode_info
node_name = tablename
structure_name = tablename
is_multiple = abap_true ).
get instance of new node
dyn_node = wd_context->get_child_node( name = tablename ).
remove "old" table UI element from view , if necessary ****************************
group_1 ?= view->get_element( 'GROUP_1' ).
group_1->remove_child( id = 'TESTTAB' ).
create new UI element table *******************************************************
new_tab = cl_wd_dynamic_tool=>create_table_from_node(
ui_parent = group_1
table_id = 'TESTTAB'
node = dyn_node ).
fill context node with data *******************************************************
create internal table of (tabletype)
CREATE DATA stru_tab TYPE TABLE OF (tablename).
ASSIGN stru_tab->* TO <tab>.
Get table content
SELECT * FROM (tablename) INTO CORRESPONDING FIELDS OF TABLE <tab>.
Bind internal table to context node.
dyn_node->bind_table( <tab> ).
ENDMETHOD.
Edited by: Sridevi D on Apr 19, 2008 10:30 AM -
How to get count of records for each type from internal table
Hi Guys,
I want to implement a logic to find out the count of records in a internal table.
Assume my internal table have one field having the entries as shown below.
Internal table Entries
10
10
10
11
11
12
12
12
12
13
14
14
15
15
15
15
15
16
16
17
18
19
20
20
20
....... etc....
I should get an output as below
10's - 3
11's -2 ,
12's - 4.... etc..
Could any one help me how to do this.
Thanx,
KumarREPORT zzz.
DATA: i(100),
t(100),
j TYPE n.
TYPES: BEGIN OF gt_int_type,
linex(100) TYPE c,
END OF gt_int_type.
DATA: gt_int TYPE STANDARD TABLE OF gt_int_type,
wa_int LIKE LINE OF gt_int.
START-OF-SELECTION.
wa_int-linex = '10'.
APPEND wa_int TO gt_int.
wa_int-linex = '10'.
APPEND wa_int TO gt_int.
wa_int-linex = '10'.
APPEND wa_int TO gt_int.
wa_int-linex = '11'.
APPEND wa_int TO gt_int.
wa_int-linex = '11'.
APPEND wa_int TO gt_int.
wa_int-linex = '12'.
APPEND wa_int TO gt_int.
wa_int-linex = '12'.
APPEND wa_int TO gt_int.
wa_int-linex = '12'.
APPEND wa_int TO gt_int.
wa_int-linex = '12'.
APPEND wa_int TO gt_int.
wa_int-linex = '13'.
APPEND wa_int TO gt_int.
wa_int-linex = '14'.
APPEND wa_int TO gt_int.
wa_int-linex = '14'.
APPEND wa_int TO gt_int.
wa_int-linex = '15'.
APPEND wa_int TO gt_int.
wa_int-linex = '15'.
APPEND wa_int TO gt_int.
wa_int-linex = '15'.
APPEND wa_int TO gt_int.
wa_int-linex = '15'.
APPEND wa_int TO gt_int.
wa_int-linex = '15'.
APPEND wa_int TO gt_int.
wa_int-linex = '16'.
APPEND wa_int TO gt_int.
wa_int-linex = '16'.
APPEND wa_int TO gt_int.
wa_int-linex = '17'.
APPEND wa_int TO gt_int.
wa_int-linex = '18'.
APPEND wa_int TO gt_int.
wa_int-linex = '19'.
APPEND wa_int TO gt_int.
wa_int-linex = '20'.
APPEND wa_int TO gt_int.
wa_int-linex = '20'.
APPEND wa_int TO gt_int.
wa_int-linex = '20'.
APPEND wa_int TO gt_int.
LOOP AT gt_int INTO wa_int.
WRITE:/ wa_int-linex.
ENDLOOP.
ULINE.
SKIP 3.
SORT gt_int BY linex.
READ TABLE gt_int INDEX 1 INTO i.
j = 0.
LOOP AT gt_int INTO wa_int.
IF wa_int-linex EQ i.
j = j + 1.
ELSE.
WRITE:/ i,'''s = ', j.
j = 1.
i = wa_int-linex.
ENDIF.
ENDLOOP.
WRITE:/ i,'''s = ', j.
consider clearing leading/trainling spaces... -
Table control from internal table giving problem.
HI ALL,
I am creating a table control using wizard from internal table in the program when i give work area it gives this error "The table work area G_TABC_WA does not exist or is not a structure"
I have declared internal table and work like this.
TYPES: BEGIN OF T_TABC,
OPTID LIKE ZHRPMT_TRNSAC-OPTID,
STGID LIKE ZHRPMT_TRNSAC-STGID,
TETID LIKE ZHRPMT_TRNSAC-TETID,
REQSR LIKE ZHRPMT_TRNSAC-REQSR,
MUNIT LIKE ZHRPMT_TRNSAC-MUNIT,
END OF T_TABC.
DATA: G_TABC_ITAB TYPE T_TABC OCCURS 0,
G_TABC_WA TYPE T_TABC. "work area
why it is giving this error and how to correct this.
thanks.Hay
Hello there is very small mistake
TYPES: BEGIN OF t_tabc,
optid TYPE zhrpmt_trnsac-optid,
stgid TYPE zhrpmt_trnsac-stgid,
tetid TYPE zhrpmt_trnsac-tetid,
reqsr TYPE zhrpmt_trnsac-reqsr,
munit TYPE zhrpmt_trnsac-munit,
END OF t_tabc.
DATA: g_tabc_itab TYPE TABLE OF t_tabc ,
g_tabc_wa LIKE t_tabc. "work area
**Please reward suitable points***
With Regards
Navin Khedikar -
How to send data from internal table to the shared folder in ABAP
Hi experts,
My requirement is to transfer data from a file to shared folder. i just did reading data from a file to a internal table. Now i want to send this internal table data into a shared folder which is "
xxx\y\z....".
I do not have any idea on how to send data from internal table to the shared folder path.
can anybody please help me out how to do this?
Thanks & Regards
Sireesha.Where that folder is located, its on presentation server i.e. desktop or application server.
If its on presentation server, use FM GUI_UPLOAD.
If its on application server, then use DATASET functions. Have a look at below link.
[File Handling in ABAP|http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3ca6358411d1829f0000e829fbfe/frameset.htm]
I hope it helps.
Thanks,
Vibha
Please mark all the useful answers -
How to update Records from Internal table to u2018Zu2019 table?
Hi Friends,
How to update Records from Internal table to u2018Zu2019 table.
I have records in Internal table , that records want to update on u2018Zmarau2019 Table.
( my internal table & u2018 Zu2019 table structures are same.)
Thanking you.
Regards,
SubashHi,
loop at internal table.
modify <Z- table > from values < internal table Workarea>.
if sy-subrc = 0.
COMMIT work.
else.
ROLLBACK waork.
endif.
endloop.
or
UPDATE <Z- table > from table < internal table Workarea>.
if sy-subrc = 0.
COMMIT work.
else.
ROLLBACK waork.
endif.
Prabhudas -
Register Table in ABAP Dictionary
One of our SAP RWD standard table got deleted during the upgrade. I have a backup of that table & created it using Create Table SQL commands directly at the database level.
I did exp & imp of various tables too however in SE11 the tables created directly in database no matter Z tables or SAP Standard tables does not show up.
My question is that how to register that table in ABAP dictionary?Table is a part of PSAPCRMUSR & does exists in schema SAPCRM.
Let me give another example:
One of SAP Table STERM_LINK got corrrupted and we did'nt knew about it for almost a month. OSS replied back saying that its a 3rd party table and we are not using any modules that would have updated/read that table. Also that table did'nt had any data.
OSS suggested that either we exp/imp that table from QA to PRD or they can send us a script which is a normal create table....... script and we can drop can corrupted table.
Now in this example if we drop that table and recreate it using script at database level, it will be unknown in dictionary.
How to solve this kind of issue? -
ZSD_TABLE is not defined in the ABAP dictionary as a table"
Hello,
I created zsd_table and inserted few records
When i use this table in program system is giving error message "ZSD_TABLE is not defined in the ABAP dictionary as a table"
How can we define this table in ABAP dictionary?
ThanksHi,
Go to Transaction SE11
Give the table name 'ZSD_TABLE'
and click on create and enter the fileds
after entering fields give 'techinical setting' for a table by clicking on technical setting button on tool bar
save check and activate
Regards
Krishna -
Update databse from internal table statement not using index
Hi Guys,
We are updating a databse table from a file. The file has a couple of fields which have data different from what the database has (non-primary fields :). We upload the file data into an internal table and then update the database table from internal table. At a time, internal table is supposed to have 10,000 records. I did SQL trace and found that the update statement is not making use of the databse index.
Should not the update statement here be using the table index (for primary key)?
Regards,
Munish... as often there are recommendations in this forum which makes me wonder, how people overestimate their knowledge!!!
Updates and Deletes do of course use indexes, as can be seen in the SQL Trace (use explain).
Inserts don't use indexes, because in many databases inserts are just done somewhere, But also with the INSERT, the primary key is the constraint for the uniqueness condition, duplicate keys are not allowed.
Coming to the original question, what is you actually coding for the update?
What is the table, which fields are in the internal table and what are the indexes?
Siegfried -
How to transfer from internal table to table control ?
How to transfer data from internal table to table control wihtout using select statement?
HI
GOOD
The commands in the flow logic are:
LOOP AT itab [INTO wa] WITH CONTROL ctrl.
ENDLOOP.
This statement assigns an internal table itab of the ABAP program to the table control and triggers a parallel loop run over the table control rows displayed on the screen and over the internal table itab. The additions INTO and WITH CONTROL are possible at the time of PBO, but not at PAI. The assignment of the loop to the table control takes place at PAI through the internal table.
Using the INTO addition, the fields of the internal table itab are written to the work area wa at the time of PBO and the content of wa is transported, line by line, to the identically-named fields of the table control on the screen. Without the INTO addition, you must use an internal table with a header line. Then the content of the header line is transported line by line to the identically-named fields of the table control on the screen at the time of PBO. No module is required for filling the table control rows.
Conversely, at the time of PAI, the internal table rows are not automatically filled with the contents of the table control rows. Instead, you must call a dialog module within the loop that modifies the table.
http://help.sap.com/saphelp_nw2004s/helpdata/en/9f/dbac5135c111d1829f0000e829fbfe/content.htm
http://help.sap.com/saphelp_nw2004s/helpdata/en/fa/0970a4543b11d1898e0000e8322d00/content.htm
THANKS
MRUTYUN^ -
Can not insert or update [TABLE] from internal table in method
I've faced a problem with OO abap. I've tried to insert into [ TABLE ] from internal table, but i've got error msg after i compiled.
"An explicit work area is necessary in the OO context. Use "INSERT wa INTO [TABLE] itab""
After i changed to loop in work area and INSERT INTO [TABLE] VALUES gw_data., everything is fine, can compile and run.
This is error code.
METHOD set_data_to_table.
REFRESH gi_data.
CLEAR gi_data.
IF gi_file[] IS NOT INITIAL.
* Set data for modify table
LOOP AT gi_file INTO gw_file.
MOVE-CORRESPONDING gw_file TO gw_data.
me->conversion_input( EXPORTING im_vendor = gw_data-vendor
CHANGING ch_vendor = gw_data-vendor ).
APPEND gw_data TO gi_data.
ENDLOOP.
INSERT [TABLE] FROM TABLE gi_data.
* LOOP AT gi_data INTO gw_data.
* INSERT INTO [TABLE] VALUES gw_data.
* IF sy-subrc = 0.
* COMMIT WORK.
* ELSE.
* ROLLBACK WORK.
* ENDIF.
* ENDLOOP.
ELSE.
MESSAGE 'No data found' TYPE 'I'.
ENDIF.
ENDMETHOD. "set_data_to_tableHi Matthew,
I think there is no difference in database insert between OO and non-OO.
The correct syntax according to ECC600 online documentation is
[Inserting Several Lines|http://help.sap.com/saphelp_erp2005vp/helpdata/en/fc/eb3a6d358411d1829f0000e829fbfe/content.htm]
To insert several lines into a database table, use the following:
INSERT target FROM TABLE itab \[ACCEPTING DUPLICATE KEYS].
This writes all lines of the internal table itabto the database table in one single operation. If one or more lines cannot be inserted because the database already contains a line with the same primary key, a runtime error occurs. You can prevent the runtime error occurring by using the addition ACCEPTING DUPLICATE KEYS.
Whenever you want to insert more than one line into a database table, it is more efficient to work with an internal table than to insert the lines one by one.
I think the syntax
INSERT my_dbtable FROM TABLE gi_data.
should work, your suggestion may lead to syntax error.
Regards,
Clemens -
How to populate field catalogue fields in ALV using dynamic internal table
Hi All,
Please let me know how to populate field catalogue fields in ALV using dynamic internal table.
I have created <dyn_table> using code below.
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = g_t_ifc
it_fieldcatalog = g_t_fieldcat
IMPORTING
ep_table = dy_table.
ASSIGN dy_table->* TO <dyn_table>.
Create dynamic work area and assign to FS
CREATE DATA dy_line LIKE LINE OF <dyn_table>.
ASSIGN dy_line->* TO <dyn_wa>.
Now this <dyn_table> has fields like idoc no.,creation date ,
segment field 1, segment field 2 etc..Now idoc no.,creation date are static fields from table EDIDC. And segment field 1, segment field 2 etc are dynamic fields from table EDSAPPL.
In my ALV report I am getting the final layout properly but I am unable to move values to corresponding fields in the final layout shown.Please let me know how to populate these fields from different tables.
I tried this way but its not working.
SORT g_t_edid4 BY docnum.
LOOP AT g_t_edidc INTO g_r_edidc.
READ TABLE g_t_edid4 into g_r_edid4
WITH KEY docnum = g_r_edidc-docnum
BINARY SEARCH.
IF sy-subrc = 0.
<dyn_wa> = g_r_edid4-sdata.
MOVE-CORRESPONDING g_r_edid4 to <dyn_wa>.
CLEAR g_r_edid4.
ENDIF.
MOVE-CORRESPONDING g_r_edidc to <dyn_wa>.
APPEND <dyn_wa> TO <dyn_table>.You have to assign each field to field symbol and then assign the value to that field symbol and asssign that field symbol to workarea field symbol.
LOOP AT g_t_edidc INTO g_r_edidc.
READ TABLE g_t_edid4 into g_r_edid4
WITH KEY docnum = g_r_edidc-docnum
BINARY SEARCH.
IF sy-subrc = 0.
ASSIGN COMPONENT 'SDATA' OF STRUCTURE <DYN_WA> TO <DYN_FLD>.
<DYN_FLD> = g_r_edid4-sdata.
" <dyn_wa> = g_r_edid4-sdata.
" Assign each fields like this.
" MOVE-CORRESPONDING g_r_edid4 to <dyn_wa>.
CLEAR g_r_edid4.
ENDIF.
" MOVE-CORRESPONDING g_r_edidc to <dyn_wa>.
APPEND <dyn_wa> TO <dyn_table>.
Regards,
Naimesh Patel -
How to choose in Delete Duplicates from internal table?
Now I need to delete Duplicates from internal table,
So at first I sort
than I delete duplicate
Sort itab1 BY Company_Code Asset_No Capital_Date.
DELETE ADJACENT DUPLICATES FROM itab1 COMPARING Company_Code Asset_No Capital_Date
Company_Code
Asset_No
Capital_Date
Remark
BC35
1515593
20021225
Helen
BC35
1515593
20021225
Common Asset
BC35
1515594
20030109
Judy
BC35
1515594
20030109
Common Asset
But here comes my problem~If I want to delete the Common Asset in Remark Column,how I let it choose the right one to do it?Hi Jack
Try the below coding..
Report zsamp.
types: begin of t_tab,
comp_code(4) type c,
***_no(7) type n,
cap_date type d,
remark type string,
end of t_tab.
data: i_tab type TABLE OF t_tab,
w_tab type t_tab.
w_tab-comp_code = 'BC35'.
w_tab-***_no = '1515593'.
w_tab-cap_date = '20021225'.
w_tab-remark = 'Helen'.
append w_tab to i_tab.
w_tab-comp_code = 'BC35'.
w_tab-***_no = '1515593'.
w_tab-cap_date = '20021225'.
w_tab-remark = 'Common Asset'.
append w_tab to i_tab.
w_tab-comp_code = 'BC35'.
w_tab-***_no = '1515594'.
w_tab-cap_date = '20030109'.
w_tab-remark = 'Judy'.
append w_tab to i_tab.
w_tab-comp_code = 'BC35'.
w_tab-***_no = '1515594'.
w_tab-cap_date = '20030109'.
w_tab-remark = 'Common Asset'.
append w_tab to i_tab.
sort i_tab by remark.
delete ADJACENT DUPLICATES FROM i_tab COMPARING remark. -
How to translate the key words in ABAp program from lower case to upper cas
How to translate the key words in ABAp program from lower case to upper case?
Hi Kittu,
You need to set the Pretty Printer settings to achieve key words in ABAP program from lower case to upper case.
Utilities -> Settings -> Pretty Printer (tab) -> Select third radio button.
Thats all.
<b>Reward points if this helps.
Manish</b> -
Update ztable from internal table
I want to update the Ztable from internal table datas.
what is the syntax to update.
Its urgent send with coding example is betterHi
PARAMETERS: p_carrid TYPE sflight-carrid,
percent(1) TYPE p DECIMALS 0.
DATA sflight_tab TYPE TABLE OF sflight.
FIELD-SYMBOLS <sflight> TYPE sflight.
SELECT *
FROM sflight
INTO TABLE sflight_tab
WHERE carrid = p_carrid AND
fldate = sy-datum.
IF sy-subrc = 0.
LOOP AT sflight_tab ASSIGNING <sflight>.
<sflight>-price =
<sflight>-price * ( 1 - percent / 100 ).
ENDLOOP.
ENDIF.
<b>UPDATE sflight FROM TABLE sflight_tab.</b>
Thanks
Vijay
PLZ reward points if helpful
Maybe you are looking for
-
UltraNav and TrackPoint not working for my user account - but ok for others...
Got a strange one on my X201T. For some reason I can't fathom, my laptop's Trackpoint, Touchpad and all their associated buttons do not work when I log into my laptop - they did before but in the last few days, they've stopped. My external USB stil
-
i connected my iphone 5 to my computer for the first time since i got it and it didnt give me any option and just started to restore it from my iphone 4s. ive now lost all my pictures that were on it. Is there a way i can get them back as i did not w
-
Translate widget in Dashboard doesn't work
I can choose the Translation widget in my Dashboard, however, I can't choose the languages (from/to) with the arrows.... :-(
-
Cisco works lms 3.1 RME
The device is not present in RME, but the RME job collection status shows the job is running.please help if any solution..
-
Comparison of dates using Oracle Business Rule
Hi to everyone! I have a business rule that has as input parameter a complex attribute with a date field inside named expiration. I want to compare the expiration field with the current date using a comparison function. I don't know where find the cu