Reg : internal table & Perform statement
hi all
i have 3 internal tables ,
* in first internal table i have mark-1 ,*
* in 2nd internal table i have mark-2 ,*
* using "PERFORM" i have to add mark 1 & mark 2*
* and i need to display the total in 3rd internal table.*
* how to do by using "PERFORM" .*
Kindly clarify.
with kind regards
vel
Raghupathy is right you just have to write:
porgram code......
perform sum_of_tables tables itab1
itab2
itab3.
program code....
definition of form:
form_sum_of_tables tables itab1
itab2
itab3.
definiton type of witab1, witab2, witab3.
loop itab1 into witab1.
loop itab2 into witab2.
witab3-total = witab1-mark1 plus witab2-mark2.
append witab3 to itab3.
endloop.
endloop.
endform.
It will return itab3 which is sum of itab1 and itab2.
Similar Messages
-
Internal Table : occurs statement
What is the meaning of using "occurs" statement in Internal Table. What does it imply?
DATA: BEGIN OF ITAB OCCURS 10,
END OF ITAB.
What difference it will make if suppose I use "OCCURS 0" or "OCCURS 10" ?Hi yogesh for more clearification
difference b/w occurs 0 & occurs n
The number <N> indicate how many lines has to have the table in initialization time: i.e. when the program is loaded in memory, the space for the table depends on the initialization numbers of the records.
AT run time if the table needs more space, this'll automatically be enhanced.
But If you know your table can have a certain numbers of records, you can indicate it in the defination, what'll improve the performance:
all the space the table needs is taken at the beginin, so it doesn't need to enhance the space at run time.
When this initial area is full, the system makes twice as much extra space available up to a limit of 8KB. Further memory areas of 12KB each are then allocated.
You can usually leave it to the system to work out the initial memory requirement. The first time you fill the table, little memory is used. The space occupied, depending on the line width, is 16 <= <n> <= 100.
It only makes sense to specify a concrete value of <n> if you can specify a precise number of table entries when you create the table and need to allocate exactly that amount of memory (exception: Appending table lines to ranked lists). This can be particularly important for deep-structured internal tables where the inner table only has a few entries (less than 5, for example).
To avoid excessive requests for memory, large values of <n> are treated as follows: The largest possible value of <n> is 8KB divided by the length of the line. If you specify a larger value of <n>, the system calculates a new value so that n times the line width is around 12KB."
and it is better to use occus 0 inplace of occurs n because of above specified reasons
while it is not recommended to use occurs for internal table declaration and it has become obselete
reward if helpful -
Reg: internal table?
hello friends?
i have one basic doubts,
please clear this things,
what are all the ways we can create the internal table?
how we create internal table using data statement?
how we create internal table using types statement?
what is the difference between these two methods?FYI..
DATA - Defining an Internal Table
Variants:
1. DATA itab TYPE itabtype [WITH HEADER LINE].
2. DATA itab {TYPE tabkind OF linetype|
LIKE tabkind OF lineobj}
WITH [UNIQUE|NON-UNIQUE] keydef
[INITIAL SIZE n] [WITH HEADER LINE].
3. DATA itab {TYPE TABLE OF linetype|LIKE TABLE OF lineobj}.
4. DATA itab TYPE RANGE OF type.
DATA itab LIKE RANGE OF f.
5. DATA itab [TYPE linetype|LIKE lineobj] OCCURS n
[WITH HEADER LINE].
6. DATA: BEGIN OF itab OCCURS n,
END OF itab [VALID BETWEEN f1 AND f2].
In an ABAP Objects context, a more severe syntax check is performed that in other ABAP areas. See New naming conventions and LIKE references to Dictionary Types not allowed.
Effect
Defines an internal table.
To fill and process internal tables, use the statements INSERT, APPEND, READ TABLE, LOOP, SORT, and so on.
The OCCURS or INITIAL SIZE parameter (OCCURS value) determines the number of lines that are created when the table itself is created. However, the table is extended dynamically on demand. For details, refer to Performance Notes for Internal Tables. The OCCURS value, has no other semantic meaning (apart from one exception in the APPEND SORTED BY statement). If you do not specify an INIT IAL SIZE , the system uses the default value 0.
If you specify WITH HEADER LINE, the table is created with a header line, that is, a field with the same name. It has the same type as the line type of the table.
This addition is not allowed in an ABAP Objects context. See Tables with header line not allowed.
Variant 1
DATA itab TYPE itabtype [WITH HEADER LINE].
Effect
itabtype must be an internal table type that you have already defined using TYPES. The statement creates an internal table in the program with this type.
In general, the type specification for the table object must be complete. The exception to this is a standard table, in which the key definition may be missing. In this case, the system automatically uses a default key.
Example
Creating a hashed table by referring to an existing table type:
TYPES: BEGIN OF STRUC, NAME(10), AGE TYPE I, END OF STRUC,
HTAB TYPE HASHED TABLE OF STRUC WITH UNIQUE KEY NAME.
DATA : PERSONS TYPE HTAB.
Variant 2
DATA itab {TYPE tabkind OF linetype|LIKE tabkind OF lineobj} WITH [UNIQUE|NON-UNIQUE] keydef
[INITIAL SIZE n] [WITH HEADER LINE].
Effect
Creates an internal table in the program with the type tabkind. Since there are no generic field definitions, you cannot use the table types ANY TABLE or INDEX TABLE.
The structure of the table lines is defined by the type linetype if you use a TYPE reference) or by the type of the referred object lineobj (when you use a LIKE reference).
The same rules apply to the UNIQUE and NON-UNIQUE additions in the DATA statement as in a TYPES definition. You may only omit the definition when defining a standard table.
If you do not specify the INITIAL SIZE the system uses a default initial size of 0.
Variant 3
DATA itab {TYPE TABLE OF linetype|LIKE TABLE OF lineobj}.
Effect
This is a shortened form of the definition of a standard table. It corresponds to
DATA itab {TYPE STANDARD TABLE OF linetype|
LIKE STANDARD TABLE OF lineobj} WITH DEFAULT KEY.
or the old definition (compare variant 4)
DATA itab {TYPE linetype|LIKE lineobj} OCCURS 0.
Variant 4
DATA itab TYPE RANGE OF type. DATA itab LIKE RANGE OF f.
Additions:
1. ... INITIAL SIZE n
2. ... WITH HEADER LINE
Effect
Creates an internal table itab with table type STANDARD. The line type is a structure with the following components:
SIGN(1) TYPE C
OPTION(2) TYPE C
LOW TYPE type bzw. LIKE f
HIGH TYPE type bzw. LIKE f
Addition 1
...INITIAL SIZE n
Effect
The INITIAL SIZE specification determines how many table lines are created when the table itself is created. The table is also dynamically expanded as required. For further information, refer to Performance Notes for Internal Tables. The INITIAL SIZE value has no semantic meaning (apart from one exception in the ei APPEND SORTED BY statement). If you do not specify the INITIAL SIZE, the system uses the default value 0.
Addition 2
... WITH HEADER LINE
This addition is not allowed in an ABAP Objects context. See Tables with Header Lines Not Allowed.
Effect
Creates an internal table and a header line for it, that is, a field with the same name as the internal table and the same type as the line type of the internal table.
Variant 5
DATA itab [TYPE linetype|LIKE lineobj] OCCURS n [WITH HEADER LINE].
This variant is not allowed in an ABAP Objects context. See Declaration with OCCURS not allowed.
Effect
This variant exists to ensure compatibility with Release 3.x. If you do not specify a line type, the system uses type C with length 1. Otherwise, the variant is the same as
DATA itab {TYPE STANDARD TABLE OF linetype|
LIKE STANDARD TABLE OF lineobj}
INITIAL SIZE n [WITH HEADER LINE].
Example
TYPES: BEGIN OF LINE_TYPE,
NAME(20) TYPE C,
AGE TYPE I,
END OF LINE_TYPE.
DATA: PERSONS TYPE LINE_TYPE OCCURS 20,
PERSONS_WA TYPE LINE_TYPE.
PERSONS_WA-NAME = 'Michael'. PERSONS_WA-AGE = 25.
APPEND PERSONS_WA TO PERSONS.
PERSONS_WA-NAME = 'Gabriela'. PERSONS_WA-AGE = 22.
APPEND PERSONS_WA TO PERSONS.
The internal table PERSONS now contains two entries.
Variant 6
DATA: BEGIN OF itab OCCURS n, ...
END OF itab [VALID BETWEEN f1 AND f2].
This variant is not allowed in an ABAP Objects context. See Declaration with OCCURS not allowed.
Effect
Creates an internal table itab with type STANDARD and a header line. The line type consists of the fields between "BEGIN OF itab OCCURS n" and " END OF itab".
Use the VALID BETWEEN f1 AND f2 addition to specify that the components f1 and f2 of the internal table itab contain a line-based validity interval. You can only use this addition in conjunction with the PROVIDE statement.
Example
DATA: BEGIN OF PERSONS OCCURS 20,
NAME(20),
AGE TYPE I,
END OF PERSONS.
PERSONS-NAME = 'Michael'.
PERSONS-AGE = 25.
APPEND PERSONS.
PERSONS-NAME = 'Gabriela'.
PERSONS-AGE = 22.
APPEND PERSONS.
The internal table consists of two entries. PERSONS also has a header line (work area), which is an interface between the program and the actual table contents.
Additional help
Internal Table Objects
Ramesh -
Loop Internal Table Performance
Hi I am from BW and not much familiar with ABAP. I have written the following code in BW. I have around 1.5 million records coming into BW and the code I have written needs to go through 1.5 million times. Hence the data load is taking long time. I would like someone to please go through the code below and suggest if any for performance improvement.
data: i_datapackage like DATA_PACKAGE occurs 0 with header line,
i_index like sy-tabix,
j_index like sy-tabix,
i_employee like /bi0/memployee occurs 0 with header line,
i_begda like /bi0/memployee occurs 0 with header line.
prev_job like i_employee-job,
prev_position like i_employee-hrposition,
curr_job like i_employee-job,
curr_position like i_employee-hrposition,
job_datefrom like i_employee-datefrom,
position_datefrom like i_employee-datefrom,
prejob_datefrom like i_employee-datefrom,
prepos_datefrom like i_employee-datefrom,
prejob_dateto like i_employee-datefrom,
prepos_dateto like i_employee-datefrom.
i_datapackage[] = DATA_PACKAGE[].
sort i_datapackage by employee calmonth ascending.
select * from /bi0/memployee into table i_employee.
sort i_employee by employee dateto descending.
i_begda[] = i_employee[].
sort i_begda by employee datefrom ascending.
delete adjacent duplicates from i_employee comparing employee.
loop at i_datapackage.
*collecting current job,position, previous job, position
read table i_employee with key employee = i_datapackage-employee
dateto ='99991231'.
if sy-subrc = 0.
curr_job = i_employee-job.
curr_position = i_employee-hrposition.
endif.
read table i_begda with key employee = i_datapackage-employee.
if sy-subrc = 0.
prev_job = i_begda-/bic/zhr_pjob.
prev_position = i_begda-/bic/zhr_ppost.
endif.
*end of collecting current job and position
sort i_begda by employee datefrom descending.
read table i_begda with key employee = i_datapackage-employee
binary search.
if sy-subrc = 0.
i_index = sy-tabix.
endif.
read table i_begda index i_index.
if i_begda-employee ne i_datapackage-employee.
exit.
endif.
code for populating service award tenure
if i_begda-/bic/zhr_srvdt is not initial.
i_datapackage-/bic/zhr_hrtnr = sy-datum+0(4) -
i_begda-/BIC/ZHR_SRVDt+0(4).
if sy-datum4(4) lt i_begda-/bic/zhr_srvdt4(4).
i_datapackage-/bic/zhr_hrtnr = i_datapackage-/bic/zhr_hrtnr - 1.
endif.
endif.
code for current hire tenure
if i_begda-/bic/zhr_curdt is not initial.
i_datapackage-/bic/zhr_crtnr = sy-datum+0(4) -
i_begda-/BIC/ZHR_CURDT+0(4).
if sy-datum4(4) lt i_begda-/BIC/ZHR_CURDT4(4).
i_datapackage-/BIC/ZHR_CRTNR = i_datapackage-/bic/zhr_crtnr - 1.
endif.
endif.
code for current supervisor tenure
if i_begda-/bic/zhr_csbdt is not initial.
i_datapackage-/bic/ZHR_CSTNR = sy-datum+0(4) -
i_begda-/BIC/ZHR_CSBDT+0(4).
if sy-datum4(4) lt i_begda-/BIC/ZHR_CSBDT4(4).
i_datapackage-/bic/ZHR_CSTNR = i_datapackage-/bic/ZHR_CSTNR - 1.
endif.
endif.
code for previous supervisor tenure
if i_begda-/bic/zhr_psbdt is not initial.
i_datapackage-/bic/ZHR_PSTNR = sy-datum+0(4) -
i_begda-/BIC/ZHR_PSBDT+0(4).
if sy-datum4(4) lt i_begda-/BIC/ZHR_PSBDT4(4).
i_datapackage-/bic/ZHR_PSTNR = i_datapackage-/bic/ZHR_PSTNR - 1.
endif.
endif.
Code for populating Years in current job
and current position
sort i_begda by employee datefrom ascending.
clear j_index.
read table i_begda with key employee = i_datapackage-employee.
if sy-subrc = 0.
j_index = sy-tabix.
endif.
loop at i_begda from j_index.
if i_begda-employee ne i_datapackage-employee.
exit.
elseif ( i_begda-job eq curr_job ) and
( curr_job is not initial ).
job_datefrom = i_begda-datefrom.
prejob_dateto = i_begda-datefrom - 1.
exit.
endif.
endloop.
loop at i_begda from j_index.
if i_begda-employee ne i_datapackage-employee.
exit.
elseif ( i_begda-hrposition eq curr_position ) and
( curr_position is not initial ).
position_datefrom = i_begda-datefrom.
prepos_dateto = i_begda-datefrom - 1.
exit.
endif.
endloop.
loop at i_begda from j_index.
if i_begda-employee ne i_datapackage-employee.
exit.
elseif ( i_begda-job eq prev_job ) and
( prev_job is not initial ) and
( i_begda-datefrom ne '10000101').
prejob_datefrom = i_begda-datefrom.
exit.
endif.
endloop.
loop at i_begda from j_index.
if i_begda-employee ne i_datapackage-employee.
exit.
elseif ( i_begda-hrposition eq prev_position ) and
( prev_position is not initial ) and
( i_begda-datefrom ne '10000101').
prepos_datefrom = i_begda-datefrom.
exit.
endif.
endloop.
i_datapackage-/bic/zhr_cjtnr = sy-datum+0(4) -
job_datefrom+0(4).
if sy-datum4(4) lt job_datefrom4(4).
i_datapackage-/bic/zhr_cjtnr = i_datapackage-/bic/zhr_cjtnr - 1.
endif.
if position_datefrom+0(4) is not initial.
i_datapackage-/bic/zhr_cptnr = sy-datum+0(4) -
position_datefrom+0(4).
if sy-datum4(4) lt position_datefrom4(4).
i_datapackage-/bic/zhr_cptnr = i_datapackage-/bic/zhr_cptnr - 1.
endif.
endif.
if prejob_datefrom is not initial.
i_datapackage-/bic/zhr_pjtnr = prejob_dateto+0(4) -
prejob_datefrom+0(4).
if prejob_dateto4(4) lt prejob_datefrom4(4).
i_datapackage-/bic/zhr_pjtnr = i_datapackage-/bic/zhr_pjtnr - 1.
endif.
endif.
if prepos_datefrom is not initial.
i_datapackage-/bic/zhr_pptnr = prepos_dateto+0(4) -
prepos_datefrom+0(4).
if prepos_dateto4(4) lt prepos_datefrom4(4).
i_datapackage-/bic/zhr_pptnr = i_datapackage-/bic/zhr_pptnr - 1.
endif.
endif.
modify i_datapackage transporting /bic/zhr_hrtnr /bic/zhr_crtnr
/bic/zhr_cstnr /bic/ZHR_PSTNR /bic/zhr_cjtnr /bic/zhr_cptnr
/bic/zhr_pjtnr /bic/zhr_pptnr.
endloop.
DATA_PACKAGE[] = i_datapackage[].
Thanks.i_datapackage[] = DATA_PACKAGE[].
i_begda[] = i_employee[].
How larger are these internal tables ?
If large, then
> sort i_begda by employee datefrom descending.
> read table i_begda with key employee = i_datapackage-employee binary search.
the resorting and
the nested loops
=> will kill your performance
Please reconsider the whole logic, I have only some hints
+ Binary search does not help anything if you have to sort everytime you use it.
+ Never use a sort of a larger table inside a larger loop, it is always avoidable!
+ Check whether you can break down the big piece into smaller one, try to
do the break down in the database already to save memory
=> Please provide your code in better layout, and explain what you actually want
to do.
Siegfried -
Internal table -Select statement -2nd plant is not being filled
Hi,
Second field for plant WERKD is not getting filled in this table.I am using into corresponding fields of table ITAB statement.
I need both plants and in single select statement.
Any ideas?
DATA: BEGIN OF T_STOF OCCURS 0,
VBELN LIKE LIPS-VBELN,
ERNAM LIKE LIPS-ERNAM,
WERKS LIKE LIPS-WERKS,
NTGEW LIKE LIPS-NTGEW,
GEWEI LIKE LIPS-GEWEI,
EBELN LIKE EKKO-EBELN,
WERKD LIKE EKPO-WERKS,
LGORT LIKE EKPO-LGORT,
EBELP LIKE EKPO-EBELP,
MATNR LIKE EKPO-MATNR,
TXZ01 LIKE EKPO-TXZ01,
AEDAT LIKE EKPO-AEDAT,
KNUMV LIKE EKKO-KNUMV,
END OF T_STOF.
SELECT LIKPVBELN LIKPERNAM LIPSWERKS LIPSNTGEW LIPS~GEWEI
EKKOEBELN EKPOWERKS EKPOLGORT EKPOEBELP EKPOMATNR EKPOTXZ01 EKPOAEDAT EKKOKNUMV
INTO CORRESPONDING FIELDS OF TABLE T_STOF
FROM LIKP
INNER JOIN LIPS
ON LIKPVBELN EQ LIPSVBELN
INNER JOIN EKKO
ON LIPSVGBEL EQ EKKOEBELN
INNER JOIN EKPO
ON EKKOEBELN EQ EKPOEBELN
WHERE LIKP~VBELN IN S_VBELN
AND LIKP~ERNAM IN S_ERNAM
AND LIPS~WERKS IN S_WERKS
AND EKKO~EBELN IN S_EBELN
AND EKPO~WERKS IN S_WERKD
AND EKPO~LGORT IN S_LGORT
AND EKPO~MATNR IN S_MATNR
AND EKPO~AEDAT IN S_AEDAT
AND BSART = 'UB'.
Or am i doing in wrong?
Regards
PraveenHi,
If you use INTO CORRESPONDING then the fieldname in the internal table has to match the selecting field name..
To avoid this you can use INTO TABLE...
SELECT LIKPVBELN LIKPERNAM LIPSWERKS LIPSNTGEW LIPS~GEWEI
EKKOEBELN EKPOWERKS EKPOLGORT EKPOEBELP EKPOMATNR EKPOTXZ01 EKPOAEDAT EKKOKNUMV
<b>INTO TABLE T_STOF</b>
Thanks,
Naren -
Hi,
AM using Read statement to read internal table as below.
Read itab into wa with key x = y.
if sy-subrc eq 0.
do some thing.
endif.
However the work area wa is not useful to me in my program. when am doing extended check it is issueing warning saying wa is not used. HOW TO CLOSE THIS WARNING.
Regards,
AAkashjust before read statement do
CLEAR WA.
This should remove the error.
Cheers
VJ -
Processing in 2 internal tables -Performance wise better option
Hi Experts,
I have 2 internal tables.
ITAB1 and ITAB2 both are sorted by PSPHI.
ITAB1 has PSPHI some more fields INVOICE DATE and AMT
ITAB2 has PSPHI some more fields amount.
Both itab1 and itab2 will always have same amount of data.
I need to filter data from ITAB2 based invoice date given on selection screen.since ITAB2 doesnt have invoice date field.
i am doing further processing to filter the records.
I have thought of below processing logic and wanted to know if there is a better option performance wise?
loop at ITAB1 into wa where invoice_date > selection screen date. (table which has invoice date)
lv_index = sy-tabix.
read table itab2 where psphi = wa-psphi and index = lv_index.
if sy-subrc = 0.
delete itab2 index lv_index.
endif.
endloop.Hi Madhu,
My Requirement is as below could you please advice on this ?
ITAB1
Field 1 PSPHI , FIELD 2 INVOICE, FIELD 3 INVOICE_DATE , FIELD4 AMT
15245, INV1, 02/2011 , 400
15245 INV2 02/2012 , 430
ITAB2
Field 1 PSPHI , FIELD 2 PSNR, FIELD 3 MATNR , FIELD4 AMT
15245, PSNR1, X . 430
15245 IPSNR2 Y, 400
When user enteres date on sel screen as 02/2011
I want to delete the data from itab1 and itab2 for invoice date greater then 02/2011/
If i delere ITAB1 for date > selection screen date.
Loop itab1.
delete itab2 where psphi in itab1 will delete both rows in above example because the field psphi which is common can be mutiple.
endloop.
Can you advice ? -
Reg. internal table logic
Hi,
I have an internal table with 5 fields (Vbeln, A, B, C, D ) and records like this:
Record1:
Field vbeln (value is 6000000001), Field A (value is 2006), Field B (value is 1130), Field C (value is initial), Field D (value is initial)
Record1:
Field vbeln (value is 6000000001), Field A (value is initial), Field B (value is initial), Field C (value is 2005), Field D (value is 1134)
Now whenever, Field A and Field B has values, field C and field D are initial and vice versa.
I Want to get all of the field values in just one record like below when the key vbeln is same.:
Field vbeln (value is 6000000001), Field A (value is 2006), Field B (value is 1130), Field C (value is 2005), Field D (value is 1134)
I know I can create another internal table, copy the contents, use the looping logic and achieve the same but wondering if there is any better way of doing the same?
Appreciate your input.
Thanks!Hi,
You need another internal tables. Please try this.
SORT ITAB1.
ITAB2[] = ITAB1[].
LOOP AT ITAB1.
LOOP AT ITAB2 WHERE ITAB2-VBELN EQ ITAB1-VBELN
AND ITAB2-DATE1 NE ITAB1-DATE1
AND ITAB2-TIME1 NE ITAB1-TIME1.
ITAB3-VBELN = ITAB1-VBELN.
ITAB3-DATE1 = ITAB1-DATE1.
ITAB3-TIME1 = ITAB1-TIME1.
ITAB3-DATE2 = ITAB2-DATE2.
ITAB3-TIME2 = ITAB2-TIME2.
APPEND ITAB3.
ENDLOOP.
ENDLOOP.
Regards,
Ferry Lianto -
Reg internal table and variants
Hi,
Can any tel me
1. how to create internal table dynamically ( i knew its done thru field symbols but i dont know how) ...pls i need a clear example..pls
2.I have got a requirement where i need to display the fields in ouutput based on the variant i choose/select at selection screen.. that means the fields should be varying based on the variant chosen at selection screen..
pls i need a good example for the above 2 queries..plsss
Thanks in ADVANCE
Jayhi
http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb387a358411d1829f0000e829fbfe/content.htm
Regards
Anuj -
REG:Internal table and Database table
Hi Xperts,
Can you tell me /give me a sample code so as to
Compare the data present in the database table and internal table.i.e
Wheher the data in the db table matches with the data in the internal table
Thanks.Hello,
First make sure that data is there in the internal table
TABLES : Declare your table example MARA, VBAK etc
TYPES: BEGIN OF ITAB1,
Declare your fields here
example
v_mat(10) type c,
v_code(5) type I,
END OF ITAB1.
IF NOT ITAB[] is INITIAL.
LOOP AT
END IF.
To compare the data with DB tables, read the database table and copy into the internal table ITAB2
Then compare the ITAB and ITAB1
IF ITAB1[] = ITAB2[]
END IF
See these links for [Creating Internal Tables|http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3660358411d1829f0000e829fbfe/content.htm]
[Comparing Internal Tables|http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3841358411d1829f0000e829fbfe/content.htm]
See this for more about [Processing Internal Tables|http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb36ae358411d1829f0000e829fbfe/content.htm]
Declaring the internal table in ABAP objects
[Thanks|http://chandranonline.blogspot.com/]
[Chandran|http://chandranonline.blogspot.com/] -
Reg alter table move statement
Hi friends,
I am having a table with 10GB. i moved the table to the same tablespace using "alter table move" statement.
previously my tablespace had 6 GB freespace. To move the table i resized datafile to increase freespace in tablespace.
after moving, my table size reduced to 8GB. now i want to reduce the datafile size to 6GB again. but its throwing error
ORA-03297: file contains used data beyond requested RESIZE value
Can't i reduce the datafile size to 6GB again?
thanks in advanceresize will not released space below the high water mark.
The simpliest way how to proceed in this case is to move all tables to the new tablespace and drop the original including datafiles. And rename new tablespace back to the old ones name if You want.
You can read some more discussions here:
http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:766625833673 -
Reg transfer of data from excel to internal table
hi
i need to upload datas from Excel sheet to Internal Table.For this i use d FM
ALSM_EXCEL_TO_INTERNAL_TABLE.but the problem is if a particular field has no value in excel sheet,then its not uploaded into internal table.then next field value has come to that blank place in d internal table. what i need is if the excel sheet has a blank value for a field then a blank value is added in d inetrnal table also.Use below program logic
Program : ZLWMI151_UPLOAD(Data load to ZBATCH_CROSS_REF Table)
Type : Upload program
Author : Seshu Maramreddy
Date : 05/16/2005
Transport : DV3K919574
Transaction: None
Description: This program will get the data from XLS File
and it upload to ZBATCH_CROSS_REF Table
REPORT ZLWMI151_UPLOAD no standard page heading
line-size 100 line-count 60.
*tables : zbatch_cross_ref.
data : begin of t_text occurs 0,
werks(4) type c,
cmatnr(15) type c,
srlno(12) type n,
matnr(7) type n,
charg(10) type n,
end of t_text.
data: begin of t_zbatch occurs 0,
werks like zbatch_cross_ref-werks,
cmatnr like zbatch_cross_ref-cmatnr,
srlno like zbatch_cross_ref-srlno,
matnr like zbatch_cross_ref-matnr,
charg like zbatch_cross_ref-charg,
end of t_zbatch.
data : g_repid like sy-repid,
g_line like sy-index,
g_line1 like sy-index,
$v_start_col type i value '1',
$v_start_row type i value '2',
$v_end_col type i value '256',
$v_end_row type i value '65536',
gd_currentrow type i.
data: itab like alsmex_tabline occurs 0 with header line.
data : t_final like zbatch_cross_ref occurs 0 with header line.
selection-screen : begin of block blk with frame title text.
parameters : p_file like rlgrap-filename obligatory.
selection-screen : end of block blk.
initialization.
g_repid = sy-repid.
at selection-screen on value-request for p_file.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
PROGRAM_NAME = g_repid
IMPORTING
FILE_NAME = p_file.
start-of-selection.
Uploading the data into Internal Table
perform upload_data.
perform modify_table.
top-of-page.
CALL FUNCTION 'Z_HEADER'
EXPORTING
FLEX_TEXT1 =
FLEX_TEXT2 =
FLEX_TEXT3 =
*& Form upload_data
text
FORM upload_data.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
FILENAME = p_file
I_BEGIN_COL = $v_start_col
I_BEGIN_ROW = $v_start_row
I_END_COL = $v_end_col
I_END_ROW = $v_end_row
TABLES
INTERN = itab
EXCEPTIONS
INCONSISTENT_PARAMETERS = 1
UPLOAD_OLE = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
write:/10 'File '.
ENDIF.
if sy-subrc eq 0.
read table itab index 1.
gd_currentrow = itab-row.
loop at itab.
if itab-row ne gd_currentrow.
append t_text.
clear t_text.
gd_currentrow = itab-row.
endif.
case itab-col.
when '0001'.
t_text-werks = itab-value.
when '0002'.
t_text-cmatnr = itab-value.
when '0003'.
t_text-srlno = itab-value.
when '0004'.
t_text-matnr = itab-value.
when '0005'.
t_text-charg = itab-value.
endcase.
endloop.
endif.
append t_text.
ENDFORM. " upload_data
*& Form modify_table
Modify the table ZBATCH_CROSS_REF
FORM modify_table.
loop at t_text.
t_final-werks = t_text-werks.
t_final-cmatnr = t_text-cmatnr.
t_final-srlno = t_text-srlno.
t_final-matnr = t_text-matnr.
t_final-charg = t_text-charg.
t_final-erdat = sy-datum.
t_final-erzet = sy-uzeit.
t_final-ernam = sy-uname.
t_final-rstat = 'U'.
append t_final.
clear t_final.
endloop.
delete t_final where werks = ''.
describe table t_final lines g_line.
sort t_final by werks cmatnr srlno.
Deleting the Duplicate Records
perform select_data.
describe table t_final lines g_line1.
modify zbatch_cross_ref from table t_final.
if sy-subrc ne 0.
write:/ 'Updation failed'.
else.
Skip 1.
Write:/12 'Updation has been Completed Sucessfully'.
skip 1.
Write:/12 'Records in file ',42 g_line .
write:/12 'Updated records in Table',42 g_line1.
endif.
delete from zbatch_cross_ref where werks = ''.
ENDFORM. " modify_table
*& Form select_data
Deleting the duplicate records
FORM select_data.
select werks
cmatnr
srlno from zbatch_cross_ref
into table t_zbatch for all entries in t_final
where werks = t_final-werks
and cmatnr = t_final-cmatnr
and srlno = t_final-srlno.
sort t_zbatch by werks cmatnr srlno.
loop at t_zbatch.
read table t_final with key werks = t_zbatch-werks
cmatnr = t_zbatch-cmatnr
srlno = t_zbatch-srlno.
if sy-subrc eq 0.
delete table t_final .
endif.
clear: t_zbatch,
t_final.
endloop.
ENDFORM. " select_data
Reward points if it is helpful
Thanks
Seshu -
Question about XML mapping to ABAP internal table
Hi experts.
I'm trying to XML mapping. But it doesn't work well. Assume there are XML file as below.
<HEADER>
<ITEM>
<FOO>123</FOO>
<BAR>ABC</BAR>
</ITEM>
<ITEM>
<FOO>456</FOO>
<BAR>DEF</BAR>
</ITEM>
<HEADER>
and I want to trasformation it as below.
ITAB
FOO | BAR
123 | ABC
456 | DEF
How could I trasformation using "call transformation"?
Regards.Hi,
REPORT zind_xml_to_sap NO STANDARD PAGE HEADING.
Data Declaration *
DATA: client TYPE REF TO if_http_client, "Interface
host TYPE string,
port TYPE string,
proxy_host TYPE string,
proxy_port TYPE string,
path TYPE string,
scheme TYPE i,
xml TYPE xstring,
response TYPE string.
DATA: t_xml TYPE smum_xmltb OCCURS 0 WITH HEADER LINE. "XML Table structure used
"for retreive and output XML doc
DATA: g_stream_factory TYPE REF TO if_ixml_stream_factory. "Interface
DATA : return LIKE bapiret2 OCCURS 0 WITH HEADER LINE. "XML Table structure used for retreive
"and output XML doc
Parameters *
PARAMETER : p_add TYPE string LOWER CASE ,
p_dfile LIKE rlgrap-filename.
AT Selection-Screen on value-request for file *
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_dfile.
Get file
PERFORM 100_get_file.
Start-of-Selection *
START-OF-SELECTION.
Perform to upload xml data from URL to SAP internal table
PERFORM 200_xml_upload.
IF t_xml[] IS NOT INITIAL.
Perform to Download data from Internal Table to a text file in local drive
PERFORM 300_download.
write : / 'Data Uploaded to Internal Table Successfully'.
write : / 'XML Data Downloaded to Local path', p_dfile.
else.
write : / 'No Data for upload'.
ENDIF.
*if t_xml[] is INITIAL.
WRITE : address, 'Given URl cannot be Converted' .
else.
LOOP AT t_xml .
WRITE: t_xml-cname, t_xml-cvalue.
ENDLOOP.
endif.
*& Form get_file
Get File
FORM 100_get_file .
CALL FUNCTION 'F4_FILENAME'
EXPORTING
PROGRAM_NAME = SYST-CPROG
DYNPRO_NUMBER = SYST-DYNNR
FIELD_NAME = ' '
IMPORTING
file_name = p_dfile
ENDFORM. " 100_get_file
*& Form 200_xml_upload
form to upload xml data from URL to SAP internal table
FORM 200_xml_upload .
*Check HTTP:// and concatenate
IF p_add NS 'http://' OR p_add NS 'HTTP://'.
CONCATENATE 'http://' p_add
INTO p_add.
ENDIF.
Fetching the address of the URL
CALL METHOD cl_http_client=>create_by_url
EXPORTING
url = p_add
IMPORTING
client = client.
*Structure of HTTP Connection and Dispatch of Data
client->send( ).
*Receipt of HTTP Response
CALL METHOD client->receive
EXCEPTIONS
http_communication_failure = 1
http_invalid_state = 2
http_processing_failed = 3
OTHERS = 4.
IF sy-subrc <> 0.
IF sy-subrc = 1.
MESSAGE 'HTTP COMMUNICATION FAILURE' TYPE 'I' DISPLAY LIKE 'E'.
EXIT.
ELSEIF sy-subrc = 2.
MESSAGE 'HTTP INVALID STATE' TYPE 'I' DISPLAY LIKE 'E'.
EXIT.
ELSEIF sy-subrc = 3.
MESSAGE 'HTTP PROCESSING FAILED' TYPE 'I' DISPLAY LIKE 'E'.
EXIT.
ELSE.
MESSAGE 'Problem in HTTP Request' TYPE 'I' DISPLAY LIKE 'E'.
EXIT.
ENDIF.
ENDIF.
Get data of the xml to Response
response = client->response->get_cdata( ).
*FM converting the XML format to abap
CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
EXPORTING
text = response
IMPORTING
buffer = xml.
*FM converting XMl to readable format to a internal table.
CALL FUNCTION 'SMUM_XML_PARSE'
EXPORTING
xml_input = xml
TABLES
xml_table = t_xml
return = return.
ENDFORM. " 200_xml_upload
*& Form 300_download
*form to Download data from Internal Table to a text file in local drive
FORM 300_download .
DATA filename TYPE string.
filename = p_dfile.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = filename
WRITE_FIELD_SEPARATOR = 'X'
TABLES
data_tab = t_xml
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22
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. -
Internal table with Dynamic and Non dynamic fileds
Hi Experts,
How to get the internal table with Dynamic and Non-Dynamic Fields.
Could u please help me.
Thanks,
VarunHi,
Execute the below sample code or analyze it there is appropriate description provided.
*& Report ZTEST_PRM_DYN_ALV
REPORT ZTEST_PRM_DYN_ALV.
type-pools: slis.
field-symbols: <dyn_table> type standard table,
<dyn_wa>.
data: alv_fldcat type slis_t_fieldcat_alv,
it_fldcat type lvc_t_fcat.
selection-screen begin of block b1 with frame title text-001.
parameters: p_flds(5) type c.
selection-screen end of block b1.
start-of-selection.
*build the dynamic internal table
perform build_dyn_itab.
*write 5 records to the alv grid
do 5 times.
perform build_report.
enddo.
*call the alv grid.
perform call_alv.
*Build_dyn_itab
form build_dyn_itab.
data: new_table type ref to data,
new_line type ref to data,
wa_it_fldcat type lvc_s_fcat.
*Create fields .
clear wa_it_fldcat.
wa_it_fldcat-fieldname = 'name1'.
wa_it_fldcat-datatype = 'mara-matnr'.
wa_it_fldcat-intlen = 5.
append wa_it_fldcat to it_fldcat .
*clear wa_it_fldcat.
wa_it_fldcat-fieldname = sy-index.
wa_it_fldcat-datatype = 'CHAR'.
wa_it_fldcat-intlen = 5.
append wa_it_fldcat to it_fldcat .
do p_flds times.
clear wa_it_fldcat.
wa_it_fldcat-fieldname = sy-index.
wa_it_fldcat-datatype = 'CHAR'.
wa_it_fldcat-intlen = 6.
append wa_it_fldcat to it_fldcat .
enddo.
*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>.
endform.
*Form build_report
form build_report.
data: fieldname(20) type c.
data: fieldvalue(5) type c.
data: index(3) type c.
field-symbols: <fs1>.
do p_flds times.
index = sy-index.
*Set up fieldvalue
concatenate 'FLD' index into
fieldvalue.
condense fieldvalue no-gaps.
assign component index of structure <dyn_wa> to <fs1>.
<fs1> = fieldvalue.
enddo.
*Append to the dynamic internal table
append <dyn_wa> to <dyn_table>.
endform.
*CALL_ALV
form call_alv.
data: wa_cat like line of alv_fldcat.
*clear wa_cat.
wa_cat-fieldname = 'matnr'.
wa_cat-seltext_s = sy-index.
wa_cat-outputlen = '10'.
append wa_cat to alv_fldcat.
do p_flds times.
clear wa_cat.
wa_cat-fieldname = sy-index.
wa_cat-seltext_s = sy-index.
wa_cat-outputlen = '6'.
append wa_cat to alv_fldcat.
enddo.
*Call ABAP List Viewer (ALV)
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
it_fieldcat = alv_fldcat
tables
t_outtab = <dyn_table>.
endform.
Hope this will help, reward if found usefull.
Cheers,
Ram. -
Populating values to internal table created dynamically
Hi,
I am creating an internal table(it1) dynamically and assigned it to a field symbol. now i want to upload values
which are present in a field of another internal table being populated from a Funct Module.Could you tell me
how to assign those values across the fields of field symbol?
loop at itab_char.
LS_ALV_CAT-FIELDNAME = itab_char-charact.
append LS_ALV_CAT to I_ALV_CAT.
endloop.
CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
EXPORTING
IT_FIELDCATALOG = I_ALV_CAT
IMPORTING
EP_TABLE = D_REF.
ASSIGN D_REF->* TO <F_FS>.
(Above my int tab is generated and now stored in <f_FS>)
loop at itab into w_lifnr.
CALL FUNCTION 'CLAF_CLASSIFICATION_OF_OBJECTS'
EXPORTING
CLASS = p_cname
CLASSTYPE = w_ctype
OBJECT = w_lifnr
TABLES
T_CLASS = t_class
T_OBJECTDATA = t_objectdata
w-lifnr is vendor number. and here we are populating t_objectdata with that vendor related datas. now i want to pass t_objectdata-ausp1 values for each vendor across the fields in <F_FS>.
FIELD-SYMBOLS : <F_FS> TYPE TABLE.
Please refer me the solution to this problem.
ThanksCheck below code and try to add in ur code....
IF NOT it_bom_expl[] IS INITIAL.
The material number data varies from run to run. For this purpose
the data is been used to build dynamic internal table which stores the
material number data along the x-axis
PERFORM build_matnr_table.
The material numbers data which is stored in the temp internal table
is been assigned to the dynamic internal table created along the
x-axis for the materials
PERFORM assign_matnr_val_fields.
The component data which is stored in the internal table needs to be
moved to the dynamic internal table
PERFORM move_bom_data_to_matnr_table.
*& Form build_matnr_table
Using the material number data the dynamic internal tables are been
built which holds the material number data along x-axis. Here the
first 3 columns are always constant which are Components-List,
Description, Count. From 4th column it depends on number of materials
FORM build_matnr_table .
DATA: l_val(3) TYPE n,
lf_mat(18) TYPE c.
Moving the Components-List details to the internal table 1st column
which will be used for creation of dynamic internal table
CLEAR gf_xfc.
gf_xfc-fieldname = text-t03.
gf_xfc-datatype = c_val_c.
gf_xfc-inttype = c_val_c.
gf_xfc-intlen = 18.
gf_xfc-decimals = 0.
APPEND gf_xfc TO gf_ifc.
APPEND gf_xfc TO gf_ipc.
CLEAR gf_xfc.
Moving the Description details to the internal table 2nd column
which will be used for creation of dynamic internal table
gf_xfc-fieldname = text-t04.
gf_xfc-datatype = c_val_c.
gf_xfc-inttype = c_val_c.
gf_xfc-intlen = 40.
gf_xfc-decimals = 0.
APPEND gf_xfc TO gf_ipc.
CLEAR gf_xfc.
Moving the Count details to the internal table 3rd column which will
be used for creation of dynamic internal table
gf_xfc-fieldname = text-t05.
gf_xfc-datatype = c_val_c.
gf_xfc-inttype = c_val_c.
gf_xfc-intlen = 5.
gf_xfc-decimals = 0.
APPEND gf_xfc TO gf_ifc.
APPEND gf_xfc TO gf_ipc.
Moving the Material numbers are moved to the internal table from 4th
column onwards till all the material numbers are moved to the columns
which will be used for creation of dynamic internal table. Here
columns will be reffered to as Material001 ..... Materialxxn
LOOP AT it_mat.
CLEAR gf_xfc.
l_val = l_val + 1.
CONCATENATE text-t06 l_val INTO lf_mat.
gf_xfc-fieldname = lf_mat.
gf_xfc-datatype = c_val_c.
gf_xfc-inttype = c_val_c.
gf_xfc-intlen = 18.
gf_xfc-decimals = 0.
APPEND gf_xfc TO gf_ifc.
APPEND gf_xfc TO gf_ipc.
ENDLOOP.
Using the above data dynamic internal table is been created
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = gf_ifc
IMPORTING
ep_table = gf_table.
The dynamic internal table which is created is been assigned to
field-symbol which holds the data of the columns of X-axis
ASSIGN gf_table->* TO <fs_dyn_table>.
Dynamic work area is been created usng the reference to the
field-symbol which has the data and the line item is been assign to
field-symbol to hold line item data for reading purposes line by line
CREATE DATA gf_line LIKE LINE OF <fs_dyn_table>.
ASSIGN gf_line->* TO <fs_dyn_wa>.
Using the above data dynamic internal table is been created
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = gf_ipc
IMPORTING
ep_table = gf_table1.
The dynamic internal table which is created is been assigned to
field-symbol which holds the data of the columns of X-axis
ASSIGN gf_table1->* TO <fs_dyn_table1>.
Dynamic work area is been created usng the reference to the
field-symbol which has the data and the line item is been assign to
field-symbol to hold line item data for reading purposes line by line
CREATE DATA gf_line1 LIKE LINE OF <fs_dyn_table1>.
ASSIGN gf_line1->* TO <fs_dyn_wa1>.
Using the above data dynamic internal table is been created
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = gf_ifc
IMPORTING
ep_table = gf_table2.
The dynamic internal table which is created is been assigned to
field-symbol which holds the data of the columns of X-axis
ASSIGN gf_table2->* TO <fs_dyn_table2>.
Dynamic work area is been created usng the reference to the
field-symbol which has the data and the line item is been assign to
field-symbol to hold line item data for reading purposes line by line
CREATE DATA gf_line2 LIKE LINE OF <fs_dyn_table2>.
ASSIGN gf_line2->* TO <fs_dyn_wa2>.
ENDFORM. " build_matnr_table
*& Form assign_matnr_val_fields
The material numbers data stored in the temp internal table needs to
be assigned to the dynamic internal table along x-axis as the first
record. The temp internal table is been looped and using the field
symbol concept the data is moved to the dynamic internal table
FORM assign_matnr_val_fields .
DATA: l_cnt(3) TYPE n,
l_nam(12),
g_total(3) TYPE n.
DESCRIBE TABLE it_mat LINES g_total.
CLEAR l_cnt.
Looping the temp internal table and concatenating material as
material001 and the same is been checked against the dynamic
internal table and the material number value is moved to the
internal table. Finally, the data is been appened as first record.
LOOP AT it_mat.
l_nam = c_mat.
l_cnt = l_cnt + 1.
CONCATENATE l_nam l_cnt INTO l_nam.
Material which is in form Materialxxn is been assigned to the field
symbol which is checked against the field of dynamic internal table
and the value of the Material Number is been passed to the dynamic
internal table field value.
After all materials are been assigned the record is been appended
to the dynamic internal table.
ASSIGN COMPONENT l_nam OF STRUCTURE <fs_dyn_wa> TO <fs_field>.
<fs_field> = it_mat-matnr.
IF l_cnt = g_total.
INSERT <fs_dyn_wa> INTO TABLE <fs_dyn_table>.
ENDIF.
ENDLOOP.
Looping the temp internal table and concatenating material as
material001 and the same is been checked against the dynamic
internal table and the material number value is moved to the
internal table. Finally, the data is been appened as first record.
This is been used for downloading of data to excel sheet as it
contains additional field which is Description field.
CLEAR l_cnt.
LOOP AT it_mat.
l_nam = c_mat.
l_cnt = l_cnt + 1.
CONCATENATE l_nam l_cnt INTO l_nam.
Material which is in form Materialxxn is been assigned to the field
symbol which is checked against the field of dynamic internal table
and the value of the Material Number is been passed to the dynamic
internal table field value.
After all materials are been assigned the record is been appended
to the dynamic internal table.
ASSIGN COMPONENT l_nam OF STRUCTURE <fs_dyn_wa1> TO <fs_field>.
<fs_field> = it_mat-matnr.
IF l_cnt = g_total.
INSERT <fs_dyn_wa1> INTO TABLE <fs_dyn_table1>.
ENDIF.
ENDLOOP.
The contents of one internal table is passed on to other internal
table for use while moving the component data for count purposes.
<fs_dyn_table2>[] = <fs_dyn_table>[].
ENDFORM. " assign_matnr_val_fields
*& Form move_bom_data_to_matnr_table
The component data is been appended to the dynamic internal table
The component is checked against a material and if exists the corresp-
onding level is been appended to the record
The total count is derived as the in how many materials the component
exists
FORM move_bom_data_to_matnr_table .
DATA: l_cnt(2) TYPE n,
l_cnt1(3) TYPE n,
l_nam(12),
l_con(18) TYPE c,
l_con1(18) TYPE c,
lf_mat TYPE matnr.
SORT it_bom_expl BY bom_comp bom_mat level.
CLEAR: l_cnt1, <fs_dyn_wa>.
Looping the component internal table
LOOP AT it_bom_expl INTO gf_it_bom_expl.
CLEAR: l_cnt1.
AT NEW bom_comp.
CLEAR: l_cnt, <fs_dyn_wa>, lf_mat.
For every new bom component the material data is moved to
temp material table which will be used for assigning the levels
checking the count
it_mat_temp[] = it_mat[].
Component data is been assigned to the field symbol which is checked
against the field of dynamic internal table and the value of the
component number is been passed to the dynamic internal table field
value.
ASSIGN COMPONENT c_comp_list OF STRUCTURE <fs_dyn_wa> TO
<fs_check>.
<fs_check> = gf_it_bom_expl-bom_comp.
ENDAT.
AT NEW bom_mat.
CLEAR l_con.
ENDAT.
lf_mat = gf_it_bom_expl-bom_mat.
Looping the temp internal table and looping the dynamic internal table
*by reading line by line into workarea, the materialxxn is been assigned
to field symbol which will be checked and used.
LOOP AT it_mat_temp.
l_nam = c_mat.
l_cnt1 = l_cnt1 + 1.
CONCATENATE l_nam l_cnt1 INTO l_nam.
LOOP AT <fs_dyn_table2> ASSIGNING <fs_dyn_wa2>.
ASSIGN COMPONENT l_nam OF STRUCTURE <fs_dyn_wa2> TO <fs_xy>.
ENDLOOP.
IF <fs_xy> = lf_mat.
CLEAR lf_mat.
l_con1 = l_con.
ENDIF.
Checking whether the material exists for a component and if so it is
been assigned to the field symbol which is checked against the field
of dynamic internal table and the level of the component number
against material is been passed to the dynamic internal table field
value.
IF <fs_xy> = gf_it_bom_expl-bom_mat.
ASSIGN COMPONENT l_nam OF STRUCTURE <fs_dyn_wa> TO <fs_check>.
CLEAR l_con.
MOVE gf_it_bom_expl-level TO l_con.
CONCATENATE c_val_l l_con INTO l_con.
CONDENSE l_con NO-GAPS.
IF l_con1 NE space.
CONCATENATE l_con1 l_con INTO l_con SEPARATED BY c_comma.
CLEAR l_con1.
l_cnt = l_cnt - 1.
ENDIF.
<fs_check> = l_con.
l_cnt = l_cnt + 1.
ENDIF.
ENDLOOP.
AT END OF bom_comp.
At end of every new bom component the count is moved to the field
symbol which is checked against the field of dynamic internal table
and the count is been passed to the dynamic internal table field
value.
ASSIGN COMPONENT c_count OF STRUCTURE <fs_dyn_wa> TO <fs_check>.
<fs_check> = l_cnt.
INSERT <fs_dyn_wa> INTO TABLE <fs_dyn_table>.
ENDAT.
ENDLOOP.
Looping the component internal table. This is used for the additional
Description field which is shown in the excel sheet
LOOP AT it_bom_expl INTO gf_it_bom_expl.
CLEAR: l_cnt1.
AT NEW bom_comp.
CLEAR: l_cnt, <fs_dyn_wa1>, lf_mat.
For every new bom component the material data is moved to
temp material table which will be used for assigning the levels
checking the count
it_mat_temp[] = it_mat[].
Component data is been assigned to the field symbol which is checked
against the field of dynamic internal table and the value of the
component number is been passed to the dynamic internal table field
value.
ASSIGN COMPONENT c_comp_list OF STRUCTURE <fs_dyn_wa1> TO
<fs_check>.
<fs_check> = gf_it_bom_expl-bom_comp.
ENDAT.
AT NEW bom_mat.
CLEAR l_con.
ENDAT.
lf_mat = gf_it_bom_expl-bom_mat.
Looping the temp internal table and looping the dynamic internal table
*by reading line by line into workarea, the materialxxn is been assigned
to field symbol which will be checked and used.
LOOP AT it_mat_temp.
l_nam = c_mat.
l_cnt1 = l_cnt1 + 1.
CONCATENATE l_nam l_cnt1 INTO l_nam.
LOOP AT <fs_dyn_table2> ASSIGNING <fs_dyn_wa2>.
ASSIGN COMPONENT l_nam OF STRUCTURE <fs_dyn_wa2> TO <fs_xy>.
ENDLOOP.
IF <fs_xy> = lf_mat.
CLEAR lf_mat.
l_con1 = l_con.
ENDIF.
Checking whether the material exists for a component and if so it is
been assigned to the field symbol which is checked against the field
of dynamic internal table and the level of the component number
against material is been passed to the dynamic internal table field
value.
IF <fs_xy> = gf_it_bom_expl-bom_mat.
ASSIGN COMPONENT l_nam OF STRUCTURE <fs_dyn_wa1> TO <fs_check>.
CLEAR l_con.
MOVE gf_it_bom_expl-level TO l_con.
CONCATENATE c_val_l l_con INTO l_con.
CONDENSE l_con NO-GAPS.
IF l_con1 NE space.
CONCATENATE l_con1 l_con INTO l_con SEPARATED BY c_comma.
CLEAR l_con1.
l_cnt = l_cnt - 1.
ENDIF.
<fs_check> = l_con.
l_cnt = l_cnt + 1.
ENDIF.
ENDLOOP.
The description is moved to the field symbol which is checked against
the field of dynamic internal table and the count is been passed to
the dynamic internal table field value.
ASSIGN COMPONENT c_description OF STRUCTURE <fs_dyn_wa1> TO
<fs_check>.
<fs_check> = gf_it_bom_expl-ojtxp.
At end of every new bom component the count is moved to the field
symbol which is checked against the field of dynamic internal table
and the count is been passed to the dynamic internal table field
value.
AT END OF bom_comp.
ASSIGN COMPONENT c_count OF STRUCTURE <fs_dyn_wa1> TO <fs_check>.
<fs_check> = l_cnt.
INSERT <fs_dyn_wa1> INTO TABLE <fs_dyn_table1>.
ENDAT.
ENDLOOP.
ENDFORM. " move_bom_data_to_matnr_table
Maybe you are looking for
-
Unable to create Schedule line(Maintain sch.agreement)
Hi experts, After running MRP i got Planned order for a certain material and for that material procurement type maintained as "Both internal and external" in material master. After completing the process planned order to purchase requisition, i separ
-
Hi Why system split service po qty by default ? I am using BAPI_PO_CREATE for PO creation. Suppose Service PO 2000 System showes 1000,1000 with two account assignment. Regards Vivek
-
HT3529 How can I have my phone number pop up when I send a text from my iPad?
I did a test text to my iPhone from my iPad and it came up as my email. How can I make it my phone number so I can text people in my contacts without it showing up as my email?
-
Is their an older version of itunes available to download for use with a power pc g5 by apple??
-
'windows founds driver software for your device but encountered an error when trying to install it'
i have recently downloaded the new itunes 10 nd now my ipod driver software is encountering errors when trying to be installed in my computer. i have uninstalled and reinstalled itunes and its still happening. i'm away to go to ******* tits, - help m