Skip to Content
author's profile photo Former Member
Former Member

ABAP Query SQ01

Hello , In Abap Query Sq01, need to add 2 fields in the output (Goods Receipt (MSEG-WEMPF) and Name( ?) ) . These 2 fields taken from MIGO Transection. In the Query, there was 3 tables has been used previously EKKO,EKPO EKKN. How to fetch the field WEMPF from MSEG, because we do not find relation of MSEG with all these 3 table. Thanks Sankil

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Nov 18, 2015 at 09:40 AM

    Hi Sankil,

    Instead of touching MSEG table, I would recommend you to use EKKO, EKPO and EKBE tables.

    If EKBE-VGABE = '1' then it is goods receipt and if EKBE-VGABE = '2' then it is invoice receipt.

    I will provide you a sample Query.

    SELECT EBELN

    LOEKZ

    ERNAM

    LIFNR

    EKGRP

    BEDAT FROM EKKO INTO TABLE GT_EKKO

    WHERE EBELN IN S_EBELN AND

    LIFNR IN S_LIFNR AND

    BEDAT IN S_BEDAT AND

    LOEKZ EQ ' '.

    IF GT_EKKO IS NOT INITIAL.

    SELECT EBELN

    EBELP

    LOEKZ

    TXZ01

    WERKS

    MENGE

    MEINS

    BPRME

    NETPR

    NETWR

    BRTWR

    PSTYP FROM EKPO INTO TABLE GT_EKPO

    FOR ALL ENTRIES IN GT_EKKO

    WHERE EBELN = GT_EKKO-EBELN AND

    LOEKZ EQ ' '.

    IF GT_EKPO IS NOT INITIAL.

    SELECT EBELN

    EBELP

    VGABE

    MENGE

    WRBTR

    SHKZG

    BLDAT FROM EKBE INTO TABLE GT_EKBE

    FOR ALL ENTRIES IN GT_EKPO

    WHERE EBELN = GT_EKPO-EBELN

    AND EBELP = GT_EKPO-EBELP.

    ENDIF.

    SELECT LIFNR

    NAME1 FROM LFA1 INTO TABLE GT_LFA1

    FOR ALL ENTRIES IN GT_EKKO

    WHERE LIFNR = GT_EKKO-LIFNR.

    ENDIF.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Nov 18, 2015 at 10:19 AM

    Read first 191492 - Performance: Customer developments in MM/WM

    2.Access to material documents

    a) via the purchase order number
    Incorrect:

    • SELECT FROM MSEG WHERE EBELN = … and EBELP = ...

    Correct:

    • SELECT FROM EKBE WHERE EBELN = .. AND EBELP = ... AND VGABE IN (1,6,7,8,9).
    • SELECT FROM MSEG WHERE MBLNR = EKBE-BELNR AND MJAHR = EKBE-GJAHR AND ZEILE = EKBE-BUZEI.

    Regards,

    Raymond

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.