on 03-13-2014 3:07 PM
Req as follows :
1. i need to create one method in a assistance calss for updating custom table .
2. now i have to pass the multiple entries to that table then inside the method based need to update the Ztable. based on this entries
3. My internal table is having 2 fields ( Customernumber (key field) , Shiftloc ).(Multiple entries ex : 500)
based on customernumber need to update the new shiftloc in my custom table.
Can any one give some inputs please. i have doubt can we pass mupltiple entries (internal) as a importing parameter to the method?
Cheers,
Venu
Hi Venu,
You need to create a table type to pass internal table data into method as parameter.
You can achieve your requirement as below.
Hope this helps you.
Regards,
Rama
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi rama,
thank you for your promt reply.
i have one more query. Here i need to update the only Shipt to adress for particular customer number.
i have written the code as below. Please clarify this code will work for my requirement.
method UPDATE_SHIPTO.
data : Lt_contract type ty_update_shipto_t.
data : ls_contract like line of Lt_contract .
REFRESH : Lt_contract.
lt_contract[] = LT_DATA[].
loop at lt_contract into ls_contract.
* update Zcustom SET ship_to_adress = ls_contract-new_bp
WHERE cust_no = ls_contract-custnum
CLEAR : ls_contract.
ENDLOOP.
COMMIT WORK.
endmethod.
Hi Venu,
Well,updating data base table a record by record is not suggested. Instead, you update all customers data at once.
you can update the ship to address only for the customers from the internal table as below
let us say your internal table is having fields : new_bp and custnum
Now, prepare the internal table of type Zcustom as below
data lt_zcustom type table of zcustom.
data ls_zcustom like line of lt_zcustom.
clear lt_zcustom.
" Prepare data for updation
loop at it_data into ls_data.
clear ls_zcustom.
ls_zcustom-mandt = sy-mandt.
ls_zcustom-ship_to_address = ls_data-new_bp.
ls_zcustom-cust_no = ls_data-custnum.
" ....... some other columns data
append ls_zcustom to lt_zcustom.
endloop.
"now update records to data base
modify ZCUSTOM from table lt_zcustom.
Hope this helps you.
Regards,
Rama
User | Count |
---|---|
101 | |
13 | |
13 | |
11 | |
11 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.