hi all
i am stuck at one point i am selecting values from vbrk ainto one internal table and then putting loop on Internal table. and then i have to match the vbeln from bseg table with internal table value. but it taking long time more then 10 min. plz help i am attaching the code also..
SELECT vkorg kunag fkart vbeln erdat netwr FROM vbrk INTO TABLE t_itab
WHERE vkorg IN s_vkorg
AND kunag IN s_kunag
AND fkart IN s_fkart
AND erdat IN s_erdat.
CHECK sy-subrc EQ 0.
LOOP AT t_itab.
SELECT vbeln FROM bseg INTO table t_bseg
WHERE vbeln eq t_itab-vbeln
AND bschl EQ '01'
AND augbl EQ ''.
CHECK sy-subrc EQ 0.
loop at t_bseg.
MOVE: t_itab-kunag TO t_final-kunag,
t_itab-fkart TO t_final-fkart,
bseg-vbeln TO t_final-vbeln,
t_itab-erdat TO t_final-erdat,
t_itab-netwr TO t_final-netwr.
APPEND t_final.
*check sy-subrc eq 0.
SELECT SINGLE name1 FROM kna1 INTO t_final-name1
WHERE kunnr = t_final-kunag.
APPEND t_final.
i hope i am clear what i have to do...
i have to get data from vbrk and then i have to match vbrk-vbeln by bseg vbeln for exsisting document no.
plz help me
its urgent
thanks in advance
HI,
First check t_itab for vbeln..if sy-subrc ne 0..then delete that records.
endloop.
next iteration.
fill up directly from t_itab to t_final..here vblen available because now it has the values which were there in bseg.
Y do u need t_bseg?
Hope u r clear
Message was edited by: raja gurrala
Hi Parul,
Change your code like this...
1.SELECT vkorg kunag fkart vbeln erdat netwr FROM vbrk INTO TABLE t_itab
WHERE vkorg IN s_vkorg
AND kunag IN s_kunag
AND fkart IN s_fkart
AND erdat IN s_erdat.
2. SELECT vbeln FROM bseg for all entries in t_itab
INTO table t_bseg
WHERE vbeln eq t_itab-vbeln
AND bschl EQ '01'
AND augbl EQ ''.
3. SELECT SINGLE name1 FROM kna1 for all entries in t_itab
INTO t_final-name1
WHERE kunnr = t_itab-kunag.
<b>Sorry, select the name1 values into another internal table...</b>
now sort these internal tables on the key fields, and then loop at t_itab, read the other two internal tables and populate your final internal table.
Regards,
Raj
Message was edited by: Rajasekhar Dinavahi
Hi parul,
can you access another tables insted of BSEG.
In the BSID, BSAD, BSIK, BSAK... there very similar information of bseg but divided by vendor, customer,....
it can help you.
Can you some filed like bukrs and gjahr to access before the bkpf and after the bseg?
bye
enzo
Hi Parul,
Please avoid writing joins on BSEG...not advisable.
declare your t_bseg as
data: begin of t_bseg,
vbeln like bseg-vbeln,
end of t_bseg.
You can try the alternate way of accessing other tables like BSIK etc...but never write joins on BSEG.
Check this code....
******
REPORT Z_TESTRAJ
NO STANDARD PAGE HEADING
LINE-SIZE 200
MESSAGE-ID ZZ.
TYPES: BEGIN OF X_VBRK,
VKORG TYPE VKORG,
KUNAG TYPE KUNAG,
FKART TYPE FKART,
VBELN TYPE VBELN_VF,
ERDAT TYPE ERDAT,
NETWR TYPE NETWR,
END OF X_VBRK.
TYPES: BEGIN OF X_BSEG,
VBELN TYPE VBELN_VF,
END OF X_BSEG.
TYPES: BEGIN OF X_KNA1,
KUNNR TYPE KUNNR,
NAME1 TYPE NAME1,
END OF X_KNA1.
DATA: T_ITAB TYPE STANDARD TABLE OF X_VBRK WITH HEADER LINE,
T_BSEG TYPE STANDARD TABLE OF X_BSEG WITH HEADER LINE,
T_KNA1 TYPE STANDARD TABLE OF X_KNA1 WITH HEADER LINE.
START-OF-SELECTION.
SELECT VKORG KUNAG FKART VBELN ERDAT NETWR FROM VBRK INTO TABLE T_ITAB.
IF SY-SUBRC = 0.
SELECT VBELN INTO TABLE T_BSEG
FROM BSEG FOR ALL ENTRIES IN T_ITAB
WHERE VBELN EQ T_ITAB-VBELN
AND BSCHL EQ '01'
AND AUGBL EQ ''.
SELECT NAME1 INTO TABLE T_KNA1 FROM KNA1 FOR ALL ENTRIES IN T_ITAB
WHERE KUNNR = T_ITAB-KUNAG.
ENDIF.
******
Regards,
Raj
Message was edited by: Rajasekhar Dinavahi
Add a comment