09-11-2007 7:30 AM
Hi,
I hace used the statement "HIDE" as follows:
<code>
loop at itab1.
Write:/ itab1-flag as checkbox
itab1-field1,
itab1-field2,
itab1-field3.
Hide:
itab1-flag,
itab1-field1,
itab1-field2,
itab1-field3.
endloop.
uline. "Err00
write:/ 'end of report'. "Err00
</code>
... ...
... ...
<code>
do.
read line sy-index field value itab1-flag.
if sy-subrc<> 0. exit. endif.
check not itb1-flag is initial.
if not itab1-field1 is initial.
.....
endif.
</code>
But the problem is,
The program always repeat last records 2 times, I means, the system will get 3 same records for last contents of itab1; but if I remove above statements
which commtent 'Err00', error will not appear.
Please kindly advise.
Thanks and best regards.
09-11-2007 8:16 AM
09-11-2007 7:33 AM
Hi
Just change the code like this..
loop at itab1.
Write:/ itab1-flag as checkbox
itab1-field1,
itab1-field2,
itab1-field3.
Hide:
itab1-flag,
itab1-field1,
itab1-field2,
itab1-field3.
endloop.
<b>CLEAR ITAB1.</b> "Add this statement after the Loop...
Reward if Helpful
09-11-2007 7:33 AM
09-11-2007 7:35 AM
Clear internal table at last so that you will not get that error.
09-11-2007 7:37 AM
HI,
IF U GET LAST RECORD TWICE THEN USE CLEAR ITAB ST BEFORE END OF LOOP AND TRY LIKE THIS,
loop at itab1.
Write:/ itab1-flag as checkbox
itab1-field1,
itab1-field2,
itab1-field3.
Hide:
itab1-flag,
itab1-field1,
itab1-field2,
itab1-field3.
CLEAR ITAB.
endloop.
IF HELPFUL REWARD SOME POINTS.
WITH REGARDS,
SURESH ALURI.
09-11-2007 7:38 AM
example
*displaying report when Batch Managed is NOT Selected
LOOP AT t_itab1 INTO wa_itab1.
IF wa_itab1-xchar = 'X'.
DELETE TABLE t_itab1 FROM wa_itab1.
ENDIF.
ENDLOOP.
ENDIF.
IF t_itab1[] IS INITIAL.
MESSAGE i000(zg) WITH text-008.
ENDIF.
SORT t_itab1 BY werks matnr.
CLEAR ws_lines.
LOOP AT t_itab1 INTO wa_itab1.
WRITE : / sy-vline, wa_itab1-mtart, 17 sy-vline,
wa_itab1-matnr, 35 sy-vline,
wa_itab1-maktx, 78 sy-vline,
wa_itab1-ernam, 93 sy-vline,
wa_itab1-matkl, 111 sy-vline,
wa_itab1-wgbez, 134 sy-vline.
*hide
HIDE : wa_itab1-matnr,wa_itab1-werks.
ON CHANGE OF wa_itab1-werks.
CLEAR ws_lines.
ENDON.
ws_lines = ws_lines + 1 .
*bottom of page
AT END OF werks.
ULINE AT /(134).
WRITE : / 'TOTAL MATERIAL DISPLAYED : ', ws_lines,
/ 'PAGE NUMBER : ', sy-pagno.
SKIP 2.
NEW-PAGE.
ENDAT.
ENDLOOP.
ENDFORM. " display
AT LINE-SELECTION.
GET CURSOR FIELD f VALUE val.
IF f = 'WA_ITAB1-MATNR'.
SET PARAMETER ID 'MAT' FIELD wa_itab1-matnr.
SET PARAMETER ID 'MXX' FIELD lc_view. "to skip the select views popup
SET PARAMETER ID 'WRK' FIELD wa_itab1-werks.
IF NOT wa_itab1-matnr IS INITIAL.
CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN.
CLEAR : wa_itab1-matnr, wa_itab1-werks.
ENDIF.
=========
Write hide out of the loop.
09-11-2007 7:49 AM
Hi,
Thank you all very much.
I added "clear itab1" in the program, but the error still appear,
Please kindly advise.
Thanks and best regards.
09-11-2007 7:53 AM
Try this
loop at itab1.
Write:/ itab1-flag as checkbox
itab1-field1,
itab1-field2,
itab1-field3.
endloop.
uline. "Err00
write:/ 'end of report'. "Err00
<b>Hide:
itab1-flag,
itab1-field1,
itab1-field2,
itab1-field3.</b></code>
... ...
... ...
<code>
do.
read line sy-index field value itab1-flag.
if sy-subrc<> 0. exit. endif.
check not itb1-flag is initial.
if not itab1-field1 is initial.
.....
endif.
<b>Clear Itab1.</b>
</code>
09-11-2007 8:02 AM
Hi, Kiran Kumar,
Thank you very much for your advise.
I changed the program but error still occured, the program will
apprear last records 2 times.
Please kindly advise.
Thanks and best regards.
09-11-2007 8:04 AM
Hi ..
Since you are using READ LINE . there is no need to use the HIDE statement at all.
Remove it and See.
<b>reward if Helpful.</b>
09-11-2007 8:14 AM
Jo, Varma@infyTree,
Thank you very much for you kindly help.
I removed the "HIDE" statements, but the error still occured.
Please kindly advise.
Thanks and best regards.
09-11-2007 8:07 AM
Hi..
As i mentioned dont use the HIDE statement.
And change your READ LINE statement as below..
do.
<b>read line sy-index field value itab1-flag itab1-field1.</b> "read all the fields that u need
if sy-subrc<> 0. exit. endif.
check not itb1-flag is initial.
if not itab1-field1 is initial.
Even now if u get the same problem paste the code.
<b>reward if Helpful.</b>
09-11-2007 8:13 AM
Hi,
For interactive report we can use 2 types
1) HIDE statement
2) READ LINE
in ur program ur using 2 types instead of using one type.
try to remove any one then check it.
<b>reward me if it use full answer.</b>
praveen
09-11-2007 8:16 AM
09-11-2007 8:24 AM
Hi, Kiran Kumar,
Complete code enclosed, please kindly help.
Thanks and best regards.
*------------------------------------
form disp_data_list.
write:/(1) 'S',
(4) 'Proc',
(5) 'Item',
(12) 'Material',
(13) 'Quantity',
(3) 'UOM',
(5) 'Plant',
(7) 'StorLoc',
(11) 'PlanDlvdate',
(7) 'MvtTyp',
(10) 'CostCenter',
(11) 'Reservation',
(12) 'RevDelDate',
* (40) 'Description-EN',
(80) 'Message'.
loop at itab_ZT01.
write:/ itab_ZT01-flag as checkbox,
(4) itab_ZT01-process, "Process
(5) itab_ZT01-ebelp, "Item
(12) itab_ZT01-matnr, "Material
(13) itab_ZT01-menge left-justified, "qty
(3) itab_ZT01-meins, "basic uom
(5) itab_ZT01-werks, "plant
(7) itab_ZT01-umlgo, "storage location
(11) itab_ZT01-badat no-zero, "pland delivery date
(7) itab_ZT01-bwart, "movement type
(10) itab_ZT01-kostl, "cost center.
(11) itab_ZT01-rsnum left-justified no-zero, "reservation.
(10) itab_ZT01-rvddate no-zero, "Rev del data
* (40) itab_ZT01-maktx, "description-en
(80) itab_ZT01-message. "message
* hide:
* itab_ZT01-flag, "flag
* itab_ZT01-ebelp, "Item
* itab_ZT01-matnr, "Material
* itab_ZT01-menge, "qty
* itab_ZT01-meins, "basic uom
* itab_ZT01-werks, "plant
* itab_ZT01-umlgo, "storage location
* itab_ZT01-badat, "pland delivery date
* itab_ZT01-bwart, "movement type
* itab_ZT01-kostl, "cost center.
* itab_ZT01-rsnum, "reservation.
* itab_ZT01-maktx. "description-en
endloop.
WRITE:/ sy-uline(180).
DATA: wk_rec TYPE i.
DESCRIBE TABLE itab_ZT01 LINES wk_rec.
WRITE:/ 'Total records:', wk_rec.
endform. " disp_data_list
*-------------------------------
form create_reservation.
do.
read line sy-index field value itab_ZT01-flag.
if sy-subrc ne 0.
exit.
endif.
check not itab_ZT01-flag is initial.
if itab_ZT01-rsnum is initial.
if itab_ZT01-matnr = '' or
itab_ZT01-werks = '' or
itab_ZT01-badat is initial or
itab_ZT01-umlgo = '' or
itab_ZT01-bwart = '' or
itab_ZT01-kostl = ''.
modify current line field value itab_ZT01-process
from '@P5@'. "skipped, no processing
modify current line field value itab_ZT01-message
from 'Data Incomplete,Skipped'.
continue.
endif.
refresh: wk_revitem, wk_return,wk_prfbseg.
clear: wk_revheader, wk_revno,wk_revitem.
wk_revheader-res_date = sy-datum. "Base date for rev
wk_revheader-created_by = sy-uname. "user name
wk_revheader-move_type = itab_ZT01-bwart. "mov type 909/910
wk_revheader-costcenter = itab_ZT01-kostl. "cost center
select single mseh3 from t006a into wk_mseh3
where spras = sy-langu and
msehi = itab_ZT01-meins.
if sy-subrc <> 0.
clear wk_mseh3.
endif.
wk_revitem-material = itab_ZT01-matnr. "material
wk_revitem-plant = itab_ZT01-werks. "Plant
wk_revitem-stge_loc = itab_ZT01-umlgo. "stor loc
wk_revitem-entry_qnt = itab_ZT01-menge. "qty
* wk_revitem-entry_uom = wk_mseh3. "basic uom
wk_revitem-req_date = itab_ZT01-badat. "req date
wk_revitem-movement = ''.
append wk_revitem.
call function 'BAPI_RESERVATION_CREATE1'
EXPORTING
reservationheader = wk_revheader
IMPORTING
reservation = wk_revno
TABLES
reservationitems = wk_revitem
profitabilitysegment = wk_prfbseg
return = wk_return.
call function 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
if not wk_revno is initial.
modify current line field value itab_ZT01-process
from '@08@'. "create :success
modify current line field value itab_ZT01-rsnum
from wk_revno.
modify current line field value itab_ZT01-rvddate
from ''.
update ZT01 set:
rsnum = wk_revno "Rev no.
rvddate = '' "rev del date
duser = sy-uname "user name
where prno = p_prno and "req no.
ebelp = itab_ZT01-ebelp. "item
commit work.
else.
perform get_message.
if wk_bmsg = ''.
concatenate 'Err:' wk_return-message
sy-msgty '-' sy-msgid '-' sy-msgno into wk_message.
modify current line field value itab_ZT01-message
from wk_message.
else.
modify current line field value itab_ZT01-message
from wk_bmsg.
endif.
modify current line field value itab_ZT01-process
from '@AG@'. "Create:failed
endif.
else.
modify current line field value itab_ZT01-process
from '@P5@'. "skipped, no processing
modify current line field value itab_ZT01-message
from 'Rev Existed,Skipped.'.
endif.
enddo.
09-11-2007 8:28 AM
Hi..
As i mentioned in earlier post.. Change the READ LINE statement to Read all the Necessary fields .. not just the Flag field.
See this..
<b>Read line sy-index field value itab_ZT01-flag
itab_ZT01-matnr
itab_ZT01-werks ... <other fields..> .
</b>
Then it should work..
Note: No need of HIDE statement since you are Reading all the lines.
<b>reward if helpful</b>
09-11-2007 8:51 AM
Hi, Varma@infyTree ,
I tried to use <b>read line ....</b> to read all fields, but the contents of <b>date field</b> and <b>numberic field</b> can't get correctly.
Please kindly advise.
Thanks and best regards.
09-11-2007 9:02 AM
Hi ..
Read Line statement Return the Field Values in Output Format (Eg : DD/MM/YYYY).
So you need to Convert them into internal Format (Eg: YYYYMMDD).
For this:
Call the Conversion Exits
like
CONVERSION_EXIT_IDATE_INPUT "For date field
CONVERSION_EXIT_ALPHA_INPUT "for numeric fields..
<b>REWARD IF HELPFUL.</b>