Skip to Content
avatar image
Former Member

CMOD - fields not populated

CMOD - fields not populated

-


Hi,

When I extract the data,

I am able to populate

ZZDATVR

ZZIHREZ

ZZINCO1

ZZBUDAT

But, I AM NOT ABLE TO POPULATE

ZZNETPR

ZZLOEKZ

ZZMENGE

---

Please let me know the changes that I need to make in the below code:

-


**************************************************************************

  • Enhancement to the Purchasing Data (Item Level)

DATA DATVR1 LIKE NAST-DATVR.

DATA: BUDAT1 LIKE EKBE-BUDAT,

IHREZ1 LIKE EKKO-IHREZ,

INCO11 LIKE EKKO-INCO1.

data: Begin of i_EKKO occurs 0,

EBELN LIKE EKKO-EBELN,

IHREZ1 LIKE EKKO-IHREZ,

INCO11 LIKE EKKO-INCO1,

END OF I_EKKO.

DATA W_MC02M_0ITM LIKE MC02M_0ITM.

WHEN '2LIS_02_ITM'.

LOOP AT C_T_DATA.

CLEAR W_MC02M_0ITM.

W_MC02M_0ITM = C_T_DATA.

CLEAR: DATVR1,IHREZ1, INCO11, BUDAT1.

SELECT SINGLE DATVR INTO DATVR1 FROM NAST WHERE OBJKY = W_MC02M_0ITM-EBELN.

W_MC02M_0ITM-ZZDATVR = DATVR1.

SELECT SINGLE BUDAT INTO BUDAT1 FROM EKBE WHERE EBELN = W_MC02M_0ITM-EBELN

AND BWART = '101'.

W_MC02M_0ITM-ZZBUDAT = BUDAT1.

SELECT EBELN IHREZ INCO1 INTO TABLE I_EKKO FROM EKKO.

read table i_EKKO with key EBELN = W_MC02M_0ITM-EBELN.

IF SY-SUBRC EQ 0.

W_MC02M_0ITM-ZZIHREZ = I_EKKO-IHREZ1.

W_MC02M_0ITM-ZZINCO1 = I_EKKO-INCO11.

ENDIF.

MODIFY C_T_DATA FROM W_MC02M_0ITM INDEX SY-TABIX.

ENDLOOP.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • avatar image
    Former Member
    Aug 24, 2007 at 09:42 PM

    &----


    *& Include ZXRSAU01 *

    &----


    data l_line type i.

    describe table C_T_DATA lines l_line.

    check l_line gt 0.

    CASE i_datasource.

    WHEN '0FI_AA_006'.

    PERFORM populate_asset_trans_data TABLES C_T_DATA.

    *{ INSERT DV1K902092 1

    tables:

    ekko,ekpo,ekbe,eine.

    DATA:

    W_DATVR LIKE NAST-DATVR,

    W_IHREZ LIKE EKKO-IHREZ,

    W_INCO1 LIKE EKKO-INCO1,

    W_EBELN LIKE EKKO-EBELN,

    W_LIFNR LIKE EKKO-LIFNR,

    W_NETPR LIKE EINE-NETPR.

    data:

    Begin of i_budat occurs 0,

    budat1 like ekbe-budat,

    end of i_budat.

    • WORK AREA TO STORE DATA

    DATA: BEGIN OF w_DATA ,

    EBELN LIKE EKKO-EBELN,

    EBELP LIKE EKPO-EBELP,

    MATNR LIKE EKPO-MATNR,

    WERKS LIKE EKPO-WERKS,

    IDNLF LIKE EKPO-IDNLF,

    LGORT LIKE EKPO-LGORT,

    LOEKZ LIKE EKPO-LOEKZ,

    MENGE LIKE EKPO-MENGE,

    infnr like ekpo-infnr,

    LIFNR LIKE EKKO-LIFNR,

    budat like ekbe-budat,

    IHREZ LIKE EKKO-IHREZ,

    INCO1 LIKE EKKO-INCO1,

    DATVR LIKE NAST-DATVR,

    NETPR LIKE EINE-NETPR,

    ELIKZ LIKE EKPO-ELIKZ,

    END OF w_DATA.

    • INTERNAL TABLE TO STORE DATA

    data:

    i_data like standard table of w_data with header line.

    DATA W_MC02M_0ITM LIKE MC02M_0ITM.

    DATA:

    ZC_T_DATA LIKE STANDARD TABLE OF W_MC02M_0ITM

    WITH HEADER LINE..

    when '2LIS_02_ITM'.

    loop at c_t_data.

    *

    *

    clear w_mc02m_0itm.

    *

    w_mc02m_0itm = c_t_data.

    *

    **zc_t_data[] = c_t_data[].

    • GET ALL DATA FROM EKPO FOR ALL PURCHASING ORDER DOCUMENTS

    SELECT EBELN

    EBELP

    MATNR

    WERKS

    IDNLF

    LGORT

    LOEKZ

    MENGE

    infnr

    ELIKZ

    FROM EKPO

    INTO I_DATA

    • for all entries in c_t_data

    WHERE EBELN EQ w_mc02m_0itm-EBELN

    AND LOEKZ NE 'L'.

    append i_data.

    endselect.

    endloop.

    sort i_data by ebeln ebelp.

    delete adjacent duplicates from i_data comparing ebeln ebelp.

    • APPEND OTHER DATA (LIKE DATVR,IHREZ,INCO1,NETPR) TO THE INTERNAL TABLE

    loop at i_data into w_data.

    clear:

    • W_DATA,

    w_datvr,

    w_ihrez,

    w_inco1,

    w_lifnr,

    w_netpr,

    i_data.

    *

    • w_data = i_data.,

    • get DATVR from NAST table

    SELECT SINGLE DATVR

    INTO w_DATVR

    FROM NAST

    WHERE OBJKY = W_data-EBELN.

    if sy-subrc eq 0.

    W_data-datvr = w_DATVR.

    endif.

    if i_data-elikz eq 'X'.

    • get BUDAT from EKBE table...

    SELECT BUDAT

    INTO table i_BUDAT

    FROM EKBE

    WHERE EBELN = W_data-EBELN

    AND EBELP = W_data-EBELP

    AND BWART = '101' . " movement type is 101

    sort i_budat descending.

    • get latest BUDAT

    read table i_budat index 1.

    if sy-subrc eq 0.

    W_data-budat = i_budat-BUDAT1.

    endif.

    endif.

    • get IHREZ and INCO1 from EKKO

    SELECT SINGLE EBELN

    IHREZ

    INCO1

    LIFNR

    INTO (w_ebeln, w_ihrez, w_inco1, W_LIFNR)

    FROM EKKO

    where ebeln = w_data-ebeln.

    IF SY-SUBRC EQ 0.

    W_data-ihrez = w_IHREZ.

    W_data-inco1 = w_INCO1.

    W_DATA-LIFNR = W_LIFNR.

    ENDIF.

    • get NETPR from EINE

    SELECT SINGLE NETPR

    INTO W_NETPR

    FROM EINE

    where EBELN = W_data-EBELN

    AND EBELP = W_data-EBELP

    and infnr = w_data-infnr.

    if sy-subrc eq 0.

    W_data-NETPR = W_NETPR.

    endif.

    MODIFY i_DATA FROM W_data.

    ENDLOOP.

    *

    **********************************************

    refresh C_T_DATA[].

    clear zc_t_data.

    delete table c_t_data.

    • APPEND THIS DATA TO THE FINAL STRUCTURE

    LOOP AT I_DATA into w_data.

    CLEAR: W_MC02M_0ITM.

    *W_DATA = I_DATA.

    MOVE:

    W_DATA-EBELN TO W_MC02M_0ITM-EBELN,

    W_DATA-EBELP TO W_MC02M_0ITM-EBELP,

    W_DATA-MATNR TO W_MC02M_0ITM-MATNR,

    W_DATA-WERKS TO W_MC02M_0ITM-WERKS,

    W_DATA-IDNLF TO W_MC02M_0ITM-ZZIDNLF,

    W_DATA-LGORT TO W_MC02M_0ITM-LGORT,

    W_DATA-LOEKZ TO W_MC02M_0ITM-ZZLOEKZ,

    W_DATA-MENGE TO W_MC02M_0ITM-MENGE,

    W_DATA-ELIKZ TO W_MC02M_0ITM-ELIKZ,

    W_DATA-LIFNR TO W_MC02M_0ITM-LIFNR,

    W_DATA-budat TO W_MC02M_0ITM-ZZbudat,

    W_DATA-IHREZ TO W_MC02M_0ITM-ZZIHREZ,

    W_DATA-INCO1 TO W_MC02M_0ITM-ZZINCO1,

    W_DATA-DATVR TO W_MC02M_0ITM-ZZDATVR,

    W_DATA-NETPR TO W_MC02M_0ITM-ZZNETPR.

    APPEND W_MC02M_0ITM TO C_T_DATA.

    ENDLOOP.

    • aug 23

    *

    **************************************************************************

    *

    • Enhancement to the Purchasing Data (Item Level)

    *

    *

    *DATA:

    *

    *INCO11 LIKE EKKO-INCO1,

    *

    *EBELN1 LIKE EKKO-EBELN,

    *

    *DATVR1 LIKE NAST-DATVR,

    *

    *BUDAT1 LIKE EKBE-BUDAT,

    *

    *IDNLF1 LIKE EKPO-IDNLF,

    *

    *IHREZ1 LIKE EKKO-IHREZ,

    *

    *LOEKZ1 LIKE EKPO-LOEKZ,

    *

    *NETPR1 LIKE EINE-NETPR.

    *

    *DATA:

    *

    *Begin of I_EKKO occurs 0,

    *

    *EBELN LIKE EKKO-EBELN,

    *

    *IHREZ1 LIKE EKKO-IHREZ,

    *

    *INCO11 LIKE EKKO-INCO1,

    *

    *END OF I_EKKO.

    *

    ******NEW BEGIN******

    *

    *data: Begin of i_EKPO occurs 0,

    *

    *EBELN LIKE EKPO-EBELN,

    *

    *LOEKZ1 LIKE EKPO-LOEKZ,

    *

    *IDNLF1 LIKE EKPO-IDNLF,

    *

    *END OF I_EKPO.

    *

    *data: Begin of i_EINE occurs 0,

    *

    *NETPR1 LIKE EINE-NETPR,

    *

    *END OF I_EINE.

    *

    *data: Begin of i_budat occurs 0,

    *budat1 like ekbe-budat,

    *end of i_budat.

    *

    *******NEW END********

    *

    *DATA W_MC02M_0ITM LIKE MC02M_0ITM.

    *

    *WHEN '2LIS_02_ITM'.

    *

    *LOOP AT C_T_DATA.

    *

    *CLEAR W_MC02M_0ITM.

    *

    *W_MC02M_0ITM = C_T_DATA.

    *

    *CLEAR: DATVR1,IHREZ1, INCO11, BUDAT1.

    *

    *******NEW BEGIN******

    *

    *CLEAR: LOEKZ1, IDNLF1, NETPR1, I_BUDAT, EBELN1.

    *

    *******NEW END********

    *

    *SELECT SINGLE DATVR INTO DATVR1 FROM NAST WHERE OBJKY = W_MC02M_0ITM-EBELN.

    *

    *W_MC02M_0ITM-ZZDATVR = DATVR1.

    *

    *SELECT BUDAT INTO table i_BUDAT FROM EKBE WHERE EBELN = W_MC02M_0ITM-EBELN

    *

    *

    *

    **************************************

    *

    *AND BWART = '101' AND EBELP = W_MC02M_0ITM-EBELP.

    *

    *sort i_budat descending.

    *

    *read table i_budat index 1.

    *

    *if sy-subrc eq 0.

    *

    *W_MC02M_0ITM-ZZBUDAT = i_budat-BUDAT1.

    *

    *endif.

    *

    *

    *

    *

    *

    ******NEW BEGIN******

    *

    *

    *SELECT EBELN IHREZ INCO1 INTO TABLE I_EKKO FROM EKKO.

    *

    *read table i_EKKO with key EBELN = W_MC02M_0ITM-EBELN.

    *

    *IF SY-SUBRC EQ 0.

    *

    *

    *W_MC02M_0ITM-ZZIHREZ = I_EKKO-IHREZ1.

    *

    *W_MC02M_0ITM-ZZINCO1 = I_EKKO-INCO11.

    *

    *ENDIF.

    *

    *

    *SELECT SINGLE LOEKZ IDNLF INTO (LOEKZ1, IDNLF1) FROM EKPO

    *

    • WHERE EBELN = W_MC02M_0ITM-EBELN

    *

    • AND EBELP = W_MC02M_0ITM-EBELP.

    *

    *

    *W_MC02M_0ITM-ZZLOEKZ = LOEKZ1.

    *

    *W_MC02M_0ITM-ZZIDNLF = IDNLF1.

    *

    *

    *SELECT SINGLE NETPR INTO NETPR1 FROM EINE

    *

    • where EBELN = W_MC02M_0ITM-EBELN

    *

    • AND EKORG = W_MC02M_0ITM-EKORG

    *

    • AND EBELP = W_MC02M_0ITM-EBELP.

    *

    *

    *W_MC02M_0ITM-ZZNETPR = NETPR1.

    *

    *

    *

    • to delete purchase order documents with movement type ne 101

    *

    *

    *select single ebeln into ebeln1 from ekbe where bwart ne '101' and EBELN = W_MC02M_0ITM-EBELN

    *.

    *

    *if sy-subrc eq 0.

    *

    *

    • CLEAR W_MC02M_0ITM.

    *

    • DELETE C_T_DATA FROM W_MC02M_0ITM INDEX SY-TABIX.

    *

    *endif.

    *

    *

    ********NEW END*******

    *

    *MODIFY C_T_DATA FROM W_MC02M_0ITM INDEX SY-TABIX.

    *

    *

    *

    *ENDLOOP.

    • END AUG 22

    ********************************************

    *

    *AND BWART = '101'.

    *

    *W_MC02M_0ITM-ZZBUDAT = BUDAT1.

    *

    ******NEW BEGIN******

    *

    *SELECT EBELN IHREZ INCO1 INTO TABLE I_EKKO FROM EKKO.

    *

    *read table i_EKKO with key EBELN = W_MC02M_0ITM-EBELN.

    *IF SY-SUBRC EQ 0.

    *

    *W_MC02M_0ITM-ZZIHREZ = I_EKKO-IHREZ1.

    *

    *W_MC02M_0ITM-ZZINCO1 = I_EKKO-INCO11.

    *

    *ENDIF.

    *

    *

    *SELECT SINGLE LOEKZ INTO LOEKZ1 FROM EKPO WHERE EBELN = W_MC02M_0ITM-EBELN.

    *

    *W_MC02M_0ITM-ZZLOEKZ = LOEKZ1.

    *

    *

    *SELECT SINGLE IDNLF INTO IDNLF1 FROM EKPO where EBELN = W_MC02M_0ITM-EBELN.

    *W_MC02M_0ITM-ZZIDNLF = IDNLF1.

    *

    *

    *

    *SELECT SINGLE NETPR INTO NETPR1 FROM EINE where EBELN = W_MC02M_0ITM-EBELN.

    *

    • W_MC02M_0ITM-ZZNETPR = NETPR1.

    *

    *

    ********NEW END*******

    *

    *

    *MODIFY C_T_DATA FROM W_MC02M_0ITM INDEX SY-TABIX.

    *

    *

    *ENDLOOP.

    ****************************************************************************

    *

    ***************************************************************************

    *

    • Enhancement to the Purchasing Data (Item Level)

    *

    *

    *DATA DATVR1 LIKE NAST-DATVR.

    *

    *DATA: BUDAT1 LIKE EKBE-BUDAT,

    *

    *IHREZ1 LIKE EKKO-IHREZ,

    *

    *INCO11 LIKE EKKO-INCO1,

    *

    *EBELN1 LIKE EKKO-EBELN,

    *

    *LOEKZ1 LIKE EKPO-LOEKZ,

    *

    *IDNLF1 LIKE EKPO-IDNLF,

    *

    *NETPR1 LIKE EINE-NETPR.

    *

    *data: Begin of i_EKKO occurs 0,

    *

    *EBELN LIKE EKKO-EBELN,

    *

    *IHREZ1 LIKE EKKO-IHREZ,

    *

    *INCO11 LIKE EKKO-INCO1,

    *

    *END OF I_EKKO.

    *

    *data: Begin of i_EKPO occurs 0,

    *

    *EBELN LIKE EKPO-EBELN,

    *

    *LOEKZ1 LIKE EKPO-LOEKZ,

    *

    *IDNLF1 LIKE EKPO-IDNLF,

    *

    *END OF I_EKPO.

    *

    *data: Begin of i_EINE occurs 0,

    *

    *NETPR1 LIKE EINE-NETPR,

    *

    *END OF I_EINE.

    *

    *data: Begin of i_budat occurs 0,

    *budat1 like ekbe-budat,

    *end of i_budat.

    *

    *

    *DATA: BEGIN OF I_DATA OCCURS 0,

    *

    *EBELN LIKE EKKO-EBELN,

    *

    • EBELP LIKE EKPO-EBELP,

    *

    • MATNR LIKE EKPO-MATNR,

    *

    • WERKS LIKE EKPO-WERKS,

    *

    • IDNLF LIKE EKPO-IDNLF,

    *

    • LGORT LIKE EKPO-LGORT,

    *

    • LOEKZ LIKE EKPO-LOEKZ,

    *

    • MENGE LIKE EKPO-MENGE,

    *

    *END OF I_DATA.

    *

    *DATA : WC_T_DATA LIKE MC02M_0ITM OCCURS 0.

    *

    *DATA W_MC02M_0ITM LIKE MC02M_0ITM.

    *

    *DATA W_DATA LIKE MC02M_0ITM.

    *

    *DATA: ZC_T_DATA LIKE STANDARD TABLE OF W_DATA WITH HEADER LINE..

    *

    *WHEN '2LIS_02_ITM'.

    *

    *LOOP AT C_T_DATA.

    *

    *CLEAR W_MC02M_0ITM.

    *

    *W_MC02M_0ITM = C_T_DATA.

    *

    *

    *

    • SELECT EBELN

    • EBELP

    • MATNR

    • WERKS

    • IDNLF

    • LGORT

    • LOEKZ

    • MENGE

    *

    • FROM EKPO

    *

    • INTO TABLE I_DATA

    *

    • WHERE EBELN EQ W_MC02M_0ITM-EBELN.

    *

    *APPEND W_MC02M_0ITM TO ZC_T_DATA.

    *

    *ENDLOOP.

    *

    *

    *LOOP AT ZC_T_DATA.

    *

    *

    *

    • BEGIN*****

  • ELIKZ is the “Delivery Completed” Indicator

  • *

    *We have to include both Completed and

    *

    *Non-Complete Line Items (EKPO-EBELP).

    *

    *Eg., IF we have multiple occurrences of

    *

    *EKPO-EBELN with various movement types, consider

    *

    *But, # of Line Items completed in the

    *past 6 months / 12 months field in our Report

    *

    *needs information where we pick the Line Items

    *(EKPO-EBELP)

    *

    *for which, “Delivery Completed” Indicator

    *(EKPO-ELIKZ) is not blank.

    *

    *We need to get the records from EKPO-EBELP.

    *

    *PO Transmit Date = NAST-DATVR where NAST-OBJKY = EKBE-EBELN

    *

    *PO Receipt Date = EKBE-BUDAT where MSEG-BWART = ‘101’.

    *

    *So, this one grabs the date from the latest date

    *

    *in the "Purchase Order Delivery" tab in the ITEM

    *

    *on the Purchasing DOcument

    *

    *

    *

    ****END****

    *

    • LOOP AT I_DATA WHERE EBELN EQ ZC_T_DATA-EBELN.

    *

    *

    *

    • CLEAR W_DATA.

    *

    • IF I_DATA-EBELP NE ZC_T_DATA-EBELP.

    *

    • MOVE:

    *

    • I_DATA-EBELN TO W_DATA-EBELN,

    *

    • I_DATA-EBELP TO W_DATA-EBELP,

    *

    • I_DATA-MATNR TO W_DATA-MATNR,

    *

    *I_DATA-WERKS TO W_DATA-WERKS,

    *

    *I_DATA-IDNLF TO W_DATA-ZZIDNLF,

    *

    *I_DATA-LOEKZ TO W_DATA-ZZLOEKZ,

    *

    *I_DATA-LGORT TO W_DATA-LGORT,

    *

    *I_DATA-MENGE TO W_DATA-MENGE.

    *

    *

    • APPEND W_DATA TO ZC_T_DATA.

    *

    • ELSEIF I_DATA-EBELP EQ W_DATA-EBELP.

    *

    • MOVE:

    *

    • I_DATA-EBELN TO W_DATA-EBELN,

    *

    • I_DATA-EBELP TO W_DATA-EBELP,

    *

    • I_DATA-MATNR TO W_DATA-MATNR,

    *

    *I_DATA-WERKS TO W_DATA-WERKS,

    *

    *I_DATA-IDNLF TO W_DATA-ZZIDNLF,

    *

    *I_DATA-LOEKZ TO W_DATA-ZZLOEKZ,

    *

    *I_DATA-LGORT TO W_DATA-LGORT,

    *

    *I_DATA-MENGE TO W_DATA-MENGE.

    *

    *

    • MODIFY ZC_T_DATA FROM W_DATA INDEX SY-TABIX. .

    *

    • ENDIF.

    *

    • ENDLOOP.

    *

    *ENDLOOP.

    *

    • CLEAR C_T_DATA.

    *

    *

    • C_T_DATA[] = ZC_T_DATA[].

    *

    *

    • LOOP AT C_T_DATA.

    *

    • CLEAR W_MC02M_0ITM.

    *

    • W_MC02M_0ITM = C_T_DATA.

    *

    • CLEAR: DATVR1,IHREZ1, INCO11, BUDAT1.

    *

    • CLEAR: LOEKZ1, IDNLF1, NETPR1, I_BUDAT, EBELN1.

    *

    • SELECT SINGLE DATVR INTO DATVR1 FROM NAST WHERE OBJKY = W_MC02M_0ITM-EBELN.

    *

    • W_MC02M_0ITM-ZZDATVR = DATVR1.

    *

    • SELECT BUDAT INTO table i_BUDAT FROM EKBE WHERE EBELN = W_MC02M_0ITM-EBELN

    *

    • AND BWART = '101' AND EBELP = W_MC02M_0ITM-EBELP.

    *

    • sort i_budat descending.

    *

    • read table i_budat index 1.

    *

    • if sy-subrc eq 0.

    *

    • W_MC02M_0ITM-ZZBUDAT = i_budat-BUDAT1.

    *

    • endif.

    *

    *

    • SELECT EBELN IHREZ INCO1 INTO TABLE I_EKKO FROM EKKO.

    *

    • read table i_EKKO with key EBELN = W_MC02M_0ITM-EBELN.

    *

    • IF SY-SUBRC EQ 0.

    *

    *

    • W_MC02M_0ITM-ZZIHREZ = I_EKKO-IHREZ1.

    *

    • W_MC02M_0ITM-ZZINCO1 = I_EKKO-INCO11.

    *

    • ENDIF.

    *

    *

    • SELECT SINGLE LOEKZ IDNLF INTO (LOEKZ1, IDNLF1) FROM EKPO

    *

    • WHERE EBELN = W_MC02M_0ITM-EBELN

    *

    • AND EBELP = W_MC02M_0ITM-EBELP.

    *

    *

    • W_MC02M_0ITM-ZZLOEKZ = LOEKZ1.

    *

    • W_MC02M_0ITM-ZZIDNLF = IDNLF1.

    *

    *

    • SELECT SINGLE NETPR INTO NETPR1 FROM EINE

    *

    • where EBELN = W_MC02M_0ITM-EBELN

    *

    • AND EKORG = W_MC02M_0ITM-EKORG

    *

    • AND EBELP = W_MC02M_0ITM-EBELP.

    *

    *

    • W_MC02M_0ITM-ZZNETPR = NETPR1.

    *

    *

    *

    • to delete purchase order documents with movement type ne 101

    *

    *

    • select single ebeln into ebeln1 from ekbe where bwart ne '101' and EBELN = W_MC02M_0ITM-EBELN

    • .

    *

    • if sy-subrc eq 0.

    *

    *

    • CLEAR W_MC02M_0ITM.

    *

    • DELETE C_T_DATA FROM W_MC02M_0ITM INDEX SY-TABIX.

    *

    • endif.

    *

    *

    • MODIFY C_T_DATA FROM W_MC02M_0ITM INDEX SY-TABIX.

    *

    *

    *

    • ENDLOOP.

    *

    **********************************************

    *.

    *

    *

    • END AUG 23

    *

    ***************************************************************************

    *

    • Enhancement to the Purchasing Data (Item Level)

    **

    **

    **DATA DATVR1 LIKE NAST-DATVR.

    **

    **DATA: BUDAT1 LIKE EKBE-BUDAT,

    **

    **IHREZ1 LIKE EKKO-IHREZ,

    **

    **INCO11 LIKE EKKO-INCO1,

    **

    **EBELN1 LIKE EKKO-EBELN,

    **

    ********new BEGIN*******

    **

    **LOEKZ1 LIKE EKPO-LOEKZ,

    **

    **IDNLF1 LIKE EKPO-IDNLF,

    **

    **NETPR1 LIKE EINE-NETPR.

    **

    *********NEW END *******

    **

    **data: Begin of i_EKKO occurs 0,

    **

    **EBELN LIKE EKKO-EBELN,

    **

    **IHREZ1 LIKE EKKO-IHREZ,

    **

    **INCO11 LIKE EKKO-INCO1,

    **

    **END OF I_EKKO.

    **

    *******NEW BEGIN******

    **

    **data: Begin of i_EKPO occurs 0,

    **

    **EBELN LIKE EKPO-EBELN,

    **

    **LOEKZ1 LIKE EKPO-LOEKZ,

    **

    **IDNLF1 LIKE EKPO-IDNLF,

    **

    **END OF I_EKPO.

    **

    **data: Begin of i_EINE occurs 0,

    **

    **NETPR1 LIKE EINE-NETPR,

    **

    **END OF I_EINE.

    **

    **data: Begin of i_budat occurs 0,

    **budat1 like ekbe-budat,

    **end of i_budat.

    **

    ********NEW END********

    **

    **DATA W_MC02M_0ITM LIKE MC02M_0ITM.

    **

    **WHEN '2LIS_02_ITM'.

    **

    **LOOP AT C_T_DATA.

    **

    **CLEAR W_MC02M_0ITM.

    **

    **W_MC02M_0ITM = C_T_DATA.

    **

    **CLEAR: DATVR1,IHREZ1, INCO11, BUDAT1.

    **

    ********NEW BEGIN******

    **

    **CLEAR: LOEKZ1, IDNLF1, NETPR1, I_BUDAT, EBELN1.

    **

    ********NEW END********

    **

    **SELECT SINGLE DATVR INTO DATVR1 FROM NAST WHERE OBJKY = W_MC02M_0ITM-EBELN.

    **

    **W_MC02M_0ITM-ZZDATVR = DATVR1.

    **

    **SELECT BUDAT INTO table i_BUDAT FROM EKBE WHERE EBELN = W_MC02M_0ITM-EBELN

    **

    **

    **

    ***************************************

    **

    **AND BWART = '101' AND EBELP = W_MC02M_0ITM-EBELP.

    **

    **sort i_budat descending.

    **

    **read table i_budat index 1.

    **

    **if sy-subrc eq 0.

    **

    **W_MC02M_0ITM-ZZBUDAT = i_budat-BUDAT1.

    **

    **endif.

    **

    **

    **

    **

    **

    *******NEW BEGIN******

    **

    **

    **SELECT EBELN IHREZ INCO1 INTO TABLE I_EKKO FROM EKKO.

    **

    **read table i_EKKO with key EBELN = W_MC02M_0ITM-EBELN.

    **

    **IF SY-SUBRC EQ 0.

    **

    **

    **W_MC02M_0ITM-ZZIHREZ = I_EKKO-IHREZ1.

    **

    **W_MC02M_0ITM-ZZINCO1 = I_EKKO-INCO11.

    **

    **ENDIF.

    **

    **

    **SELECT SINGLE LOEKZ IDNLF INTO (LOEKZ1, IDNLF1) FROM EKPO

    **

    • WHERE EBELN = W_MC02M_0ITM-EBELN

    **

    • AND EBELP = W_MC02M_0ITM-EBELP.

    **

    **

    **W_MC02M_0ITM-ZZLOEKZ = LOEKZ1.

    **

    **W_MC02M_0ITM-ZZIDNLF = IDNLF1.

    **

    **

    **SELECT SINGLE NETPR INTO NETPR1 FROM EINE

    **

    • where EBELN = W_MC02M_0ITM-EBELN

    **

    • AND EKORG = W_MC02M_0ITM-EKORG

    **

    • AND EBELP = W_MC02M_0ITM-EBELP.

    **

    **

    **W_MC02M_0ITM-ZZNETPR = NETPR1.

    **

    **

    **

    • to delete purchase order documents with movement type ne 101

    **

    **

    **select single ebeln into ebeln1 from ekbe where bwart ne '101' and EBELN = W_MC02M_0ITM-EBELN

    **.

    **

    **if sy-subrc eq 0.

    **

    **

    • CLEAR W_MC02M_0ITM.

    **

    • DELETE C_T_DATA FROM W_MC02M_0ITM INDEX SY-TABIX.

    **

    **endif.

    **

    **

    *********NEW END*******

    **

    **MODIFY C_T_DATA FROM W_MC02M_0ITM INDEX SY-TABIX.

    **

    **

    **

    **ENDLOOP.

    *

    *

    *

    **END AUG 22

    **********************************************

    *

    **AND BWART = '101'.

    **

    **W_MC02M_0ITM-ZZBUDAT = BUDAT1.

    **

    *******NEW BEGIN******

    **

    **SELECT EBELN IHREZ INCO1 INTO TABLE I_EKKO FROM EKKO.

    **

    **read table i_EKKO with key EBELN = W_MC02M_0ITM-EBELN.

    **IF SY-SUBRC EQ 0.

    **

    **W_MC02M_0ITM-ZZIHREZ = I_EKKO-IHREZ1.

    **

    **W_MC02M_0ITM-ZZINCO1 = I_EKKO-INCO11.

    **

    **ENDIF.

    **

    **

    **SELECT SINGLE LOEKZ INTO LOEKZ1 FROM EKPO WHERE EBELN = W_MC02M_0ITM-EBELN.

    **

    **W_MC02M_0ITM-ZZLOEKZ = LOEKZ1.

    **

    **

    **SELECT SINGLE IDNLF INTO IDNLF1 FROM EKPO where EBELN = W_MC02M_0ITM-EBELN.

    **W_MC02M_0ITM-ZZIDNLF = IDNLF1.

    **

    **

    **

    **SELECT SINGLE NETPR INTO NETPR1 FROM EINE where EBELN = W_MC02M_0ITM-EBELN.

    **

    • W_MC02M_0ITM-ZZNETPR = NETPR1.

    **

    **

    *********NEW END*******

    **

    **

    **MODIFY C_T_DATA FROM W_MC02M_0ITM INDEX SY-TABIX.

    **

    **

    **ENDLOOP.

    *

    *

    ******************************************************************************

    *

    *

    *

    *

    *

    *

    *

    ****************************************************************************

    • Enhancement to the Purchasing Data (Item Level)

    **

    **DATA DATVR1 LIKE NAST-DATVR.

    **

    **DATA: BUDAT1 LIKE EKBE-BUDAT,

    **

    **IHREZ1 LIKE EKKO-IHREZ,

    **

    **INCO11 LIKE EKKO-INCO1,

    **

    ********new BEGIN*******

    **

    **LOEKZ1 LIKE EKPO-LOEKZ,

    **

    **IDNLF1 LIKE EKPO-IDNLF,

    **

    **NETPR1 LIKE EINE-NETPR.

    **

    *********NEW END *******

    **

    **data: Begin of i_EKKO occurs 0,

    **

    **EBELN LIKE EKKO-EBELN,

    **

    **IHREZ1 LIKE EKKO-IHREZ,

    **

    **INCO11 LIKE EKKO-INCO1,

    **

    **END OF I_EKKO.

    **

    *******NEW BEGIN******

    **

    **data: Begin of i_EKPO occurs 0,

    **

    **EBELN LIKE EKPO-EBELN,

    **

    **LOEKZ1 LIKE EKPO-LOEKZ,

    **

    **IDNLF1 LIKE EKPO-IDNLF,

    **

    **END OF I_EKPO.

    **

    **data: Begin of i_EINE occurs 0,

    **

    **EKORG LIKE EINE-EKORG,

    **

    **NETPR1 LIKE EINE-NETPR,

    **

    **END OF I_EINE.

    **

    ********NEW END********

    **

    **DATA W_MC02M_0ITM LIKE MC02M_0ITM.

    **

    **WHEN '2LIS_02_ITM'.

    **

    **LOOP AT C_T_DATA.

    **

    **CLEAR W_MC02M_0ITM.

    **

    **W_MC02M_0ITM = C_T_DATA.

    **

    **CLEAR: DATVR1,IHREZ1, INCO11, BUDAT1.

    **

    ********NEW BEGIN******

    **

    **CLEAR: LOEKZ1, IDNLF1, NETPR1.

    **

    ********NEW END********

    **

    **SELECT SINGLE DATVR INTO DATVR1 FROM NAST WHERE OBJKY = W_MC02M_0ITM-EBELN.

    **

    **W_MC02M_0ITM-ZZDATVR = DATVR1.

    **

    **SELECT SINGLE BUDAT INTO BUDAT1 FROM EKBE WHERE EBELN = W_MC02M_0ITM-EBELN

    **

    **AND BWART = '101'.

    **

    **W_MC02M_0ITM-ZZBUDAT = BUDAT1.

    **

    **SELECT EBELN IHREZ INCO1 INTO TABLE I_EKKO FROM EKKO.

    **

    **read table i_EKKO with key EBELN = W_MC02M_0ITM-EBELN.

    **

    *******NEW BEGIN******

    **

    **SELECT SINGLE LOEKZ INTO LOEKZ1 FROM EKPO WHERE EBELN = W_MC02M_0ITM-EBELN.

    **

    **SELECT SINGLE IDNLF INTO IDNLF1 FROM EKPO where EBELN = W_MC02M_0ITM-EBELN.

    **

    **read table i_EKPO with key EBELN = W_MC02M_0ITM-EBELN.

    **

    **SELECT SINGLE NETPR INTO NETPR1 FROM EINE where WERKS = W_MC02M_0ITM-WERKS.

    **

    **read table i_EINE with key EKORG = W_MC02M_0ITM-EKORG.

    **

    **

    *********NEW END*******

    **

    **IF SY-SUBRC EQ 0.

    **

    **W_MC02M_0ITM-ZZIHREZ = I_EKKO-IHREZ1.

    **

    **W_MC02M_0ITM-ZZINCO1 = I_EKKO-INCO11.

    **

    ********NEW BEGIN******

    **

    **W_MC02M_0ITM-ZZLOEKZ = I_EKPO-LOEKZ1.

    **

    **W_MC02M_0ITM-ZZIDNLF = I_EKPO-IDNLF1.

    **

    **W_MC02M_0ITM-ZZNETPR = I_EINE-NETPR1.

    **

    *********NEW END*******

    **

    **ENDIF.

    **

    **MODIFY C_T_DATA FROM W_MC02M_0ITM INDEX SY-TABIX.

    **

    **

    **ENDLOOP.

    *

    *

    *

    ******************************************************************************

    *

    *

    *

    *

    ****************************************************************************

    • Enhancement to the Purchasing Data (Item Level)

    **

    **DATA DATVR1 LIKE NAST-DATVR.

    **

    **DATA: BUDAT1 LIKE EKBE-BUDAT,

    **

    **IHREZ1 LIKE EKKO-IHREZ,

    **

    **INCO11 LIKE EKKO-INCO1.

    **

    **data: Begin of i_EKKO occurs 0,

    **

    **EBELN LIKE EKKO-EBELN,

    **

    **IHREZ1 LIKE EKKO-IHREZ,

    **

    **INCO11 LIKE EKKO-INCO1,

    **

    **END OF I_EKKO.

    **

    **DATA W_MC02M_0ITM LIKE MC02M_0ITM.

    **

    **WHEN '2LIS_02_ITM'.

    **

    **LOOP AT C_T_DATA.

    **

    **CLEAR W_MC02M_0ITM.

    **

    **W_MC02M_0ITM = C_T_DATA.

    **

    **CLEAR: DATVR1,IHREZ1, INCO11, BUDAT1.

    **

    **SELECT SINGLE DATVR INTO DATVR1 FROM NAST WHERE OBJKY = W_MC02M_0ITM-EBELN.

    **

    **W_MC02M_0ITM-ZZDATVR = DATVR1.

    **

    **SELECT SINGLE BUDAT INTO BUDAT1 FROM EKBE WHERE EBELN = W_MC02M_0ITM-EBELN

    **

    **AND BWART = '101'.

    **

    **W_MC02M_0ITM-ZZBUDAT = BUDAT1.

    **

    **SELECT EBELN IHREZ INCO1 INTO TABLE I_EKKO FROM EKKO.

    **

    **read table i_EKKO with key EBELN = W_MC02M_0ITM-EBELN.

    **

    **IF SY-SUBRC EQ 0.

    **

    **W_MC02M_0ITM-ZZIHREZ = I_EKKO-IHREZ1.

    **

    **W_MC02M_0ITM-ZZINCO1 = I_EKKO-INCO11.

    **

    **ENDIF.

    **

    **MODIFY C_T_DATA FROM W_MC02M_0ITM INDEX SY-TABIX.

    **

    **

    **

    **ENDLOOP.

    **

    **

    **

    *******************************************************************************

    **

    **

    *

    *.

    *

    • WHEN OTHERS.

    • DATA: L_PROG_NAME LIKE D010SINF-PROG,

    • L_SUBRC LIKE SY-SUBRC.

    *

    • ==>> Added by Deolikarj on 2/9/7 .

  • DATA: L_APPLNM type RSAPPLNM ,

  • l_appl(2) ,

  • l_name like trdir-name .

  • *

    • Select Application Name from table

  • select single applnm

  • into l_applnm

  • from roosource

  • where oltpsource = i_datasource .

  • *

    • get Application area

  • if l_applnm(1) = '0' .

  • l_appl = l_applnm+1(2).

  • else.

  • l_appl = l_applnm(2).

  • endif .

  • *

    • <<== End Add

    *

    • Changed by Deolikarj 2/9/7

    • CONCATENATE 'ZBW_'

    • I_DATASOURCE

    • INTO L_PROG_NAME.

    *

    • CONCATENATE 'ZBWTR_' l_appl '_'

    • I_DATASOURCE

    • INTO L_PROG_NAME.

    *

    • PERFORM TRANSFORM IN PROGRAM (L_PROG_NAME)

    • TABLES I_T_SELECT

    • I_T_FIELDS

    • C_T_DATA

    • C_T_MESSAGES

    • USING I_DATASOURCE

    • I_ISOURCE

    • I_UPDMODE

    • CHANGING L_SUBRC

    • IF FOUND.

    • IF L_SUBRC <> 0.

    • RAISE RSAP_CUSTOMER_EXIT_ERROR.

    • ENDIF.

    *

    *

    *

    *} INSERT

    ENDCASE.

Add comment
10|10000 characters needed characters exceeded