01-07-2008 9:33 AM
Hi All,
I have an internal table where i have populated Billing Document header and item level data. Now i have a field in the same internal table "material Desc" which is empty. I have material number data in the same internal table.
Now i have used for all entries syntax to get the material description against available material number as follows.
SELECT MAKTX FROM MAKT
INTO I_VBRK-MAKTX
FOR ALL ENTRIES IN I_VBRK
WHERE MATNR = I_VBRK-MATNR.
After execution of this syntax, the internal table is populating with required Material Description. But the other fields like Billing Document Number, Business Areas etc data are getting deleted.
How to resolve this issue?
Regards
Pavan
01-07-2008 9:36 AM
Hi Use INTO CORRESPONDING FIELDS OF I_VBRK
awrd points if useful
bhupal
01-07-2008 9:36 AM
Hi Use INTO CORRESPONDING FIELDS OF I_VBRK
awrd points if useful
bhupal
01-07-2008 9:37 AM
Hi,
Try this.
LOOP AT I_VBRK.
SELECT MAKTX FROM MAKT INTO I_VBRK-MAKTX
WHERE MATNR = I_VBRK-MATNR.
MODIFY I_VBRK TRANSPORING MAKTX.
ENDLOOP.
Rewards points if helpful.
Regards,
Srinivas Ch
01-07-2008 9:39 AM
Hi,
The structure of i_vbrk_maktx should have all the required fields.
regards,
kavitha
01-07-2008 9:39 AM
Hi,
Do like this
Types: Begin of ty_MAKT,
matnr type makt-matnr,
maktx type makt-maktx,
end of ty_makt.
Data: I_MAKT type table of ty_makt,
wa_makt type ty_makt.
SELECT MAKTX FROM MAKT
INTO I_MAKT
FOR ALL ENTRIES IN I_VBRK
WHERE MATNR = I_VBRK-MATNR.
Sort I_MAKT by matnr.
In the loop of I_VBRK,
READ TABLE I_MAKT into WA_MAKT with key matnr = i_VBRK-matnr binary search.
if sy-subrc = 0.
move wa_makt-maktx to itab-maktx.
append itab.
clear itab.
endif.
Regards,
Satish
01-07-2008 9:44 AM
hi,
Dont keep the select statement in the loop it is the performance issue.
so select maktx into one internal table according to the material
then keep the loop to first internal table and use modify key word to modify the interanl table itself.
modify internal table index sy-tabix from work area trasporting maktx.
modify should be inside the loop.
01-07-2008 9:44 AM
Hi friend, make sure that your internal table has required fields. and use " into corresponding fields of" . It solves ur problem
01-07-2008 10:08 AM
Hi Pavan,
Just try by modifying your query as follows:
SELECT MAKTX FROM MAKT
INTO CORRESPONDING FIELDS OF I_VBRK-MAKTX
FOR ALL ENTRIES IN I_VBRK
WHERE MATNR = I_VBRK-MATNR.
This clause will checks the internal table for a similar field type as that of the selected field and updates only that field.
Hence your problem will be solved.
Reward if useful.
Regards,
Shiny
01-08-2008 9:54 AM