Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with FOR ALL ENTRIES

Former Member
0 Kudos

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

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Use INTO CORRESPONDING FIELDS OF I_VBRK

awrd points if useful

bhupal

8 REPLIES 8

Former Member
0 Kudos

Hi Use INTO CORRESPONDING FIELDS OF I_VBRK

awrd points if useful

bhupal

Former Member
0 Kudos

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

Former Member
0 Kudos

Hi,

The structure of i_vbrk_maktx should have all the required fields.

regards,

kavitha

Former Member
0 Kudos

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

Former Member
0 Kudos

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.

Former Member
0 Kudos

Hi friend, make sure that your internal table has required fields. and use " into corresponding fields of" . It solves ur problem

Former Member
0 Kudos

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

Former Member
0 Kudos

Answered...

Thanks....