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: 

Issue related For All Entries

Former Member
0 Kudos

H, I have to pick up BELNR by passing  MSEG-LFBNR using for all entries to RSEG-LFBNR . I am getting only 1 BELNR because of for all entries. But I want more than 1 BELNR. Can anyone suggest me solution to this problem? Thanks in advance.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

hi ,

check your where clause ,i think bcos of year field u might missing the data.

17 REPLIES 17

Former Member
0 Kudos

Hi Kalpana

without using for all entries, u can use the select statement inside the loop to get multiple belnr

types: begin of t_belnr,

          belnr type mseg-belnr,

          end of t_belnr.

data: i_belnr type table of t_belnr.

loop at rseg.

  select belnr from mseg into table i_belnr where lfbnr eq rseg-lfbnr

endloop.

Hope it helps...

Regards

Suganya

Former Member
0 Kudos

check your select query and table values.

i think you can pass

MSEG-LFBNR

MSEG-LFBJA

MSEG-LFPOS  

to

RSEG-BELNR

RSEG-GJAHR

RSEG-BUZEI

Former Member
0 Kudos

hi ,

check your where clause ,i think bcos of year field u might missing the data.

Former Member
0 Kudos

Hi Kalpana,

First check how many values are there in the internal table before doing for all entries. Please share the code. Debugger would be the best person to help you although.

Regards

Purnand

former_member205060
Active Participant
0 Kudos

Did you included item "zelie " in your selection. Check by adding the same.

Former Member
0 Kudos

SELECT *

        FROM msge

        INTO TABLE it_mseg.

  

IF sy-subec = 0.

   SELECT *

          FROM rseg

          INTO TABLE it_resg

          FOR ALL ENTRIES IN it_mseg

          WHERE lfbnr = it_mseg-lfbnr.

ENDIF.

PeterJonker
Active Contributor
0 Kudos

Can you please post a snippet of the code with the for all entries statement ? Would be easier to help you.

0 Kudos

IF  it_mseg[] IS NOT INITIAL.
    SELECT   belnr gjahr buzei ebeln  lfbnr lfgja lfpos INTO CORRESPONDING FIELDS OF TABLE it_rseg FROM rseg   FOR ALL ENTRIES IN it_mseg
    WHERE lfgja EQ it_mseg-lfbja AND  lfbnr EQ it_mseg-lfbnr AND lfpos EQ it_mseg-lfpos.
ENDIF.

By using this code I am getting only 1 belnr gjahr buzei ebeln against lfbnr lfpos lfbja.

If it has more than 1 ebeln against 1 lfbnr, it was retreiving only 1 ebeln. But I want more than 1 ebeln against 1 lfbnr.

0 Kudos

Hi Kalpana,

Can you pleaase paste a snapshot of the data available at runtime.

Thanks,

Ankit.

0 Kudos

Hi Kalpana,

First you need to pass the same data in SE16n and find the result.


Try by changing the where clause.

WHERE lfgja EQ it_mseg-lfbja AND  lfbnr EQ it_mseg-lfbnr.


I think you need to follow this Link MSEG->EKBE->RSEG->RBKP->BKPF


Message was edited by: RAHUL SINGH

Former Member
0 Kudos

Dear Kalpana,

Please post the code lines, so that we can guide you better.

Regards,

Prameet Gopal Verma

Former Member
0 Kudos

Hi kalpana,

The for all entries and join select in SAP will delete the duplicate records in the results table so if you are selecting single field in the select you will get only single record.

In the select try adding non-unique fields like item no .

Regards,

Former Member
0 Kudos

Hi Kalpana,

Along with the for all entries which has where clause you need to include some more where condition in the where clause.

Below is the sample code:

DATA:

   T_SPFLI TYPE STANDARD TABLE OF SPFLI,

   WA_SPFLI TYPE SPFLI,

   T_SFLIGHT TYPE TABLE OF SFLIGHT.

SELECT *

   FROM SPFLI

   INTO TABLE T_SPFLI.

IF SY-SUBRC EQ 0.

   SELECT *

     FROM SFLIGHT

     INTO TABLE T_SFLIGHT

     FOR ALL ENTRIES IN T_SPFLI

     WHERE CARRID = T_SPFLI-CARRID AND

           CONNID = T_SPFLI-CONNID OR

           CARRID = 'AA'.

ENDIF.

sivaprasad_paruchuri
Active Participant
0 Kudos

if u need no of entries related to same BELNR select the line item field  in the table , then all records will come with for all entries.

Regards,

Siva Prasad.

Former Member
0 Kudos

Hi,

You have to fetch all the of primary keys fields of table RSEG as the for all entries deletes the duplicate values.

Types:  begin of ty_rseg,

            BELNR type BELNR_D,

            GJAHR type GJAHR,

             BUZEI type RBLGP,

            end of ty_rseg.

data: gt_rseg type standard table of ty_rseg.

select BELNR

          GJAHR

           BUZEI

           from rseg

           into table it_rseg

           for all entries in it_mseg

           where  BELNR = it_mseg-MBLNR.

Regards,

Suman

Former Member
0 Kudos

Thank u all for your suggestions. The problem has been solved.

0 Kudos

You must close your post with the solution if there is no supported answer for your query.