2006 Jan 25 10:22 AM
Hi experts,
Iam trying to get the details form MKPF & MSEG and passing into T_INS internal table.Here i dont want to get the documents which are reversed(SMBLN).How can i do that?
What is the better approach?
SELECT * INTO TABLE T_MKPF FROM MKPF
WHERE VGART EQ 'WF' AND
XBLNR = P_XBLNM.
SELECT * INTO TABLE T_MSEG FROM MSEG
FOR ALL ENTRIES IN T_MKPF
WHERE MBLNR = T_MKPF-MBLNR
AND MJAHR = T_MKPF-MJAHR
AND BWART = '101'
AND INSMK = 'X'.
LOOP AT T_MSEG.
MOVE-CORRESPONDING T_MSEG TO T_INS.
APPEND T_INS.
CLEAR T_INS.
ENDLOOP.
Hi experts,
Iam trying to get the details form MKPF & MSEG and passing into T_INS internal table.Here i dont want to get the documents which are reversed(SMBLN).How can i do that?
What is the better approach?
SELECT * INTO TABLE T_MKPF FROM MKPF
WHERE VGART EQ 'WF' AND
XBLNR = P_XBLNM.
SELECT * INTO TABLE T_MSEG FROM MSEG
FOR ALL ENTRIES IN T_MKPF
WHERE MBLNR = T_MKPF-MBLNR
AND MJAHR = T_MKPF-MJAHR
AND BWART = '101'
AND INSMK = 'X'.
LOOP AT T_MSEG.
MOVE-CORRESPONDING T_MSEG TO T_INS.
APPEND T_INS.
CLEAR T_INS.
ENDLOOP.
2006 Jan 25 10:31 AM
Hi
SELECT * INTO TABLE T_MKPF FROM MKPF
WHERE VGART EQ 'WF' AND
XBLNR = P_XBLNM.
SELECT * INTO TABLE T_MSEG FROM MSEG
WHERE AND BWART = '101'
AND INSMK = 'X'.
sort t_mseg by mblnr mjahr
loop at t_mkpf.
clear t_mseg.
read table t_mseg with key MBLNR = T_MKPF-MBLNR
MJAHR = T_MKPF-MJAHR
SMBLN NE SPACE
Binary search.
MOVE-CORRESPONDING T_MSEG TO T_INS
APPEND T_INS.
CLEAR T_INS.
endloop
Message was edited by: Harikishore Sreenivasulu
2006 Jan 25 10:41 AM
Hi Kaki,
SELECT *
INTO TABLE T_MKPF
FROM MKPF
WHERE VGART EQ 'WF'
AND XBLNR = P_XBLNM.
<b>if sy-subrc = 0.</b>
SELECT *
INTO TABLE T_MSEG
FROM MSEG
FOR ALL ENTRIES IN T_MKPF
WHERE MBLNR = T_MKPF-MBLNR
AND MJAHR = T_MKPF-MJAHR
AND BWART = '101'
AND INSMK = 'X'.
LOOP AT T_MSEG.
MOVE-CORRESPONDING T_MSEG TO T_INS.
APPEND T_INS.
CLEAR T_INS.
ENDLOOP.
<b>ENDIF</b>.it's fine , is there any specific problem..
2006 Jan 25 10:32 AM
hI,
Check FOR smbln NE space.
For Ex.
SELECT * INTO TABLE T_MSEG FROM MSEG
FOR ALL ENTRIES IN T_MKPF
WHERE MBLNR = T_MKPF-MBLNR
AND MJAHR = T_MKPF-MJAHR
AND BWART = '101'
AND INSMK = 'X'
and smbln ne space.
2006 Jan 25 10:38 AM
Hi, please try this..
SELECT * INTO TABLE T_INS
from MSEG as a
inner join mkpf as b
on amblnr = bmblnr
and amjahr = bmjahr
WHERE VGART EQ 'WF' AND
XBLNR = P_XBLNM
AND BWART = '101'
AND INSMK = 'X'.
Table T_INS should have same row sequence as in mseg . Or else, you have to specify fields in particular instead of the whole table. Performance-wise, that will be faster.
cheers
2006 Jan 25 11:34 AM
You can incorporate the last loop
LOOP AT T_MSEG.
MOVE-CORRESPONDING T_MSEG TO T_INS.
APPEND T_INS.
CLEAR T_INS.
ENDLOOP.
into the second select statement by using INTO CORRESPONDING FIELDS OF.
This way u will not require the tmp table T_MSEG and will also save the looping time for T_MSEG table.
regards,
Sumeet Mishra
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |