Logic for internal table
Hi,
I have an internal table with the following structure.
PO Number PO Line Number Quantity ETA
PO_1 001 10 10 Aug 2009
PO_1 002 12 11 Aug 2009
PO_2 001 5 10 Aug 2009
PO_1 001 13 10 Aug 2009
PO_1 001 7 11 Aug 2009
Now I want to sum up quantity based on ETA dates so that the structure will look like as below:
PO Number PO Line Number Quantity ETA
PO_1 001 23 10 Aug 2009
PO_1 001 7 11 Aug 2009
PO_1 002 12 11 Aug 2009
PO_2 001 5 10 Aug 2009
Collect statement will not work as the checking is on date but not on po no and line item.
Regards,
Abhi...
Use SUM statement for adding the quantity fields.
Sample code :
LOOP AT T INTO WA_T.
WA_N = WA_T
SUM.
WA_N-QUANTITY = WA_T-QUANTITY.
APPEND WA_N TO ITAB_N.
ENDLOOP.
Similar Messages
-
Need a logic for Internal table processing
Hi,
I have a requirement...an internal table contains three fields material no, bin no, and Quantity
Mat. No | Bin No | Quantity
a | x1 | 10
a | x1 | 10
a | x2 | 20
b | x3 | 10
c | x3 | 20
c | x4 | 30
c | x4 | 40
In this I need to append the records to new internal table say itab1 where multiple entries exist for some material no like mat no 'a' and 'c' and
if the material no. exist only once in the table, it has to be moved to another new internal table say itab2.
Pls suggest some logic that does not have performance issues.
Thanks in advance
SaravanaHi there,
a solution in brief...
data: wa_itab1_a like itab1,
wa_itab2_b like itab1,
lv_tabix type sytabix.
sort itab1 by matnr.
loop at itab1.
wa_itab1_a = itab1.
at new matnr.
lv_tabix = sy-tabix + 1.
clear wa_itab2_b.
READ TABLE itab1 into wa_itab2_b
INDEX lv_tabix.
if wa_itab2_b-matnr ne wa_itab1_a-matnr.
append wa_itab1_a to itab2.
delete itab1 where matnr = wa_itab1_a-matnr.
endif.
endat.
endloop.
Regards
George Zervas
Edited by: gzervas on Oct 20, 2010 12:08 PM -
Why using workarea for internal table is better in performance
Please tell me
why using workarea for internal table is better in performanceHi Vineet ,
Why would we choose to use an internal table without a header line when it is easier to code one with a header line?
it has following reason.
1)Separate Internal Table Work Area:
The work area (staging area) defined for the internal table is not limited to use with just one internal table.
take ex-
Suppose you want two internal tables for EMPLOYEE one to contain all records and one to contain only those records where country = USA. You could create both of these internal tables without header lines and use only one work area to load data into both of them. You would append all records from the work area into the first internal table. You would conditionally append the USA records from the same work area into the second internal table.
2) Performance Issues: Using an internal table without a header line is more efficient than one with a header line
3) Nested Internal Tables: If you want to include an internal table within a structure or another internal table, you must use one without a header line.
If this one is helpful ,then rewards me
Regards
Shambhu -
System Variable For Internal table count
Can anybody tell me what the system variable for internal table count?
I just wants to know how many recoreds are there in my internal table ?
Regards,
pandu.Hi ,
DESCRIBE TABLE <itab> [LINES <l>] [OCCURS <n>] [KIND <k>].
If you use the LINES parameter, the number of filled lines is written to the variable <lin>. If parameter, the you use the OCCURS value of the INITIAL SIZE of the table is returned to the variable <n>. If you use the KIND parameter, the table type is returned to the variable <k>: T for standard table, S for sorted table, and H for hashed table.
using variable
SY-TFILL
After the statements DESCRIBE TABLE, LOOP AT, and READ TABLE, SY-TFILL contains the number of lines in the relevant internal table.
http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3798358411d1829f0000e829fbfe/content.htm
<REMOVED BY MODERATOR>
Edited by: Alvaro Tejada Galindo on Feb 21, 2008 4:53 PM -
Aggregate functions for internal table.
Hi Gurus,
I'm just wondering whether we can use aggregate functions for internal table. I wanted to know the max value for a particular column in my internal table. How can I achieve this easily and quickly.
Thanks,
David.sort the table on which you want the maximum value and read it. Please find below example code.
TYPES : BEGIN OF ty_mvke,
matnr TYPE mvke-matnr,
vkorg TYPE mvke-vkorg,
vtweg TYPE mvke-vtweg,
AUMNG type mvke-AUMNG,
END OF ty_mvke.
DATA : wa_mvke TYPE ty_mvke,
it_mvke TYPE STANDARD TABLE OF ty_mvke.
data : temp_AUMNG type AUMNG.
START-OF-SELECTION.
SELECT matnr vkorg vtweg AUMNG FROM mvke INTO
table it_mvke.
sort it_mvke by AUMNG.
read TABLE it_mvke into wa_mvke INDEX 1.
if sy-subrc = 0.
move wa_mvke-AUMNG to temp_AUMNG.
write : temp_AUMNG.
endif.
Thanks,
Sreekala. -
hello all,
i have a requirement like this,
there are two select statements like below
select * from IFLO appending corresponding fields of table it_itab_33kv
where begru eq '006F' and fltyp eq '6'.
select * from IFLO appending corresponding fields of table it_itab_33kv
where begru eq '004F' and fltyp eq '4'.
i wanted to do some thing like this in my ALV report
serno cost center cost center name no:of 33kv substations no:of 11kv feeders
1 0402120401 xxxxx 2 1
2 0402120301 xxxxx 1 3
3 0402120201 xxxxx 3 2
cost center wise i need to aggregate this,
how do i write my logic in internal table....
suggest me some ways....
thankqHi,
in the final alv grid u want to display first u sort the cost center and if you want to add the 33 kv and 11 kv feeder.use the code
data: l_grid type ref to cl_salv_table,
lr_functions type ref to cl_salv_functions_list.
CONSTANTS: gc_true TYPE sap_bool VALUE 'X'.
sortlt_final ascending costcenter.
loop at lt_final into wa_final.
collect wa_final into lt_final.
endloop.
CALL METHOD cl_salv_table=>factory
IMPORTING
r_salv_table = l_grid
CHANGING
t_table = lt_final.
lr_functions = l_grid->get_functions( ).
lr_functions->set_all( gc_true ).
l_grid->display( ).
hope it helps...do reward so -
Logic in internal table -- Urgent
Hi All,
I have an internal table idoc_data of structure
DOCNUM SEGNUM SEGNAM
3164 00001 E1STZUM -
1st idoc
3164 00002 E1MASTM
3164 00003 E1MARAM
3164 00004 E1MAKTM
3164 00005 E1STPOM -
end of 1st idoc
3164 00006 E1STZUM -
2nd idoc
3164 00007 E1MASTM
3164 00008 E1MARAM
3164 00009 E1STPOM -
end of 2nd idoc
3164 00010 E1STZUM -
3rd idoc
3164 00011 E1MASTM
3164 00012 E1MARAM
3164 00013 E1STPOM -
end of 3rd idoc
and so on .........
"Pls note that the idocs are collected into a single idoc having same DOCNUM 3164".
I have to write a logic like this.
Loop at idoc_data.
Move the first idoc record starting from E1STZUM -
1st idoc till E1STPOM----end of 1st idoc into a temporary internal table and call master_idoc_distribute to send an idoc out.
Move the second idoc record starting from E1STZUM -
2nd idoc till E1STPOM -
end of 2nd idoc into the temporary internal table and call master_idoc_distribute to send an idoc out.
Move the third idoc like the same and so on........for the whole idocs.
There could be even more than 5000 idocs in the same structure having same idoc number.
Any help in writing the logic is really appreciated. Pls send me the whole code itself. It is an urgent reqmt. So pls do the needful.....
Thanks
RickyWill explain one more time.
Internal table structure
DOCNUM SEGNUM SEGNAM
3164 00001 E1STZUM -
1st idoc
3164 00002 E1MASTM
3164 00003 E1MARAM
3164 00004 E1MAKTM
3164 00005 E1STPOM
3164 00006 Z1MARZ -
end of 1st idoc (this could be more than one )
3164 00007 E1STZUM -
2nd idoc
3164 00008 E1MASTM
3164 00009 E1MARAM
3164 00010 E1STPOM
3164 00011 Z1MARZ -
end of 2nd idoc (this could be more than one)
3164 00010 E1STZUM -
start of 3rd idoc
3164 00011 E1MASTM
3164 00012 E1MARAM
3164 00013 E1STPOM
3164 00014 Z1MARZ -
end of 3rd idoc (this could be more than one)
and so on.........
"Pls note that the idocs are collected into a single idoc having same DOCNUM 3164".
I have to write a logic like this.
Loop at idoc_data.
Move the first idoc record starting from E1STZUM -
1st idoc till Z1MARZ----end of 1st idoc into a temporary internal table and call '' FM master_idoc_distribute'' to send an idoc out.
Move the second idoc record starting from E1STZUM -
2nd idoc till Z1MARZ -
end of 2nd idoc into the temporary internal table and call FM "master_idoc_distribute" to send an idoc out.
Move the third idoc like the same and so on........for the whole idocs.
There could be even more than 5000 idocs in the same structure having same idoc number.
Any help in writing the logic is really appreciated. Pls send me the whole code itself. It is an urgent reqmt. So pls do the needful.....
Thanks -
Steps for: Internal table - convert to PDF - Sotre PDF files on UNIX Server
Hi Experts,
My requirement is to Split an internal table into multiple tables and generate a PDF for each of them.Then I have to place these files on a unix server directory. How can I achieve this?
This seems like a very high level requirement description .Please let me know if the solution needs some more details.
Thanks In Advance
Abhishek
Edited by: Yatin Vishwas Parab on Oct 23, 2009 1:53 PMHi,
1) The logic for splitting a internal table into multiple tables should lie with you .
2) write each of the split internal table to spool and convert them to PDF using the FM 'CONVERT_ABAPSPOOLJOB_2_PDF'. This has been discussed many times and you can find relevant threads by searching.
3) For storing the PDF in application server, use OPEN DATASET statement in binary mode and transfer the data. Even this has been discussed quite a few times before and you can search for relevant threads
Vikranth -
Need logic in Internal table processing
Hi all,
I have requirement like this.
i cretaed three internal tables
1) first Internal table can store total uploaded data from flat file..means line by line( Here each line is one record)
2) Second internal can store all fields which are fetched based on table which is given on selction screen.
3)now i cretaed one internal table with one variable
4) i used spilt statement on first internal table ( which store all flat file recrds) into third internal table.
so , my third internal table has first records values of first internal table in one column.
Now my probelm...i need to populate bapi structre tables with values of third internal table based on field names of second internal table. i am not able to do logic.
Is there any pointers to know soultion
Note:we know which fields values from flat values needs to populate Bapi structure table..
Thanks in advance,
regards,
JBRcheck this program may be u will get the logic
*& Report ZBAPI_MATERIAL_SAVEDATA
*& PURPOSE : THIS REPORT USES BAPI MATERIAL SAVE DATA TO UPDATE AND CREATE
*& THE MATERIAL
REPORT ZBAPI_MATERIAL_SAVEDATA NO STANDARD PAGE HEADING MESSAGE-ID (ZHNC).
TYPES:BEGIN OF TY_MAT,
MATERIAL(4),
IND_SECTOR(1),
MATL_TYPE(4),
MATL_GROUP(9),
BASE_UOM(3),
BASE_UOM_ISO(3),
PLANT(4),
DEL_FLAG(1),
PUR_GROUP(3),
BASE_QTY(13),
STGE_LOC(4),
MRP_IND(1),
SALES_ORG(4),
DISTR_CHAN(2),
DEL_FLAG1(1),
MIN_ORDER(13),
LANGU(2),
MATL_DESC(40),
END OF TY_MAT.
DATA: IT_DATA TYPE TABLE OF TY_MAT,
WA_DATA LIKE LINE OF IT_DATA.
*decalraing flag
data: v_flag value ''.
*DECLARING WORK AREAs TO BE PASSED TO THE FUNCTION MODULE.
DATA: BAPI_HEAD LIKE BAPIMATHEAD,
BAPI_CLIENTDATA LIKE BAPI_MARA,
BAPI_CLIENTDATAX LIKE BAPI_MARAX,
BAPI_PLANTDATA LIKE BAPI_MARC,
BAPI_PLANTDATAX LIKE BAPI_MARCX,
BAPI_STORAGELOCATIONDATA LIKE BAPI_MARD,
BAPI_STORAGELOCATIONDATAX LIKE BAPI_MARDX,
BAPI_SALESDATA LIKE BAPI_MVKE,
BAPI_SALESDATAX LIKE BAPI_MVKEX,
BAPI_MAKT LIKE BAPI_MAKT,
BAPI_RETURN LIKE BAPIRET2.
*INTERNAL TABLE TO HOLD THE MATERIAL DESCRIPTION
DATA: BEGIN OF IT_MAKT OCCURS 0.
INCLUDE STRUCTURE BAPI_MAKT.
DATA END OF IT_MAKT.
DATA:BEGIN OF IT_RET OCCURS 0.
INCLUDE STRUCTURE BAPIRET2.
DATA END OF IT_RET.
*INTERNAL TABLE TO HOLD HEADER DATA
DATA: IT_EXCEL TYPE ALSMEX_TABLINE OCCURS 0 WITH HEADER LINE.
*SELECTION-SCREEN ELEMENTS
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
PARAMETER: FNAME TYPE RLGRAP-FILENAME OBLIGATORY DEFAULT 'C:\Documents and Settings\Administrator\Desktop\MATMAS.XLS' .
PARAMETERS: P_BEGCOL TYPE I DEFAULT 1 NO-DISPLAY,
P_BEGROW TYPE I DEFAULT 1 NO-DISPLAY,
P_ENDCOL TYPE I DEFAULT 100 NO-DISPLAY,
P_ENDROW TYPE I DEFAULT 32000 NO-DISPLAY.
SELECTION-SCREEN END OF BLOCK B1.
*DECLARATION OF EXCELAL TABLE
AT SELECTION-SCREEN ON VALUE-REQUEST FOR FNAME.
PERFORM F_GET_FILE USING FNAME.
START-OF-SELECTION.
PERFORM F_XLS_ITAB USING FNAME
CHANGING IT_EXCEL.
PERFORM F_MOVE_DATA.
perform F_GET_DATA.
*& Form F_GET_FILE
text
-->P_FNAME text
<--P_SY_SUBRC text
FORM F_GET_FILE USING P_FNAME LIKE FNAME.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
PROGRAM_NAME = SYST-REPID
DYNPRO_NUMBER = SYST-DYNNR
FIELD_NAME = ' '
STATIC = ' '
MASK = ' '
CHANGING
FILE_NAME = P_FNAME
EXCEPTIONS
MASK_TOO_LONG = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE E006(ZHNC).
ENDIF.
ENDFORM. " F_GET_FILE
*& Form F_XLS_ITAB
text
-->P_FNAME text
<--P_IT_EXCEL text
FORM F_XLS_ITAB USING P_FNAME
CHANGING P_IT_EXCEL.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
FILENAME = FNAME
I_BEGIN_COL = P_BEGCOL
I_BEGIN_ROW = P_BEGROW
I_END_COL = P_ENDCOL
I_END_ROW = P_ENDROW
TABLES
INTERN = IT_EXCEL
EXCEPTIONS
INCONSISTENT_PARAMETERS = 1
UPLOAD_OLE = 2
OTHERS = 3
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " F_XLS_ITAB
*& Form F_MOVE_DATA
text
--> p1 text
<-- p2 text
FORM F_MOVE_DATA .
DATA : LV_INDEX TYPE I.
FIELD-SYMBOLS <FS>.
*--- Sorting the internal table
SORT IT_EXCEL BY ROW COL.
CLEAR IT_EXCEL.
LOOP AT IT_EXCEL.
MOVE IT_EXCEL-COL TO LV_INDEX.
*--- Assigning the each record to an internal table row
ASSIGN COMPONENT LV_INDEX OF STRUCTURE WA_DATA TO <FS>.
*--- Asigning the field value to a field symbol
MOVE IT_EXCEL-VALUE TO <FS>.
AT END OF ROW.
APPEND WA_DATA TO IT_DATA.
CLEAR WA_DATA.
ENDAT.
ENDLOOP.
ENDFORM. " F_MOVE_DATA
*& Form F_GET_DATA
text
--> p1 text
<-- p2 text
FORM F_GET_DATA .
LOOP AT IT_DATA INTO WA_DATA.
MOVE-CORRESPONDING WA_DATA TO BAPI_HEAD.
BAPI_HEAD-BASIC_VIEW ='X'.
BAPI_HEAD-SALES_VIEW ='X'.
BAPI_HEAD-PURCHASE_VIEW ='X'.
BAPI_HEAD-STORAGE_VIEW ='X'.
MOVE-CORRESPONDING WA_DATA TO BAPI_CLIENTDATA.
BAPI_CLIENTDATAX-MATL_GROUP = 'X'.
BAPI_CLIENTDATAX-BASE_UOM = 'X'.
BAPI_CLIENTDATAX-BASE_UOM_ISO = 'X'.
MOVE-CORRESPONDING WA_DATA TO BAPI_PLANTDATA.
BAPI_PLANTDATAX-PLANT = BAPI_PLANTDATA-PLANT.
BAPI_PLANTDATAX-DEL_FLAG = 'X'.
BAPI_PLANTDATAX-PUR_GROUP = 'X'.
BAPI_PLANTDATAX-BASE_QTY = 'X'.
MOVE-CORRESPONDING WA_DATA TO BAPI_STORAGELOCATIONDATA.
BAPI_STORAGELOCATIONDATA-PLANT = BAPI_PLANTDATA-PLANT.
BAPI_STORAGELOCATIONDATAX-PLANT = BAPI_STORAGELOCATIONDATA-PLANT.
BAPI_STORAGELOCATIONDATAX-STGE_LOC = BAPI_STORAGELOCATIONDATA-STGE_LOC.
BAPI_STORAGELOCATIONDATAX-MRP_IND = 'X'.
MOVE-CORRESPONDING WA_DATA TO BAPI_SALESDATA.
BAPI_SALESDATAX-SALES_ORG = BAPI_SALESDATA-SALES_ORG.
BAPI_SALESDATAX-DISTR_CHAN = BAPI_SALESDATA-DISTR_CHAN.
BAPI_SALESDATAX-DEL_FLAG = BAPI_SALESDATA-DEL_FLAG.
BAPI_SALESDATAX-MIN_ORDER = 'X'.
REFRESH IT_MAKT.
IT_MAKT-LANGU = WA_DATA-LANGU.
IT_MAKT-MATL_DESC = WA_DATA-MATL_DESC.
APPEND IT_MAKT.
CLEAR IT_RET.
REFRESH IT_RET.
PERFORM F_CALL_BAPI.
READ TABLE IT_RET WITH KEY TYPE = 'S'.
IF SY-SUBRC EQ 0.
PERFORM F_BAPI_COMMIT.
WRITE:/ 'MATERIAL CREATED OR UPDATED SUCESSFULLY WITH MATERIAL NO',WA_DATA-MATERIAL.
ELSE.
MESSAGE E000(ZHNC) WITH 'ERROR IN CREATING THE MATERIAL'.
*WRITE: / 'ERROR IN CREATIN MATERIAL',IT_RET-MESSAGE.
*PERFORM F_DOWNLOAD.
ENDIF.
*ENDIF.
ENDLOOP.
ENDFORM. " F_GET_DATA
*& Form F_CALL_BAPI
text
--> p1 text
<-- p2 text
FORM F_CALL_BAPI .
CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
EXPORTING
HEADDATA = BAPI_HEAD
CLIENTDATA = BAPI_CLIENTDATA
CLIENTDATAX = BAPI_CLIENTDATAX
PLANTDATA = BAPI_PLANTDATA
PLANTDATAX = BAPI_PLANTDATAX
STORAGELOCATIONDATA = BAPI_STORAGELOCATIONDATA
STORAGELOCATIONDATAX = BAPI_STORAGELOCATIONDATAX
SALESDATA = BAPI_SALESDATA
SALESDATAX = BAPI_SALESDATAX
IMPORTING
RETURN = IT_RET
TABLES
MATERIALDESCRIPTION = IT_MAKT
UNITSOFMEASURE =
UNITSOFMEASUREX =
INTERNATIONALARTNOS =
MATERIALLONGTEXT =
TAXCLASSIFICATIONS =
RETURNMESSAGES =
PRTDATA =
PRTDATAX =
EXTENSIONIN =
EXTENSIONINX =
APPEND IT_RET.
ENDFORM. " F_CALL_BAPI
*& Form F_BAPI_COMMIT
text
--> p1 text
<-- p2 text
FORM F_BAPI_COMMIT .
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT =
IMPORTING
RETURN =
ENDFORM. " F_BAPI_COMMIT -
Sy-tabix for internal table in smartform
Hi friends,
How to capture the sy-tabix value for the entries in an internal table which has been looped into the loop of table node of a smartform?? I need to print something immedaitely after the end of the table
For every record the value of sy-tabix is showing 1 !!
Advance Thanks
AadarshHi Aadarsh,
Give ur sy-tabix at the end of the loop.
loop at itab.
//table node populations.
endloop.
give a seperate loop for this.
loop at itab.
sy-tabix.
endloop
get the total no and print it after the table.
If u r using do loop then give sy-index.
Hope tihs helps u,
Regards,
Nagarajan.
Message was edited by: Nagarajan Kumarappan -
Field catalog for internal table in ALV
In my program the internal table consists many fields from various tables and structure doesn't belong to a single data table.
In order to get output in ALV grid following FM has been used
REUSE_ALV_GRID_DISPLAY
for field catalog the fields are defined specifically.
l_fieldcat-fieldname = 'VBELN'.
l_fieldcat-outputlen = 10.
l_fieldcat-seltext_l = 'Billing doc'.
l_fieldcat-no_zero = 'X'.
l_fieldcat-hotspot = 'X'.
append l_fieldcat to p_fieldtab.
..............and so on for all the fields.
Just wanted to know is there any other method to display all the fields of this internal table automatically so each field is not specified specifically.
anyaHi
Try this instead:
*& Form create_fieldcatalog
* Create a field catalogue from any internal table
* -->PT_TABLE Internal table
* -->PT_FIELDCAT Field Catalogue
FORM create_fieldcatalog
USING pt_table TYPE ANY TABLE
CHANGING pt_fieldcat TYPE lvc_t_fcat.
DATA:
lr_tabdescr TYPE REF TO cl_abap_structdescr
, lr_data TYPE REF TO data
, lt_dfies TYPE ddfields
, ls_dfies TYPE dfies
, ls_fieldcat TYPE lvc_s_fcat
CLEAR pt_fieldcat.
CREATE DATA lr_data LIKE LINE OF pt_table.
lr_tabdescr ?= cl_abap_structdescr=>describe_by_data_ref( lr_data ).
lt_dfies = cl_salv_data_descr=>read_structdescr( lr_tabdescr ).
LOOP AT lt_dfies
INTO ls_dfies.
CLEAR ls_fieldcat.
MOVE-CORRESPONDING ls_dfies TO ls_fieldcat.
APPEND ls_fieldcat TO pt_fieldcat.
ENDLOOP.
ENDFORM. "create_fieldcatalog -
Query statement for internal table
is it possible to use a select statement to select data from an internal table? if yes, can anyone show me the codes to it? thx
Hi Daphne,
You use SELECT statement to read data from database table but not from Internal table.
For reading data from Internal table, you have to use READ statement.
Syntax:
READ TABLE itab { table_key
| free_key
| index } result.
Effect of using read statement:
This statement reads a row from internal table itab. You have to specify the row by either naming values table_key for the table key, a free condition free_key or an index index. The latter choice is possible only for index tables. The output result result determines when and where the row contents are read.
If the row to be read is not uniquely specified, the first suitable row is read. In the case of index tables, this row has the lowest table index of all matching rows.
Reward if usefull
thanks
swaroop -
Using aggregation in ABAP code for internal table
I have written following code to get cumulative amount on a date but i have to hit database for each record.
Can't I use some function similar to SUM for doing the same thing on internal table??It would increase my performance.
code is:
SELECT SUM( DEB_CRE_LC ) FROM /BIC/AZFIAR_O500
INTO LV_BALMONTH WHERE DEBITOR = LV_DEBITOR AND
CALMONTH GE LV_STARTMONTH AND CALMONTH LE LV_LASTCALMON.
I want to put ZFIAR data to internal table and read and do SUM thing..is it possible?? withotut usiong loop.
regards,
rakeshHi Rajesh,
types : begin of ty_tab,
date type dats,
DEB_CRE_LC type ..... " delare type & is the filed need to summerized
end of ty_tab,
data: itab type standard table of ty_tab.
SELECT date
SUM( DEB_CRE_LC ) as DEB_CRE_LC FROM /BIC/AZFIAR_O500
INTO corresponding fields of itab
where CALMONTH GE LV_STARTMONTH AND CALMONTH LE LV_LASTCALMON
group by date. " date is the field available in your ODS/transparent table
simulate the above code in your program...
Hope this will work.. -
How to parse XML for internal table
hi guys, I would like to know how to parse xml for an internal table. I explain myself.
Let's say you have a purchase order form where you have header data & items data. In my interactive form, the user can change the purchase order quantity at the item level. When I received back the pdf completed by mail, I need to parse the xml and get the po qty that has been entered.
This is how I do to get header data from my form
lr_ixml_node = lr_ixml_document->find_from_name( name = ''EBELN ).
lv_ebeln = lr_ixml_node->get_value( ).
How do we do to get the table body??
Should I used the same method (find_from_name) and passing the depth parameter inside a do/enddo?
thanks
Alexandre GiguereAlexandre,
Here is an example. Suppose your internal table is called 'ITEMS'.
lr_node = lr_document->find_from_name('ITEMS').
lv_num_of_children = lr_node->num_children( ).
lr_nodechild = lr_node->get_first_child( ).
do lv_num_of_children times.
lv_num_of_attributes = lr_nodechild->num_children( ).
lr_childchild = lr_nodechild->get_first_child( ).
do lv_num_of_attributes times.
lv_value = lr_childchild->get_value( ).
case sy-index.
when 1.
wa_item-field1 = lv_value
when 2.
wa_item-field2 = lv_value.
endcase.
lr_childchild = lr_childchild->get_next( ).
enddo.
append wa_item to lt_item.
lr_nodechild = lr_nodechild->get_next( ).
enddo. -
Maximum record limit for internal table
hello all,
can any one tell me what is the maximum limit of internal table. i would like to add all records from bseg to internal table. so i can improve processing time.
thanks,
rajhi,
Before Release 4.0A, ABAP stored the content of internal tables in a combination of main memory and file space. This means that the maximum size of all internal tables of all programs running on such an application server at one time is about 2 GB. With Release 4.0A or greater, this size decreases to about 500 MB. (Note that those values aren't fixed, but this is a good guide. This minimum of 500 MB is the lowest limit of the real value, which varies among different operating systems and even among different releases of the same operating system.)
It may sound strange that a newer release has a higher restriction on capacity. But it's a consequence of the fact that the contents of internal tables move from a reserved file to shared memory. When you process internal tables this way in Release 4.0A or greater, you pay for much better performance with a smaller potential size.
Regards,
Sourabh
Maybe you are looking for
-
Monitor any record to stay in queue for more than 5 minutes under AQ ADMIN schema
Hi All, We need to prepare script which monitor/notify us the record which stays in queue for more than 5 minutes under AQADMIN queue tables. Can someone throw light on this? Regards, MD
-
Handling multiple cursors with column of date datatype issue reg
Dear all, i am using three cursors in one pl/sql block each of this three cursor will fetch data based on column of date data type.i believe due to each condition relate to same table,contradiction may arise i.e 1> when code will execute , cursor c1
-
Reader & Flash Player won't finish downloading
I am trying to install Reader & Flash Player on my Windows 7 computer but once the program goes to the installer screen it just freezes. The computer has been sitting for an hour and nothing happens. I have tried starting the install from a saved loc
-
Can't print remotely using foxfire and can on internet explorer is norton security blocking foxfire
when i try to print on hp printer, won't print. it prints using internet explorer. is it because i have norton security and foxfire is blocking it?
-
I created a new Outgoing excise document. then take a print preview And Export (PDF) then show me error Application has problem "C:\Program Files\SAP\SAP Business One\Log\SAP Business_20081120103341.dmp" was created . please contact support and attac