Static internal table issue - Used in BI Extractor
Hi,
We are reading data from a table in to a static internal table and using this table for future lookups.
Once in a while we can't find data while doing a lookup from this static internal table , But most of the time it works.
Is it possible that data from this static internal table is removed due to memory issues during peak periods.
Thanks in advance
Here is the code and it is there in a function module.This function module is called from a different FM in a loop.
TABLES: OIU_CM_MAT_PRCD.
STATICS: i_mat_prcd LIKE OIU_CM_MAT_PRCD OCCURS 10 WITH HEADER LINE.
DATA: ws_lines like sy-toccu.
DESCRIBE TABLE i_mat_prcd LINES ws_lines.
IF ws_lines = 0.
SELECT * INTO TABLE i_mat_prcd
FROM OIU_CM_MAT_PRCD.
IF i_matnr > ' '.
SORT i_mat_prcd BY matnr.
ELSE.
SORT i_mat_prcd BY majpd_cd pd_cd.
ENDIF.
ENDIF.
IF i_matnr > ' '.
READ TABLE i_mat_prcd WITH KEY matnr = i_matnr
BINARY SEARCH.
IF SY-SUBRC = 0.
CHG_MAJOR = i_mat_prcd-MAJPD_CD.
CHG_MINOR = i_mat_prcd-PD_CD.
CONCATENATE i_mat_prcd-majpd_cd i_mat_prcd-pd_cd
INTO chg_prod.
ENDIF. " i_matnr > blank
Similar Messages
-
Read data from STATIC internal table during round trip in DO_PREPARE_OUTPUT
Dear Gurus
I have a requirement where I need to select some data from the database table BUT_HIER_NODE_D.
After SELECTING this data to an internal table (say ITAB), I am displaying this data in a table view. I was able to achive this functionality by putting some code in the DO_PREPARE_OUTPUT method.
Now according to my requirement, after the above data has been displayed on the screen initially, the user will click on any row. After clicking on a particular row, I need to capture the document number on that particular row and need to display all its child document numbers in a separate table. I am able to achive this functionality also.
Initially I am not sure of how to READ the same internal table (ITAB) again and again by avoiding the SELECT query upon each round trip (between CRM and Web).
After some research, I understand that I might have to use STATIC internal table to store the data during the
initial SELECT. This way, upon each round trip, I can READ the data from the same internal table.
My question: But now, when I tried to create a STATIC internal table in DO_PREPARE_OUTPUT, it is not allowing me to declare this table because DO_PREPARE_OUTPUT method is a INSTANCE method.
I didn't find any STATIC methods in the IMPL class of the view.
I would really appreciate if somebody can help me on how to proceed further.
Thanks
RajHi Bharathy / Adil / Masood
Thank you very much for the replies. I declared a static method inside the IMPL class and I was calling this method inside the DO_PREPARE_OUTPUT method. Looks like it is working fine for me...will comeback if I had any further issues.
Masood
As per my requirement, I need to Select the data into the internal table during the very first step, then I need to continuosly read the data from this internal table upon every round trip. So I am not sure if I would be able to use the method DO_INIT_CONTEXT. Because I need a method which will trigger upon each round trip and will also hold the data of this internal table. So right now, the only option for me is DO_PREPARE_OUTPUT method.
Plz let me know if am doing in the right way.
Thanks
Raj -
Xperts,
say Exit001 is called 2-3 times for Transaction T1.
and in my exit i have some select stmts..
If i use Static internal table..can i avoid multiple times fetching of data from database.??I got the ans...
it is for u guys..
If you use the STATICS statement instead of DATA when you
declare local data objects, their lifetime is extended to the overall
program lifetime. Therefore, such data objects have the same lifetime as
global data objects, but their visibility is still limited to the respective
modularization unit.
You can use the STATICS statement in function modules, subroutines,
and static methods.
Local data objects are overwritten with their start value or initial value each time
they are called by the surrounding modularization unit (unless they were declared
with the STATICS statement).
Static retain their values when an executable program calls several function
modules in the same function group consecutively.
Thanks & Regards,
Anoop Chandran -
I want to create an internal table without using header line and occurs 0?
hi experts,
Can anybody help me to declare an internal table without using headerline and occurs 0 options but still i have to use the functionalities that occurs 0 and header line options provide.Hi Saisri,
You can use the internal table without headerline and create a header for then internal table with the same structure. We need to use the header while manipulating with the data of the internal table.
example:
types: begin of ty_afpo,
kdauf type kdauf,
kdpos type kdpos,
ltrmp type ltrmp,
end of ty_afpo.
data : t_afpo type standard table of ty_afpo, " internal table declaration
wa_afpo type ty_afpo. " work area declaration
<after populating the data into the internal table>
loop at t_afpo into wa_afpo.
write:/ wa_afpo-kdauf, wa_afpo-kdpos, wa_afpo-ltrmp.
endloop.
This I think shall give you a basic understanding of how things work.
<b>Reward points if this helps,</b>
Kiran -
Can i send back an internal table by using Changing clause?
i'm using a Perform statement in SAP Script and i have written corresponding subroutine in an Zprogram.
In that subroutine i want to create one internal table and send back it to script.
can i send back an internal table by using Changing clause?
if it is possible, pls give me the idea................Hi,
While calling the formroutine,just u can pass the individual values using the ITCSY.In form,you are decalring the internal table with structure itcsy-input.
Then,you need to place the loop on the table and print in script.
But, passing the internal table in script,is not recomnded..
Regards,
Shiva Kumar -
Hi Experts,
Row
Column
Value
1
0001
Prem(First Name )
1
0002
Raj(Middle name )
1
0003
Kaushik(Last name
2
0001
Naresh
I have the above data in excel file and my internal table like as follows
Data : begin of it_itab occurs 0,
Row type c,
Column type string,
Value type string,
End of it_itab.
Now I want to upload the excel file to my internal table
filed wise i.e in my intenal table row
shold have row values from excel same as
for column and value also
Can anyone suggest me fix this issue?
Best Regards,
Ramjee MYou may use this function to put data in internal table.
CALL FUNCTION 'KCD_EXCEL_OLE_TO_INT_CONVERT'
EXPORTING
filename = p_file *xcel file name
i_begin_col = p_scol *start column
i_begin_row = p_srow *start row
i_end_col = p_ecol *end col
i_end_row = p_erow *end row
TABLES
intern = it_tab
EXCEPTIONS
inconsistent_parameters = 1
upload_ole = 2
OTHERS = 3.
Use this function to put data in internal table. -
Upload data from Excel to internal table without using Screen
Hi,
My reqirment is to read the excel input data and then upload it to internal table for further proceeing but without using selection input screen. I mean can I mention the fixed file name and the path in the function module iself for the input file.1.First create one internal table as u have created ur EXCEL file.
e.g: if ur EXCEL file contains 3 fields col1 col2 and col3.
data: begin of wa,
col1(10),
col2(10),
col3(10),
end of wa,
itab like standard table of wa.
data: filename type string 'C:\FOLDER\DATA.XLS'
If u dont want to use the screen, then pass the file name directly to the GUI_UPLOAD FM.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = filename
FILETYPE = '.XLS'
tables
data_tab = itab
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
NO_AUTHORITY = 6
UNKNOWN_ERROR = 7
BAD_DATA_FORMAT = 8
HEADER_NOT_ALLOWED = 9
SEPARATOR_NOT_ALLOWED = 10
HEADER_TOO_LONG = 11
UNKNOWN_DP_ERROR = 12
ACCESS_DENIED = 13
DP_OUT_OF_MEMORY = 14
DISK_FULL = 15
DP_TIMEOUT = 16
OTHERS = 17
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
This will serve ur puspose.
loop at itab into wa.
write: / wa-col1,wa-col2,wa-col3.
endloop.
Thanks & Regards
Santhosh -
How to use dynamic internal table when using gui_upload?
Hi Experts,
my scenario is like i have header data, item data and serial numbers.
so with respect to the quantity in unit of measure ,there will be number of serial numbers..
i have declared the dynamic internal table,but i am not getting the logic to change the structure accordingly with respect to the flat file entries..
is it possible to do or its not possible....any suggestion!!!!i have declared like this....
TYPES: BEGIN OF ty_final,
bldat TYPE string, "Document Date
budat TYPE string, "Psting Date
bktxt TYPE string, "Document Header Text
werks TYPE string, "Plant
lgort TYPE string, "Storage Location
matnr TYPE string, "Material Number
erfmg TYPE string, "Quantity in Unit Of Entry
anln1 TYPE string, "Asset Number
anln2 TYPE string, "Asset Subnumber
sernr TYPE string, "serial Number
END OF ty_final.
DATA : it_final TYPE TABLE OF ty_final,
wa_final TYPE ty_final.
FIELD-SYMBOLS : <fs_final> TYPE table.
ASSIGN it_final TO <fs_final>.
after this i called gui upload and passed internal table it_final..
but i have to change the internal table structure dynamically before the upload function.so that it will match with the flat file...
Regards
KarthickThere are at least two approaches you can use to change/generate new dynamic-structured table. Either with [RTTI + RTTS|https://wiki.sdn.sap.com/wiki/display/Snippets/CreatingFlatandComplexInternalTablesDynamicallyusingRTTI] or using [CL_ALV_TABLE_CREATE|http://www.sdn.sap.com/irj/scn/advancedsearch?query=cl_alv_table_create] . In this one just determine fieldcatalog of current table and change it accordingly, then regenarate table.
There are plenty of examples in SCN for this. You should not face difficulties applying this.
Regards
Marcin -
Populate and display internal table results using search help exit...
I have copied F4IF_SHLP_EXIT_EXAMPLE and made changes. I want this search help exit to populate and display contents related to 'FIELD1' when the user enters a specific value for it in the search help screen, meaning when the user restricts the search by that value. For field2, field3, field4, field5, field6, field7, and field8 I am using a custom view.
Following is the code:
TYPES: BEGIN OF t_search,
field2 TYPE field2,
field3 TYPE field3,
field4 TYPE field4,
field5 TYPE field5,
field6 TYPE field6,
field7 TYPE field7,
field8 TYPE field8,
field1 TYPE field1,
END OF t_search.
DATA: it_itab TYPE TABLE OF t_search,
wa TYPE t_search,
wa_selopt TYPE ddshselopt,
wa_fielddescr TYPE dfies.
ranges: r_field1 for std_table1-field1
STEP SELECT (Select values)
FREE: r_field1.
**Get the value entered for FIELD1 in search help
LOOP AT shlp-selopt INTO wa_selopt.
CASE wa_selopt-shlpfield.
WHEN 'FIELD1'.
r_field1-sign = wa_selopt-sign.
r_field1-option = wa_selopt-option.
r_field1-low = wa_selopt-low.
r_field1-high = wa_selopt-high.
APPEND r_field1.
CLEAR: r_field1.
ENDCASE.
ENDLOOP.
**Select 'ID' and 'FIELD1' from table into lt_itab
SELECT id field1
INTO TABLE lt_itab
FROM std_table1
WHERE field1 IN r_field1.
IF sy-subrc = 0.
**Now, based on the particular IDs from lt_itab, I need to select other values
from other tables which also have 'ID' as the key.
SELECT std_table2~field2
std_table2~field3
std_table3~field4
std_table3~field5
std_table3~field6
std_table4~field7
std_table4~field8
std_table1~field1
INTO CORRESPONDING FIELDS OF TABLE it_itab
FROM std_table2
INNER JOIN std_table3 ON
std_table3mandt = std_table2mandt AND
std_table3id = std_table2id
INNER JOIN std_table4 ON
std_table4mandt = std_table2mandt AND
std_table4id = std_table2id
INNER JOIN std_table1 ON
std_table1mandt = std_table2mandt AND std_table1id = std_table2id
WHERE
std_table1~field1 IN r_field1.
'id' is common in all the std_tables --> std_table1, std_table2, std_table3, std_table4.
STEP DISP (Display values)
**Then I need to gather all the results in my internal table it_itab and display
in search help results for the value of FIELD1 entered by the user in the search help.
CALL FUNCTION 'F4UT_PARAMETER_RESULTS_PUT'
EXPORTING
parameter = 'FIELD1'
fieldname = 'FIELD1'
TABLES
shlp_tab = shlp_tab
record_tab = record_tab
source_tab = it_itab
CHANGING
shlp = shlp
callcontrol = callcontrol.
I am not getting all the data in my internal table and wanted to know if there is anyting wrong in my select statement.
Any guidance will be appreciated and awarded appropriate points.
Thanks.the webdynpro fieldname and the search help input parameter name were made same.
-
Xml to abap internal table by using a dynamic internal table at runtime
Hi ,
I have a requirement to convert xml to abap internal table . But the requirement is that i need to create internal table according to the XML .
Ex : If my XML is :
<?xml version="1.0" ?>
- <flights>
- <airline code="AA" name="American Airlines">
- <flight number="0017">
<from airport="JFK">NEW YORK,US</from>
<to airport="SFO">SAN FRANCISCO,US</to>
<departure>110000</departure>
<arrival>140100</arrival>
<type>Scheduled</type>
</flight>
- <flight number="0064">
<from airport="SFO">SAN FRANCISCO,US</from>
<to airport="JFK">NEW YORK,US</to>
<departure>090000</departure>
<arrival>172100</arrival>
<type>Scheduled</type>
</flight>
</airline>
So after conversion my abap internal table shoul have fields as :
airline_code Name flight_number from_airport to_airport departure arrival type
and the field values should be corresponding field values .
Thanks in advance .
Regards .Hi Ujjwal,
use
CALL TRANSFORMATION
Study the online documentation and if required do some search for CALL TRANSFORMATION and/or XML PARSER
And, when coming back here with next question, tell us what searches you did with what results - please always follow the 'search before post' rule, thank you.
Regards,
Clemens -
Error in xml to abap internal table transformation using xslt_tool
Hi friends,
When i am trying to convert xml data into internal table it is going to dump because of empty elements. Can any body help to delete the empty tags from xml before processing through xslt_tool.
example
<Activity>
<ID>add12095</ID>
<Start>09/01/2014 12:01</Start>
<Type>3</Type>
<Code>99202</Code>
<Quantity>1</Quantity>
<Net>244</Net>
<Clinician>GD16130</Clinician>
<PriorAuthorizationID/> "empty tag
<Gross>294</Gross>
<PatientShare>50</PatientShare>
<PaymentAmount>244</PaymentAmount>
</Activity>
the empty element some times will come in the xml and some times not. so i made a check in xslt. when this empty element tag processed through that condition i am getting the dump. either i need to remove the condition or we should delete the empty tags before processing. Removing of if condition is not possible because that element may or may not come all the time.
Regards,
Rajesh.You can replace all empty tags using regular expression.
REPLACE ALL OCCURRENCES OF REGEX '<\w+/>' IN lv_xml WITH ''. -
hi All,
I am having three itabs. itab1 and itab2 have common field prctr. And prctr can be same for many records in both itab1 and itab2. i want to check that if records for a particular prctr are not in itab1 but are in itab2 then those records be moved to itab3. can anyone give me some suggestion?
thanks and regards,
ReenaHi Reena,
If you want to append itab3 based on internal table is ITAB2.
Use this:
LOOP AT ITAB2.
READ TABLE ITAB1 WITH KEY PRCTR = ITAB2-PRCTR.
IF SY-SUBRC <> 0.
MOVE CORRESPONDING ITAB2 TO ITAB3.
APPEND ITAB3.
CLEAR ITAB2.
ENDIF.
ENDLOOP.
else If you want to append itab3 based on internal table is ITAB1
Use this:
LOOP AT ITAB1.
READ TABLE ITAB2 WITH KEY PRCTR = ITAB1-PRCTR.
IF SY-SUBRC <> 0.
MOVE CORRESPONDING ITAB1 TO ITAB3.
APPEND ITAB3.
CLEAR ITAB1.
ENDIF.
ENDLOOP.
Regards,
Vinod. -
Internal table Issue ( very urgent)
Hi,
There are two internal tables A and B.
Product is one of the fields of both A and B and is the key.
A has say say 10 products and B has 4 products.
I want to delete those products from A which are not there in B.
( It is somewhat like using 'FOR ALL ENTERIES IN ' with Select Statement)
Is this possible in internal tables without 'Loop at'. The actual table would have over 1 million records and and looping is a major concern.
I am new to abap and any help from you guys would be appreciated.....Advait,
I think you will need atleast one loop. This loop can be on the table B.
If product is the <b>left most field</b> of table B try this:
The last field for table A must be a flag for don't delete
SORT IT_B by product.
LOOP AT IT_B INTO WA_B.
AT NEW product.
WA_A-dont_delete = 'X'.
MODIFY IT_A FROM WA_A TRANSPORTING dont_delete WHERE product = wa_b-product.
ENDAT.
ENDLOOP.
DELETE IT_A WHERE dont_delete <> 'X'. -
Dear Experts,
I have a Qty field which needs to be summed up when material no, po no and size are same in my internal table
Eg: PO no Mat no Size Qty
111 001 L 10
111 001 L 20
needs to be shown as
111 001 L 30
I have tried using the collect statement in several ways but unfortunately ddnt work out. Any suggestions?Although Farid's sugegestion of looping and over two tables and summing would work I don't there is any reason to desist with your original approach of using the collect statement. The collect statment is designed exactly for this purpose and would be more efficient than two nested loops. As described before the folloiwng code should work the correct data elements inserted instead of the descriptions
types: BEGIN OF tys_structure,
po_num type po_num,
mat_no type mat_no,
size type sizw,
qty type qty,
END OF tys_structure.
data: lt_table type standard table of tys_structure
with non-unique key matnr, po_no, size,
ls_workarea type type_structure.
collect ls_workarea into lt_table.
One additional note, It would probably be better to use a unique key of a sorted or hashed table if you only want the results to be aggreagted by material no, po no and size. I suggested a non-unique key of a standard table here because it is more flexible and i don't know what elese you might want to do with this table in your code. -
Space removed from character data type when move to internal table issue...
Hi Friends,
I converted material code and other details into internal table which have corresponding data types.But in internal table,I can see material code as left justified ,but after that space was removed.For example if material code is 'ABC' then rest of the space(material char(18)) are removed.But I need remaining spaces.I tried to concatenate material code with spaces (caoncatenate matnr ` ` int etc .. )at right side and moved to another internal table.Its working.But the problem is material codes have different values like one material 'ABC' and another like '123893-h' etc.So I need to calculate the space(out of char 18) dynamiclly and need to put space based on material code value.
<< Moderator message - Everyone's problem is important >>
.Thank you all..
Regards,
Kumaran..
Edited by: Rob Burbank on Oct 26, 2010 11:18 AMHi Ramkumaran,
You have not told the purpose of having these spaces.
is it for transfering to a file?
If that is the case, use a table with fixed lenght lines instead of many fields.
i.e. try something like this
DATA : i_tab type standard table of BUSDATA,
wa_tab type BUSDATA.
wa_tab+0(10) = material number.
wa_tab+10(10) = material code.
wa_tab+20(4) = company code...
append wa_tab to i_tab.
Thanks
Vimal
Maybe you are looking for
-
Is there a t-code that allows you to view the AUC Settlement Log?
One of my counterparts in a different region would like to review the AUC Settlements for the prvious month. Is there a t-code that allows one to view the AUC Settlement Log or is there a special procedure required to view those results? thanks in a
-
hi, what are the function modules do we use for the conversion of currency and units. 1) i want to convert currency(US$) to INR. 2) and to convert from one unit to another unit. before using these function modules what we have to do in bdcs. re
-
How? Contour Gradient Work-Around/Controlling Blend Characteristics
I'm trying to create a contour gradient work-around, somewhat successfully, but not yet happy with the results. Here's my method: create a closed path with the pen tool, (in this case, a four point path shaped something like a banana with the ends cu
-
How to run Labview apps in tablet with android os
How to run Labview application in tablet with android operating system? Can we use Labview mobile module or we must use google play data dashboard for labVIEW? how to install it in PC? Solved! Go to Solution.
-
Problem resetting count on read with fp ctr-500 counter
Using the ctr-500 module with a FP-1000. I want to reset the count of a channel on each read. The CTR-500 manual says to selecting "Reset on Read" from the Value menu. I've done that but the counter never resets when I read it. I then tried click