2007 Mar 06 12:45 PM
Hallow I have a 2 table with data and the table that I do the read statement I wont to increase the index of score_tab after all read because the problem is when I modify the table score 4 I have the first data in all my table.
How can I do that?
Regards
LOOP AT score_tab_4 INTO wa_score_tab_4.
<b>READ TABLE score_tab INTO wa_score_tab
WITH KEY objid_p = wa_score_tab_4-objid_p.</b>
IF sy-subrc = 0.
MOVE wa_score_tab-stext_vc TO wa_score_tab_4-stext_vc.
MOVE wa_score_tab-score_numric TO wa_score_tab_4-score_numric.
MOVE wa_score_tab-score_from_total TO wa_score_tab_4-score_from_total.
MODIFY score_tab_4 FROM wa_score_tab_4
TRANSPORTING stext_vc score_numric score_from_total.
CLEAR wa_score_tab_4.
ENDIF.
ENDLOOP.
2007 Mar 06 2:56 PM
I guess that your table score_tab_4 has no header line.
In that case the coding has to be:
field-symbols: <fs_tab4> type ?
Use for ? the Type description that you are using for your table.
Example:
types: begin of <b>ltyp_test</b>,
line type STRING,
end of ltyp_test.
Data: lt_test type standard table of ltyp_test.
field-symbols: <fs_dat> type ltyp_test.
Hope that helps!
Regards
Nicola
I guess that your table score_tab_4 has no header line.
In that case the coding has to be:
field-symbols: <fs_tab4> type ?
Use for ? the Type description that you are using for your table.
Example:
types: begin of <b>ltyp_test</b>,
line type STRING,
end of ltyp_test.
Data: lt_test type standard table of ltyp_test.
field-symbols: <fs_dat> type ltyp_test.
Hope that helps!
Regards
Nicola
2007 Mar 06 12:48 PM
data_ l_tabix like sy-tabix. " CHECK HERE
LOOP AT score_tab_4 INTO wa_score_tab_4.
l_tabix = sy-tabix. " CHECK HERE
READ TABLE score_tab INTO wa_score_tab
WITH KEY objid_p = wa_score_tab_4-objid_p.
IF sy-subrc = 0.
MOVE wa_score_tab-stext_vc TO wa_score_tab_4-stext_vc.
MOVE wa_score_tab-score_numric TO wa_score_tab_4-score_numric.
MOVE wa_score_tab-score_from_total TO wa_score_tab_4-score_from_total.
MODIFY score_tab_4 FROM wa_score_tab_4
TRANSPORTING stext_vc score_numric score_from_total index l_tabix. " CHECK HERE
CLEAR wa_score_tab_4.
ENDIF.
ENDLOOP.
Vasanth
2007 Mar 06 12:59 PM
hi Vasanth M
i have erorr in this
TRANSPORTING stext_vc score_numric score_from_total index l_tabix.
the erorr is no component exist with the name index
and i declare it.
2007 Mar 06 1:06 PM
hi
declare like this:
data l_tabix like sy-tabix.
remove the underscore that next to data:
data<b>_</b> l_tabix like sy-tabix.
reward if helpful
regards,
madhu
2007 Mar 06 1:44 PM
Hi,
change the statement like this
MODIFY score_tab_4 FROM wa_score_tab_4 <b>index l_tabix</b>
TRANSPORTING stext_vc score_numric score_from_total .
2007 Mar 06 2:09 PM
hi Chandrasekhar
i try this suggstion but its not working
i have the same data in score_tab_4 like before
regards
2007 Mar 06 2:16 PM
all looks ok , but try this..
Try sorting the table used in READ statement
<b>sort score_tab by objid_p.</b>
LOOP AT score_tab_4 INTO wa_score_tab_4.
READ TABLE score_tab INTO wa_score_tab
WITH KEY objid_p = wa_score_tab_4-objid_p <b>binary search</b>.
IF sy-subrc = 0.
MOVE wa_score_tab-stext_vc TO wa_score_tab_4-stext_vc.
MOVE wa_score_tab-score_numric TO wa_score_tab_4-score_numric.
MOVE wa_score_tab-score_from_total TO wa_score_tab_4-score_from_total.
MODIFY score_tab_4 FROM wa_score_tab_4
TRANSPORTING stext_vc score_numric score_from_total.
CLEAR wa_score_tab_4.
ENDIF.
ENDLOOP.
also check in debugging if the sy-subrc eq 0 after read statement
2007 Mar 06 2:30 PM
hi Chandrasekhar
theb problem is that i need to increase the index in the <b>read statment</b> and i dont now how to do it.
regards
2007 Mar 06 2:41 PM
I did not fully understand ur question,
Is it this what u r looking for
sort score_tab by objid_p.
LOOP AT score_tab_4 INTO wa_score_tab_4.
loop at score_tab INTO wa_score_tab
where objid_p = wa_score_tab_4-objid_p.
MOVE wa_score_tab-stext_vc TO wa_score_tab_4-stext_vc.
MOVE wa_score_tab-score_numric TO wa_score_tab_4-score_numric.
MOVE wa_score_tab-score_from_total TO wa_score_tab_4-score_from_total.
MODIFY score_tab_4 FROM wa_score_tab_4
CLEAR wa_score_tab_4.
endloop.
ENDIF.
ENDLOOP.</b>Message was edited by:
Chandrasekhar Jagarlamudi
null
2007 Mar 06 12:54 PM
Hi
Instead of modifying the table contents with in a loop .. endloop.. (This is not recommended approach)
Create a new internal table and populate it with the required data and use it as per your requirements.
Hope this will help.
Regards
- Atul
2007 Mar 06 12:58 PM
Hi Antonio,
I'm not sure if I understand your problem but I wonder why you fill 3 fields in structure wa_score_tab_4 and with using transporting while doing the modify you try to update a field that hasn't changed before? Could you please give us more information which fields you are trying to change?
Regards
Nicola
P.S.: Try to use shorter structure and field names; it's pretty confusing with the long names
2007 Mar 06 1:29 PM
I just saw that your "transporting" is correct (I was confused with the long names) so please forget my first post.
Could you try the following coding?
field-symbols: <fs_tab4> like score_tab_4 (if your table has a header line, otherwise use 'type xxx').
Loop at score_tab_4 assigning <fs_tab4>.
READ TABLE score_tab INTO wa_score_tab
WITH KEY objid_p = <fs_tab4>-objid_p.
IF sy-subrc = 0.
MOVE wa_score_tab-stext_vc to <fs_tab4>-stext_vc.
MOVE wa_score_tab-score_numric TO <fs_tab4>-score_numric.
MOVE wa_score_tab-score_from_total TO <fs_tab4>-score_from_total.
endif.
endloop.
You don't need the modify anymore than.
Regards
Nicola
2007 Mar 06 2:33 PM
hi Schwab
i have an error score_tab_4 is not comptebole with <fs_tab4>.
what can i do with that thankes
2007 Mar 06 2:56 PM
I guess that your table score_tab_4 has no header line.
In that case the coding has to be:
field-symbols: <fs_tab4> type ?
Use for ? the Type description that you are using for your table.
Example:
types: begin of <b>ltyp_test</b>,
line type STRING,
end of ltyp_test.
Data: lt_test type standard table of ltyp_test.
field-symbols: <fs_dat> type ltyp_test.
Hope that helps!
Regards
Nicola
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |