Po's based on material created
hi,
please help me out in generation of the below report.
<b>display the PO's based on material created by the user.</b>
you can send your views on ' [email protected]'.
thanks in advance.
-Muraly.
Hi
Check this report
REPORT ZCOMMITMENT.
*DATA: ED TYPE F.
DATA : ED(15) TYPE N .
TABLES: EKKO, EKBE, EKPO, KONH , KONV ,LFA1 ,ESLL.
TYPE-POOLS: SLIS.
DATA: val1 like konh-vakey.
Data:GS_LAYOUT TYPE SLIS_LAYOUT_ALV,
G_REPID LIKE SY-REPID,
G_GRID_TITLE TYPE LVC_TITLE.
Data:G_USER_COMMAND TYPE SLIS_FORMNAME VALUE 'USER_COMMAND'.
DATA:G_TABNAME TYPE SLIS_TABNAME VALUE 'ITAB1',
G_SAVE .
DATA:GS_VARIANT LIKE DISVARIANT.
DATA:LS_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
DATA:GT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE.
G_SAVE = 'A'.
DATA: BEGIN OF ITAB OCCURS 10,
EBELN LIKE EKKO-EBELN,
* LIFNR like p_vendor,
LIFNR LIKE EKKO-LIFNR,
NAME1 LIKE LFA1-NAME1,
NAME2 LIKE LFA1-NAME2,
* EBELP LIKE EKBE-EBELP,
BELNR LIKE EKBE-BELNR,
VGABE LIKE EKBE-VGABE,
GJAHR LIKE EKBE-GJAHR,
KNUMV LIKE EKKO-KNUMV,
EKORG LIKE EKKO-EKORG,
BEDAT LIKE EKKO-BEDAT,
* VAKEY LIKE KONH-VAKEY,
END OF ITAB.
DATA: BEGIN OF ITAB1 OCCURS 10,
NAME1 LIKE LFA1-NAME1,
NAME2 LIKE LFA1-NAME2,
EBELN LIKE EKPO-EBELN,
LIFNR LIKE EKKO-LIFNR,
EBELP LIKE EKPO-EBELP,
* EBELP LIKE EKBE-EBELP,
KNUMH LIKE KONH-KNUMH,
BELNR LIKE EKBE-BELNR,
MATNR LIKE EKPO-MATNR,
TXZ01 LIKE EKPO-TXZ01,
PS_PSP_PNR LIKE EKKN-PS_PSP_PNR,
EXTROW LIKE ESLL-EXTROW,
SRVPOS LIKE ESLL-SRVPOS,
KTEXT1 LIKE ESLL-KTEXT1,
KOSTL LIKE EKKN-KOSTL,
NETPR LIKE EKPO-NETPR,
NETWR LIKE EKPO-NETWR,
ED1 TYPE p decimals 2,
KBETR2 LIKE KONV-KBETR,
KBETR1 LIKE KONV-KBETR,
KBETR LIKE KONV-KBETR,
* KBETR3 LIKE KONV-KBETR,
KWERT LIKE KONV-KWERT, " THIS IS FOR FREIGHT
KWERT1 LIKE KONV-KWERT, " THIS IS FOR PBXX OR PB00
KWERT2 LIKE KONV-KWERT, " THIS FOR OTHER CONDITION
MENGE LIKE EKPO-MENGE,
* TOTAL(15) type .
TOTAL TYPE p decimals 2,
VAKEY LIKE KONH-VAKEY,
WERKS LIKE EKPO-WERKS,
MWSKZ LIKE EKPO-MWSKZ,
PACKNO LIKE EKPO-PACKNO,
KNUMV LIKE KONV-KNUMV,
SUB_PACKNO LIKE ESLL-SUB_PACKNO,
GJAHR LIKE RSEG-GJAHR,
END OF ITAB1.
DATA: BEGIN OF ITAB2 OCCURS 10,
EBELN LIKE EKKN-EBELN,
EBELP LIKE EKKN-EBELP,
PS_PSP_PNR LIKE EKKN-PS_PSP_PNR,
KOSTL LIKE EKKN-KOSTL,
END OF ITAB2.
data: begin of itab3 occurs 10,
KNUMH LIKE KONH-KNUMH,
KSCHL LIKE KONH-KSCHL,
end of itab3.
data: begin of itab4 occurs 10,
KBETR LIKE KONP-KBETR,
end of itab4.
data: begin of itab5 occurs 10,
KPOSN LIKE KONV-KPOSN,
KNUMV LIKE KONV-KNUMV,
KSCHL LIKE KONV-KSCHL,
KBETR LIKE KONV-KBETR,
KWERT LIKE KONV-KWERT, " THIS IS FOR FREIGHT
* KAWRT LIKE KONV-KAWRT,
end of itab5.
DATA: BEGIN OF ITAB6 OCCURS 10,
* PACKNO LIKE EKPO-PACKNO,
SUB_PACKNO LIKE ESLL-SUB_PACKNO,
END OF ITAB6.
DATA: BEGIN OF ITAB7 OCCURS 10,
BELNR LIKE RSEG-BELNR,
GJAHR LIKE RSEG-GJAHR,
END OF ITAB7.
DATA: BEGIN OF ITAB8 OCCURS 10,
SUB_PACKNO LIKE ESLL-SUB_PACKNO,
SRVPOS LIKE ESLL-SRVPOS,
EXTROW LIKE ESLL-EXTROW,
KTEXT1 LIKE ESLL-KTEXT1,
END OF ITAB8.
*selection-screen
*SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
*SELECTION-SCREEN SKIP 2.
*SELECTION-SCREEN BEGIN OF LINE.
*SELECTION-SCREEN COMMENT 25(23) text-002.
**SELECT-OPTIONS: s_lifnr FOR ekko-lifnr.
*PARAMETERS:p_lifnr LIKE ekko-lifnr obligatory.
*SELECTION-SCREEN END OF LINE.
*SELECTION-SCREEN END OF BLOCK b1.
START-OF-SELECTION.
PERFORM get_data.
* PERFORM field_catalog.
* PERFORM display_data.
END-OF-SELECTION.
**& Form display_data
** text
*FORM display_data.
*data: new(15) TYPE N.
* CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
* EXPORTING
* i_callback_program = sy-repid
* it_fieldcat = int_cat[]
* TABLES
* t_outtab = int_out
* EXCEPTIONS
* program_error = 1
* OTHERS = 2.
*ENDFORM. "display_data
PERFORM GET_DATA.
PERFORM CALL_ALV_GRID.
FORM CALL_ALV_GRID.
PERFORM FIELDCAT_INIT USING GT_FIELDCAT[].
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = G_repid
I_CALLBACK_USER_COMMAND = G_USER_COMMAND
I_GRID_TITLE = G_GRID_TITLE
IT_FIELDCAT = GT_FIELDCAT[]
I_DEFAULT = 'X'
I_SAVE = G_SAVE
IS_VARIANT = Gs_VARIANT
TABLES
T_OUTTAB = ITAB1.
ENDFORM.
FORM FIELDCAT_INIT
USING RT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
CLEAR LS_FIELDCAT.
LS_FIELDCAT-TABNAME = G_TABNAME.
LS_FIELDCAT-seltext_l = 'Vendo No'.
LS_FIELDCAT-FIELDNAME = 'LIFNR'.
LS_FIELDCAT-REF_FIELDNAME = 'LIFNR'.
LS_FIELDCAT-REF_TABNAME = 'EKKO'.
APPEND LS_FIELDCAT TO RT_FIELDCAT.
CLEAR LS_FIELDCAT.
LS_FIELDCAT-TABNAME = G_TABNAME.
LS_FIELDCAT-SELTEXT_L = 'Vendor Name'.
LS_FIELDCAT-FIELDNAME = 'NAME1'.
LS_FIELDCAT-REF_FIELDNAME = 'NAME1'.
LS_FIELDCAT-REF_TABNAME = 'LFA1'.
APPEND LS_FIELDCAT TO RT_FIELDCAT.
* CLEAR LS_FIELDCAT.
* LS_FIELDCAT-TABNAME = G_TABNAME.
* LS_FIELDCAT-FIELDNAME = 'NAME2'.
* LS_FIELDCAT-REF_FIELDNAME = 'NAME2'.
* LS_FIELDCAT-REF_TABNAME = 'LFA1'.
* APPEND LS_FIELDCAT TO RT_FIELDCAT.
CLEAR LS_FIELDCAT.
LS_FIELDCAT-TABNAME = G_TABNAME.
LS_FIELDCAT-seltext_l = 'Purchase Document No'.
LS_FIELDCAT-FIELDNAME = 'EBELN'.
LS_FIELDCAT-REF_FIELDNAME = 'EBELN'.
LS_FIELDCAT-REF_TABNAME = 'EKKO'.
APPEND LS_FIELDCAT TO RT_FIELDCAT.
* CLEAR LS_FIELDCAT.
* LS_FIELDCAT-TABNAME = G_TABNAME.
* LS_FIELDCAT-FIELDNAME = 'VGABE'.
* LS_FIELDCAT-REF_FIELDNAME = 'VGABE'.
* LS_FIELDCAT-REF_TABNAME = 'EKBE'.
* APPEND LS_FIELDCAT TO RT_FIELDCAT.
CLEAR LS_FIELDCAT.
LS_FIELDCAT-TABNAME = G_TABNAME.
LS_FIELDCAT-SELTEXT_L = 'Item No'.
LS_FIELDCAT-FIELDNAME = 'EBELP'.
LS_FIELDCAT-REF_FIELDNAME = 'EBELP'.
LS_FIELDCAT-REF_TABNAME = 'EKPO'.
APPEND LS_FIELDCAT TO RT_FIELDCAT.
* CLEAR LS_FIELDCAT.
* LS_FIELDCAT-TABNAME = G_TABNAME.
* LS_FIELDCAT-FIELDNAME = 'BELNR'.
* LS_FIELDCAT-REF_FIELDNAME = 'BELNR'.
* LS_FIELDCAT-REF_TABNAME = 'EKBE'.
* APPEND LS_FIELDCAT TO RT_FIELDCAT.
CLEAR LS_FIELDCAT.
LS_FIELDCAT-TABNAME = G_TABNAME.
LS_FIELDCAT-SELTEXT_L = 'Document Con'.
LS_FIELDCAT-FIELDNAME = 'KNUMH'.
LS_FIELDCAT-REF_FIELDNAME = 'KNUMH'.
LS_FIELDCAT-REF_TABNAME = 'KONH'.
APPEND LS_FIELDCAT TO RT_FIELDCAT.
* CLEAR LS_FIELDCAT.
* LS_FIELDCAT-TABNAME = G_TABNAME.
* LS_FIELDCAT-SELTEXT_L = 'Service/Material No'.
* LS_FIELDCAT-FIELDNAME = 'MATNR'.
* LS_FIELDCAT-REF_FIELDNAME = 'MATNR'.
* LS_FIELDCAT-REF_TABNAME = 'EKPO'.
* APPEND LS_FIELDCAT TO RT_FIELDCAT.
* CLEAR LS_FIELDCAT.
* LS_FIELDCAT-TABNAME = G_TABNAME.
* LS_FIELDCAT-SELTEXT_L = 'Service / Material description' .
* LS_FIELDCAT-FIELDNAME = 'TXZ01'.
* LS_FIELDCAT-REF_FIELDNAME = 'TXZ01'.
* LS_FIELDCAT-REF_TABNAME = 'EKPO'.
* APPEND LS_FIELDCAT TO RT_FIELDCAT.
* CLEAR LS_FIELDCAT.
* LS_FIELDCAT-TABNAME = G_TABNAME.
* LS_FIELDCAT-SELTEXT_L = 'WBS Element' .
* LS_FIELDCAT-FIELDNAME = 'PS_PSP_PNR'.
* LS_FIELDCAT-REF_FIELDNAME = 'PS_PSP_PNR'.
* LS_FIELDCAT-REF_TABNAME = 'EKKN'.
* APPEND LS_FIELDCAT TO RT_FIELDCAT.
* CLEAR LS_FIELDCAT.
* LS_FIELDCAT-TABNAME = G_TABNAME.
* LS_FIELDCAT-SELTEXT_L = 'Serial Number' .
* LS_FIELDCAT-FIELDNAME = 'EXTROW'.
* LS_FIELDCAT-REF_FIELDNAME = 'PACKNO'.
* LS_FIELDCAT-REF_TABNAME = 'ESLL'.
* APPEND LS_FIELDCAT TO RT_FIELDCAT.
* CLEAR LS_FIELDCAT.
* LS_FIELDCAT-TABNAME = G_TABNAME.
* LS_FIELDCAT-SELTEXT_L = 'Service Number' .
* LS_FIELDCAT-FIELDNAME = 'SRVPOS'.
* LS_FIELDCAT-REF_FIELDNAME = 'SRVPOS'.
* LS_FIELDCAT-REF_TABNAME = 'ESLL'.
* APPEND LS_FIELDCAT TO RT_FIELDCAT.
* CLEAR LS_FIELDCAT.
* LS_FIELDCAT-TABNAME = G_TABNAME.
* LS_FIELDCAT-SELTEXT_L = 'Dscription' .
* LS_FIELDCAT-FIELDNAME = 'KTEXT1'.
* LS_FIELDCAT-REF_FIELDNAME = 'KTEXT1'.
* LS_FIELDCAT-REF_TABNAME = 'ESLL'.
* APPEND LS_FIELDCAT TO RT_FIELDCAT.
* CLEAR LS_FIELDCAT.
* LS_FIELDCAT-TABNAME = G_TABNAME.
* LS_FIELDCAT-SELTEXT_L = 'Cost Center'.
* LS_FIELDCAT-FIELDNAME = 'KOSTL'.
* LS_FIELDCAT-REF_FIELDNAME = 'KOSTL'.
* LS_FIELDCAT-REF_TABNAME = 'EKKN'.
* APPEND LS_FIELDCAT TO RT_FIELDCAT.
CLEAR LS_FIELDCAT.
LS_FIELDCAT-TABNAME = G_TABNAME.
* LS_FIELDCAT-FIELDNAME = 'NETWR'.
LS_FIELDCAT-FIELDNAME = 'NETPR'.
LS_FIELDCAT-reptext_ddic = 'Basic'.
* LS_FIELDCAT-SELTEXT_L = 'Basic'.
LS_FIELDCAT-REF_FIELDNAME = 'NETPR'.
LS_FIELDCAT-REF_TABNAME = 'EKPO'.
APPEND LS_FIELDCAT TO RT_FIELDCAT.
CLEAR LS_FIELDCAT.
LS_FIELDCAT-TABNAME = G_TABNAME.
LS_FIELDCAT-FIELDNAME = 'NETWR'.
* LS_FIELDCAT-FIELDNAME = 'NETPR'.
* LS_FIELDCAT-reptext_ddic = ''.
* LS_FIELDCAT-SELTEXT_L = 'Basic'.
LS_FIELDCAT-REF_FIELDNAME = 'NETWR'.
LS_FIELDCAT-REF_TABNAME = 'EKPO'.
APPEND LS_FIELDCAT TO RT_FIELDCAT.
CLEAR LS_FIELDCAT.
LS_FIELDCAT-TABNAME = G_TABNAME.
LS_FIELDCAT-SELTEXT_L = 'Excise'.
LS_FIELDCAT-FIELDNAME = 'ED1'.
LS_FIELDCAT-REF_FIELDNAME = 'ED1'.
* LS_FIELDCAT-REF_TABNAME = 'EKKN'.
APPEND LS_FIELDCAT TO RT_FIELDCAT.
CLEAR LS_FIELDCAT.
LS_FIELDCAT-TABNAME = G_TABNAME.
LS_FIELDCAT-SELTEXT_L = 'Insurance'.
LS_FIELDCAT-FIELDNAME = 'KBETR2'.
LS_FIELDCAT-REF_FIELDNAME = 'KBETR'.
LS_FIELDCAT-REF_TABNAME = 'KONV'.
APPEND LS_FIELDCAT TO RT_FIELDCAT.
CLEAR LS_FIELDCAT.
LS_FIELDCAT-TABNAME = G_TABNAME.
LS_FIELDCAT-SELTEXT_L = 'Frieght'.
LS_FIELDCAT-FIELDNAME = 'KWERT'.
LS_FIELDCAT-REF_FIELDNAME = 'KWERT'.
LS_FIELDCAT-REF_TABNAME = 'KONV'.
APPEND LS_FIELDCAT TO RT_FIELDCAT.
* CLEAR LS_FIELDCAT.
* LS_FIELDCAT-TABNAME = G_TABNAME.
* LS_FIELDCAT-SELTEXT_L = '' .
* LS_FIELDCAT-FIELDNAME = 'KBETR1'.
* LS_FIELDCAT-REF_FIELDNAME = 'KBETR'.
* LS_FIELDCAT-REF_TABNAME = 'KONV'.
* APPEND LS_FIELDCAT TO RT_FIELDCAT.
*CLEAR LS_FIELDCAT.
* LS_FIELDCAT-TABNAME = G_TABNAME.
* LS_FIELDCAT-SELTEXT_L = 'PBXX'.
* LS_FIELDCAT-FIELDNAME = 'KWERT1'.
* LS_FIELDCAT-REF_FIELDNAME = 'KWERT'.
* LS_FIELDCAT-REF_TABNAME = 'KONV'.
* APPEND LS_FIELDCAT TO RT_FIELDCAT.
CLEAR LS_FIELDCAT.
LS_FIELDCAT-TABNAME = G_TABNAME.
LS_FIELDCAT-SELTEXT_L = 'VAT/ST '.
LS_FIELDCAT-FIELDNAME = 'KBETR'.
LS_FIELDCAT-REF_FIELDNAME = "KBETR".
LS_FIELDCAT-REF_TABNAME = 'KONV'.
APPEND LS_FIELDCAT TO RT_FIELDCAT.
CLEAR LS_FIELDCAT.
LS_FIELDCAT-TABNAME = G_TABNAME.
LS_FIELDCAT-SELTEXT_L = 'OTHER '.
LS_FIELDCAT-FIELDNAME = 'KWERT2'.
LS_FIELDCAT-REF_FIELDNAME = "KWERT".
LS_FIELDCAT-REF_TABNAME = 'KONV'.
APPEND LS_FIELDCAT TO RT_FIELDCAT.
CLEAR LS_FIELDCAT.
LS_FIELDCAT-TABNAME = G_TABNAME.
LS_FIELDCAT-SELTEXT_L = 'TOTAL'.
LS_FIELDCAT-FIELDNAME = 'TOTAL'.
LS_FIELDCAT-REF_FIELDNAME = 'TOTAL'.
* LS_FIELDCAT-REF_TABNAME = 'EKKN'.
APPEND LS_FIELDCAT TO RT_FIELDCAT.
ENDFORM. " FIELDCAT_INIT
FORM GET_DATA.
SELECT A~EBELN A~LIFNR A~EKORG A~KNUMV B~VGABE B~GJAHR B~BELNR
L~NAME1 L~NAME2
FROM EKKO AS A
INNER JOIN EKBE AS B ON B~EBELN = A~EBELN
INNER JOIN LFA1 AS L ON L~LIFNR = A~LIFNR
INTO CORRESPONDING
FIELDS OF TABLE ITAB.
* WHERE B~VGABE = '2'.
SELECT EKPO~EBELN EKPO~EBELP EKPO~MATNR EKPO~TXZ01 EKPO~WERKS
EKPO~NETWR EKPO~MENGE EKPO~MWSKZ EKPO~NETPR EKPO~PACKNO
FROM EKPO
INTO CORRESPONDING FIELDS OF TABLE ITAB1
FOR ALL ENTRIES IN ITAB
WHERE EKPO~EBELN = ITAB-EBELN and
EKPO~BUKRS = 'GSPL'.
SELECT EKKN~EBELN EKKN~EBELP EKKN~KOSTL EKKN~PS_PSP_PNR
FROM EKKN
INTO CORRESPONDING FIELDS OF TABLE ITAB2
FOR ALL ENTRIES IN ITAB1
WHERE EKKN~EBELN = ITAB1-EBELN AND
EKKN~EBELP = ITAB1-EBELP.
SELECT KONV~KNUMV KONV~KSCHL KONV~KBETR KONV~KWERT KONV~KWERT
KONV~KPOSN
FROM KONV
INTO CORRESPONDING FIELDS OF TABLE ITAB5
WHERE KONV~KNUMV = ITAB1-KNUMV AND
KONV~KPOSN = ITAB1-EBELP.
* SELECT LFA1~NAME1 LFA1~NAME2 FROM LFA1
* INTO CORRESPONDING FIELDS OF TABLE ITAB1
* WHERE LFA1~LIFNR = ITAB-LIFNR.
* SELECT ESLL~SUB_PACKNO ESLL~SRVPOS
* ESLL~EXTROW ESLL~KTEXT1 FROM ESLL
* INTO CORRESPONDING FIELDS OF TABLE ITAB6
* FOR ALL ENTRIES IN ITAB1
* WHERE ESLL~PACKNO = ITAB1-PACKNO .
** SELECT ESLL~SUB_PACKNO FROM ESLL
** INTO CORRESPONDING FIELDS OF TABLE ITAB6
** FOR ALL ENTRIES IN ITAB1
** WHERE ESLL~PACKNO = ITAB1-PACKNO.
* SELECT ESLL~SUB_PACKNO ESLL~SRVPOS
* ESLL~EXTROW ESLL~KTEXT1 FROM ESLL
* INTO CORRESPONDING FIELDS OF TABLE ITAB8
* FOR ALL ENTRIES IN ITAB6
* WHERE ESLL~PACKNO = ITAB6-SUB_PACKNO .
* SELECT RSEG~BELNR RSEG~GJAHR FROM RSEG
* INTO CORRESPONDING FIELDS OF TABLE ITAB7
* FOR ALL ENTRIES IN ITAB
* WHERE RSEG~BELNR = ITAB-BELNR AND
* RSEG~GJAHR = ITAB-GJAHR.
*LOOP AT ITAB1.
LOOP AT ITAB.
READ TABLE ITAB1 WITH KEY EBELN = ITAB-EBELN.
* IF ITAB1-EBELN = ITAB-EBELN.
IF sy-subrc eq 0.
* ITAB1-EBELN = ITAB-EBELN.
ITAB1-LIFNR = ITAB-LIFNR.
* ITAB1-EBELP = ITAB-EBELP.
ITAB1-BELNR = ITAB-BELNR.
ITAB1-KNUMV = ITAB-KNUMV.
ITAB1-NAME1 = ITAB-NAME1.
ITAB-NAME2 = ITAB-NAME2.
ITAB1-GJAHR = ITAB-GJAHR.
modify itab1 index sy-tabix.
ENDIF.
ENDLOOP.
*LOOP AT ITAB2.
* READ TABLE ITAB1 WITH KEY EBELN = ITAB2-EBELN.
* IF sy-subrc eq 0.
* ITAB1-EBELN = ITAB2-EBELN.
* ITAB1-PS_PSP_PNR = ITAB2-PS_PSP_PNR.
* ITAB1-KOSTL = ITAB2-KOSTL.
* modify itab1 transporting ps_psp_pnr kostl
* where ebeln = Itab2-ebeln AND EBELP = ITAB2-EBELP.
* ENDIF.
*ENDLOOP.
LOOP AT ITAB1.
**ON CHANGE OF ITAB1-ebeln or itab1-ebelp.
* concatenate itab1-werks itab1-lifnr itab1-matnr
* into val1.
* MOVE VAL1 TO ITAB1-VAKEY.
* MODIFY ITAB1.
* SELECT KONH~KNUMH KONH~KSCHL FROM KONH
* INTO CORRESPONDING FIELDS OF TABLE ITAB3
* FOR ALL ENTRIES IN ITAB1
* WHERE KONH~VAKEY = ITAB1-VAKEY.
**endon.
** sort Itab3 by kschl descending.
** Select konp-kbetr from konp into itab4 where
** KONP~KNUMH = ITAB3-KNUMH AND KONP~KSCHL = ITAB3-KSCHL.
**ON CHANGE OF ITAB1-ebelp.
**LOOP AT ITAB3
** ON CHANGE OF ITAB1-ebelp.
* itab1-knumh = itab3-knumh.
** SELECT KONP~KBETR FROM KONP INTO CORRESPONDING FIELDS
** OF TABLE ITAB4
** FOR ALL ENTRIES IN ITAB3 WHERE
** KONP~KNUMH = ITAB3-KNUMH AND KONP~KSCHL = ITAB3-KSCHL .
** IF ITAB3-KSCHL = 'JMOP' .
** ED = ITAB4-KBETR / 1000 * ITAB1-NETWR .
** ENDIF.
** IF ITAB3-KSCHL = 'JEC1'.
** Itab1-ed1 = ITAB4-KBETR / 1000 * ED.
** ADD ED TO ITAB1-ED1.
** modify ITAB1 transporting ed1.
** ENDIF.
* IF ITAB3-KSCHL = 'JMOP' .
* ED = 16 / 100 * ITAB1-NETWR .
* ENDIF.
* IF ITAB3-KSCHL = 'JEC1'.
* Itab1-ed1 = 2 / 100 * ED.
* ADD ED TO ITAB1-ED1.
* modify ITAB1 transporting ed1.
* ENDIF.
** ENDLOOP.
**endon.
modify ITAB1.
*endon.
LOOP AT ITAB5.
IF ITAB5-KSCHL = 'NAVS' OR ITAB5-KSCHL = 'NAVM'.
ITAB1-KBETR = ITAB5-KBETR.
modify ITAB1 transporting KBETR
where KNUMV = ITAB1-KNUMV AND EBELP = ITAB1-EBELP .
ELSEIF ITAB5-KSCHL = 'FRA1' OR ITAB5-KSCHL = 'FRC1' OR
ITAB5-KSCHL = 'FRB1'.
ITAB1-KWERT = ITAB5-KWERT .
modify ITAB1 transporting KWERT
where KNUMV = ITAB1-KNUMV AND EBELP = ITAB1-EBELP
* IF ITAB5-KSCHL = 'FRA1'.
* ITAB1-KBETR1 = ITAB5-KBETR / 1000 * ITAB1-NETWR .
* modify ITAB1 transporting KBETR1
* where KNUMV = ITAB1-KNUMV AND EBELP = ITAB1-EBELP
* ELSEIF ITAB5-KSCHL = 'FRC1' .
* ITAB1-KBETR1 = ITAB5-KBETR * ITAB1-MENGE .
* modify ITAB1 transporting KBETR1
* where KNUMV = ITAB1-KNUMV AND EBELP = ITAB1-EBELP
* ELSEIF ITAB5-KSCHL = 'FRB1' .
* ITAB1-KBETR1 = ITAB5-KBETR .
* modify ITAB1 transporting KBETR1
* where KNUMV = ITAB1-KNUMV AND EBELP = ITAB1-EBELP
* ENDIF.
* **THIS CODE IS FOR iNSURANCE CONDITION
ELSEIF ITAB5-KSCHL = 'ZGIN' OR ITAB5-KSCHL = 'ZIN2'.
ITAB1-KBETR2 = ITAB5-KBETR.
modify ITAB1 transporting KBETR2
where KNUMV = ITAB1-KNUMV AND EBELP = ITAB1-EBELP
* **THIS CODE IS FOR PBXX OR PB00 CONDITION
* ELSEIF ITAB5-KSCHL = 'PBXX' OR ITAB5-KSCHL = 'PB00'.
* ITAB1-KWERT1 = ITAB5-KWERT1.
* modify ITAB1 transporting KWERT1
* where KNUMV = ITAB1-KNUMV AND EBELP = ITAB1-EBELP
** ELSEIF ITAB5-KSCHL = 'JOCM' OR ITAB5-KSCHL = 'RA00' OR
** ITAB5-KSCHL = 'RA01' OR ITAB5-KSCHL = 'RB00' OR
** ITAB5-KSCHL = 'RC00' OR
**THIS CODE IS FOR OTHER CONDITION
ELSEIF ITAB5-KSCHL = 'RL01' OR ITAB5-KSCHL = 'ZA00' OR
ITAB5-KSCHL = 'ZA01' OR ITAB5-KSCHL = 'ZAE1' OR
ITAB5-KSCHL = 'ZAED' OR
ITAB5-KSCHL = 'ZAFR' OR ITAB5-KSCHL = 'ZB00' OR
ITAB5-KSCHL = 'ZBCH' OR ITAB5-KSCHL = 'ZBED' OR
ITAB5-KSCHL = 'ZC00' OR
ITAB5-KSCHL = 'ZCEX' OR ITAB5-KSCHL = 'ZCIF' OR
ITAB5-KSCHL = 'ZHC1' OR ITAB5-KSCHL = 'ZHC2' OR
ITAB5-KSCHL = 'ZHCT' OR
ITAB5-KSCHL = 'ZHCV' OR ITAB5-KSCHL = 'ZJOC' OR
ITAB5-KSCHL = 'ZOTH' OR ITAB5-KSCHL = 'ZOTP' OR
ITAB5-KSCHL = 'ZOTT' OR
ITAB5-KSCHL = 'ZPK1' OR ITAB5-KSCHL = 'ZPK2' OR
ITAB5-KSCHL = 'ZPK3' OR ITAB5-KSCHL = 'ZPK4' OR
ITAB5-KSCHL = 'ZRPO' OR
ITAB5-KSCHL = 'ZSE1' OR ITAB5-KSCHL = 'ZSED' OR
ITAB5-KSCHL = 'ZSFR' OR ITAB5-KSCHL = 'ZSTX' OR
ITAB5-KSCHL = 'ZTPI' OR
ITAB5-KSCHL = 'ZTPV' OR ITAB5-KSCHL = 'ZTRD' OR
ITAB5-KSCHL = 'ZWCT'.
ITAB1-KWERT2 = ITAB5-KWERT.
modify ITAB1 transporting KWERT2
where KNUMV = ITAB1-KNUMV AND EBELP = ITAB1-EBELP
modify itab1.
ENDIF.
ENDLOOP .
ITAB1-TOTAL = ITAB1-NETWR + ITAB1-KWERT2 + ITAB1-KWERT + ITAB1-KBETR.
* ITAB1-TOTAL = ITAB1-NETWR + ITAB1-ED1 + ITAB1-KBETR2 +
* ITAB1-KBETR1 + ITAB1-KBETR + ITAB1-KWERT .
modify ITAB1 transporting TOTAL.
LOOP AT ITAB6.
ITAB1-SUB_PACKNO = ITAB6-SUB_PACKNO.
* modify ITAB1.
ENDLOOP.
LOOP AT ITAB7.
ITAB1-BELNR = ITAB7-BELNR.
ITAB1-GJAHR = ITAB7-GJAHR.
ENDLOOP.
LOOP AT ITAB8.
ITAB1-SUB_PACKNO = ITAB8-SUB_PACKNO.
ITAB1-SRVPOS = ITAB8-SRVPOS.
ITAB1-EXTROW = ITAB8-EXTROW.
ITAB1-KTEXT1 = ITAB8-KTEXT1.
modify ITAB1.
ENDLOOP.
* SELECT ESLL~PACKNO ESLL~SUB_PACKNO ESLL~SRVPOS ESLL~KTEXT1
* FROM ESLL
* INTO CORRESPONDING FIELDS OF TABLE ITAB6
* WHERE ESLL~PACKNO = ITAB1-PACKNO.
** delete adjacent duplicates from itab1 comparing EBELN .
modify ITAB1.
endloop.
sort Itab1 by EBELN Ascending.
SELECT KONV~KBETR FROM KONV
INTO ITAB1-KBETR
WHERE KONV~KSCHL = 'NAVS' OR KONV~KSCHL = 'NAVM'.
ENDSELECT.
ITAB1-KBETR = ITAB5-KBETR.
*ENDLOOP.
*ENDLOOP.
*ENDLOOP.
ENDFORM.
Reward all helpfull answers
Regards
Pavan
Similar Messages
-
Get Folder details(CV01N) based on material.
Hi Friends,
I have created a document(CV01N) and linked the material via program. I need to add the same material in root folder which is in Document browser tab.
I'll get the corresponding material number range and add it.
How to get the folder based on material.
Thanks with Regards,
Vallamuthu M.Solved.
Get data from AUSP table using ATWRT field.
Thanks with Regards,
Vallamuthu M. -
Delivery split for STO based on Material Loading Group
Hello, I want to split the Delivery created from STO based on material loading group. I checked SAP Note:166397 and it requires copying routine. But this solution is not accepted and looking for other solutions. Please help with any user-exit or badi which can solve the purpose. Delivery needs to be created from VL10B transaction.
Edited by: ananthula sumanth on Aug 6, 2010 9:12 AMThe copy routine is designed for this purpose - it's not clear why the client does not allow the use of it. In my opinion you should find the root casue of their resistance and offer an acceptable solution (if it is possible).
If you want to solve it in another way I guess you should go into a big development and develop your own copy routine functionality which could mean much more work (for you) and money (of your client) - instread of modifying a copy routine (maybe within few minutes). -
Block sales order creation based on material qty
Hi,
In my scenario i want to block the sales order creation based on material qty , how i can do this?
Example:
Material qty below 100 = able to create sales order
Material qty above 100 = not able to create SO
Thanks,
ArunHi
For restricting the order if it is less than a specified qty, you can maintain the 'min order qty' in material master.
But your requirement is the other way round - Restrict order if it is more than specified qty.
In this case, you need to use the following sales order exit in progran MV45AFZZ
u2022 USEREXIT_SAVE_DOCUMENT_PREPARE
Use this user exit to make certain changes or checks immediately before saving a document. It is the last possibility for changing or checking a document before posting.
The user exit is carried out at the beginning of the FORM routine BELEG_SICHERN.
Hope this helps.
Regards
Madhu -
Problem with replication based on materialized view
Problem with replication based on materialized view...
Given:
1. Source: S-1
2. Targets: T-1, T-2
3. DB links: from T-1 to S-1, from T-2 to S-1
Required replicate table TBL on S-1 to T-1, T-2 via db links.
On S-1 was created materialized view log with PK on TBL. On T-1, T-2 were created mat.views as "on prebuilt table refresh fast on demand". In case of get "ORA-12034: materialized view log younger than last refresh" or initial load - perform complete refresh. Initial load on T-1 takes about 1 hour, on T-2 - about 12 hours. Refresh is executed via job with minutely interval. If refresh is running then it is not performed.
Problem: after initial load on T-1 performs fast refresh, but on T-2 raised ORA-12034 and complete performs again.
What's wrong?34MCA2K2, Google lover?
I confess perhaps I gave a little info.
View log was created before MV.
It was the first initial load.
No refresh failed.
No DDL.
No purge log.
Not warehouse.
There is no such behavior for MVs on another sites.
P.S. I ask help someone who knows what's wrong or who faced with it or can me follow by usefull link.
P.P.S. It's a pity that there is no button "Useless answer" -
Contracts based on Material Groups....
Can we create Contracts based on material Group?
Like We want to create a contract for Material Group Casting. We want to negotiate terms for Material Group & then procure the part.
How do we do this?
Thanks AnupamCreate a Quantiy Contract with Item Category 'M'- Material Unknown.
Then create PO refering to this contract.
System asks for material number or AAC. It also checks the material group against the one in the contract.
By defaut a warning message is issued if material groups do not match (message MEPO074).
This can be set to 'E' in customising but SAP gives a warning when you trying to set this message as error.
Customising path: SPRO>MM>Purchasing>Environment>Define attributes of system messages.
It is also possible to code this check in PO user exit and issue a custom message. -
PO release strategy based on Material Group (CEKKO - MAKTL)
Hi Experts,
I have configure the Rel strategy based CEKKO-MATKL (material group) for purchase order, but when i raise the PO Rel strategy is not affecting, Can any body tell me why.
Regards,
KumarYou can set Release strategy based on Material group & other Line item specific fields..
You better follow a suitable and hinder less process..
For PR use Material group & Account Assignment based Release process..
then for PO use a Release Process based on Header level fields like Doc type, Amount, pur Group etc..
So that the approved PR line can be converted into PR and then the PO also subjected to Release before sending it to External Vendor..
Even if you want you can make that the PO can not be created without referencing PR for SOme users or All users..
based on your business requirement.. -
PO release based on Material Group
Gurus
Client wants to release PO based on material groups, Client will ensure that all the materials in the PO would be of same material group.
i see CEKKO has material group MATKL field .. but not sure how we have to implement this..
Do we have to use some exit or badi?
regards
Mohammedmohammed wrote:
Gurus
>
> Client wants to release PO based on material groups, Client will ensure that all the materials in the PO would be of same material group.
>
> i see CEKKO has material group MATKL field .. but not sure how we have to implement this..
>
> Do we have to use some exit or badi?
>
> regards
> Mohammed
HI,
For this you have to create one characteristic for material groupand that characteristic in additional data view you have to maintain table and field as( CEKKO,MATKL) .and in values tab you have to given your all material groups .
After that your characteristic to be assign to your class.
thanking you. -
Hello,
In our current system the system looks on based of the Requisitioner and under which Purchasing Group the Requisitoner is set under PPOMA_BBP where the Purchase Requisition is going. Then the Purchaser can create a Purchase Order. Under each Purchasing Group is an appointed Purchaser.
Weu2019d like to change this proces. We want this change based on material group. However, when multiple Purchasing Groups use the same material groups than the system always looks for the top Purchasing Group. This is not the intention. Can this set separately in PPOMA_BBP? Or elsewhere in the system?
Thanks in advance.
Best regards,
Petra de WinterIssue resolved
-
QC Activity based on Material Production Version
Hi,
Normally, we perform QC activity based on Material Code, i.e. in Material Master we maintain inspection type in QM View for material which needs QC activation during Good Receipt from Production
Is it possible to perform QC Activity based on Production Version of a material i.e.
For Example
Product A having 2 Production Versions
IF Product A with Production Version 1 then No QC required during goods receipt from production
IF Product A with Production Version 2 then QC required during goods receipt from production
So please tell me what feasible solution possible from your side
With Regards,
Kunal ShethDear Sap User,
Production version is nothing just a combination of Master recipe/Routing and BOM used for particular production or process.
If you are having so many production version then you have to choose which you want to choose but if you are having a single production version then it will be chosen automatically.
Do it once and revert in case of any query.
Rgrds,
Dheeraj Rawal
Edited by: Dheeraj89 on Feb 9, 2012 6:13 AM -
Hi Experts,
I have a new customer requirement, Customer does not want invoices based on the order They want invoices on monthly basis and based on the material means like they want the invoice for all the orders with material A for the month of April 2011.
I tried to search something logical in forum but was not able to find it, any suggestions will be appreciated.
Regards,
JainHI
Better you go for yr customised programme where u can have option to enter material and check delivery table and get all delivery no for that particular material and then do billing and invoice. Take help of your ABAPer give him your requirement with logic for monthly billing and sure he will be able to write a customised programme to fulfill yr requirement.
In short, Here is the way..... Get a customised programme where you select all dliveries for a partuicular period by date range, from delivery table based on material and call VF01 ( as u know billing is based on payer. Payer must be same for all deliveries. U can add to check payer criteria as well with material) and then invoice.
Have a nice day!
Thanks
DK:)
Edited by: Dwarkesh Thakkar on Jun 24, 2011 12:17 PM -
HOW TO FIND LAST DOCUMENT DATE BASED ON MATERIAL NUMBER
Hi,
I want to know how to find the last document details based on material number.
Is there any Functional modulle or BAPI programe?
i,e, I want know last goods receipt details (MIGO) based on material number.
Can u please anybody tell me.
Thanks,
S.Muthu.
Edited by: Subramaniyan Marimuthu on Jan 2, 2008 9:07 AMHello.
Check the BAPI_GOODSMVT_GETITEMS
-example--
Get GRs after a specific date for a specific plant/ storage location and movement types
wa_budats-sign = 'I'.
wa_budats-option = 'GE'.
wa_budats-low = '20071201'.
APPEND wa_budats TO budats.
wa_plants-sign = 'I'.
wa_plants-option = 'EQ'.
wa_plants-low = '1000'.
APPEND wa_plants TO plants.
wa_stlocs-sign = 'I'.
wa_stlocs-option = 'EQ'.
wa_stlocs-low = '0001'.
APPEND wa_stlocs TO stlocs.
wa_mvts-sign = 'I'.
wa_mvts-option = 'EQ'.
wa_mvts-low = '101'.
APPEND wa_mvts TO mvts.
wa_mvts-low = '901'.
APPEND wa_mvts TO mvts.
wa_mvts-low = '123'.
APPEND wa_mvts TO mvts.
CALL FUNCTION 'BAPI_GOODSMVT_GETITEMS'
TABLES
plant_ra = plants
stge_loc_ra = stlocs
move_type_ra = mvts
pstng_date_ra = budats
goodsmvt_header = header
goodsmvt_items = item
return = return.
Reward if helpful.
Cheers,
George -
List of stocks based on material types
Hi,
I need a list of stocks overview based on material types.
Ex:
Need a list of current stocks for finished materials.
Kindly help reg this.
sathyaHi,
Check in MC.9 transaction to get the list of stocks based on the Material types along with materials & material description with Value & stocks
The Report will give you all the details with respect to material types, Material group etc. for a particular period or as on period also.
rgds
gsc -
How to check weather a material created is active or not
Dear Friends
1 How to check weather a material created is active or not.
2 MIGO standard document has a check button, can we have similar check button in other documents like Purchase requisition.
3 In case of material valuation is Standard (Price control), the costing is done on the basis of the Standard Price or actual cost of the raw material.
I will be thankful for your advice.
Sanjeev1 How to check weather a material created is active or not.
There is a Blue "i" button for the Material, pls click that it will show you the current status..
2 MIGO standard document has a check button, can we have similar check button in other documents like Purchase requisition.
for PR you can see the check button( CtrlShiftF3) beside personal settings -
How to get ATINN value based on material number and Class Type ?
I have below SELECT stmt code which gives the correct value of atwrt based on materil no and ATINN.
However in quality system, it is failing because in quality system "atinn" value is not 0000000381. It is different.
So how can I get ATINN(Internal characteristic) value based on material number and Class Type?
-Obtain the batch characterstic value for the Material******************
SELECT atwrt
UP TO 1 ROWS
INTO v_charvalue
FROM ausp
WHERE objek = mcha-matnr
AND atinn = '0000000381' " 'US80_FRENCH_ON_LABEL'
AND klart = '001'.
THANKS N ADVANCE.Hi SAm,
use the Below function module to get the Atinn for Atwrt for thr Class and MAterial combination..
CALL FUNCTION 'CLAF_CLASSIFICATION_OF_OBJECTS'
EXPORTING
classtype = '023' "Class type
object = w_object "Material number with Leading zeros
no_value_descript = 'X' "Default X
objecttable = 'MCH1' "Table name Mara or MCH1 or MARC
TABLES
t_class = t_class "It return the Batch class available for the above combination
t_objectdata = t_char "Return Batch characteristics(ATWRT) and their value ATINN in this table
EXCEPTIONS
no_classification = 1
no_classtypes = 2
invalid_class_type = 3
OTHERS = 4.
Regards,
Prabhudas
Maybe you are looking for
-
Hi all, I am having an issue with my Photoshop CS4 version 11.0.2 I am running it in a Macintosh environment. Mac Pro 2.8 GHz Quad-Core Intel Xeon with 12 GB ram. OS Snow Leopard 10.6.8, the scratch disk is set to an empty partition on an external La
-
Programs for converting avi to mp4/h.264
As the title says. I'm looking for a really good program for this, i want really good video quality, and it doesn't matter if the program is for free or if u need to buy it. I'm a windows user.
-
IWeb starts but don't show project window on OSX Lion
I used iWeb 3.0.4 on Snow leopard but after i updated to lion 10.7.3, iWeb don't show project window. When i click on the app, it launches then nothing on screen, no project windows. I have removed the plist files again and again but nothing changed.
-
AS 3 compatible with AS2 player???
Hi. We recently upgraded to Captivate 5 and altought the text and image look great in preview and web browser it displays faded and blurry in LMS. Is this a matter of scripting? Does the problem appear because Captivate 5 publishes in AS 3 but the p
-
PE8 won't import .mov files
I am using a new installation of PE8 on a new computer. When attempting to import .mov files I get a message saying that the file type is not supported or the required codec is not installed. .mov files should be supported and there was never a probl