Collect internal table
Hi ....
How can I collect internal table when a field adjacent is been . For example when corresponding matnr have I want to add other fields of other record .
Hi,
COLLECT add the numeric entries for the corresponding table keys..
Example.
DATA: BEGIN OF ITAB OCCURS 0,
MATNR TYPE MATNR,
COUNT TYPE I,
END OF ITAB.
ITAB-MATNR = 'ABC'.
ITAB-COUNT = 2.
COLLECT ITAB.
ITAB-MATNR = 'ABC'.
ITAB-COUNT = 1.
COLLECT ITAB.
ITAB-MATNR = 'ABCD'.
ITAB-COUNT = 2.
COLLECT ITAB.
ITAB-MATNR = 'ABCD'.
ITAB-COUNT = 3.
COLLECT ITAB.
LOOP AT ITAB.
WRITE: / ITAB-MATNR, ITAB-COUNT.
ENDLOOP.
Thanks,
Naren
Similar Messages
-
What's the best way to collect internal table?
Hi,
I have an internal table, the fields are:
Key1, key2, key3, qty1, qty2, qty3
I want to collect the field "qty3" based on the key fields: "key1 + key2 + key3".
What's the most efficient way to collect the internal table?
Thanks.Hi Ren,
You can code something like this with COLLECT statement.
DATA: BEGIN OF ITAB OCCURS 0,
KEY1 TYPE TABLE1-FIELD1,
KEY2 TYPE TABLE1-FIELD2,
KEY3 TYPE TABLE1-FIELD3,
QTY1 TYPE TABLE2-QTY1,
QTY2 TYPE TABLE2-QTY2,
QTY3 TYPE TABLE2-QTY3.
DATA: END OF ITAB.
DATA: BEGIN OF ITAB2 OCCURS 0,
KEY1 TYPE TABLE1-FIELD1,
KEY2 TYPE TABLE1-FIELD2,
KEY3 TYPE TABLE1-FIELD3,
QTY3 TYPE TABLE2-QTY3.
DATA: END OF ITAB2.
SORT ITAB.
LOOP AT ITAB.
MOVE-CORRESPONDING ITAB TO ITAB2.
COLLECT ITAB2.
ENDLOOP.
LOOP AT ITAB2.
WRITE: /01 ITAB2-KEY1, ITAB2-KEY2, ITAB2-KEY3,
ITAB3-QTY3.
ENDLOOP.
Hope this will help and give an idea.
Regards,
Ferry Lianto
Please reward points if helpful. -
Collect data from a dynamic XML file into multiple internal tables
I need to convert the XML file into multiple internal tables. I tried many links and posts in SDN but still was facing difficulty in achieving this. Can some one tell me where I am going wrong.
My XML file is of the following type.It is very complex and the dynamice.
The following tags occur more than once in the XML file. The "I" and "L" tags and its child tags can occur ones or more than once for each XML file and it is not constant. i.e in one file they can occur 1 time and in another they can occur 100 times.
"I" and "L" are child tags of <C>
<I>
<J>10</J>
<K>EN</K>
</I>
<L>
<J>20</J>
<N>BB</N>
</L>
Tags <C> and <F> occur only ones for each XML file. <C> is the child tag of "A" and "F" is the child tag of <C>.
I need to collect <D>, <E> in one internal table ITAB.
I need to collect <G>, <H> in one internal table JTAB.
I need to collect <J>, <K> in one internal table KTAB.
I need to collect <J>, <N> in one internal table PTAB.
Below is the complete XML file.
?xml version="1.0" encoding="iso-8859-1" ?>
<A>
<B/>
<C>
<D>RED</D>
<E>999</E>
<F>
<G>TRACK</G>
<H>PACK</H>
</F>
<I>
<J>10</J>
<K>EN</K>
</I>
<I>
<J>20</J>
<K>TN</K>
</I>
<I>
<J>30</J>
<K>KN</K>
</I>
<L>
<J>10</J>
<N>AA</N>
</L>
<L>
<J>20</J>
<N>BB</N>
</L>
<L>
<J>30</J>
<N>CC</N>
</L>
</C>
</A>
With the help of SDN I am able to gather the values of <D> <E> in one internal table.
Now if I need to gather
<G>, <H> in one internal table JTAB.
<J>, <K> in one internal table KTAB.
<J>, <N> in one internal table PTAB.
I am unable to do. I am following XSLT transformation method. If some one has some suggestions. Please help.
Here is my ABAP program
TYPE-POOLS abap.
CONSTANTS gs_file TYPE string VALUE 'C:\TEMP\ABCD.xml'.
* This is the structure for the data from the XML file
TYPES: BEGIN OF ITAB,
D(10) TYPE C,
E(10) TYPE C,
END OF ITAB.
* Table for the XML content
DATA: gt_itab TYPE STANDARD TABLE OF char2048.
* Table and work ares for the data from the XML file
DATA: gt_ITAB TYPE STANDARD TABLE OF ts_ITAB,
gs_ITAB TYPE ts_ITAB.
* Result table that contains references
* of the internal tables to be filled
DATA: gt_result_xml TYPE abap_trans_resbind_tab,
gs_result_xml TYPE abap_trans_resbind.
* For error handling
DATA: gs_rif_ex TYPE REF TO cx_root,
gs_var_text TYPE string.
* Get the XML file from your client
CALL METHOD cl_gui_frontend_services=>gui_upload
EXPORTING
filename = gs_file
CHANGING
data_tab = gt_itab1
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
not_supported_by_gui = 17
error_no_gui = 18
OTHERS = 19.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
* Fill the result table with a reference to the data table.
* Within the XSLT stylesheet, the data table can be accessed with
* "IITAB".
GET REFERENCE OF gt_shipment INTO gs_result_xml-value.
gs_result_xml-name = 'IITAB'.
APPEND gs_result_xml TO gt_result_xml.
* Perform the XSLT stylesheet
TRY.
CALL TRANSFORMATION zxslt
SOURCE XML gt_itab1
RESULT (gt_result_xml).
CATCH cx_root INTO gs_rif_ex.
gs_var_text = gs_rif_ex->get_text( ).
MESSAGE gs_var_text TYPE 'E'.
ENDTRY.
* Now let's see what we got from the file
LOOP AT gt_ITAB INTO gs_ITAB.
WRITE: / 'D:', gs_ITAB-D.
WRITE: / 'E :', gs_ITAB-E.
ENDLOOP.
Transformation
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output encoding="iso-8859-1" indent="yes" method="xml" version="1.0"/>
<xsl:strip-space elements="*"/>
<xsl:template match="/">
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<IITAB>
<xsl:apply-templates select="//C"/>
</IITAB>
</asx:values>
</asx:abap>
</xsl:template>
<item>
<D>
<xsl:value-of select="D"/>
</D>
<E>
<xsl:value-of select="E"/>
</E>
</item>
</xsl:template>
</xsl:transform>
Now the above pgm and transformation work well and I am able to extract data into the ITAB. Now what changes should I make in transformation and in pgm to collect
<G>, <H> in one internal table JTAB.
<J>, <K> in one internal table KTAB.
<J>, <N> in one internal table PTAB.
Please help..i am really tring hard to figure this out. I am found lot of threads addressing this issue but not my problem.
Kindly help.
Regards,
VSHi Rammohan,
Thanks for the effort!
But I don't need to use GUI upload because my functionality does not require to fetch data from presentation server.
Moreover, the split command advised by you contains separate fields...f1, f2, f3... and I cannot use it because I have 164 fields. I will have to split into 164 fields and assign the values back to 164 fields in the work area/header line.
Moreover I have about 10 such work areas. so the effort would be ten times the above effort! I want to avoid this! Please help!
I would be very grateful if you could provide an alternative solution.
Thanks once again,
Best Regards,
Vinod.V -
Reg: Collect statement in internal table
Hi,
Can any one tell me wether we can use the collect statement in an internal table which has no header line
if it can be used can anyone please send me a sample snippet
Thanks In ADVANCE
Guhapriyan SubrahmanyamHi Guhapriyan,
I have used the collect statement in the way as shown..
DATA : BEGIN of I_ALLOCATIONS OCCURS 0,
PSPNR LIKE PRPS-PSPNR,
PSPID LIKE PROJ-PSPID,
PSPHI LIKE PRPS-PSPHI,
POST1 LIKE PROJ-POST1,
ZZLOB LIKE PROJ-ZZLOB,
WERKS LIKE PROJ-WERKS,
SOBID LIKE HRP1001-SOBID,
OBJID LIKE HRP1001-OBJID,
BEGDA LIKE HRP1001-BEGDA,
ENDDA LIKE HRP1001-ENDDA,
PROZT LIKE HRP1001-PROZT,
LOB LIKE HRP1000-STEXT,
TEMP TYPE P decimals 2,
TYPE(3),
ZROLE LIKE PA0001-ZROLE,
HOLID TYPE P decimals 2,
LEAVE TYPE P decimals 2,
DAYS TYPE P decimals 2,
END of I_ALLOCATIONS.
DATA: I_ALLOCATION LIKE I_ALLOCATIONS OCCURS 0 WITH HEADER LINE.
************Populate I_ALLOCATIONS **************
LOOP AT I_ALLOCATIONS.
COLLECT I_ALLOCATIONS INTO I_ALLOCATION.
ENDLOOP.
Actually i had requirement like u, but this one is rather simple...
Get the required data in an I_Table which dont require Header line..
Later on collect this particular I_Table in other I_Table1 with the Header Line...
Regards,
Abhishek -
Two collect statement from internal table
Dear Experts,
I want populate values to two internal tables from a internal table.
can i use two collect statement for different internal table from a single internal table.
advise please.
Thanks in advance.
R.Rajendranhi there....
well u can very well use this thing.....
use the two colect statements inside the loop which u will use to read the records of the input table.
hope it helps.
do reward if it does. -
Collecting spool list into internal table.
Hey guys,
Could you pls help me in how to take the output in spool list and collec the list into one internal table?
i guess using GET_PRINT_PARAMETER does that? how to collect the list from the spool list.
ambichan.Hi ambi,
e.g.:
SUBMIT y123...
EXPORTING LIST TO MEMORY
AND RETURN.
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
listobject = liste
EXCEPTIONS
not_found = 1
OTHERS = 2.
CALL FUNCTION 'LIST_TO_ASCI'
EXPORTING
list_index = -1
TABLES
listasci = tab
listobject = liste
EXCEPTIONS
empty_list = 1
list_index_invalid = 2
OTHERS = 3.
LOOP AT tab.
append tab to tab_total.
endloop.
free tab.
regards Andreas -
Problem in collecting Spool data into internal table
Hi ,
i need to download spool request data into internal table,
after collecting i need to loop it and delete some records,
for this i am using Fm RSPO_RETURN_ABAP_SPOOLJOB
but getting some extra spaces and lines,unable to get right format.
please help me in this issue to prepare internal table like normal internal table with spool id.
Regards
sarathHi ,
Thanks for the reply,
My requirement is like i need to collect all the records from the spool to Internal table and
after that based on one field in the internal table i have to separate error records by deleting sucess records from that internal table(from spool),
for that i have to loop the internal table and need to count the error records, after that download to excel and mail functionalities
required for that .
so please help me in this.
Regards
sarath -
Collect message into internal table
Hi,
does any one knows how BAPIs or CALL TRANSACTIONs collect messages into internal table.
My problem is that some BI with CALL TRANSACTION doesn't collect right message into return table and I would like to collect this last message after CALL TRANSACTION and therefore be sure that everything went OK.....
thx
mariohi
good
check this
Call Transaction p_trans using ZBDC_Table
Mode p_mode
Update p_update
Messages into p_messages.
Move sy-subrc to w__subrc.
Scan the messages in YDCRAISES to see if we need to
change the message class.
Loop at p_messages.
Select single msgtyp
into w__msgtp
from zdcraise
where tcode = p_messages-tcode and
msgid = p_messages-msgid and
msgnr = p_messages-msgnr.
If sy-subrc = 0.
Move w__msgtp to p_messages-msgtyp.
Modify p_messages.
EndIf.
EndLoop.
Dump the message table ?
If w__ydcset-dumpmsg = True.
thanks
mrutyun^ -
Collect repeated entries in internal table
Hi,
I have an internal table with a field logk and prof..i have multiple entries for logk. i want to collect all multiple entries for a particular value of logk to put into error log.can u help me out.
Thanks ,
Anand.if prof is a numeric tye field you can do like this
sort itab.
loop at itab.
collect itab into itab1.
endloop.
Here Itab1 must be of same structure as itab
Regards,
Ravi -
Using COLLECT on a internal table
Hello,
I have fetched records from a table into my internal table through, " SELECT * FROM .... INTO TABLE FOR ALL ENTRIES IN ...... "
There are two columns in my internal table against which i need a total of the column. COLLECT sums the amounts . But how can i use COLLECT in this scenario ?
Can anyone kindly guide me ...Thanks
Shehryar DaharHi,
COLLECT add the numeric entries for the corresponding table keys..
Example.
DATA: BEGIN OF ITAB OCCURS 0,
MATNR TYPE MATNR,
COUNT TYPE I,
END OF ITAB.
ITAB-MATNR = 'ABC'.
ITAB-COUNT = 2.
COLLECT ITAB.
ITAB-MATNR = 'ABC'.
ITAB-COUNT = 1.
COLLECT ITAB.
ITAB-MATNR = 'ABCD'.
ITAB-COUNT = 2.
COLLECT ITAB.
ITAB-MATNR = 'ABCD'.
ITAB-COUNT = 3.
COLLECT ITAB.
LOOP AT ITAB.
WRITE: / ITAB-MATNR, ITAB-COUNT.
ENDLOOP.
For more information on Collect, check this site:
http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/collect.htm
Hope this would help you out.
Regards,
Varun. -
Collect in an internal table with keys plant and material
Hi ,
I have an output internal table with material , plant and var quantitites .
I would like to use Collect statement and sum the quantities but do it by plant and material .
How do I specify that i want to do it on plant or material ?
Thanks !hi here is an example like urs..
DATA: BEGIN OF seats,
carrid TYPE sflight-carrid,
connid TYPE sflight-connid,
seatsocc TYPE sflight-seatsocc,
END OF seats.
DATA seats_tab LIKE HASHED TABLE OF seats
WITH UNIQUE KEY carrid connid.
SELECT carrid connid seatsocc
FROM sflight
INTO seats.
COLLECT seats INTO seats_tab.
ENDSELECT.
check for help..
http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/collect.htm
regards,
venkat -
Internal Table Line Operations - Collect Statement
Hello Gurus,
I have an internal table with data in it. The fields of the internal table are
Location - Matnr - Qty - Flag.
Same material can be at different locations with different quantities. I need to get material and total quantity of the material in all the locations in a new internal table.
If the table (it_tab) contains -
Location - matnr - qty - flag
1200 abc 10 S
1201 abc 20 S
1205 abc 30 S
1207 abc 50 S
1200 xyz 20 S
1201 xyz 25 S
1300 xyz 22 S
From this table, I need to get the result int table (it_res) as below -
Matnr - qty
abc 110
xyz 67
110 = 102030+50
67 = 252220
My idea is we can use collect statement looping the it_tab table.
Please help me how to do this.
Regards,
BaluHi balu,
1. Simple
2. Create one another internal table STAB,
with only two fields
a) MATNR
b) QTY
3. Now,
4.
Loop at Itab.
Move-corresponding itab to STAB.
COLLECT STAB.
Endloop.
regards,
amit m. -
How to collect similar record from the internal table
I need to collect exact matched records from 1 internal table to another internal table by searching 5 fields. I need to have records which are exactly matched for 5 fields. i have written a code wich is mention below it gave me only similar records but not 100% matched record.. would you like to help me. any correction, suggetion,. Will be great help to me.
To get exact match of 5 records, do as follows.
Check whether internal table gives only one record or not after READ statement.If internal table gives more than one entry for READ then the results will be improper.
I think there is no need of READ statement on same internal table within LOOP. I commented the same in code.
sort i_bp_p by title initials name_last idnumber idtype f50code rbcode. "acc_num.
loop at i_bp_p into wa_i_bp_p.
*lv_tabix = sy-tabix.
*read table i_bp_p index lv_tabix into wa_i_bp_p.read table i_but0id into wa_but0id with key idnumber = wa_i_bp_p-idnumber
idtype = wa_i_bp_p-idtype binary search.
if sy-subrc = 0.
read table i_but000 into wa_but000 with key title = wa_i_bp_p-title
initials = wa_i_bp_p-initials
name_last = wa_i_bp_p-name_last binary search.
if sy-subrc = 0.
read table i_but0is into wa_but0is with key f50code = wa_i_bp_p-f50code
rbcode = wa_i_bp_p-rbcode binary search.
if sy-subrc = 0.
move-corresponding wa_i_bp_p to i_bp_p100.
append i_bp_p100.
endif.
endif.
endif.
endloop.
sort i_bp_p100 by partner.
loop at i_bp_p100.
write : /10 i_bp_p100-partner,
20 i_bp_p100-title,
30 i_bp_p100-initials,
40 i_bp_p100-name_last,
53 i_bp_p100-idnumber,
70 i_bp_p100-idtype,
85 i_bp_p100-rbcode,
95 i_bp_p100-f50code.
endloop.
sort i_bp_p by title initials name_last idnumber idtype f50code rbcode. "acc_num.
loop at i_bp_p into wa_i_bp_p.
lv_tabix = sy-tabix.
read table i_bp_p index lv_tabix into wa_i_bp_p.
if sy-subrc = 0.
read table i_but0id into wa_but0id with key idnumber = wa_i_bp_p-idnumber
idtype = wa_i_bp_p-idtype binary search.
if sy-subrc = 0.
read table i_but000 into wa_but000 with key title = wa_i_bp_p-title
initials = wa_i_bp_p-initials
name_last = wa_i_bp_p-name_last binary search.
if sy-subrc = 0.
read table i_but0is into wa_but0is with key f50code = wa_i_bp_p-f50code
rbcode = wa_i_bp_p-rbcode binary search.
if sy-subrc = 0.
move-corresponding wa_i_bp_p to i_bp_p100.
append i_bp_p100.
endif.
endif.
endif.
endif.
endloop. -
How can i collect data form diff. Internal Tables to single main table
hi
i am using 3 diffrent internal tables for fatching & store data , but when i want to put it on report for display it come in APPENDING MANNER i.e. data from 1 table get displayed , all otther fields remain blank, then data from 2 table appended at bottom , similar for 3 table ,
but i want the data together.
is there any way by which i can insert data to final table's particular field without effecting all others fields data . ?
please give answer it's urgent<b>see how data is brought into I_OUT.</b>
REPORT Y_RK_REPORT_TASK2 LINE-SIZE 180
LINE-COUNT 25(8)
NO STANDARD PAGE HEADING.
*& TABLE DECLARATION *
TABLES: MARA, "GENERAL MASTER DATA
MARC, "PLANT DATA FOR MATERIAL
MARD, "STORAGE LOCATION DATA FOR MATERIAL
MBEW, "MATERIAL VALUATION
MVKE, "SALES DATA FOR MATERIAL
MAKT. "MATERIAL DESCRIPTION
*& INTERNAL TABLE DECLARATION *
DATA: BEGIN OF I_MARC OCCURS 0,
MATNR LIKE MARC-MATNR,
WERKS LIKE MARC-WERKS,
LVORM LIKE MARC-LVORM,
PSTAT LIKE MARC-PSTAT,
END OF I_MARC.
DATA: BEGIN OF I_MARA OCCURS 0,
MATNR LIKE MARA-MATNR,
MBRSH LIKE MARA-MBRSH,
MEINS LIKE MARA-MEINS,
END OF I_MARA.
DATA: BEGIN OF I_MAKT OCCURS 0,
MATNR LIKE MAKT-MATNR,
MAKTX LIKE MAKT-MAKTX,
END OF I_MAKT.
DATA: BEGIN OF I_MBEW OCCURS 0,
MATNR LIKE MBEW-MATNR,
BWKEY LIKE MBEW-BWKEY,
BWTAR LIKE MBEW-BWTAR,
LBKUM LIKE MBEW-LBKUM,
END OF I_MBEW.
DATA: BEGIN OF I_MVKE OCCURS 0,
MATNR LIKE MVKE-MATNR,
VKORG LIKE MVKE-VKORG,
VTWEG LIKE MVKE-VTWEG,
END OF I_MVKE.
DATA: BEGIN OF I_MARD OCCURS 0,
MATNR LIKE MARD-MATNR,
WERKS LIKE MARD-WERKS,
LGORT LIKE MARD-LGORT,
LABST LIKE MARD-LABST,
END OF I_MARD.
DATA: BEGIN OF I_OUT OCCURS 0,
MATNR LIKE MARC-MATNR,
WERKS LIKE MARC-WERKS,
LVORM LIKE MARC-LVORM,
PSTAT LIKE MARC-PSTAT,
MBRSH LIKE MARA-MBRSH,
MEINS LIKE MARA-MEINS,
MAKTX LIKE MAKT-MAKTX,
BWKEY LIKE MBEW-BWKEY,
BWTAR LIKE MBEW-BWTAR,
LBKUM LIKE MBEW-LBKUM,
VKORG LIKE MVKE-VKORG,
VTWEG LIKE MVKE-VTWEG,
LGORT LIKE MARD-LGORT,
LABST LIKE MARD-LABST,
END OF I_OUT.
*& A T - S E L E C T I O N - S C R E E N *
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-101.
PARAMETERS: P_WERKS LIKE MARC-WERKS.
SELECTION-SCREEN END OF BLOCK B1.
SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-102.
SELECT-OPTIONS: S_MATNR FOR MARC-MATNR,
S_LGORT FOR MARD-LGORT.
SELECTION-SCREEN END OF BLOCK B2.
*& INITIALIZATION.
INITIALIZATION.
P_WERKS = '3000'.
S_MATNR-SIGN = 'I'.
S_MATNR-OPTION = 'EQ'.
S_MATNR-LOW = '1'.
S_MATNR-HIGH = '995'.
S_LGORT-SIGN = 'I'.
S_LGORT-OPTION = 'EQ'.
S_LGORT-LOW = '0001'.
S_LGORT-HIGH = '0007'.
APPEND S_LGORT.
APPEND S_MATNR.
CLEAR S_MATNR.
CLEAR S_LGORT.
*& S T A R T - O F - S E L E C T I O N *
START-OF-SELECTION.
SELECT MATNR WERKS LVORM FROM MARC
INTO TABLE I_MARC
WHERE WERKS = P_WERKS
AND MATNR IN S_MATNR.
SELECT MATNR MBRSH MEINS FROM MARA
INTO TABLE I_MARA
FOR ALL ENTRIES IN I_MARC
WHERE MATNR = I_MARC-MATNR.
SELECT MATNR MAKTX FROM MAKT
INTO TABLE I_MAKT
FOR ALL ENTRIES IN I_MARA
WHERE MATNR = I_MARA-MATNR
AND SPRAS = SY-LANGU.
SELECT MATNR BWKEY BWTAR FROM MBEW
INTO TABLE I_MBEW
FOR ALL ENTRIES IN I_MARA
WHERE MATNR = I_MARA-MATNR.
SELECT MATNR VKORG VTWEG FROM MVKE
INTO TABLE I_MVKE
FOR ALL ENTRIES IN I_MARA
WHERE MATNR = I_MARA-MATNR.
SELECT MATNR WERKS LGORT LABST FROM MARD
INTO TABLE I_MARD
FOR ALL ENTRIES IN I_MARC
WHERE MATNR = I_MARC-MATNR
AND WERKS = P_WERKS
AND LGORT IN S_LGORT..
*& MOVING DATA TO I-OUT *
LOOP AT I_MARC.
MOVE I_MARC-MATNR TO I_OUT-MATNR.
MOVE I_MARC-WERKS TO I_OUT-WERKS.
MOVE I_MARC-LVORM TO I_OUT-LVORM.
READ TABLE I_MARA WITH KEY MATNR = I_MARD-MATNR.
MOVE I_MARA-MBRSH TO I_OUT-MBRSH.
MOVE I_MARA-MEINS TO I_OUT-MEINS.
READ TABLE I_MAKT WITH KEY MATNR = I_MARD-MATNR.
MOVE I_MAKT-MAKTX TO I_OUT-MAKTX.
READ TABLE I_MBEW WITH KEY MATNR = I_MARD-MATNR.
MOVE I_MBEW-BWKEY TO I_OUT-BWKEY.
MOVE I_MBEW-BWTAR TO I_OUT-BWTAR.
READ TABLE I_MVKE WITH KEY MATNR = I_MARD-MATNR.
MOVE I_MVKE-VKORG TO I_OUT-VKORG.
MOVE I_MVKE-VTWEG TO I_OUT-VTWEG.
LOOP AT I_MARD WHERE MATNR = I_MARC-MATNR
AND WERKS = I_MARC-WERKS.
MOVE I_MARD-LGORT TO I_OUT-LGORT.
MOVE I_MARD-LABST TO I_OUT-LABST.
APPEND I_OUT.
ENDLOOP.
CLEAR I_OUT.
ENDLOOP.
*& DISPLAYIING FROM I-OUT *
LOOP AT I_OUT.
*FORMAT HOTSPOT ON.
WRITE: /5 I_OUT-MATNR,
22 I_OUT-WERKS,
29 I_OUT-LGORT,
33 I_OUT-LABST,
56 I_OUT-LVORM,
61 I_OUT-MBRSH,
71 I_OUT-MEINS,
82 I_OUT-VTWEG,
93 I_OUT-BWKEY,
104 I_OUT-BWTAR,
118 I_OUT-VKORG,
130 I_OUT-MAKTX.
*FORMAT HOTSPOT OFF.
ENDLOOP.
*& E N D -- O F -- S E L E C T I O N *
END-OF-SELECTION.
*& T O P - O F - P A G E *
TOP-OF-PAGE.
WRITE 60 'MATERIAL MASTER REPORT -- BASIC LIST'
COLOR COL_GROUP.
WRITE: SY-ULINE.
WRITE: /2 'MATERIAL_NO',
22 'PLANT',
28 'STORGE_LOC',
45 'STOCK',
54 'FLAG',
60 'INDUSTRY',
70 'UNIT',
76 'DISTR_CHANNEL',
91 'VALU_AREA',
102 'VALU_TYPE',
114 'SALES_ORG',
128 'DESCRIPTION'.
*& E N D - O F - P A G E *
END-OF-PAGE.
WRITE: / SY-ULINE.
WRITE: /85 'PAGNO: ',SY-PAGNO,
SY-ULINE.
regards,
srinivas
<b>*reward for useful answers*</b> -
Modify dynamic internal table from dynamic work area using index...
ASSIGN w_text TO <fs>.
ASSIGN w_temp TO <fs1>.
lint_tab_iw49[] = <tab>.
lint_tab_iw49_t[] = <tab>.
DELETE ADJACENT DUPLICATES FROM lint_tab_iw49 COMPARING aufnr.
LOOP AT lint_tab_iw49 INTO lws_tab_iw49.
READ TABLE lint_object_tab1 INTO lws_object_tab1
WITH KEY aufnr = lws_tab_iw49-aufnr.
IF sy-subrc EQ 0.
Collect operations in rows of an internal table.
w_idx = 1.
WHILE w_idx < 51.
w_nn = w_idx.
CONCATENATE 'lws_object_tab1-ZZOPERN' w_nn INTO w_xx.
ASSIGN (w_xx) TO <fs>.
CONCATENATE w_text <fs> INTO w_text SEPARATED BY ','.
w_idx = w_idx + 1.
ENDWHILE.
Split operations into an internal table to get operations in rows.
SPLIT w_text AT ',' INTO TABLE lint_vornr.
DELETE lint_vornr WHERE vornr = ' '.
DESCRIBE TABLE lint_vornr LINES w_lines.
Collect costs in rows of an internal table
CLEAR: w_idx, w_nn, w_xx, w_text.
w_idx = 1.
WHILE w_idx < 51.
w_nn = w_idx.
CONCATENATE 'lws_object_tab1-ZZCOST' w_nn INTO w_xx.
ASSIGN (w_xx) TO <fs>.
<fs1> = <fs>.
CONCATENATE w_text <fs1> INTO w_text SEPARATED BY ','.
w_idx = w_idx + 1.
ENDWHILE.
Split costs into an internal table to get costs in rows.
SPLIT w_text AT ',' INTO TABLE lint_escost.
DELETE lint_escost WHERE cost = ' '.
DESCRIBE TABLE lint_escost LINES w_lines_cost.
Append lines of lint_escost from 1 to w_lines to lint_escost1.
Collect currencies in rows of an internal table
CLEAR: w_idx, w_nn, w_xx, w_text.
w_idx = 1.
WHILE w_idx < 51.
w_nn = w_idx.
CONCATENATE 'lws_object_tab1-ZZCURR' w_nn INTO w_xx.
ASSIGN (w_xx) TO <fs>.
<fs1> = <fs>.
CONCATENATE w_text <fs1> INTO w_text SEPARATED BY ','.
w_idx = w_idx + 1.
ENDWHILE.
Split costs into an internal table to get costs in rows.
SPLIT w_text AT ',' INTO TABLE lint_curr.
DELETE lint_curr WHERE curr = ' '.
DESCRIBE TABLE lint_curr LINES w_lines_curr.
Append lines of lint_curr from 1 to w_lines to lint_curr1.
ENDIF.
PERFORM update_object_tab_for_iw49n.
ENDLOOP.
ENDIF.
ENDFORM. " modify_object_tab
*& Form update_object_tab_for_IW49N
text
--> p1 text
<-- p2 text
FORM update_object_tab_for_iw49n .
DATA: lws_temp TYPE string VALUE 'where aufnr = lws_tab_iw49-aufnr',
lw_index TYPE sy-index.
READ TABLE <tab> TRANSPORTING NO FIELDS WITH KEY ('AUFNR') =
lws_tab_iw49-aufnr.
IF sy-subrc EQ 0.
lw_index = sy-tabix.
LOOP AT <tab> INTO <wa1> FROM lw_index.
IF <wa1>-aufnr NE lws_tab_iw49-aufnr.
EXIT.
ELSE.
CLEAR lw_index.
lw_index = sy-tabix.
lw_index = 1.
WHILE lw_index LE w_lines.
READ TABLE lint_escost INTO lws_escost INDEX lw_index.
IF sy-subrc EQ 0.
lw_index = lw_index + 1.
<wa1>-zzcost1 = lws_escost-cost.
ENDIF.
READ TABLE lint_curr1 INTO lws_curr INDEX lw_index.
IF sy-subrc EQ 0.
<wa1>-zzcurr1 = lws_curr-curr.
ENDIF.
MODIFY <tab> FROM <wa1> "TRANSPORTING ('ZZCOST1') ('ZZCURR1')
INDEX sy-tabix.
IF sy-subrc EQ 0.
ENDIF.
lw_index = lw_index + 1.
ENDWHILE.
ENDIF.
ENDLOOP.
ENDIF.
ENDFORM. " update_object
Hi,
With referene to the code snippet above I want to modify <tab> from <wa1> on specific indices or with specific where condition.
Is it achievable... How?
Many thanks in advance.
Thanks & Regards,
ShreyaYou might have to split the code in to two parts to keep the formatting intact.
Maybe you are looking for
-
Vibrate Texts, Sound Calls
Is there a way I can set my text messages to vibrate while still leaving the other options on ring? I know you can change to silent/ring mode and switch to vibrate but that makes incoming calls vibrate too. I would like to only make incoming texts vi
-
How do I get my icloud login and apple ID to be the same?
My login and apple ID for all my deivces match. It is just when I login to the iCloud.com where the Apple ID is not the same... kinda wierd
-
I have itunes 10.5.5 and iam trying to upgrade to 10.7, having installed ios6 on my phone wirelessly, my itunes is out of date and cannot sync to my phone. When I try and update, I get the message pathway cannot be found please choose another pathway
-
Ipad 2 will not sync edited photos from iphoto
I've changed some of my photos to black and white or sepia in iphoto. When I sync them to my ipad 2, they remain in color. Any ideas? It's only happened to pictures edited within the past month or so. Wondering if it coincides with a recent iphot
-
Default external protocol handler not listed as alternative
In Windows I have registered my own handler for an external protocol in the registry. When I click the link in Firefox or Thunderbird I'm shown the "Launch Application" dialog in which I should choose an application for handling the protocol, but the