‎2008 Aug 20 12:14 PM
HI all,
i have one subroutine as follows,
FORM Update_MCOP_HDR
Select shop order FINAL_ISS SHOP_ORD_STEP COUNTER
From ZMIRS_MCOP_HDR
Where shop_order = idoc-shop_order_number
And counter = idoc-record-id
Read internal table of ZMIRS_MCOP_HDR to modify FINAL_ISSUE COLUMN TO u2019Nu2019.
In this i want to modify the value of the field final_iss as "N"
where value of Final_iss can be blank also.
can you help me out in this coding
Thanks in Advance,
Supriya
‎2008 Aug 20 12:19 PM
Hi,
data: itab type standard table of ZMIRS_MCOP_HDR,
wa type ZMIRS_MCOP_HDR.
FORM Update_MCOP_HDR
Select shop order FINAL_ISS SHOP_ORD_STEP COUNTER
From ZMIRS_MCOP_HDR
into corresponding fields of table itab
Where shop_order = idoc-shop_order_number
And counter = idoc-record-id
loop at itab into wa.
wa- FINAL_ISSUE = 'N'.
modify itab from wa.
endloop.
update the table ZMIRS_MCOP_HDR from itab.
Yogesh N
‎2008 Aug 20 12:20 PM
Select shop order FINAL_ISS SHOP_ORD_STEP COUNTER
From ZMIRS_MCOP_HDR
INTO table itab
Where shop_order = idoc-shop_order_number
And counter = idoc-record-id
if sy-subrc eq 0.
loop at itab into wa. "specify a condition here if required using where clause
<if you want to modify the value based on some condition, write an if -endif here.
wa-final_issue = 'N'.
modify itab from wa transporting final_issue.
endloop.
endif.
if you are getting a single record from the select statement, then you need not loop on the table and can get the single record using the select single statement. then you can directly update the value in the work area and there is no need of a loop or a modify statement.
‎2008 Aug 20 12:24 PM
Hi,
Try this.
There should be one common field to compare both the table values. for ex: shop_order_number.
Read table i_ZMIRS_MCOP_HDR into wa_ZMIRS_MCOP_HDR with key shop_order_number = idoc-shop_order_number.
if sy-subrc eq 0.
read table i_field_iss into wa_field_iss with key shop_order_number = idoc-shop_order_number.
if sy-subrc eq 0.
wa_field_iss-field = 'N'.
modify i_field_iss from wa_field_iss transporting field.
modify FINAL_ISSUE from i_field_iss.
endif.
endif.
The field is the name of the column which u want to change.
Here shop_order_number is just an example. You may have different field to compare the two tables also.
Sharin.
‎2008 Aug 20 12:34 PM
HI,
FORM Update_MCOP_HDR
Select shop order FINAL_ISS SHOP_ORD_STEP COUNTER
From ZMIRS_MCOP_HDR
Where shop_order = idoc-shop_order_number
And counter = idoc-record-id
After reading ii into internal table.
Loop at zmirms_mcop_hdr.
if zmirms_mcop_hdr-FINAL_ISSUE = ' ' or zmirms_mcop_hdr-FINAL_ISSUE ne 'N'.
zmirms_mcop_hdr-FINAL_ISSUE = 'N'.
modify zmirms_mcop_hdr.
endif.
endloop.
Regards
Rajendra