Logic to build Hierarchy in an internal table
Hi expert,
I have store the output in the following manner in an iinternal table
xx.0011.1
xx.0011.2
xx.0011
xx.0012.1.1
xx.0012.1
xx.0012
XX.001.
I want to convert it with proper hierarchy and need to store it in an internal table
like the following :
XX.001
xx.0011
xx.0011.1
xx.0011.2
xx.0012
xx.0012.1
xx.0012.1.1.Plz suggest me a logic for the same
Thanks in adv
Hi,
u just SORT the Inetrnal table conataing the entries.
Check the belwo code. and copy paste .
data: begin of itab occurs 0,
n(15),
end of itab.
itab-n = 'xx.0011.1'.
append itab.
itab-n = 'xx.0011.2'.
append itab.
itab-n = 'xx.0011'.
append itab.
itab-n = 'xx.0012.1.1'.
append itab.
itab-n = 'xx.0012.1'.
append itab.
itab-n = 'xx.0012'.
append itab.
itab-n = 'XX.001'.
append itab.
sort itab.
loop at itab.
write:/ itab-n.
endloop.
output :
<b>XX.001
xx.0011
xx.0011.1
xx.0011.2
xx.0012
xx.0012.1
xx.0012.1.1</b>
Revert back if any issues,
Reward with points if helpful.
Regards,
Naveen.
Message was edited by:
Naveen Deva
Similar Messages
-
Urgent:Logic needed to fetch data from Internal Table
Here i have an internal table having Emp no,Emp name,Salary fields....
With unique Emp no.
My requirement is i want to fetch all the details of the employees(like empno,emp name, emp address..) whose salary is the third highest salary.
Note: Many employees can have unique salary.
I need the logic for that,
helpfull ans ill be rewarded.suppose ur table has three fields like
types : begin of typ_emp,
num type i ,
name type char20 ,
salary type char10 ,
end of typ_emp.
data : it_emp type table of typ_emp ,
it1_emp TYPE TABLE OF typ_emp ,
wa_emp type typ_emp .
DATA : count TYPE i ,
w_salary type i .
code is
SORT it_emp BY salary ASCENDING .
it1_emp = it_emp .
Take the all data to another table and delete all adjacent duplicates .
DELETE ADJACENT DUPLICATES FROM it_emp COMPARING salary .
READ TABLE IT_EMP INTO WA_EMP INDEX 3.
MOVE WA_EMP-SALARY TO W_SALARY .
now the third highest salary will come into w_salary .
and now again process your internal table and retrieve whose salary is equal to w_salary ...
thanks
reward if helpfull..............
Edited by: sam k on May 27, 2008 12:43 PM
Edited by: sam k on May 27, 2008 12:55 PM -
How to read only particualr columns from excel sheet to internal table
Hi,
I have and excel sheet which has around 20 columns, in which i want to read only 6 columns. They are at different column positions, means the 1st column, 6thcolumn, 8th column so on..
Can we do this in sap? do we have any FM to do this?
Thanks.
Praveena.hi,
Use the below logic to fetch the data into internal table..You need to read the data cell by cell and update the internal table,
DATA l_count TYPE sy-tabix.
CONSTANTS: lc_begin_col TYPE i VALUE '1',
lc_begin_row TYPE i VALUE '2',
lc_end_col TYPE i VALUE '2',
lc_end_row TYPE i VALUE '3000'.
CLEAR p_i_excel_data. REFRESH p_i_excel_data.
* Function module to read excel file and convert it into internal table
CALL FUNCTION 'KCD_EXCEL_OLE_TO_INT_CONVERT'
EXPORTING
filename = p_p_file
i_begin_col = lc_begin_col
i_begin_row = lc_begin_row
i_end_col = lc_end_col
i_end_row = lc_end_row
TABLES
intern = i_data
EXCEPTIONS
inconsistent_parameters = 1
upload_ole = 2
OTHERS = 3.
* Error in file upload
IF sy-subrc NE 0 .
MESSAGE text-006 TYPE 'E'.
EXIT.
ENDIF.
IF i_data[] IS INITIAL .
MESSAGE text-007 TYPE 'E'.
EXIT.
ELSE.
SORT i_data BY row col .
* Loop to fill data in Internal Table
LOOP AT i_data .
MOVE i_data-col TO l_count .
ASSIGN COMPONENT l_count OF STRUCTURE p_i_excel_data TO <fs_source> .
MOVE i_data-value TO <fs_source> .
AT END OF row .
* Append data into internal table
APPEND p_i_excel_data.
CLEAR p_i_excel_data.
ENDAT .
ENDLOOP .
ENDIF . -
How to convert internal table with dynamic fields to XML
Dear all,
I met a problem like the following:
The aim is to transform the following parameter to XML
IT_FIELD stores the dynamic filed name of the internal table,with these fields, the dynamic internal can be created by cl_abap_tabledescr=>create(it_field)
IT_VALUE stores the value of the internal table dynamically created with dynamic fields.
For example
IT_FIELD =>
line1: FIELD1
line2: FIELD2
line3: FIELD3,
three lines in this internal table.
dynamically created internal table structure FIELD1 FIELD2 FIELD3
And IT_VALUE=>
1 2 3 (First line)
11 22 33
two lines of data.
Do you have any idea about how to transform the IT_VALUE to XML here? And also the transformed XML to the IT_VALUE.( we may need remember IT_FIELD here for later XML to IT_VALUE.)
Hope I describe the problem clearly.
Any inputs will be appreciated.
Edited by: Max Tang on Jan 12, 2009 3:46 PM
Edited by: Max Tang on Jan 12, 2009 4:14 PMHi,
you need to implement a bit of coding for that.
With the 'do varying' statement abap provides a loop over those fields. Within this loop you can build up a new internal table with one entry for each period and amount.
kind regards
Siggi
PS: I am not very familiar with CO, but I guess there will be a standard extractor for that. -
Export internal table to Excel file pressing a new button created in ALV
Hello, I am trying to implement the functionality to export to excel file inside a button that i have created into my ALV. I don't want to use FileDownload UI.
The code I have set for event handler of this button is the following:
METHOD attach_files .
TYPES:
BEGIN OF tipo_alv_tab,
tipod TYPE objid,
descd TYPE p1000-stext,
begda TYPE begdatum,
endda TYPE enddatum,
pernr TYPE pernr_d,
nombre TYPE ad_namefir,
email TYPE ad_smtpadr,
posicion TYPE p1000-stext,
uodesc TYPE p1000-stext,
END OF tipo_alv_tab.
DATA:
i_alv_tab TYPE TABLE OF tipo_alv_tab,
conv_out TYPE REF TO cl_abap_conv_out_ce,
content TYPE xstring,
lv_filename TYPE string,
xml_out TYPE string.
Fill values from memory
IMPORT name1 TO i_alv_tab FROM MEMORY ID 'ZCA'.
Build XML file with internal table information
CALL TRANSFORMATION ('ID') SOURCE tab = i_alv_tab[] RESULT XML xml_out.
Build XSTRING with XML
CALL FUNCTION 'CRM_IC_XML_STRING2XSTRING'
EXPORTING
instring = xml_out
IMPORTING
outxstring = content.
Format XSTRING
conv_out = cl_abap_conv_out_ce=>create( encoding = 'UTF-8' ).
Convert data
conv_out->convert( EXPORTING data = xml_out IMPORTING buffer = content ).
Save file
CALL METHOD cl_wd_runtime_services=>attach_file_to_response
EXPORTING
i_filename = 'Excel File.xls'
i_content = content
i_mime_type = 'application/msexcel'
i_in_new_window = i_in_new_window
i_inplace = i_inplace.
ENDMETHOD.
When pressing the button, the file created is without extension, and with a rare name. When trying to open the file, it seems to be corrupted.
Does anyone know what am I doing wrong???
Please, help is really really appreciated!!!!Hi Jorge,
The export data to excel functionality is available inbuilt in ALV and you dont have to write any implementation. However, if you want to create your own button for it, you can do so as below.
data:
lr_button type ref to cl_salv_wd_fe_button,
lr_function type ref to cl_salv_wd_function.
CREATE OBJECT lr_button.
lr_button->set_text( 'Export to excel' ).
lr_button->set_tooltip( 'Export data to excel' ).
lr_function = l_alv_model->if_salv_wd_function_settings~create_function( id = 'EXCEL' ).
lr_function->set_function_std( IF_SALV_WD_C_STD_FUNCTIONS=>EXPORT_EXCEL ).
lr_function->set_editor( lr_button ).
Now, you have created your own button, created a user defined function for the ALV and set this button as editor for the function. And using the set_function_std method, we have just mapped the functionality of your new button to the existing export to excel functionality in ALV.
Hope this is what you are looking for.
Regards
Nithya -
Global Class that returns an internal table
Hello,
Is it possible to create a global class (under class builder) that returns an internal table like we used to do in a function module?
e.g. call function '<Function module name>'
tables = i_tab.
Thanks,
JeffreyHi Jeffrey,
Yeah u can do that by specifying importing parameters
to method.You can give table type for the parameters.
Thanks&Regards,
Siri. -
How to build tree/hierarchy/explorer format in internal table
Dear Friends,
I have one internal table with parent and child, again child will be acting as parent and it can have further childs ......
like that it goes on there is no constant levels it goes on....
for example.
parent child
100 101
102
103
101 201
202
102 301
103 401
402
403
this has to be displayed in hierarchy mode.
here i to as a column wich has to represent its position/level in the hierarchy like:
1
1.1
1.1.1
1.2
1.2.1
......n
1.2.2...n
1.3
2
2.1
2.2
3
etc...
let me know any ideas to get the maping of the rows to put it in tree format( like windows explorer).
Thanks,
Mahesh.GattuREPORT Z_TREE.
TYPE-POOLS: ICON.
TYPE-POOLS : FIBS,STREE.
INCLUDE <ICON>.
DATA : T_NODE TYPE SNODETEXT.
DATA : NODE_TAB LIKE T_NODE OCCURS 0 WITH HEADER LINE.
DATA : ITAB LIKE VBAP OCCURS 0 WITH HEADER LINE.
DATA : ITTX LIKE MAKT OCCURS 0 WITH HEADER LINE.
DATA : LI TYPE I VALUE 1.
CLEAR : NODE_TAB, NODE_TAB[].
SELECT * FROM VBAP INTO TABLE ITAB UP TO 50 ROWS.
SELECT * FROM MAKT INTO TABLE ITTX FOR ALL ENTRIES IN ITAB WHERE MATNR = ITAB-MATNR.
NODE_TAB-TYPE = 'T'.
NODE_TAB-NAME = ''.
NODE_TAB-TLEVEL = '01'.
NODE_TAB-NLENGTH = ''.
NODE_TAB-COLOR = '3'.
NODE_TAB-TEXT = 'ICON_DETAIL'.
NODE_TAB-TCOLOR = '1'.
NODE_TAB-KIND = 'I'.
NODE_TAB-TLENGTH = '2'.
NODE_TAB-TEXT1 = 'Details'.
NODE_TAB-TCOLOR1 = '2'.
NODE_TAB-KIND = 'I'.
NODE_TAB-TLENGTH1 = '10'.
APPEND NODE_TAB.
CLEAR NODE_TAB.
LOOP AT ITAB.
AT NEW VBELN.
NODE_TAB-TYPE = 'P'.
* node_tab-name = 'Sale Number'.
NODE_TAB-TLEVEL = '02'.
* node_tab-nlength = '12'.
NODE_TAB-TCOLOR = '4'.
NODE_TAB-TEXT = ITAB-VBELN.
NODE_TAB-TLENGTH ='10'.
APPEND NODE_TAB.
CLEAR NODE_TAB.
ENDAT.
READ TABLE ITTX WITH KEY MATNR = ITAB-MATNR.
NODE_TAB-TYPE = 'P'.
* node_tab-name = 'LI'.
NODE_TAB-TLEVEL = '03'.
* node_tab-nlength = '4'.
NODE_TAB-TEXT = 'ICON_MATERIAL'.
NODE_TAB-TCOLOR = '1'.
NODE_TAB-KIND = 'I'.
NODE_TAB-TLENGTH = '2'.
NODE_TAB-TCOLOR1 = '5'.
NODE_TAB-TEXT1 = ITAB-MATNR.
NODE_TAB-TLENGTH1 = '20'.
NODE_TAB-TCOLOR2 = '7'.
NODE_TAB-TEXT2 = ITTX-MAKTX.
LI = STRLEN( ITTX-MAKTX ).
NODE_TAB-TLENGTH2 = LI.
APPEND NODE_TAB.
CLEAR NODE_TAB.
* READ TABLE ITTX WITH KEY MATNR = ITAB-MATNR.
* NODE_TAB-TYPE = 'P'.
** node_tab-name = 'LI'.
* NODE_TAB-TLEVEL = '03'.
** node_tab-nlength = '4'.
* NODE_TAB-TCOLOR1 = '7'.
* NODE_TAB-TEXT1 = ITTX-MAKTX.
* LI = STRLEN( ITTX-MAKTX ).
* NODE_TAB-TLENGTH = LI.
* APPEND NODE_TAB.
* CLEAR NODE_TAB.
ENDLOOP.
CALL FUNCTION 'RS_TREE_CONSTRUCT'
TABLES
NODETAB = NODE_TAB.
*DATA: type_mapping TYPE stree_ctl_type_mapping_tab.
*DATA: wa_type TYPE stree_ctl_type_mapping.
*CLEAR: type_mapping[].
*wa_type-type = 'A'.
*wa_type-icon = '@BL@'.
*APPEND wa_type TO type_mapping.
CALL FUNCTION 'RS_TREE_LIST_DISPLAY'
EXPORTING
STATUS = 'STANDARD'
USE_CONTROL = 'L'. -
Hi ,
I have two internal tables having with different structures . Finally I need to pass data to final internal table.
In runtime we have data in only one table. The final internal table should take either internal1, or internal table 2.
it_final_data[] = it_first_data[].
or
it_final_data[] = it_sec_data[].
i have to one generic include , it will understands the IT_final_data internal table only.
please help me.
regards,
AjayHi Ajay,
Build your final internal table with all the fields from first and second internal table. Use the below logic to move the data to the final internal table depending on the internal table data which you want to display.
IF not it_first_data[] is initial.
loop at it_first_data.
move-corresponding it_frist_data to it_final_data.
append it_final_data.
endloop.
else.
loop at it_second_data.
move-corresponding it_second_data to it_final_data.
append it_final_data.
endloop.
endif.
Hope this works for you.
Regards,
Jayaram -
Logic for retreiving the values from a dynamic internal table
Hi all,
I have an issue with the logic to fetch data from a dynamic internal table into fields. let me give you guys an example the sy-tfill = 9 (subject to vary). I need to populate the fields.
Regards,
SukumarHi,
this is for printing out the info in a dynamic table,
it will work likewise to insert data.
PARAMETERS:
p_tabnam TYPE tabname DEFAULT 'DB_TABLE_NAME'.
DATA:
lv_dref TYPE REF TO data,
ls_dd03l LIKE dd03l,
lt_fieldname TYPE TABLE OF fieldname,
ls_fieldname TYPE fieldname.
FIELD-SYMBOLS:
<fs> TYPE STANDARD TABLE,
<wa_comp> TYPE fieldname,
<wa_data> TYPE ANY,
<wa_field> TYPE ANY.
REFRESH lt_fieldname.
SELECT * FROM dd03l INTO ls_dd03l
WHERE as4local = 'A'
AND as4vers = '0000'
AND tabname = p_tabnam
ORDER BY position.
ls_fieldname = ls_dd03l-fieldname.
APPEND ls_fieldname TO lt_fieldname.
ENDSELECT.
IF NOT ( lt_fieldname[] IS INITIAL ).
CREATE DATA lv_dref TYPE TABLE OF (p_tabnam).
ASSIGN lv_dref->* TO <fs>.
SELECT * FROM (p_tabnam) INTO TABLE <fs>.
WRITE:
/ 'CONTENTS OF TABLE', p_tabnam.
LOOP AT <fs> ASSIGNING <wa_data>.
SKIP.
WRITE:
/ 'LINE', sy-tabix.
ULINE.
LOOP AT lt_fieldname ASSIGNING <wa_comp>.
ASSIGN COMPONENT sy-tabix OF STRUCTURE <wa_data> TO <wa_field>.
WRITE:
/ <wa_comp>, <wa_field>.
ENDLOOP.
ENDLOOP.
ENDIF.
grtz
Koen -
Logic issues for manipulation of internal table data
Hi,
I am having a issue with logic of one program.
In the <b>XVBAP</b> internal table of <b>SO</b> User Exit.
We will have fields like
<b>UPDKZ, POSNR, UEPOS, ZZECD[Z-Field] etc.</b>
Above fields are related to logic.
1. Now my first point is:
<b>We need to capture Records where UPDKZ='D' and ZZECD[Z-Field] is populated.</b>
For this we will write code as below:
<b>LOOP AT XVBAP WHERE UPDKZ EQ C_D AND
ZZECD NE SPACE.
Here we will store all fields in I_XVBAP I.Table
ENDLOOP.</b>
Supoose we have retrieved records as below:
<b>VBELN, UPDKZ, POSNR, UEPOS, ZZECD
100 D 000040 000030 Text1
100 D 000050 000020 Text2
100 D 000060 000000 Text3</b>
2. My second point here is:
<b>For Every Item[POSNR] we need to get the Higher level item from UEPOS field, If the Higher level Item also has UPDKZ = D, then move the base unit and all its components into an internal table. continue this process till UEPOS for POSNR is 000000 but High item should have UPDKZ = 'D', not only this all items in this chain should have UPDKZ = 'D'.</b>
Ex:
<b>Suppose for item 000050 UEPOS is 000020 then goto XVBAP with POSNR = UEPOS[000020] and UPDKZ = 'D' if yes and then pick up UEPOS for 000020 item and continue this process till UEPOS becomes 000000 and UPDKZ = 'D'.
Here from Low level to High level all the chain items should have UPDKZ = 'D'. Then only write all items into Final Internal table.</b>
<b>Need to do this process for all above rec's [40,50,60 - POSNR].</b>
Can anybody provide me the logic for the above scenario.
Thanks in advance.
Thanks and Regards,
DeepHi Anurag,
Your assumption is wrong.
See first when we get into our logic we will get <b>XVBAP</b> data as below:
<b>VBELN, POSNR, UEPOS, UPDKZ, ZZECD
100, 10, 00, D, Text1
100, 20, 00, , Text2
100, 30, 20, D, Text3
100, 40, 30, D, Text4
100, 50, 00, , Text5
100, 60, 00, D, Text6
100, 70, 60, D, Text7</b>
After we run first point we will get data as:
Here logic is pick up data where <b>UPDKZ = D</b> and <b>ZZECD NE SPACE</b>.
<b>VBELN, POSNR, UEPOS, UPDKZ, ZZECD
100, 10, 00, D, Text1
100, 30, 20, D, Text3
100, 40, 30, D, Text4
100, 60, 00, D, Text6
100, 70, 60, D, Text7</b>
Then we will goto second point:
Here we need to look into <b>3</b> things totally in 2nd point:
1. In loop Select the record which has <b>UEPOS EQ space</b>, <b>UPDKZ = D</b> and <b>POSNR</b> should not be <b>UEPOS</b> for any other record from above data from 1st point.
<b>100, 10, 00, D, Text1</b>
will be selected into final internal table as per this point.
2. If for a POSNR value UEPOS NE SPACE, UPDKZ = D then goto UEPOS's POSNR in high level check there if UPDKZ = D and then wether UEPOS is ZERO (or) contains any value.
If any value is there repeat the process till UEPOS become ZERO. Then for that final higher level item check UPDKZ value if it has value as 'D', If has then write all those records from low item to high item into final internal table.
<b>100, 60, 00, D, Text6
100, 70, 60, D, Text7</b>
In above for Item 70[POSNR] we have UEPOS as 60 and UPDKZ as D. then we will goto UEPOS's POSNR, Now POSNR is 60 then check it's UEPOS it is ZERO so check UPDKZ because it is D write both items 60, 70 into final internal table.
2. If for a POSNR value UEPOS NE SPACE, UPDKZ = D then goto UEPOS's POSNR in high level check there if UPDKZ = D and then wether UEPOS is ZERO (or) contains any value.
If any value is there repeat the process till UEPOS become ZERO. Then for that final higher level item check UPDKZ value if it has value as 'D', If it does not have UPDKZ as 'D' then don't write any item from low to high into final internal table.
If we take the scenario of below rows:
<b>100, 20, 00, , Text2
100, 30, 20, D, Text3
100, 40, 30, D, Text4</b>
POSNR-40 has UEPOS-30 & UPDKZ = D then UEPOS's POSNR-30 has UEPOS-20 and UPDKZ-D then UEPOS POSNR-20 has UEPOS as 00 then stop here and see UPDKZ which is ZERO so don't consider items 20,30,40 into final i.table.
In the above chain in any record UPDKZ is not 'D' then skip the process anddon't write the records into final internal table.
Final output will come as:
<b>100, 10, 00, D, Text1</b>
<b>100, 60, 00, D, Text6
100, 70, 60, D, Text7</b>
Thanks for all your efforts.
Thanks,
Deep -
Hi All,
I have one logical issue related to internal table manipulation.
I have one internal table :
I_DAT - This is related to Loading/Unloading of Goods.
for example with 3 fields
VSTEL, KUNNA, KMMANG.
Now suppose my data looks like this after sorting:
VSTEL KUNNA KMMANG
100 - -
200 - -
300 - -
400 - -
- 500 X
- 600 X
- 700 X
- 800 X
Here 100,200,300,400 are Loading points.
ANd 500,600,700,800 are unloading points.
Now what i want is For loading & Unloading points i need to pick up Address and print one after other.
But how they need to print is:
FOR INITIAL LOADING OF
ADDRESS- For 100
FIRST STOP: FOR LOADING OF
ADDRESS- For 200
SECOND STOP: FOR LOADING OF
ADDRESS- For 300
Etc .....
Then
FOR UNLOADING OF:
ADDRESS- For 400
FIRST STOP: FOR UNLOADING OF
etc.
FINAL STOP: FOR FINAL UNLOADING OF
We might get as many records :
Can any body give me the logic:
Printing Address is not a problem:
But Above every address we need to print FIRST STOP, SECOND etc like that.
For this i need logic.
Can anybody give the solution!
Thanks in advance.
Thanks & Regards,
Prasad.Try this.I think you want output like this......
DATA: BEGIN OF LINE,
CARRID TYPE SBOOK-CARRID,
CONNID TYPE SBOOK-CONNID,
FLDATE TYPE SBOOK-FLDATE,
CUSTTYPE TYPE SBOOK-CUSTTYPE,
CLASS TYPE SBOOK-CLASS,
BOOKID TYPE SBOOK-BOOKID,
END OF LINE.
DATA ITAB LIKE SORTED TABLE OF LINE WITH UNIQUE KEY TABLE LINE.
SELECT CARRID CONNID FLDATE CUSTTYPE CLASS BOOKID
FROM SBOOK INTO CORRESPONDING FIELDS OF TABLE ITAB.
LOOP AT ITAB INTO LINE.
AT FIRST.
WRITE / 'List of Bookings'.
ULINE.
ENDAT.
AT NEW CARRID.
WRITE: / 'Carrid:', LINE-CARRID.
ENDAT.
AT NEW CONNID.
WRITE: / 'Connid:', LINE-CONNID.
ENDAT.
AT NEW FLDATE.
WRITE: / 'Fldate:', LINE-FLDATE.
ENDAT.
AT NEW CUSTTYPE.
WRITE: / 'Custtype:', LINE-CUSTTYPE.
ENDAT.
WRITE: / LINE-BOOKID, LINE-CLASS.
AT END OF CLASS.
ULINE.
ENDAT.
ENDLOOP.
This is also helpful......
LOOP AT <itab>.
AT FIRST. ... ENDAT.
AT NEW <f1>. ...... ENDAT.
AT NEW <f2 >. ...... ENDAT.
<single line processing>
AT END OF <f2>. ... ENDAT.
AT END OF <f1>. ... ENDAT.
AT LAST. .... ENDAT.
ENDLOOP.
Regards
Abhishek -
hi experts , i need a logic
i have a internal table itab_equi in that i am getting 11 values when i pass this internal table to another table using for all entries i will get 4 values in int_bmgkobj . i need logic for how to get the deleted values i.e 9 values deleted . i need that value 9 values ..
SELECT matnr
sernr
kunde
objnr FROM equi
INTO TABLE itab_equi " i am getting 11 values here
WHERE kunde = kunde .
IF itab_equi[] IS NOT INITIAL.
SELECT j_objnr
gwldt
gwlen FROM bgmkobj
INTO TABLE itab_bgmkobj " i am getting 4 values here
FOR ALL ENTRIES IN itab_equi
WHERE j_objnr = itab_equi-objnr .
i need the deleted 9 values in a seperate internal table ..
plz help me for this logic
regards
chinnaiya PHI,
Check this ..
SELECT matnr
sernr
kunde
objnr FROM equi
INTO TABLE itab_equi " i am getting 11 values here
WHERE kunde = kunde .
IF itab_equi[] IS NOT INITIAL.
SELECT j_objnr
gwldt
gwlen FROM bgmkobj
INTO TABLE itab_bgmkobj " i am getting 4 values here
FOR ALL ENTRIES IN itab_equi
WHERE j_objnr NE itab_equi-objnr . "--> Check here
Or
Select all the data from bgmkobj into internal table itab_bgmkobj.
Loop the itab_bgmkobj and check the entry using entries in internal table itab_equi..if found delete ..the left entries are what you required -
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 -
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 -
Defining attribute for internal table within class builder?
Hello there,
I use an function module that provides me an internal table which has the reference type of the DDIC object zml_output. Furthermore I call this function module within a global class that should keep the result of the function module into the attribute lt_result, that is declared as private and typed with
lt_result TYPE zml_output.
Even the definition of that attribute causes the following error message:
"lt_result" is not an internal table.
I don't have any clue how to type lt_result differently. Actually I would need the following type of typing "TYPE TABLE OF" but that does not exist within the class builder.
Thanks for your help in advanced!
RobertHi Konstantinidis ...
Of course I can provide it to you. The code of my methode load_data reads as follows:
method LOAD_DATA.
CALL FUNCTION 'ZDATAGET'
EXPORTING
iv_dat = iv_dat
iv_time1 = iv_time1
iv_delta = iv_delta
TABLES
et_result = lt_result.
endmethod.
Especially the lt_result causes the mentioned error message
The compiler seems to expect something "TABLE" like for attribute lt_result. But whatever I tried it doesn't seem to work out.
Many thanks for help...
Maybe you are looking for
-
Hello, I created a Selection screen by adding attribute M_HANDLER of type IF_WD_SELECT_OPTIONS. This way I can create a selection screen with normal select-options. Now I added a parameter for a dropdown list. The Value set is passed correctly. No pr
-
ITunes Match sometimes skips / plays songs with exclamation marks
Using iTunes Match (v10.5.3) from my MacBook (OS X 10.6.8) I synched about 60G of music located on an external hard drive connected to my home-based AirPort Extreme base station into Apple's cloud. It works great from my iPhone and the iMac in my rem
-
ITunes wont sync apps from iPhone
So, the problem is that iTunes won't sync apps which I downloaded on iPhone. I synced my iPhone before and it all worked well, but now when I go to Apps folder its empty and when I connect my iPhone to computer and sync it, iTunes syncs all exept app
-
& special character problem with parseXML() and parseEscapedXML().
Hi, I'm having a problem to parse messages that has '&' character. According to metalink note 1340195.1 I tried to use parseXML instead of parseEscapedXML, still had same problem. Then added the following scope that replaces "&" with "& a m p ; a m p
-
Exported PDF converts black to gray
Hello, I am trying to export an InDesign CS3 document as a PDF, but all my blacks turn gray when previewed in Acrobat. I opened the PDF in Photoshop to sample the gray to make sure it wasn't a preview problem, but it is gray in Photoshop as well. I h