05-23-2013 10:30 AM
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.
05-23-2013 11:29 AM
hi ,
check your where clause ,i think bcos of year field u might missing the data.
05-23-2013 11:19 AM
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
05-23-2013 11:25 AM
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
05-23-2013 11:29 AM
hi ,
check your where clause ,i think bcos of year field u might missing the data.
05-23-2013 11:45 AM
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
05-23-2013 11:57 AM
Did you included item "zelie " in your selection. Check by adding the same.
05-23-2013 12:09 PM
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.
05-23-2013 12:09 PM
Can you please post a snippet of the code with the for all entries statement ? Would be easier to help you.
05-23-2013 12:34 PM
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.
05-23-2013 7:04 PM
Hi Kalpana,
Can you pleaase paste a snapshot of the data available at runtime.
Thanks,
Ankit.
05-24-2013 6:39 AM
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
05-23-2013 12:50 PM
Dear Kalpana,
Please post the code lines, so that we can guide you better.
Regards,
Prameet Gopal Verma
05-23-2013 1:03 PM
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,
05-24-2013 11:50 AM
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.
05-24-2013 11:55 AM
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.
05-24-2013 1:25 PM
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
05-25-2013 6:57 AM
05-29-2013 5:26 AM
You must close your post with the solution if there is no supported answer for your query.