Read table
i have to fetch belnr from bkpf table, and tax amount(fwste) from bset table.
if for a particular belnr suppose if this belnr 1700000000 has 5 line items in bset table than i need tax amount for all those 5 line items it means i need addition of that tax amount in output
for eg in bset table
belnr fwste lifnr curr
17000000000 0.00 0002300000 usd
2.00
0.00
4.00
in ouput i should get only subtotal has
1700000000 6.00 00023000000 usd
please help how to do its urgent
below is the code
SELECT bukrs
belnr
gjahr
xblnr
waers
budat
usnam
tcode
awkey
FROM bkpf
INTO TABLE gt_bkpf
WHERE bukrs IN s_bukrs
AND gjahr IN s_gjahr
AND tcode EQ 'MIRO'.
SELECT bukrs
belnr
gjahr
buzei
koart
lifnr
zlspr
FROM bseg
INTO TABLE gt_bseg
FOR ALL ENTRIES IN gt_bkpf
WHERE bukrs EQ gt_bkpf-bukrs
AND belnr EQ gt_bkpf-belnr
AND gjahr EQ gt_bkpf-gjahr
AND lifnr IN s_lifnr
AND zlspr IN s_zlspr
and koart eq 'K'.
AND bschl EQ '31'.
gt_bseg1[] = gt_bseg[].
SORT gt_bseg1[] BY lifnr.
DELETE ADJACENT DUPLICATES FROM gt_bseg1[] COMPARING lifnr.
IF gt_bseg1[] IS NOT INITIAL.
SELECT lifnr
name1
FROM lfa1
INTO TABLE gt_lfa1
FOR ALL ENTRIES IN gt_bseg1
WHERE lifnr EQ gt_bseg1-lifnr.
and lifnr eq s_lifnr.
ENDIF.
IF gt_bkpf[] IS NOT INITIAL.
SELECT belnr
gjahr
tcode
WAERS
zuonr
FROM rbkp
INTO TABLE gt_rbkp
FOR ALL ENTRIES IN gt_bkpf
WHERE gjahr EQ gt_bkpf-gjahr
AND tcode EQ gt_bkpf-tcode
AND belnr EQ gt_bkpf-awkey+0(10).
tax amount
SELECT bukrs
belnr
gjahr
buzei
fwste
FROM bset
INTO TABLE gt_bset
FOR ALL ENTRIES IN gt_bkpf
WHERE bukrs EQ gt_bkpf-bukrs
AND belnr EQ gt_bkpf-belnr
AND gjahr EQ gt_bkpf-gjahr.
and fwste ne 0 .
ENDIF.
IF gt_rbkp[] IS NOT INITIAL.
SELECT belnr
gjahr
buzei
cobl_nr
wrbtr
menge
mwskz
meins
FROM rbco
INTO TABLE gt_rbco
FOR ALL ENTRIES IN gt_rbkp
WHERE belnr EQ gt_rbkp-belnr.
ENDIF.
SELECT ebeln
ernam
FROM ekko
INTO TABLE gt_ekko
FOR ALL ENTRIES IN gt_rbkp
WHERE ebeln EQ gt_rbkp-zuonr+0(10).
IF gt_ekko[] IS NOT INITIAL.
SELECT banfn
bnfpo
ernam
ebeln
FROM eban
INTO TABLE gt_eban
FOR ALL ENTRIES IN gt_ekko
WHERE ebeln EQ gt_ekko-ebeln.
ENDIF.
ENDFORM. " RETRIEVE_DATA
*& Form MODIFY_DATA
text
--> p1 text
<-- p2 text
FORM modify_data .
*Sorting all Internal Tables .
SORT gt_bseg BY bukrs belnr gjahr.
SORT gt_bkpf BY bukrs belnr gjahr.
SORT gt_lfa1 BY lifnr.
SORT gt_rbkp BY belnr.
SORT gt_rbco BY belnr.
SORT gt_ekko BY ebeln.
SORT gt_bset BY belnr.
SORT gt_bset
SORT gt_eban BY ebeln.
SORT gt_bkpf .
SORT gt_bseg .
SORT gt_lfa1 .
SORT gt_rbkp .
SORT gt_rbco .
SORT gt_ekko .
SORT gt_bset.
SORT gt_eban .
LOOP AT GT_BSEG WHERE BELNR NE ' '.
MOVE gt_bseg-pswsl TO gt_final-pswsl.
MOVE gt_bseg-lifnr TO gt_final-lifnr.
MOVE gt_bseg-zlspr TO gt_final-zlspr.
READ TABLE GT_BKPF WITH KEY BELNR = GT_BSEG-BELNR BINARY SEARCH.
IF SY-SUBRC = 0.
MOVE gt_bkpf-bukrs TO gt_final-bukrs.
MOVE gt_bkpf-belnr TO gt_final-belnr.
MOVE gt_bkpf-xblnr TO gt_final-xblnr.
MOVE gt_bkpf-budat TO gt_final-budat.
MOVE gt_bkpf-usnam TO gt_final-usnam.
ENDIF.
READ TABLE gt_lfa1 WITH KEY lifnr = gt_bseg-lifnr BINARY SEARCH.
IF sy-subrc = 0.
MOVE gt_lfa1-name1 TO gt_final-name1.
ENDIF.
READ TABLE gt_rbkp WITH KEY belnr = gt_bkpf-awkey+0(10)
gjahr = gt_bkpf-gjahr
BINARY SEARCH.
IF sy-subrc = 0.
MOVE gt_rbkp-belnr TO gt_final-rbelnr.
MOVE gt_rbkp-waers TO gt_final-waers.
MOVE gt_rbkp-zuonr TO gt_final-zuonr.
endif.
READ TABLE gt_rbco WITH KEY belnr = gt_rbkp-belnr BINARY SEARCH.
IF sy-subrc = 0.
MOVE gt_rbco-buzei TO gt_final-buzei.
MOVE gt_rbco-wrbtr TO gt_final-wrbtr.
MOVE gt_rbco-menge TO gt_final-menge.
MOVE gt_rbco-meins TO gt_final-meins.
MOVE gt_rbco-mwskz TO gt_final-mwskz.
endif.
READ TABLE gt_ekko WITH KEY ebeln = gt_rbkp-zuonr+0(10) BINARY SEARCH.
IF sy-subrc = 0.
MOVE gt_ekko-ernam TO gt_final-ernam.
endif.
READ TABLE gt_eban WITH KEY ebeln = gt_ekko-ebeln BINARY SEARCH.
IF sy-subrc = 0.
MOVE gt_eban-ernam TO gt_final-ernam.
ENDIF.
READ TABLE GT_BSET WITH KEY BELNR = GT_BKPF-BELNR BINARY SEARCH.
IF SY-SUBRC = 0.
MOVE GT_BSET-FWSTE TO GT_FINAL-FWSTE.
ENDIF.
APPEND gt_final.
endloop.
please help where to add code and how to write
thanks in advance
declare itab with fields belnr and fwste.... and write code as below...!!!
SELECT bukrs
belnr
gjahr
xblnr
waers
budat
usnam
tcode
awkey
FROM bkpf
INTO TABLE gt_bkpf
WHERE bukrs IN s_bukrs
AND gjahr IN s_gjahr
AND tcode EQ 'MIRO'.
SELECT bukrs
belnr
gjahr
buzei
koart
lifnr
zlspr
FROM bseg
INTO TABLE gt_bseg
FOR ALL ENTRIES IN gt_bkpf
WHERE bukrs EQ gt_bkpf-bukrs
AND belnr EQ gt_bkpf-belnr
AND gjahr EQ gt_bkpf-gjahr
AND lifnr IN s_lifnr
AND zlspr IN s_zlspr
and koart eq 'K'.
AND bschl EQ '31'.
gt_bseg1[] = gt_bseg[].
SORT gt_bseg1[] BY lifnr.
DELETE ADJACENT DUPLICATES FROM gt_bseg1[] COMPARING lifnr.
IF gt_bseg1[] IS NOT INITIAL.
SELECT lifnr
name1
FROM lfa1
INTO TABLE gt_lfa1
FOR ALL ENTRIES IN gt_bseg1
WHERE lifnr EQ gt_bseg1-lifnr.
and lifnr eq s_lifnr.
ENDIF.
IF gt_bkpf[] IS NOT INITIAL.
SELECT belnr
gjahr
tcode
WAERS
zuonr
FROM rbkp
INTO TABLE gt_rbkp
FOR ALL ENTRIES IN gt_bkpf
WHERE gjahr EQ gt_bkpf-gjahr
AND tcode EQ gt_bkpf-tcode
AND belnr EQ gt_bkpf-awkey+0(10).
tax amount
SELECT bukrs
belnr
gjahr
buzei
fwste
FROM bset
INTO TABLE gt_bset
FOR ALL ENTRIES IN gt_bkpf
WHERE bukrs EQ gt_bkpf-bukrs
AND belnr EQ gt_bkpf-belnr
AND gjahr EQ gt_bkpf-gjahr.
and fwste ne 0 .
ENDIF.
IF gt_rbkp[] IS NOT INITIAL.
SELECT belnr
gjahr
buzei
cobl_nr
wrbtr
menge
mwskz
meins
FROM rbco
INTO TABLE gt_rbco
FOR ALL ENTRIES IN gt_rbkp
WHERE belnr EQ gt_rbkp-belnr.
ENDIF.
SELECT ebeln
ernam
FROM ekko
INTO TABLE gt_ekko
FOR ALL ENTRIES IN gt_rbkp
WHERE ebeln EQ gt_rbkp-zuonr+0(10).
IF gt_ekko[] IS NOT INITIAL.
SELECT banfn
bnfpo
ernam
ebeln
FROM eban
INTO TABLE gt_eban
FOR ALL ENTRIES IN gt_ekko
WHERE ebeln EQ gt_ekko-ebeln.
ENDIF.
ENDFORM. " RETRIEVE_DATA
*& Form MODIFY_DATA
text
--> p1 text
<-- p2 text
FORM modify_data .
*Sorting all Internal Tables .
SORT gt_bseg BY bukrs belnr gjahr.
SORT gt_bkpf BY bukrs belnr gjahr.
SORT gt_lfa1 BY lifnr.
SORT gt_rbkp BY belnr.
SORT gt_rbco BY belnr.
SORT gt_ekko BY ebeln.
SORT gt_bset BY belnr.
SORT gt_bset
SORT gt_eban BY ebeln.
SORT gt_bkpf .
SORT gt_bseg .
SORT gt_lfa1 .
SORT gt_rbkp .
SORT gt_rbco .
SORT gt_ekko .
SORT gt_bset.
SORT gt_eban .
<b>sort gt_bset by belnr.
loop at gt_bset.
at end of belnr.
itab-belnr = gt_bset-belnr.
sum.
itab-fwste = gt_bset-fwste.
append itab.
clear itab.
endat.
endloop.
delete adjacent duplicates from gt_bset comparing belnr.
loop at gt_bset.
read table itab with key belnr = gt_bset-belnr.
if sy-subrc = 0.
gt_bset-fwste = itab-fwste.
modify gt_bset index sy-tabix.
endif.
endloop.</b>
LOOP AT GT_BSEG WHERE BELNR NE ' '.
MOVE gt_bseg-pswsl TO gt_final-pswsl.
MOVE gt_bseg-lifnr TO gt_final-lifnr.
MOVE gt_bseg-zlspr TO gt_final-zlspr.
READ TABLE GT_BKPF WITH KEY BELNR = GT_BSEG-BELNR BINARY SEARCH.
IF SY-SUBRC = 0.
MOVE gt_bkpf-bukrs TO gt_final-bukrs.
MOVE gt_bkpf-belnr TO gt_final-belnr.
MOVE gt_bkpf-xblnr TO gt_final-xblnr.
MOVE gt_bkpf-budat TO gt_final-budat.
MOVE gt_bkpf-usnam TO gt_final-usnam.
ENDIF.
READ TABLE gt_lfa1 WITH KEY lifnr = gt_bseg-lifnr BINARY SEARCH.
IF sy-subrc = 0.
MOVE gt_lfa1-name1 TO gt_final-name1.
ENDIF.
READ TABLE gt_rbkp WITH KEY belnr = gt_bkpf-awkey+0(10)
gjahr = gt_bkpf-gjahr
BINARY SEARCH.
IF sy-subrc = 0.
MOVE gt_rbkp-belnr TO gt_final-rbelnr.
MOVE gt_rbkp-waers TO gt_final-waers.
MOVE gt_rbkp-zuonr TO gt_final-zuonr.
endif.
READ TABLE gt_rbco WITH KEY belnr = gt_rbkp-belnr BINARY SEARCH.
IF sy-subrc = 0.
MOVE gt_rbco-buzei TO gt_final-buzei.
MOVE gt_rbco-wrbtr TO gt_final-wrbtr.
MOVE gt_rbco-menge TO gt_final-menge.
MOVE gt_rbco-meins TO gt_final-meins.
MOVE gt_rbco-mwskz TO gt_final-mwskz.
endif.
READ TABLE gt_ekko WITH KEY ebeln = gt_rbkp-zuonr+0(10) BINARY SEARCH.
IF sy-subrc = 0.
MOVE gt_ekko-ernam TO gt_final-ernam.
endif.
READ TABLE gt_eban WITH KEY ebeln = gt_ekko-ebeln BINARY SEARCH.
IF sy-subrc = 0.
MOVE gt_eban-ernam TO gt_final-ernam.
ENDIF.
READ TABLE GT_BSET WITH KEY BELNR = GT_BKPF-BELNR BINARY SEARCH.
IF SY-SUBRC = 0.
MOVE GT_BSET-FWSTE TO GT_FINAL-FWSTE.
ENDIF.
APPEND gt_final.
endloop.
Similar Messages
-
Sy-tabix in relation to LOOP AT and READ TABLE
Hi All,
As per SAP documentation,
1) While looping through an internal table (LOOP AT), sy-tabix contains the index number of current row(for standard and sorted tables)
2)When successfully reading from an internal table(READ TABLE), sy-tabix is set to the index of the result row.
But what happens when READ TABLE is used while looping through another internal table?
i.e. Loop at TAB1...
write sy-tabix.
READ TABLE TAB2...
write sy-tabix.
endloop.
If we are looping through 1st row of TAB1 and the result of read statement is found in 3rd row of TAB2, I expected that sy-tabix before READ would be 1 and after the READ be 3.
But, I found that sy-tabix remains unchanged at 1. Can someone expalin why?
Thanks,
JaganHi
If after reading the table TAB2 the system variable SY-TABIX has still the previous value, that menas the READ TABLE fails or it was read the first record of TAB2.
After READ TABLE TAB2 try to check the SY-SUBRC:
LOOP AT TAB1.
WRITE: / 'TAB1 index:', SY-TABIX.
READ TABLE TAB2 .........
IF SY-SUBRC = 0.
WRITE: 'TAB2 index:', SY-TABIX.
Try this:
DATA: BEGIN OF ITAB OCCURS 0,
FIELD1,
END OF ITAB.
DATA: BEGIN OF ITAB2 OCCURS 0,
FIELD1,
END OF ITAB2.
DATA: INDEX TYPE I.
DO 10 TIMES.
APPEND ITAB.
ENDDO.
DO 10 TIMES.
APPEND ITAB2.
ENDDO.
LOOP AT ITAB.
WRITE: / 'ITAB:', SY-TABIX.
INDEX = SY-TABIX + 2.
READ TABLE ITAB2 INDEX INDEX.
IF SY-SUBRC = 0.
WRITE: 'ITAB2:', SY-TABIX.
ENDIF.
ENDLOOP.
Max -
Conflict: READ TABLE itab2 INDEX 1 vs Modify itab1 from index sy-tabix
The below simple code is for each itab1 line, create a new itab2 by using select statement, and then grab the max value of field f in itab2 and fill it into a corresponding field in itab1.
However the statement:
READ TABLE itab2 into gs_itab1 INDEX 1.
causes the conflict with our another statement in the end of itab1 loop:
Modify itab1 from gs_itab1 index sy-tabix.
that the below Modify statement always modify itab1 at 1st row and also causes an unlimited loop that the program is hung up. Our code looks as the following:
Loop AT itab1 into gs_itab1.
use Select statement to fill in itab2...
SORT itab2 BY f DESCENDING. "f is a field of itab2
READ TABLE itab2 into gs_itab1 INDEX 1.
Modify itab1 from gs_itab1 index sy-tabix.
EndLoop.
However the last two lines of statements in the itab1 loop causes the program hang!
Any solution?
Thanks in advance!Hi,
I got confused while going thru the code...
according to code
first u loop itab1 and get tht in gs_itab1 and then a select query to get data from some table and store in itab2.
Here are u using any where condition, if yes u may probably check aganst gs_itab1 rite? if yes
first suggestion...why cant u put the select statement above the loop and get all the values to an internal table and then read the internal table in the loop stmt. Yes i can see u r sorting it based on some 'f'..just a suggestion
Now here can u follow this code...
Loop AT itab1 ASSIGNING <fs_itab1>,
use Select statement to fill in itab2...
SORT itab2 BY f DESCENDING. "f is a field of itab2
READ TABLE itab2 into <fs_itab1> index 1.
EndLoop.
Please let me know if its not ok
<REMOVED BY MODERATOR>
Regards,
ABAPer007
Edited by: Alvaro Tejada Galindo on Apr 11, 2008 12:26 PM -
How to get the number of hits ("returned rows") in read table statement
Hi Experts
I have the statement shown below, which seems not to work as I would like it to. My problem is that I would like to do two different things depending on weather or not a read table statement results in 0 hits or 1 (or more) hits.
READ TABLE g_ship_item
WITH KEY
l_ztknum = DATA_PACKAGE-/bic/ztknum
BINARY SEARCH.
IF sy-subrc is initial.
no hits found
DATA_PACKAGE-/BIC/ZSTAGEERR = 1.
ELSE.
hits where found and we will do something else...
DATA_PACKAGE-/BIC/ZSTAGEERR = 0.
Hope someone can help me out of my problem...
Thanks in advance, regards
TorbenHi,
As you are using READ statement with Binary search, check whether the internal table g_ship_item is sorted with field /bic/ztknum or not. If it is not sorted then the result of this READ statement is not correct.
Below is the correct code.
sort g_ship_item by /bic/ztknum.
READ table g_ship_item with key g_ship_item = xxx.
Thanks,
Satya -
Dear All,
Please let me know which one of the two should I use to improve the performance, for tables containing a lot of data ?
Regards,
Thanks in anticipation.
Alok.Hi,
Follow below steps.
In se30 transaction you can look for
Tip&TRicks button on application toolbar
apart from below conventions
Follow below steps
1) Remove corresponding from select satement
2) Remove * from select
3) Select field in sequence as defined in database
4) Avoid unnecessary selects
i.e check for internal table not initial
5) Use all entries and sort table by key fields
6) Remove selects ferom loop and use binary search
7) Try to use secondary index when you don't have
full key.
8) Modify internal table use transporting option
9) Avoid nested loop . Use read table and loop at itab
from sy-tabix statement.
10) free intrenal table memory wnen table is not
required for further processing.
11)
Follow below logic.
FORM SUB_SELECTION_AUFKTAB.
if not it_plant[] is initial.
it_plant1[] = it_plant[].
sort it_plant1 by werks.
delete adjacent duplicates from it_plant1 comparing werks
SELECT AUFNR KTEXT USER4 OBJNR INTO CORRESPONDING FIELDS OF TABLE I_AUFKTAB
FROM AUFK
FOR ALL ENTRIES IN it_plant1
WHERE AUFNR IN S_AUFNR AND
KTEXT IN S_KTEXT AND
WERKS IN S_WERKS AND
AUART IN S_AUART AND
USER4 IN S_USER4 AND
werks eq it_plant1-werks.
free it_plant1.
Endif.
ENDFORM. "SUB_SELECTION_AUFKTAB
Regards
Amole -
Invalid Cursor when I want to modify itab with READ TABLE ?
Following code causes a core dump and says invalid cursor.
What should I do if I want to change gt_itab .?
REPORT ZEV_READ_TABLE.
data: begin of gt_itab occurs 0,
key like vbrk-vbeln,
name(10) type C,
amount type i,
end of gt_itab .
start-of-SELECTION.
gt_itab-key = 1.
gt_itab-name = 'erkan'.
gt_itab-amount = 10.
append gt_itab.
gt_itab-key = 2.
gt_itab-name = 'dilem'.
gt_itab-amount = 20.
append gt_itab.
LOOP AT gt_itab.
write:/ gt_itab-key,
gt_itab-name,
gt_itab-amount.
ENDLOOP.
Read table gt_itab with key Key = 1.
if sy-subrc = 0.
gt_itab-amount = 100.
modify gt_itab.
endif.
Kind Regards.
Erkan VAROLChange the code this way & try
modify gt_itab index sy-tabix.
a® -
Field symbols and READ TABLE with system code 4
Hi,
I have a hashed table and I am using field symbols to point to it to retrieve the field content. I then use it in the READ TABLE statement in the following way:
Loop at x_data assign <fs>.
ASSIGN COMPONENT 'xxx' OF STRUCTURE <fs> TO <c1>.
ASSIGN COMPONENT 'xxx' OF STRUCTURE <fs> TO <c2>.
READ TABLE ZZZZ assign <fs> with table key a1 = <c1>
a2 = <c2>.
If sy-subrc = 0.
endif.
I ran the debugger and I keep getting a 4. I am not able to get the value from a1 and a2 to see what it is and why it is causing a 4 sy-subrc. I know the value from the hashed table and the values c1 and c2 are the same, so the sy-subrc should be 0.
How would I read a hashed table using field symbols? I know that usig a standard table, I have to sort the table on the key fields() before I actually can do the READ TABLE using the binary search.
Please advise. Thanks
RTHai Rob
Go through the following Code
Field-Symbols are place holders for existing fields.
A Field-Symbol does not physically reserve space for a field but points to a field, which is not known until run time of the program.
Field-Symbols are like Pointers in Programming language C .
Syntax check is not effective.
Syntax :
Data : v1(4) value abcd.
Field-symbols <fs>.
Assign v1 to <fs>.
Write:/ <fs>.
DATA: BEGIN OF LINE,
COL1 TYPE I,
COL2 TYPE I,
END OF LINE.
DATA ITAB LIKE SORTED TABLE OF LINE WITH UNIQUE KEY COL1.
FIELD-SYMBOLS <FS> LIKE LINE OF ITAB.
DO 4 TIMES.
LINE-COL1 = SY-INDEX.
LINE-COL2 = SY-INDEX ** 2.
APPEND LINE TO ITAB.
ENDDO.
READ TABLE ITAB WITH TABLE KEY COL1 = 2 ASSIGNING <FS>.
<FS>-COL2 = 100.
READ TABLE ITAB WITH TABLE KEY COL1 = 3 ASSIGNING <FS>.
DELETE ITAB INDEX 3.
IF <FS> IS ASSIGNED.
WRITE '<FS> is assigned!'.
ENDIF.
LOOP AT ITAB ASSIGNING <FS>.
WRITE: / <FS>-COL1, <FS>-COL2.
ENDLOOP.
The output is:
1 1
2 100
4 16
Thanks & regards
Sreenivasulu P -
Hi EXpert,
I have an internal table say itab and I need to fetch a single record with some given conditions.
Hence I have used READ table statement ,
But on using this read table statement , I am unable to fetch the record :-(((( . It gives sy-subrc = 4.
And the same conditions when are put in Loop at itab statement, then I am able to fetch the data .
My requirement is only 1 record for the given conditions ( in where clause in case of loop at statement).
I think I am probably missing out on some minor thing..
<removed_by_moderator>
Warm Regards,
SUDHA
Edited by: Julius Bussche on Feb 7, 2009 2:48 PMHi,
Test the following Code hope it will solve out your problem,
PARAMETERS: key TYPE i .
TYPES: BEGIN OF t_test,
s_no TYPE i,
name(15),
END OF t_test.
DATA: it_test TYPE STANDARD TABLE OF t_test WITH HEADER LINE.
DO 10 TIMES.
it_test-s_no = sy-index.
it_test-name = 'SDN'.
APPEND it_test TO it_test.
ENDDO.
READ TABLE it_test INTO it_test WITH KEY key.
IF sy-subrc = 0.
WRITE: 'sy-subrc = ' , sy-subrc,
/1 it_test-s_no, 15 it_test-name.
ELSE.
WRITE: 'sy-subrc = ' , sy-subrc,
/ 'Sorry there is no Records with this Key'.
ENDIF.
Kind Regards,
Faisal
Edited by: Faisal Altaf on Feb 7, 2009 6:59 PM -
RFC and read table in another destination
HI
I search a complete code to read a table using the function 'RFC_GET_TABLE_ENTRIES '
I can acess to another server using RFC without problem.
I need to read table 'tmsbuftxt ' and data ' TRKORR '.
my program looks like
TABLES:
tmsbuftxt.
DATA:
i_tab512 TYPE tab512 OCCURS 0 WITH HEADER LINE,
i_tmsbuftxt TYPE table of tmsbuftxt,
st_tmsbuftxt type tmsbuftxt.
PARAMETERS p_dest LIKE rfcdes-rfcdest OBLIGATORY.
START-OF-SELECTION.
CLEAR i_tab512. REFRESH i_tab512.
CALL FUNCTION 'RFC_GET_TABLE_ENTRIES'
DESTINATION
p_dest
EXPORTING
" BYPASS_BUFFER = ' '
" FROM_KEY = ' '
" GEN_KEY = ' '
" MAX_ENTRIES = 0
table_name = 'tmsbuftxt'
" TO_KEY = ' '
" IMPORTING
"* NUMBER_OF_ENTRIES =
TABLES
entries = i_tab512
EXCEPTIONS
OTHERS = 1.
i_tmsbuftxt[] = i_tab512[].
LOOP AT i_tmsbuftxt INTO st_tmsbuftxt.
Write : st_tmsbuftxt-TRKORR.
ENDLOOP.
The problem is I dont know how to use the function correctly , I can choose the RFC I want but my programm return nothing.
Anyone can corect this?
I just start develop abap since 1 month.
I just want write st_tmsbuftxt-TRKORR. who is in another environnement using RFC.Hello Guillaume,
welcome in this forum.
I try RFC_GET_TABLE_ENTRIES, but I think it is better to use RFC_READ_TABLE. Try this to get the numbers of the transports from another system:
"-Begin-----------------------------------------------------------------
Program Z_TEST.
Data Fields Type Standard Table Of RFC_DB_FLD.
Data Field Type RFC_DB_FLD.
Data Data Type Standard Table Of TAB512.
Data Line Type TAB512.
Field-FIELDNAME = 'TRKORR'.
Append Field To Fields.
Call Function 'RFC_READ_TABLE' Destination 'NONE'
Exporting
QUERY_TABLE = 'TMSBUFTXT'
Tables
FIELDS = Fields
DATA = Data
Exceptions
TABLE_NOT_AVAILABLE = 1
TABLE_WITHOUT_DATA = 2
OPTION_NOT_VALID = 3
FIELD_NOT_VALID = 4
NOT_AUTHORIZED = 5
DATA_BUFFER_EXCEEDED = 6
Others = 7.
If sy-subrc <> 0.
Else.
Loop At Data Into Line.
Write: / Line.
EndLoop.
EndIf.
"-End-------------------------------------------------------------------
Let us know your results.
Cheers
Stefan -
Performance syntax loop at and read table
in the routine , for reading one line in a internal table , the syntaxe
loop at xxx where and read tabl exxx with key XXXX
has a great difference on performance or not?Loop at statement is used only for processing multiple records.Read table is used for reading a particluar record of an internal table.If you just need to check whether record exists in internal table, use can sort and use binary search with TRANSPORTING NO FIELDS addition. Also, try to use field symbols so that performance is increased.
-
Hi,
I would like to seek advice on this.
I have 2 internal table as below. The problem is although i have the same set of data in both internal table but
why sy-subrc still returns 4. I found out anln2 map to different ones. Why read table not able to pick the same anln2 even though it has the same value of anln2 in itab2.
LOOP AT it_itab1 INTO wa_itab1.
READ TABLE it_itab2 INTO wa_itab2
WITH KEY glla = wa_itab2-glia
cctrla = wa_itab2-cctria
anln1 = wa_itab2-anln1
anln2 = wa_itab2-anln2.
IF sy-subrc = 0.
ThanksDear Please check the below code
same as urs but small mofications
>
Ask_que wrote:
> Hi,
> I would like to seek advice on this.
> I have 2 internal table as below. The problem is although i have the same set of data in both internal table but
> why sy-subrc still returns 4. I found out anln2 map to different ones. Why read table not able to pick the same anln2 even though it has the same value of anln2 in itab2.
>
> LOOP AT it_itab1 INTO wa_itab1.
> READ TABLE it_itab2 INTO wa_itab2
> WITH KEY glla = wa_itab1-glia
> cctrla = wa_itab2-cctria
> anln1 = wa_itab2-anln1
> anln2 = wa_itab2-anln2.
> IF sy-subrc = 0.
>
>
> Thanks
LOOP AT it_itab1 INTO wa_itab1.
READ TABLE it_itab2 INTO wa_itab2
WITH KEY glla = wa_itab1-glia
IF sy-subrc = 0.
cctrla = wa_itab1-cctria
anln1 = wa_itab1-anln1
anln2 = wa_itab1-anln2.
ENDIF.
ENDLOOP.
Thanks
Surendra P -
Hi,
How can i read this table with where condition in OOPS? is it possible?
Give some idea how to proceed?
Inside method i have written like this.
ret is my return parameter.
code:
Loop at me->s001_raw[] assigning <arr_s001>.
read table ret[] with table key
vkorg in me->select_parameters->SO_VKORG[]
and ZZEMP in me->select_parameters->SO_empl[].
assigning <arr_return>.
ThanksRead will not work
May be you can try this way
Loop at me->s001_raw[] assigning <arr_s001>.
loop at ret[] assigning <arr_return> where vkorg in me->select_parameters->SO_VKORG[]
and zzemp in me->select_parameters->SO_empl[].
exit.
endloop.
endloop.
a® -
"Read table" and field symbols
Hello all,
I have a (hopefully simple) question. Let's suppose I want to do the following:
loop at itab1 assigning <fs1>.
read table itab2 assigning <fs2> with table key <fs1>-field1.
if sy-subrc eq 0.
move <fs2>-field1 to ls_out-field1.
endif.
read table itab3 assigning <fs3> with table key <fs1>-field2.
if sy-subrc eq 0.
move <fs3>-field1 to ls_out-field2.
endif.
endloop.
It's also possible to do the following instead:
loop at itab1 assigning <fs1>.
unassign: <fs2>,
<fs3>.
read table itab2 assigning <fs2> with table key <fs1>-field1.
read table itab3 assigning <fs3> with table key <fs1>-field2.
if <fs2> is assigned.
move <fs2>-field1 to ls_out-field1.
endif.
if <fs3> is assigned.
move <fs3>-field1 to ls_out-field2.
endif.
endloop.
My question is: is it "better" to check sy-subrc after each read, and then do a move statement within that if statement, or is it better to check whether the field symbol is assigned each time I want to fill in a field and read everything at the same time?
I'm only really concerned about the case where you don't want to drop out of the loop after the read (so if the read fails you just don't fill any data in). I'm also discounting potential human error (otherwise the sy-subrc method wins hands-down).Just to close this one (albeit somewhat belatedly). I asked Harry Dietz (the ABAP Performance blogging fella) what he would suggest, and he says sy-subrc all the way. Checking that an integer is zero is considerably faster than checking for the assignment, or otherwise, of a field symbol. Furthermore, whilst the field symbol method has the potential to be faster than the sy-subrc method given some compiler optimizations, unfortunately these optimizations don't exist in the ABAP compiler - they're there in the Java compiler though! Shame really. Apparently the ABAP compiler is a pretty simple beast.
Anyway - thanks Harry for clearing this one up! -
How to assigne multiple value in key of read table
Hi gurus,
I want read table xxxx with key field1 = ' xxx' or field1 = 'yyy'.
how to assign multiple value as key for the same field while reading internal table.
Regards
sagarHi ,
You can loop the internal table like
loop at <table xxxx> where field1 = ' xxx' or field1 = 'yyy'
or you can write two read statements to read the internal table in wrk area.
read table <table xxxx> with key field1 = ' xxx'.
if sy-subrc <>0
read table <table xxxx> with key field1 = 'yyy'.
if sy-subrc = 0
endif.
else.
do your data processing.
endif.
Thans. -
RFC-Error while reading table TFMCA003
Hello,
we have a running system with campus management an I'm doing the customizing for a separate system SLCM with EHP3. I created a RFC-Connection as in the Base IMG Configuration Settings for Pre-Configured SAP Student Lifecycle Management (ERP 6 - EHP 3) 31 October 2007 page 8+9 described.
On the old system it works without problems but on EHP3 I get the following error displayed while creating new students: Error - check RFC-Destination RFC_FICA_ACCT_CREATE
Looking into the rfc trace I read the following entry:
Trace file opened at 20090407 135656 W. Europe Daylight Time, SAP-REL 700,0,185 RFC-VER nU 3 1025200 MT-SL
======> Fehler beim Lesen in der Tabelle TFMCA003
ABAP Programm: SAPLHRPIQ00STUDENT_ACCOUNT (Transaction: PIQSTC)
Called function module: HRIQ_STUDENT_ACCTDATA_UPD_INT
User: RSEIDLER (Client: 100)
Destination: RFC_FICA_CREATE_100 (handle: 6, 10238413, {306B23DE-EF74-F186-BAA8-0022640496A6})
Error RFCIO_ERROR_MESSAGE in abrfcio.c : 1833
So there is an error reading table TFMCA003, but this one is empty, in both systems!
Although the error message is displayed I can not see any limitation working with the created student. So it seems everything is working normal. But the message is unacceptable in a live system, of course.
Any ideas?
RobertHi Nivdedita,
Check the rule which you have defined in the workflow.
Regards,
Sravanthi -
After reset Mail hangs w/spinning ball on "Reading table of contents"
This problem is on a 17" monitor Power PC G4, 256mb DDR SDRAM.iMac, half ball bottom, with Mail, with Systems 10.3.9
After Reset, Mail is hanging with the spinning beach ball on "Reading table of contents." Quite a few emails are being retrieved and placed in the Dock before the hang, and Mail responds to mouse commands up to the "hang." Then a Force Quit is the only way to proceed. Other programs run OK, with Mail "hung."
The reason for the Reset is that my daughter reads "fan fiction," and can go through a hundred pages in an hour, and the computer gets so plugged up that it takes FIVE MINUTES to retrieve, then display another Safari window. Empty Cache does not help. So, to get things back to normal, a reset is required. Something went wrong on this reset.
This happened once before, possibly with OS-X 10.2, and I was advised to delete a file somewhere deep in Systems, and Mail apparently made a "new" file and all was fine from then on. My "guess" is that Mail then makes a new "table of contents."
Anybody know what file to delete? Or any other advice? At the moment, I am getting Mail with another IMac, with System 10.2
iMac 17" "half ball bottom" 1 GHZ PowrPc G4 Mac OS X (10.3.9)Hello Jean.
When you use the term "reset", are you referring to a
computer restart?
On this PowerPC with 10.3.9, what is the hard drive
capacity and available free space?
If the problem Inbox mailbox is for a POP type
account, with the Mail.app quit and using the Finder
go to Home > Library > Mail > this account named
folder (named by the user name and incoming mail
server for the account) > INBOX.mbox.
Move the INBOX.mbox to the Desktop.
Launch Mail and if successful, a new (and empty)
INBOX.mbox will be created automatically by Mail
within this account named folder when receiving the
next message with this account.
This should allow the Mail.app to function properly
again while working on the old INBOX.mbox move to the
Desktop to recover the existing messages.
Control-click on the old INBOX.mbox moved to the
Desktop and at the menu window that appears, select
Show Package Contents.
List the package content file names and size of
each here.
I have had the same problem as Jean - did what you advised and now find mail runs find but need to rescue the old mail.
This is the package content of my old inbox:
content index 36 kb
content_index-computername.local-372 10.9 MB
info.plist 4 kb
mbox 939.1 MB
tableofcontents 1.5 MB
hope you can help me...
x
habibi
Maybe you are looking for
-
BI Webtemplate View can not be saved in Portal
Hi Friends. We are running at my Client BMW Sales Portal. in which we have used the web templates. I want to activate the functionality to save the view for reports displayed on portal. Where should I go to change any required thing in my web templat
-
Where did my cursor go when I was surfing the web?
My cursor disappeared when I was surfing two different sites today. My only solution was to power off and reboot. [My touchpad is not turned off.] Is this a problem that has an easier solution or is this a technical problem that needs fixing by HP/Co
-
How to mask out unwanted objects in locked-off shots in Prem Pro CS5.5
hello, I have Adobe CS5.5 Master Collection. I am editing a short film on Prem Pro and on some of the locked-off shots where the camera doesn't move there are objects in shot, such as boom mic, that I want to get rid of by painting over them with wha
-
i can't put music on my ipod touch help meee itunes can't find my ipod touch so what do i need to do i already reinstalled itunes but same probleme
-
[JS] [CS3] How do you find an insertion point's paragraph index #?
This is probably a very simple thing to do, but I haven't been able to find a way to reference this. Thanks in advance for any help provided. Len Swierski