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

table join

hello experts,

i am working on report.

the problem is i want to join ekpo and likp/lips tables together.....

how it will be connected..

any suggestion????

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

5 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jul 04, 2007 at 11:19 AM

    i think lips has fields VGBEL & VGPOS that correspond to vbeln & posnr of ekpo or vbpa.

    please check if it works.

    Reward if useful.

    Message was edited by:

    Mayank Agarwal

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 04, 2007 at 11:23 AM

    u can also fetch the details from VBFA table.

    Fetch this table with the following keys-

    preceding document number will be vbeln

    preceding document type will be type of purchase order

    succeding document type will be type of Delivery.

    Try if it works.

    Reward points if helpful

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 04, 2007 at 11:23 AM

    hi

    just refer to these

    <b>LIPS( SO: Delv Item )</b>

    VBELN Delivery

    POSNR Delivery Item

    PSTYV Delivery Item Catg

    WERKS Plant

    LGORT Storage Location

    VRKME Sales Unit

    VKBUR Sales Office

    VKGRP Sales Group

    VTWEG Distribution channel

    <b>

    LIKP ( SO: Delv Header )</b>

    VBELN Delivery

    ERNAM Person Who Created

    ERZET Entry Time

    ERDAT Record creation date

    BZIRK Sales District

    VKORG Sales Organization

    LFART Delivery Type

    VSBED Shipping Condn

    KUNNR Ship to Party

    KUNAG Sold to Party

    KDGRP Customer Group

    <b>EKPO( PO: Item )</b>

    EBELN Purchasing Doc No

    EBELP Item No of Pur Doc

    STATU Status of Pur. Doc

    MATNR Material Number

    EMATN Material Number

    LGORT Storage Location

    MATKL Material Group

    MEINS Order Quantity

    MENGE Pur Order Quantity

    BURKS Company Code

    SPART Division

    KDAUF Sales Order No.

    they will help u making a join.

    regards

    ravish

    <b>plz dont forget to reward points if helpful</b>

    Message was edited by:

    ravish goyal

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 04, 2007 at 11:24 AM

    chk out this example

    SELECT EKKOEBELN EKPOWERKS EKPOLGORT EKPOMENGE EKPOMEINS EKPOMATNR EKPOTXZ01 EKKOAEDAT EKKO~KNUMV

    LIPSVBELN LIPSERNAM LIPSERDAT LIPSWERKS

    INTO TABLE T_STOF

    FROM EKKO

    INNER JOIN EKPO

    ON EKKOEBELN EQ EKPOEBELN

    INNER JOIN LIPS

    ON EKPOEBELN EQ LIPSVGBEL

    AND EKPOEBELP EQ LIPSVGPOS

    WHERE EKKO~EBELN IN S_EBELN

    AND EKPO~WERKS IN S_WERKD

    AND EKPO~LGORT IN S_LGORT

    AND EKPO~MATNR IN S_MATNR

    AND EKKO~BSART = 'UB'

    AND EKPO~LOEKZ = ' '

    AND LIPS~VBELN IN S_VBELN

    AND LIPS~ERNAM IN S_ERNAM

    AND LIPS~ERDAT In S_ERDAT

    AND LIPS~WERKS IN S_WERKS.

    reward points if useful

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 04, 2007 at 11:31 AM

    Here is the program for linking of all 3 tables in alv ...

    REPORT Z_LIST_MATERIALS.
    
    TYPE-POOLS: SLIS.
    TABLES:MARC, MARD, VBAP, LIPS, EKPO, VBFA, EKBE, MARM, VBBE, MARA, MBEW.
    
    SELECTION-SCREEN BEGIN OF BLOCK SEL WITH FRAME TITLE TEXT-001.
    SELECT-OPTIONS: S_WERKS FOR MARC-WERKS, " Plant
                   S_MATNR FOR MARC-MATNR, " Material
                   S_MTART FOR MARA-MTART. " Material Type SELECTION-SCREEN END OF BLOCK SEL.
    PARAMETERS: P_VARI LIKE DISVARIANT-VARIANT. " ALV Variant
    
    CONSTANTS: FORMNAME_TOP_OF_PAGE TYPE SLIS_FORMNAME VALUE 'TOP_OF_PAGE'.
    
    DATA: BEGIN OF INV OCCURS 100,
           WERKS LIKE MARD-WERKS, " Plant
           MATNR LIKE MARD-MATNR, " Material
           MTART LIKE MARA-MTART, " Material Type
           STPRS LIKE MBEW-STPRS, " Standard Price
           AVAIL LIKE MARD-LABST, " Available
           LABST LIKE MARD-LABST, " Unrestricted use
           INSME LIKE MARD-INSME, " Quality Inspection
           RETME LIKE MARD-RETME, " Returns
           TRANS LIKE MARC-UMLMC, " Stock in transit (calculated)
           UMLMC LIKE MARC-UMLMC, " Stock Transfer (plant)
           UMLME LIKE MARD-UMLME, " Transfer (SLoc)
           WESBS LIKE EKBE-WESBS, " GR Blocked Stock
           TRAME LIKE MARC-TRAME, " Stock in transit
           SPEME LIKE MARD-SPEME, " Blocked
           KWMENG LIKE VBAP-KWMENG, " Sales orders
           LFIMG LIKE LIPS-LFIMG, " Scheduled for Delivery
           MENGE LIKE EKPO-MENGE, " Open Purch. Orders
           VALUE LIKE MBEW-SALK3, " Stock Value (Calculated)
           MEINS LIKE MARA-MEINS, " Unit of measure
         END OF INV.
    
    DATA: FIELDTAB TYPE SLIS_T_FIELDCAT_ALV,
         HEADING  TYPE SLIS_T_LISTHEADER,
         LAYOUT   TYPE SLIS_LAYOUT_ALV,
         EVENTS   TYPE SLIS_T_EVENT,
         REPNAME  LIKE SY-REPID,
         F2CODE   LIKE SY-UCOMM VALUE  '&ETA',
         G_SAVE(1) TYPE C,
         G_EXIT(1) TYPE C,
         G_VARIANT LIKE DISVARIANT,
         GX_VARIANT LIKE DISVARIANT.
    
    INITIALIZATION.
     REPNAME = SY-REPID.
     PERFORM INITIALIZE_FIELDCAT USING FIELDTAB[].
     PERFORM BUILD_EVENTTAB USING EVENTS[].
     PERFORM BUILD_COMMENT USING HEADING[].
     PERFORM INITIALIZE_VARIANT.
    
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_VARI.
     PERFORM F4_FOR_VARIANT.
    
    AT SELECTION-SCREEN.
     PERFORM PAI_OF_SELECTION_SCREEN.
    
    START-OF-SELECTION.
     PERFORM GET_MARD.
     PERFORM GET_UNIT_OF_MEASURE.
     PERFORM GET_MARC.
     PERFORM GET_EKPO.
     PERFORM GET_LIPS.
     PERFORM GET_VBAP.
     PERFORM GET_OPEN.
     PERFORM GET_PRICE.
    
    END-OF-SELECTION.
    
     PERFORM BUILD_LAYOUT USING LAYOUT.
     PERFORM WRITE_OUTPUT.
    
    
    *&---------------------------------------------------------------------*
    *&      Form  INITIALIZE_FIELDCAT
    *&---------------------------------------------------------------------*
    *       text
    *----------------------------------------------------------------------*
    *      -->P_FIELDTAB[]  text                                           *
    *----------------------------------------------------------------------*
    FORM INITIALIZE_FIELDCAT USING P_FIELDTAB TYPE SLIS_T_FIELDCAT_ALV.
     DATA: L_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
    * fixed columns (obligatory)
     CLEAR L_FIELDCAT.
     L_FIELDCAT-TABNAME    = 'INV'.
     L_FIELDCAT-FIX_COLUMN = 'X'.
     L_FIELDCAT-NO_OUT     = 'O'.
     L_FIELDCAT-FIELDNAME  = 'WERKS'.
     APPEND L_FIELDCAT TO P_FIELDTAB.
     L_FIELDCAT-FIELDNAME  = 'MATNR'.
     APPEND L_FIELDCAT TO P_FIELDTAB.
    
    * totalized columns
     CLEAR L_FIELDCAT.
     L_FIELDCAT-TABNAME   = 'INV'.
     L_FIELDCAT-SP_GROUP  = 'A'.
     L_FIELDCAT-DO_SUM    = 'X'.
     L_FIELDCAT-FIELDNAME = 'LABST'.
     APPEND L_FIELDCAT TO P_FIELDTAB.
     L_FIELDCAT-FIELDNAME = 'INSME'.
     APPEND L_FIELDCAT TO P_FIELDTAB.
     L_FIELDCAT-FIELDNAME = 'RETME'.
     APPEND L_FIELDCAT TO P_FIELDTAB.
     L_FIELDCAT-FIELDNAME = 'UMLME'.
     APPEND L_FIELDCAT TO P_FIELDTAB.
     L_FIELDCAT-FIELDNAME = 'WESBS'.
     APPEND L_FIELDCAT TO P_FIELDTAB.
     L_FIELDCAT-FIELDNAME = 'SPEME'.
     APPEND L_FIELDCAT TO P_FIELDTAB.
    * columns with different description
     L_FIELDCAT-FIELDNAME = 'KWMENG'.
     L_FIELDCAT-SELTEXT_M = 'Sales Orders'.
     L_FIELDCAT-SELTEXT_S = 'Sales Or'.
     L_FIELDCAT-SELTEXT_L = 'Sales Orders Qty'.
     APPEND L_FIELDCAT TO P_FIELDTAB.
     L_FIELDCAT-FIELDNAME = 'LFIMG'.
     L_FIELDCAT-SELTEXT_M = 'Sched. Delivery'.
     L_FIELDCAT-SELTEXT_S = 'Schd. Del'.
     L_FIELDCAT-SELTEXT_L = 'Scheduled for Delivery'.
     APPEND L_FIELDCAT TO P_FIELDTAB.
     L_FIELDCAT-FIELDNAME = 'TRANS'.
     L_FIELDCAT-SELTEXT_M = 'Stk. in transit'.
     L_FIELDCAT-SELTEXT_S = 'Stk. trns'.
     L_FIELDCAT-SELTEXT_L = 'Stock in transit (sum)'.
     APPEND L_FIELDCAT TO P_FIELDTAB.
     L_FIELDCAT-FIELDNAME = 'AVAIL'.
     L_FIELDCAT-SELTEXT_M = 'Available'.
     L_FIELDCAT-SELTEXT_S = 'Avail.'.
     L_FIELDCAT-SELTEXT_L = 'Stock Available'.
     APPEND L_FIELDCAT TO P_FIELDTAB.
     L_FIELDCAT-FIELDNAME = 'MENGE'.
     L_FIELDCAT-SELTEXT_M = 'Open Orders'.
     L_FIELDCAT-SELTEXT_S = 'Open Ord'.
     L_FIELDCAT-SELTEXT_L = 'Open Purchase Orders'.
     APPEND L_FIELDCAT TO P_FIELDTAB.
    
    * columns not displayed
     CLEAR L_FIELDCAT.
     L_FIELDCAT-TABNAME   = 'INV'.
     L_FIELDCAT-SP_GROUP  = 'A'.
     L_FIELDCAT-NO_OUT    = 'X'.
     L_FIELDCAT-FIELDNAME = 'MEINS'.
     APPEND L_FIELDCAT TO P_FIELDTAB.
     L_FIELDCAT-FIELDNAME = 'UMLMC'.
     APPEND L_FIELDCAT TO P_FIELDTAB.
     L_FIELDCAT-FIELDNAME = 'TRAME'.
     APPEND L_FIELDCAT TO P_FIELDTAB.
     L_FIELDCAT-FIELDNAME = 'STPRS'.
     APPEND L_FIELDCAT TO P_FIELDTAB.
     L_FIELDCAT-FIELDNAME = 'VALUE'.
     APPEND L_FIELDCAT TO P_FIELDTAB.
    ENDFORM.                               " INITIALIZE_FIELDCAT
    
    *&---------------------------------------------------------------------*
    *&      Form  BUILD_EVENTTAB
    *&---------------------------------------------------------------------*
    *       text
    *----------------------------------------------------------------------*
    *      -->P_EVENTS[]  text                                             *
    *----------------------------------------------------------------------*
    FORM BUILD_EVENTTAB USING P_EVENTS TYPE SLIS_T_EVENT.
     DATA: LS_EVENT TYPE SLIS_ALV_EVENT.
     CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
          EXPORTING
               I_LIST_TYPE = 0
          IMPORTING
               ET_EVENTS   = P_EVENTS.
     READ TABLE P_EVENTS WITH KEY NAME = SLIS_EV_TOP_OF_PAGE
                              INTO LS_EVENT.
     IF SY-SUBRC = 0.
       MOVE FORMNAME_TOP_OF_PAGE TO LS_EVENT-FORM.
       APPEND LS_EVENT TO P_EVENTS.
     ENDIF.
    ENDFORM.                               " BUILD_EVENTTAB
    
    *&---------------------------------------------------------------------*
    *&      Form  BUILD_COMMENT
    *&---------------------------------------------------------------------*
    *       text
    *----------------------------------------------------------------------*
    *      -->P_HEADING[]  text                                            *
    *----------------------------------------------------------------------*
    FORM BUILD_COMMENT USING P_HEADING TYPE SLIS_T_LISTHEADER.
     DATA: HLINE TYPE SLIS_LISTHEADER,
           TEXT(60) TYPE C,
           SEP(20) TYPE C.
     CLEAR: HLINE, TEXT.
     HLINE-TYP  = 'H'.
     WRITE: TEXT-101 TO TEXT+23.
     HLINE-INFO = TEXT.
     APPEND HLINE TO P_HEADING.
     CLEAR TEXT.
     WRITE: 'User: ' TO TEXT,
            SY-UNAME TO TEXT+6,
            'Date: ' TO TEXT+25,
            SY-DATUM TO TEXT+31,
            'Page: ' TO TEXT+50,
            SY-PAGNO TO TEXT+56.
     HLINE-INFO = TEXT.
     APPEND HLINE TO P_HEADING.
    
    
    
    ENDFORM.                    " BUILD_COMMENT
    
    *---------------------------------------------------------------------*
    *       FORM TOP_OF_PAGE                                              *
    *---------------------------------------------------------------------*
    *       ........                                                      *
    *---------------------------------------------------------------------*
    FORM TOP_OF_PAGE.
     CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
          EXPORTING
               IT_LIST_COMMENTARY = HEADING.
    ENDFORM.
    *&---------------------------------------------------------------------*
    *&      Form  INITIALIZE_VARIANT
    *&---------------------------------------------------------------------*
    *       text
    *----------------------------------------------------------------------*
    FORM INITIALIZE_VARIANT.
     G_SAVE = 'A'.
     CLEAR G_VARIANT.
     G_VARIANT-REPORT = REPNAME.
     GX_VARIANT = G_VARIANT.
     CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
          EXPORTING
               I_SAVE     = G_SAVE
          CHANGING
               CS_VARIANT = GX_VARIANT
          EXCEPTIONS
               NOT_FOUND  = 2.
     IF SY-SUBRC = 0.
       P_VARI = GX_VARIANT-VARIANT.
     ENDIF.
    ENDFORM.                               " INITIALIZE_VARIANT
    
    *&---------------------------------------------------------------------*
    *&      Form  F4_FOR_VARIANT
    *&---------------------------------------------------------------------*
    *       text
    *----------------------------------------------------------------------*
    FORM F4_FOR_VARIANT.
     CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
          EXPORTING
               IS_VARIANT = G_VARIANT
               I_SAVE     = G_SAVE
          IMPORTING
               E_EXIT     = G_EXIT
               ES_VARIANT = GX_VARIANT
          EXCEPTIONS
               NOT_FOUND  = 2.
     IF SY-SUBRC = 2.
       MESSAGE ID SY-MSGID TYPE 'S'      NUMBER SY-MSGNO
               WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
     ELSE.
       IF G_EXIT = SPACE.
         P_VARI = GX_VARIANT-VARIANT.
       ENDIF.
     ENDIF.
    ENDFORM.                               " F4_FOR_VARIANT
    
    *&---------------------------------------------------------------------*
    *&      Form  PAI_OF_SELECTION_SCREEN
    *&---------------------------------------------------------------------*
    *       text
    *----------------------------------------------------------------------*
    FORM PAI_OF_SELECTION_SCREEN.
    *
     IF NOT P_VARI IS INITIAL.
       MOVE G_VARIANT TO GX_VARIANT.
       MOVE P_VARI TO GX_VARIANT-VARIANT.
       CALL FUNCTION 'REUSE_ALV_VARIANT_EXISTENCE'
            EXPORTING
                 I_SAVE     = G_SAVE
            CHANGING
                 CS_VARIANT = GX_VARIANT.
       G_VARIANT = GX_VARIANT.
     ELSE.
       PERFORM INITIALIZE_VARIANT.
     ENDIF.
    ENDFORM.                               " PAI_OF_SELECTION_SCREEN
    
    
    *&---------------------------------------------------------------------*
    *&      Form  GET_MARD
    *&---------------------------------------------------------------------*
    *       text
    *----------------------------------------------------------------------*
    FORM GET_MARD.
     SELECT MATNR WERKS LABST INSME RETME UMLME SPEME
            FROM MARD
            INTO CORRESPONDING FIELDS OF INV
            WHERE MATNR IN S_MATNR
            AND   WERKS IN S_WERKS.
       COLLECT INV.
     ENDSELECT.
     PERFORM FILTER_BY_MATERIAL_TYPE.
    ENDFORM.                               " GET_MARD
    
    *&---------------------------------------------------------------------*
    *&      Form  FILTER_BY_MATERIAL_TYPE
    *&---------------------------------------------------------------------*
    *       text
    *----------------------------------------------------------------------*
    FORM FILTER_BY_MATERIAL_TYPE.
     LOOP AT INV.
       CLEAR INV-MTART.
       SELECT SINGLE MTART
              INTO INV-MTART
              FROM MARA
              WHERE MATNR EQ INV-MATNR
              AND   MTART IN S_MTART.
       IF SY-SUBRC EQ 0.
         MODIFY INV.
       ELSE.
         DELETE INV.
       ENDIF.
     ENDLOOP.
    ENDFORM.                    " FILTER_BY_MATERIAL_TYPE
    
    *&---------------------------------------------------------------------*
    *&      Form  GET_MARC
    *&---------------------------------------------------------------------*
    *       text
    *----------------------------------------------------------------------*
    FORM GET_MARC.
     LOOP AT INV.
       SELECT SINGLE UMLMC TRAME
              FROM MARC
              INTO CORRESPONDING FIELDS OF INV
              WHERE MATNR EQ INV-MATNR
              AND   WERKS EQ INV-WERKS.
       IF SY-SUBRC EQ 0.
         INV-TRANS = INV-UMLMC + INV-TRAME.
         MODIFY INV.
       ENDIF.
     ENDLOOP.
    ENDFORM.                               " GET_MARC
    *&---------------------------------------------------------------------*
    *&      Form  GET_EKPO
    *&---------------------------------------------------------------------*
    *       text
    *----------------------------------------------------------------------*
    FORM GET_EKPO.
     DATA: WESBS LIKE INV-WESBS,
           SHKZG LIKE EKBE-SHKZG,
           MEINS LIKE EKPO-MEINS,
           LMEIN LIKE EKPO-LMEIN.
     LOOP AT INV.
       CLEAR: WESBS, SHKZG, MEINS, LMEIN.
       SELECT YWESBS YSHKZG XMEINS XLMEIN
              INTO (WESBS, SHKZG, MEINS, LMEIN)
              FROM EKPO AS X JOIN EKBE AS Y
              ON   XEBELN = YEBELN
              AND  XEBELP = YEBELP
              WHERE XMATNR EQ INV-MATNR
              AND   XWERKS EQ INV-WERKS
              AND   XLOEKZ NE 'L'.
         IF SHKZG EQ 'H'.
           MULTIPLY WESBS BY -1.
         ENDIF.
         IF MEINS NE LMEIN.
           PERFORM CONVERT_UNIT_OF_MEASURE CHANGING INV-MATNR MEINS WESBS.
         ENDIF.
         ADD WESBS TO INV-WESBS.
       ENDSELECT.
       MODIFY INV.
     ENDLOOP.
    ENDFORM.                               " GET_EKPO
    *&---------------------------------------------------------------------*
    *&      Form  GET_LIPS
    *&---------------------------------------------------------------------*
    *       text
    *----------------------------------------------------------------------*
    FORM GET_LIPS.
     DATA: LFIMG LIKE INV-LFIMG.
     LOOP AT INV.
       CLEAR: LFIMG, INV-LFIMG.
       SELECT OMENG
              INTO LFIMG
              FROM VBBE
              WHERE MATNR EQ INV-MATNR
              AND   WERKS EQ INV-WERKS
              AND   VBTYP EQ 'J'.
         ADD LFIMG TO INV-LFIMG.
       ENDSELECT.
       MODIFY INV.
     ENDLOOP.
    ENDFORM.                               " GET_LIPS
    *&---------------------------------------------------------------------*
    *&      Form  GET_VBAP
    *&---------------------------------------------------------------------*
    *       text
    *----------------------------------------------------------------------*
    FORM GET_VBAP.
     DATA: KWMENG LIKE INV-KWMENG.
     LOOP AT INV.
       CLEAR: KWMENG, INV-KWMENG.
       SELECT OMENG
              INTO KWMENG
              FROM VBBE
              WHERE MATNR EQ INV-MATNR
              AND   WERKS EQ INV-WERKS
              AND   VBTYP EQ 'C'.
         ADD KWMENG TO INV-KWMENG.
       ENDSELECT.
       INV-AVAIL = INV-LABST - INV-INSME - INV-KWMENG - INV-LFIMG.
       MODIFY INV.
     ENDLOOP.
    ENDFORM.                               " GET_VBAP
    
    *&---------------------------------------------------------------------*
    *&      Form  GET_UNIT_OF_MEASURE
    *&---------------------------------------------------------------------*
    *       text
    *----------------------------------------------------------------------*
    *  -->  p1        text
    *  <--  p2        text
    *----------------------------------------------------------------------*
    FORM GET_UNIT_OF_MEASURE.
     LOOP AT INV.
       SELECT SINGLE MEINS
              FROM MARA
              INTO INV-MEINS
              WHERE MATNR EQ INV-MATNR.
       MODIFY INV.
     ENDLOOP.
    ENDFORM.                               " GET_UNIT_OF_MEASURE
    
    *&---------------------------------------------------------------------*
    *&      Form  GET_OPEN
    *&---------------------------------------------------------------------*
    *       text
    *----------------------------------------------------------------------*
    FORM GET_OPEN.
     DATA: BEGIN OF XTAB OCCURS 10,       " Open orders table
              WERKS LIKE EKPO-WERKS,
              LGORT LIKE EKPO-LGORT,
              MATNR LIKE EKPO-MATNR,
              MENGE LIKE EKPO-MENGE,
              MENGK LIKE EKPO-MENGE,
            END OF XTAB.
     RANGES: L_WERKS FOR MARD-WERKS.
    
     LOOP AT INV.
       REFRESH XTAB.
       CLEAR: XTAB, L_WERKS.
       MOVE INV-WERKS TO L_WERKS-LOW.
       CALL FUNCTION 'MB_ADD_PURCHASE_ORDER_QUANTITY'
            EXPORTING
                 X_MATNR = INV-MATNR
                 X_MEINS = INV-MEINS
                 X_ELIKZ = SPACE
                 X_LOEKZ = SPACE
            TABLES
                 XTAB    = XTAB
                 XWERKS  = L_WERKS.
       MOVE XTAB-MENGE TO INV-MENGE.
       MODIFY INV.
     ENDLOOP.
    ENDFORM.                               " GET_OPEN
    
    *&---------------------------------------------------------------------*
    *&      Form  GET_PRICE
    *&---------------------------------------------------------------------*
    *       text
    *----------------------------------------------------------------------*
    FORM GET_PRICE.
     LOOP AT INV.
       SELECT SINGLE STPRS
              FROM MBEW
              INTO INV-STPRS
              WHERE MATNR EQ INV-MATNR
              AND   BWKEY EQ INV-WERKS
              AND   BWTAR EQ SPACE.
         IF SY-SUBRC EQ 0.
           INV-VALUE = INV-STPRS *
                     ( INV-LABST + INV-INSME + INV-TRANS + INV-SPEME ).
           MODIFY INV.
         ENDIF.
     ENDLOOP.
    ENDFORM.                    " GET_PRICE
    
    *---------------------------------------------------------------------*
    *       FORM CONVERT_UNIT_OF_MEASURE                                  *
    *---------------------------------------------------------------------*
    *       text                                                          *
    *---------------------------------------------------------------------*
    *  -->  P_MATNR                                                       *
    *  -->  P_VRKME                                                       *
    *  -->  P_QUANT                                                       *
    *---------------------------------------------------------------------*
    FORM CONVERT_UNIT_OF_MEASURE USING P_MATNR P_VRKME P_QUANT.
     DATA: UMREZ LIKE MARM-UMREZ,
           UMREN LIKE MARM-UMREN.
     SELECT SINGLE UMREZ UMREN
            INTO (UMREZ, UMREN)
            FROM MARM
            WHERE MATNR EQ P_MATNR
            AND   MEINH EQ P_VRKME.
     IF SY-SUBRC EQ 0.
       COMPUTE P_QUANT = ( P_QUANT * UMREZ ) / UMREN.
     ENDIF.
    ENDFORM.
    
    *&---------------------------------------------------------------------*
    *&      Form  BUILD_LAYOUT
    *&---------------------------------------------------------------------*
    *       text
    *----------------------------------------------------------------------*
    *      -->P_LAYOUT  text                                               *
    *----------------------------------------------------------------------*
    FORM BUILD_LAYOUT USING P_LAYOUT TYPE SLIS_LAYOUT_ALV.
     P_LAYOUT-F2CODE       = F2CODE.
     P_LAYOUT-ZEBRA        = 'X'.
     P_LAYOUT-DETAIL_POPUP = 'X'.
    ENDFORM.                               " BUILD_LAYOUT
    
    *&---------------------------------------------------------------------*
    *&      Form  WRITE_OUTPUT
    *&---------------------------------------------------------------------*
    *       text
    *----------------------------------------------------------------------*
    FORM WRITE_OUTPUT.
     SORT INV BY WERKS MATNR.
     CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
          EXPORTING
               I_PROGRAM_NAME     = REPNAME
               I_INTERNAL_TABNAME = 'INV'
               I_INCLNAME         = REPNAME
          CHANGING
               CT_FIELDCAT        = FIELDTAB.
     IF SY-SUBRC <> 0.
       WRITE: 'SY-SUBRC: ', SY-SUBRC, 'REUSE_ALV_FIELDCATALOG_MERGE'.  ENDIF.  CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
          EXPORTING
               I_CALLBACK_PROGRAM = REPNAME
               I_STRUCTURE_NAME   = 'INV'
               IS_LAYOUT          = LAYOUT
               IT_FIELDCAT        = FIELDTAB
               I_DEFAULT          = 'A'
               I_SAVE             = G_SAVE
               IS_VARIANT         = G_VARIANT
               IT_EVENTS          = EVENTS[]
          TABLES
               T_OUTTAB           = INV.
     IF SY-SUBRC <> 0.
       WRITE: 'SY-SUBRC: ', SY-SUBRC, 'REUSE_ALV_LIST_DISPLAY'.  ENDIF.
    ENDFORM.                               " WRITE_OUTPUT
    

    reward points if it is usefull ....

    Girish

    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.