EBKN-PS_PSP_PNR proviede in BI as posid
Hi,
I created a view of eban and ekbn in the sourcesystem (I didn't find something in the content).
But I have the problem, that I get WBS-element only as a numeric field in BI (comes from EBKN-PS_PSP_PNR) for example 00010487 not like I need it for example E/000250-ERG.
Now I'm not able to work with this infromation, I need the 'external' wbs-Element.
Could somebody help me, I don't know where and how I have to do something.
Thank you in advance, Kind Regards Manuela
I tried Shilpa's soultion and it worked for me (I was sending WBS element in txt file out of SAP):
call function 'CONVERSION_EXIT_ABPSP_OUTPUT'
exporting
input = ls_ebkn-ps_psp_pnr
importing
output = cs_file-pp_idaccnt
BR,
Tomek .
Similar Messages
-
I've been assigned to make some modification to an incomplete program written by another ABAPer. I have managed to fulfill most of what is required by the specification document, however, i'm having difficulty with a particular AT NEW statement that will WRITE a new PR Doc Type whenever the next line of output belongs to a different PR Doc Type than the previous line.
Currently, the PR Doc Type is always being written at each new line, no matter whether the current like is the same or different from the previous line's PR Doc Type.
Could you guys have a look what i have done so far?
NOTE: The original coding that i removed from the program were not deleted, i just * it
REPORT ZRMME006 NO STANDARD PAGE HEADING
MESSAGE-ID 38
LINE-SIZE 255
LINE-COUNT 65.
TABLES: EBAN, "Purchase Requisition
EBKN, "Purchase Requisition Account Assignment
EKKO, "Purchasing Document Header
EKPO, "Purchasing Document Item
EKBE, "History of Purchasing Document
EKET, "Scheduling Agreement Delivery Schedules
CDPOS, "Change document items
CDHDR, "Change document header
PRPS, "WBS (Work Breakdown Structure) Element Master Data
T161T. "Text for Purchasing Document Types
* DATA DECLARATION
DATA: BEGIN OF T_PR OCCURS 0,
KNTTP LIKE EBAN-KNTTP, "Account assignment category
KOSTL LIKE EBKN-KOSTL, "Cost center
POSID LIKE PRPS-POSID, "Project code name
PS_PSP_PNR LIKE EBKN-PS_PSP_PNR, "WBS element
ERNAM LIKE EBAN-ERNAM, "User ID
BANFN LIKE EBAN-BANFN, "PR number
BNFPO LIKE EBAN-BNFPO, "PR item number
MATNR LIKE EBAN-MATNR, "Material number
TXZ01 LIKE EBAN-TXZ01, "Material description
BSART LIKE EBAN-BSART, "PR document type
BATXT LIKE T161T-BATXT, "Desc of purchasing doc type
EBELN LIKE EBAN-EBELN, "PO number - eban
EKKO_EBELN LIKE EKKO-EBELN, "PO number - ekko
EKET_EBELN LIKE EKET-EBELN, "PO number - eket
EBELP LIKE EBAN-EBELP, "PO item number - eban
EKPO_EBELP LIKE EKPO-EBELP, "PO item number - ekpo
EKET_EBELP LIKE EKET-EBELP, "PO item number - eket
BADAT LIKE EBAN-BADAT, "PR creation date
CHANGENR_PR LIKE CDPOS-CHANGENR, "PR changenr
UDATE_PR LIKE CDHDR-UDATE, "PR approval date
ANFNR LIKE EKPO-ANFNR, "RFQ number
ANFPS LIKE EKPO-ANFPS, "RFQ item number
CHANGENR_RFQ LIKE CDPOS-CHANGENR, "RFQ changenr
UDATE_RFQ LIKE CDHDR-UDATE, "RFQ maintained date
AEDAT LIKE EKPO-AEDAT, "PO creation date
EINDT LIKE EKET-EINDT, "PO required (dev date)
CHANGENR_PO LIKE CDPOS-CHANGENR, "PO changenr
UDATE_PO LIKE CDHDR-UDATE, "PO approval date
DATVR_PO LIKE NAST-DATVR, "PO printed date
CPUDT LIKE EKBE-CPUDT, "GRN delivered date
FRGZU LIKE EBAN-FRGZU, "Release status
EKKO_FRGZU LIKE EKKO-FRGZU, "Release status
RFQ_AEDAT LIKE EKPO-AEDAT, "RFQ creation date
VSTAT LIKE NAST-VSTAT, "Processing status of message
EKGRP LIKE EBAN-EKGRP, "Purchasing group
END OF T_PR.
DATA: BEGIN OF T_DATE OCCURS 0,
CPUDT LIKE EKBE-CPUDT,
EBELN LIKE EKKO-EBELN,
EBELP LIKE EKPO-EBELP,
END OF T_DATE.
DATA: BEGIN OF T_PUR OCCURS 0.
INCLUDE STRUCTURE T_PR.
DATA: END OF T_PUR.
DATA: V_PRDAY(10) TYPE C, "PR days
V_RFQDAY(10) TYPE C, "RFQ days
V_PODAY(10) TYPE C, "PO days
V_GRNDAY(10) TYPE C, "GRN days
V_STADAY TYPE I, "Standard days
V_ACTDAY TYPE I, "Actual days
V_VARDAY(10) TYPE C, "Variance
V_RELPR TYPE I, "Release pr days
V_RELPO TYPE I, "Release po days
V_PRTEMP(10),
V_RFQTEMP(10),
V_POTEMP(10),
V_GRNTEMP(10),
V_FLAG(1) TYPE C,
V_FLAG2(1) TYPE C,
V_FLAG3(1) TYPE C,
V_COUNT TYPE I,
V_COUNT_MOD TYPE I,
V_SDATE LIKE SY-DATUM,
V_EDATE LIKE SY-DATUM,
V_LEN TYPE I,
V_LEN2 TYPE I.
DATA: CHECK(1) TYPE C. "DEVK951017
* selection screen *
SELECTION-SCREEN BEGIN OF BLOCK BLK1 WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS: S_WERKS FOR EBAN-WERKS DEFAULT '6001' to '6002', "Plant
S_EKORG FOR EBAN-EKORG DEFAULT '6001' NO INTERVALS,
"Purch Org
S_BSART FOR EBAN-BSART,
"PR type
S_BANFN FOR EBAN-BANFN,
"PR number
S_BADAT FOR EBAN-BADAT.
"PR date
SELECTION-SCREEN END OF BLOCK BLK1.
SELECTION-SCREEN BEGIN OF BLOCK BLK2 WITH FRAME TITLE TEXT-002.
SELECT-OPTIONS: S_KOSTL FOR EBKN-KOSTL, "Cost ctr
S_PS_PNR FOR EBKN-PS_PSP_PNR NO-DISPLAY, "Project code
S_ERNAM FOR EBAN-ERNAM. "User ID
PARAMETERS: P_ASSET AS CHECKBOX DEFAULT 'X', "Acct Assign - A
P_KOSTL AS CHECKBOX DEFAULT 'X', "Acct Assign - K
P_ERNAM AS CHECKBOX DEFAULT 'X', "Acct Assign - Z
P_BSI AS CHECKBOX DEFAULT 'X', "Acct Assign - H
P_MOI AS CHECKBOX DEFAULT 'X', "Acct Assign - F
P_STA AS CHECKBOX DEFAULT 'X'. "Acct Assign - <blank>
SELECTION-SCREEN END OF BLOCK BLK2.
SELECTION-SCREEN BEGIN OF BLOCK BLK3 WITH FRAME TITLE TEXT-003.
PARAMETERS: P_CON RADIOBUTTON GROUP PGRP, "Overseas
P_LCL RADIOBUTTON GROUP PGRP, "Local
P_ALL RADIOBUTTON GROUP PGRP DEFAULT 'X'. "All
SELECTION-SCREEN END OF BLOCK BLK3.
*--> range of knttp that the report will only select
RANGES: S_KNTTP FOR EBAN-KNTTP,
*--> range of tcode that approval obtained from
S_TCODE FOR CDHDR-TCODE.
TOP-OF-PAGE.
* perform write_rpttop using sy-title v_sdate v_edate. "DEVK951017
*PERFORM WRITE_RPTTOP USING SY-TITLE S_BADAT-LOW S_BADAT-
*HIGH."DEVK951017
* START-OF-SELECTION
START-OF-SELECTION.
PERFORM INITIALISATION.
IF P_ASSET IS INITIAL AND
P_KOSTL IS INITIAL AND
P_ERNAM IS INITIAL AND
P_BSI IS INITIAL AND
P_MOI IS INITIAL AND
P_STA IS INITIAL.
MESSAGE S000 WITH TEXT-E02.
EXIT.
ELSE.
PERFORM SELECT_DATA.
IF V_FLAG NE 'X'.
PERFORM WRITE_REPORT.
* PERFORM GET_TPAGENO.
* PERFORM WRITE_RPTEND.
ELSE.
MESSAGE S000 WITH TEXT-E01.
ENDIF.
ENDIF.
*& Form SELECT_DATA
FORM SELECT_DATA.
IF P_CON EQ 'X'.
SELECT X~KNTTP Y~KOSTL X~ERNAM X~BANFN X~BNFPO X~MATNR
X~TXZ01 X~BSART X~EBELN X~EBELP X~BADAT X~FRGZU
FROM ( EBAN AS X
INNER JOIN EBKN AS Y
ON X~BANFN EQ Y~BANFN AND
X~BNFPO EQ Y~BNFPO )
APPENDING CORRESPONDING FIELDS OF TABLE T_PR
WHERE X~BANFN IN S_BANFN AND
X~LOEKZ EQ '' AND
X~KNTTP IN S_KNTTP AND
X~WERKS IN S_WERKS AND
X~BADAT IN S_BADAT AND
X~ERNAM IN S_ERNAM AND
X~BSART IN S_BSART AND
X~EKORG IN S_EKORG AND
Y~KOSTL IN S_KOSTL AND
EKGRP = 'OVS' AND
EKGRP = 'CON'.
ELSEIF P_LCL EQ 'X'.
SELECT X~KNTTP Y~KOSTL X~ERNAM X~BANFN X~BNFPO X~MATNR
X~TXZ01 X~BSART X~EBELN X~EBELP X~BADAT X~FRGZU
FROM ( EBAN AS X
INNER JOIN EBKN AS Y
ON X~BANFN EQ Y~BANFN AND
X~BNFPO EQ Y~BNFPO )
APPENDING CORRESPONDING FIELDS OF TABLE T_PR
WHERE X~BANFN IN S_BANFN AND
X~LOEKZ EQ '' AND
X~KNTTP IN S_KNTTP AND
X~WERKS IN S_WERKS AND
X~BADAT IN S_BADAT AND
X~ERNAM IN S_ERNAM AND
X~BSART IN S_BSART AND
X~EKORG IN S_EKORG AND
Y~KOSTL IN S_KOSTL AND
EKGRP = 'LCL'.
ELSE.
SELECT X~KNTTP Y~KOSTL X~ERNAM X~BANFN X~BNFPO X~MATNR
X~TXZ01 X~BSART X~EBELN X~EBELP X~BADAT X~FRGZU
FROM ( EBAN AS X
INNER JOIN EBKN AS Y
ON X~BANFN EQ Y~BANFN AND
X~BNFPO EQ Y~BNFPO )
APPENDING CORRESPONDING FIELDS OF TABLE T_PR
WHERE X~BANFN IN S_BANFN AND
X~LOEKZ EQ '' AND
X~KNTTP IN S_KNTTP AND
X~WERKS IN S_WERKS AND
X~BADAT IN S_BADAT AND
X~ERNAM IN S_ERNAM AND
X~BSART IN S_BSART AND
X~EKORG IN S_EKORG AND
Y~KOSTL IN S_KOSTL.
ENDIF.
* SELECT * FROM ZEPURDAY INTO T_PRDAY.
* APPEND T_PRDAY.
* ENDSELECT.
READ TABLE T_PR INDEX 1.
IF SY-SUBRC NE 0.
V_FLAG = 'X'.
ENDIF.
ENDFORM. " SELECT_DATA
*& Form WRITE_REPORT
FORM WRITE_REPORT.
DATA: V_ERNAM LIKE EBKN-ERNAM,
V_KOSTL LIKE EBKN-KOSTL.
*--> get from and to date for report header
PERFORM GET_TITLE_DATE.
*--> get header and line item data
PERFORM GET_HEADER_ITEM.
*--> check data entries of table zepurday.
* PERFORM CHECK_TZEPURDAY.
*--> identify sort key for sorting
PERFORM SORT.
CLEAR T_PUR.
LOOP AT T_PUR.
*--> get further data from tables against t_pr
PERFORM PROCESS_DATA.
*--> get standard day
PERFORM GET_STAND_DAY.
*--> get latest grn date
PERFORM GET_LATEST_GRNDATE.
*--> get actual day = GRN date - PR creation date
PERFORM GET_ACT_DAY.
*--> get variance days = Standard days - Actual days
PERFORM GET_VAR_DAY.
V_COUNT = V_COUNT + 1.
MOVE: T_PUR-ERNAM TO V_ERNAM,
T_PUR-KOSTL TO V_KOSTL.
AT NEW KNTTP.
IF V_FLAG3 NE 'X'.
* NEW-PAGE.
ENDIF.
V_FLAG3 = 'X'.
SKIP 1.
WRITE:/2 'Account Assignment:', 22(10) T_PUR-KNTTP COLOR COL_GROUP.
ENDAT.
*--> This is the part i am having trouble <--*
IF T_PUR-KNTTP EQ 'Z' OR
T_PUR-KNTTP EQ 'A' OR
T_PUR-KNTTP EQ 'K' OR
T_PUR-KNTTP EQ 'H' OR
T_PUR-KNTTP EQ 'F'.
AT NEW BSART.
SELECT SINGLE * FROM T161T
WHERE SPRAS = 'EN' AND
BSART = T_PUR-BSART AND
BSTYP = 'B'.
T_PUR-BATXT = T161T-BATXT.
IF V_FLAG3 NE 'X'.
ENDIF.
V_FLAG3 = 'X'.
WRITE:/2 'PR Doc Type Desc:',
22(3) T_PUR-BSART COLOR COL_GROUP.
WRITE: 26 T_PUR-BATXT NO-GAP COLOR COL_GROUP.
PERFORM WRITE_HEADER.
ENDAT.
ELSE.
AT NEW BSART.
SELECT SINGLE * FROM T161T
WHERE SPRAS = 'EN' AND
BSART = T_PUR-BSART AND
BSTYP = 'B'.
T_PUR-BATXT = T161T-BATXT.
IF V_FLAG3 NE 'X'.
ENDIF.
V_FLAG3 = 'X'.
WRITE:/2 'PR Doc Type Desc:',
22(3) T_PUR-BSART COLOR COL_GROUP.
WRITE: 26 T_PUR-BATXT NO-GAP COLOR COL_GROUP.
PERFORM WRITE_HEADER.
ENDAT.
ENDIF.
* IF T_PUR-KNTTP EQ 'Z'.
* AT NEW ERNAM.
* IF SY-LINNO >= 60.
* NEW-PAGE.
* ENDIF.
* WRITE:/2 'User ID:', 22(10) V_ERNAM COLOR COL_GROUP.
* PERFORM WRITE_HEADER. "write contents header
* ENDAT.
* ELSEIF T_PUR-KNTTP EQ 'A' OR T_PUR-KNTTP EQ 'K'.
* AT NEW KOSTL.
* IF SY-LINNO >= 60.
* NEW-PAGE.
* ENDIF.
* WRITE:/2 'Cost Center:', 22(10) V_KOSTL COLOR COL_GROUP.
* PERFORM WRITE_HEADER. "write contents header
* ENDAT.
* ELSEIF T_PUR-KNTTP EQ 'P'.
* AT NEW POSID.
* IF SY-LINNO >= 60.
* NEW-PAGE.
* ENDIF.
* WRITE:/2 'Project Code:', 22(10) T_PUR-POSID COLOR COL_GROUP.
* PERFORM WRITE_HEADER. "write contents header
* ENDAT.
* ENDIF.
*--> write report details
IF SY-LINNO >= 60.
ULINE (255).
NEW-PAGE.
PERFORM WRITE_HEADER.
ENDIF.
PERFORM INVERT_LINE_ITEMS_COLOR.
PERFORM WRITE_DETAILS.
*--> display data ordered by User ID/Cost Center/Project ID.
IF T_PUR-KNTTP EQ 'Z'.
AT END OF ERNAM.
ULINE (236).
SKIP 1.
FORMAT COLOR COL_BACKGROUND INTENSIFIED.
CLEAR: V_COUNT_MOD, V_COUNT.
ENDAT.
ELSEIF T_PUR-KNTTP EQ 'A' OR T_PUR-KNTTP EQ 'K'.
AT END OF KOSTL.
ULINE (236).
SKIP 1.
FORMAT COLOR COL_BACKGROUND INTENSIFIED.
CLEAR: V_COUNT_MOD, V_COUNT.
ENDAT.
ELSEIF T_PUR-KNTTP EQ 'H'.
AT END OF KOSTL.
ULINE (236).
SKIP 1.
FORMAT COLOR COL_BACKGROUND INTENSIFIED.
CLEAR: V_COUNT_MOD, V_COUNT.
ENDAT.
ELSEIF T_PUR-KNTTP EQ 'F'.
AT END OF KOSTL.
ULINE (236).
SKIP 1.
FORMAT COLOR COL_BACKGROUND INTENSIFIED.
CLEAR: V_COUNT_MOD, V_COUNT.
ENDAT.
ELSEIF T_PUR-KNTTP EQ ' '.
AT END OF KOSTL.
ULINE (236).
SKIP 1.
FORMAT COLOR COL_BACKGROUND INTENSIFIED.
CLEAR: V_COUNT_MOD, V_COUNT.
ENDAT.
ENDIF.
CLEAR: V_PRDAY,
V_PRTEMP,
V_RFQDAY,
V_RFQTEMP,
V_PODAY,
V_POTEMP,
V_GRNDAY,
V_GRNTEMP,
V_ACTDAY,
V_STADAY,
V_RELPR,
V_RELPO,
V_FLAG3.
ENDLOOP.
ENDFORM. " WRITE_REPORT
*& FORM INITIALISATION
*& Initialize value for s_knttp *
FORM INITIALISATION.
S_KNTTP-SIGN = 'I'.
S_KNTTP-OPTION = 'EQ'.
*--> BUDGETED ASSET
IF P_ASSET = 'X'.
S_KNTTP-LOW = 'A'.
APPEND S_KNTTP.
ENDIF.
*--> COST CENTER
IF P_KOSTL = 'X'.
S_KNTTP-LOW = 'K'.
APPEND S_KNTTP.
ENDIF.
*--> Project
*IF P_PCODE = 'X'.
* S_KNTTP-LOW = 'P'.
* APPEND S_KNTTP.f
*ENDIF.
*--> NON-BUDGETED ASSET
IF P_ERNAM = 'X'.
S_KNTTP-LOW = 'Z'.
APPEND S_KNTTP.
ENDIF.
*--> BALANCE SHEET ITEM
IF P_BSI = 'X'.
S_KNTTP-LOW = 'H'.
APPEND S_KNTTP.
ENDIF.
*--> MO ITEM
IF P_MOI = 'X'.
S_KNTTP-LOW = 'F'.
APPEND S_KNTTP.
ENDIF.
*--> STANDARD
IF P_STA = 'X'.
S_KNTTP-LOW = ' '.
APPEND S_KNTTP.
ENDIF.
S_TCODE-SIGN = 'I'.
S_TCODE-OPTION = 'EQ'.
S_TCODE-LOW = 'ZME55'.
APPEND S_TCODE.
S_TCODE-LOW = 'ME54'.
APPEND S_TCODE.
S_TCODE-LOW = 'ME28'.
APPEND S_TCODE.
S_TCODE-LOW = 'ME47'.
APPEND S_TCODE.
ENDFORM.
*& FORM SORT
FORM SORT.
CLEAR T_PUR.
LOOP AT T_PUR.
IF T_PUR-KNTTP EQ 'A' OR
T_PUR-KNTTP EQ 'K' OR
T_PUR-KNTTP EQ 'Z' OR
T_PUR-KNTTP EQ 'H' OR
T_PUR-KNTTP EQ 'F' OR
T_PUR-KNTTP EQ ' '.
SORT T_PUR BY BSART EBELN EBELP.
EXIT.
ENDIF.
ENDLOOP.
ENDFORM.
*& FORM PROCESS_DATA
FORM PROCESS_DATA.
DATA: V_TABKEY LIKE CDPOS-TABKEY,
V_TABKEY2 LIKE CDPOS-TABKEY,
V_TABKEY3 LIKE CDPOS-TABKEY.
CONCATENATE SY-MANDT T_PUR-BANFN T_PUR-BNFPO INTO V_TABKEY.
CONCATENATE SY-MANDT T_PUR-EBELN INTO V_TABKEY2.
CONCATENATE SY-MANDT T_PUR-ANFNR T_PUR-EKPO_EBELP INTO V_TABKEY3.
*--> get po history data
REFRESH T_DATE.
SELECT CPUDT EBELN EBELP
INTO CORRESPONDING FIELDS OF T_DATE
FROM EKBE
WHERE EBELN EQ T_PUR-EBELN AND EBELP EQ T_PUR-EBELP
AND BEWTP EQ 'E' AND BWART EQ '101'.
APPEND T_DATE.
ENDSELECT.
*-->get scheduling agreement delivery schedules data
SELECT EINDT INTO T_PUR-EINDT FROM EKET
WHERE EBELN EQ T_PUR-EBELN AND EBELP EQ T_PUR-EBELP.
MODIFY T_PUR TRANSPORTING EINDT
WHERE EBELN EQ T_PUR-EBELN AND EBELP EQ T_PUR-EBELP.
ENDSELECT.
*--> PR approval date
SELECT CHANGENR INTO T_PUR-CHANGENR_PR
FROM CDPOS
WHERE OBJECTCLAS EQ 'BANF' AND OBJECTID EQ T_PUR-BANFN
AND TABNAME EQ 'EBAN' AND TABKEY EQ V_TABKEY
AND FNAME EQ 'FRGKZ' AND CHNGIND EQ 'U'
AND VALUE_NEW EQ '2'.
MODIFY T_PUR TRANSPORTING CHANGENR_PR WHERE BANFN EQ T_PUR-BANFN.
ENDSELECT.
SELECT UDATE INTO T_PUR-UDATE_PR
FROM CDHDR
WHERE OBJECTCLAS EQ 'BANF' AND OBJECTID EQ T_PUR-BANFN
AND TCODE IN S_TCODE AND CHANGE_IND EQ 'U'
AND CHANGENR EQ T_PUR-CHANGENR_PR.
MODIFY T_PUR TRANSPORTING UDATE_PR WHERE BANFN EQ T_PUR-BANFN.
ENDSELECT.
*--> PO approval date
SELECT CHANGENR INTO T_PUR-CHANGENR_PO
FROM CDPOS
WHERE OBJECTCLAS EQ 'EINKBELEG' AND OBJECTID EQ T_PUR-EBELN
AND TABNAME EQ 'EKKO' AND TABKEY EQ V_TABKEY2
AND FNAME EQ 'FRGKE' AND CHNGIND EQ 'U'
AND VALUE_NEW EQ 'A'.
MODIFY T_PUR TRANSPORTING CHANGENR_PO WHERE EBELN EQ T_PUR-EBELN.
ENDSELECT.
SELECT UDATE INTO T_PUR-UDATE_PO
FROM CDHDR
WHERE OBJECTCLAS EQ 'EINKBELEG' AND OBJECTID EQ T_PUR-EBELN
AND TCODE IN S_TCODE AND CHANGE_IND EQ 'U'
AND CHANGENR EQ T_PUR-CHANGENR_PO.
MODIFY T_PUR TRANSPORTING UDATE_PO WHERE EBELN EQ T_PUR-EBELN.
ENDSELECT.
*--> PO printed date
SELECT DATVR VSTAT INTO (T_PUR-DATVR_PO, T_PUR-VSTAT)
FROM NAST
WHERE KAPPL EQ 'EF' AND OBJKY EQ T_PUR-EBELN.
* and vstat eq '1'.
MODIFY T_PUR TRANSPORTING DATVR_PO VSTAT
WHERE EBELN EQ T_PUR-EBELN.
ENDSELECT.
*--> RFQ maintained date
IF NOT T_PUR-ANFNR IS INITIAL.
SELECT CHANGENR INTO T_PUR-CHANGENR_RFQ
FROM CDPOS
WHERE OBJECTCLAS EQ 'EINKBELEG' AND OBJECTID EQ T_PUR-ANFNR
AND TABNAME EQ 'EKPO' AND TABKEY EQ V_TABKEY3
AND FNAME EQ 'NETPR' AND CHNGIND EQ 'U'.
MODIFY T_PUR TRANSPORTING CHANGENR_RFQ WHERE ANFNR EQ T_PUR-ANFNR.
ENDSELECT.
SELECT UDATE INTO T_PUR-UDATE_RFQ
FROM CDHDR
WHERE OBJECTCLAS EQ 'EINKBELEG' AND OBJECTID EQ T_PUR-ANFNR
AND TCODE IN S_TCODE AND CHANGE_IND EQ 'U'
AND CHANGENR EQ T_PUR-CHANGENR_RFQ.
MODIFY T_PUR TRANSPORTING UDATE_RFQ WHERE ANFNR EQ T_PUR-ANFNR.
ENDSELECT.
ELSE.
T_PUR-UDATE_RFQ = '00000000'.
ENDIF.
*--> get RFQ creation date
SELECT AEDAT INTO T_PUR-RFQ_AEDAT FROM EKPO
WHERE EBELN EQ T_PUR-ANFNR.
MODIFY T_PUR TRANSPORTING RFQ_AEDAT.
ENDSELECT.
*--> PR Days = PR release date - PR creation date
IF T_PUR-UDATE_PR IS INITIAL OR T_PUR-BADAT IS INITIAL.
V_PRDAY = '0'.
ELSE.
* v_prday = t_pur-udate_pr - t_pur-badat.
* v_prtemp = t_pur-udate_pr - t_pur-badat. " DEVK951017
PERFORM CALC_ACT_WORKDAY "DEVK951017
USING T_PUR-BADAT T_PUR-UDATE_PR V_PRTEMP. "DEVK951017
PERFORM CONVERT_NEG_TO_BRACKET USING V_PRTEMP
CHANGING V_PRDAY.
ENDIF.
*--> RFQ Days = RFQ quotation date - PR release date
* if t_pur-rfq_aedat is initial or t_pur-udate_pr is initial."DEVK951017
IF T_PUR-UDATE_RFQ IS INITIAL OR T_PUR-UDATE_PR IS INITIAL."DEVK951017
V_RFQDAY = '0'.
ELSE.
* v_rfqday = t_pur-rfq_aedat - t_pur-udate_pr.
* v_rfqtemp = t_pur-rfq_aedat - t_pur-udate_pr. "DEVK951017
PERFORM CALC_ACT_WORKDAY "DEVK951017
USING T_PUR-UDATE_PR T_PUR-UDATE_RFQ V_RFQTEMP. "DEVK951017
PERFORM CONVERT_NEG_TO_BRACKET USING V_RFQTEMP
CHANGING V_RFQDAY.
ENDIF.
*--> PO days
*--> RFQ number not exist (PO Days = PO printed date - PR released date)
IF T_PUR-ANFNR IS INITIAL.
* if t_pur-datvr_po is initial or t_pur-udate_pr is initial.
* v_poday = '0'.u
* else.
IF T_PUR-VSTAT = 1.
IF T_PUR-DATVR_PO IS INITIAL OR T_PUR-UDATE_PR IS INITIAL.
V_PODAY = '0'.
ELSE.
* v_poday = t_pur-datvr_po - t_pur-udate_pr.
* v_potemp = t_pur-datvr_po - t_pur-udate_pr. "DEVK951017
PERFORM CALC_ACT_WORKDAY "DEVK951017
USING T_PUR-UDATE_PR T_PUR-DATVR_PO V_POTEMP. "DEVK951017
PERFORM CONVERT_NEG_TO_BRACKET USING V_POTEMP
CHANGING V_PODAY.
ENDIF.
ELSEIF T_PUR-VSTAT = 2 OR T_PUR-VSTAT = 0.
IF T_PUR-AEDAT IS INITIAL OR T_PUR-UDATE_PR IS INITIAL.
V_PODAY = '0'.
ELSE.
* v_poday = t_pur-aedat - t_pur-udate_pr.
* v_potemp = t_pur-aedat - t_pur-udate_pr. "DEVK951017
PERFORM CALC_ACT_WORKDAY "DEVK951017
USING T_PUR-UDATE_PR T_PUR-AEDAT V_POTEMP. "DEVK951017
PERFORM CONVERT_NEG_TO_BRACKET USING V_POTEMP
CHANGING V_PODAY.
ENDIF.
ELSEIF T_PUR-VSTAT IS INITIAL.
V_PODAY = '0'.
ENDIF.
* endif.
ELSE.
*--> RFQ number exist (PO Days = PO printed date - Quotation date)
* if t_pur-datvr_po is initial or t_pur-rfq_aedat is initial.
* v_poday = '0'.
* else.
IF T_PUR-VSTAT = 1.
IF T_PUR-DATVR_PO IS INITIAL OR T_PUR-RFQ_AEDAT IS INITIAL.
V_PODAY = '0'.
ELSE.
* v_poday = t_pur-datvr_po - t_pur-rfq_aedat.
* v_potemp = t_pur-datvr_po - t_pur-rfq_aedat. "DEVK951017
PERFORM CALC_ACT_WORKDAY "DEVK951017
USING T_PUR-RFQ_AEDAT T_PUR-DATVR_PO V_POTEMP. "DEVK951017
PERFORM CONVERT_NEG_TO_BRACKET USING V_POTEMP
CHANGING V_PODAY.
ENDIF.
ELSEIF T_PUR-VSTAT = 2 OR T_PUR-VSTAT = 0.
IF T_PUR-AEDAT IS INITIAL OR T_PUR-RFQ_AEDAT IS INITIAL.
V_PODAY = '0'.
ELSE.
* v_poday = t_pur-aedat - t_pur-rfq_aedat.
* v_potemp = t_pur-aedat - t_pur-rfq_aedat. "DEVK951017
PERFORM CALC_ACT_WORKDAY "DEVK951017
USING T_PUR-RFQ_AEDAT T_PUR-AEDAT V_POTEMP. "DEVK951017
PERFORM CONVERT_NEG_TO_BRACKET USING V_POTEMP
CHANGING V_PODAY.
ENDIF.
ELSEIF T_PUR-VSTAT IS INITIAL.
V_PODAY = '0'.
ENDIF.
ENDIF.
CLEAR: V_TABKEY,
V_TABKEY2,
V_TABKEY3.
ENDFORM.
*& FORM WRITE_HEADER
FORM WRITE_HEADER.
ULINE (255).
FORMAT COLOR COL_HEADING INTENSIFIED ON.
WRITE:/ '|', 9 'PR',
21 '|', 48 'Material',
83 '|', 92 'PO',
103 '|', 107 'Purchase Requisition',
131 '|', 143 'RFQ',
159 '|', 176 'Purchase Order',
209 '|', 210 'S',
211 '|', 217 'GRN',
228 '|', 229 'Standard',
237 '|', 238 'Actual',
244 '|', 255 '|'.
ULINE (228).
FORMAT COLOR OFF.
WRITE: 237 '|', 244 '|', 255 '|'.
FORMAT COLOR COL_HEADING INTENSIFIED ON.
WRITE:/ '|', 2 'Number',
12 '|', 13 'Item No.',
21 '|', 22 'Number',
41 '|', 42 'Description',
83 '|', 84 'Number',
94 '|', 95 'Item No.',
103 '|', 104 'Created',
114 '|', 115 'Released',
125 '|', 126 'Days',
131 '|', 132 'Created',
142 '|', 143 'Maintained',
153 '|', 154 'Days',
159 '|', 160 'Created',
170 '|', 171 'Required',
181 '|', 182 'Approved',
192 '|', 193 'Printed',
203 '|', 204 'Days',
209 '|',
211 '|', 212 'Delivered',
222 '|', 223 'Days',
228 '|', 229 'Days',
237 '|', 238 'Days',
244 '|', 245 'Variance',
255 '|'.
FORMAT COLOR OFF.
ULINE (255).
ENDFORM. " WRITE_HEADER
*& Form INVERT_LINE_ITEMS_COLOR
FORM INVERT_LINE_ITEMS_COLOR.
V_COUNT_MOD = V_COUNT MOD 2.
IF V_COUNT_MOD EQ '0'.
FORMAT COLOR COL_KEY INTENSIFIED OFF.
ELSE.
FORMAT COLOR COL_NORMAL INTENSIFIED OFF.
ENDIF.
ENDFORM. " INVERT_LINE_ITEMS_COLOR
*& Form GET_TITLE_DATE
FORM GET_TITLE_DATE.
IF NOT S_BADAT-LOW IS INITIAL AND NOT S_BADAT-HIGH IS INITIAL.
V_SDATE = S_BADAT-LOW.
V_EDATE = S_BADAT-HIGH.
ELSE.
SORT T_PR BY BADAT ASCENDING.
READ TABLE T_PR INDEX 1.
V_SDATE = T_PR-BADAT.
SORT T_PR BY BADAT DESCENDING.
READ TABLE T_PR INDEX 1.
V_EDATE = T_PR-BADAT.
ENDIF.
ENDFORM. " GET_TITLE_DATE
*& Form GET_LATEST_GRNDATE
FORM GET_LATEST_GRNDATE.
DATA: D_LINES TYPE I.
CLEAR T_DATE.
DESCRIBE TABLE T_DATE LINES D_LINES.
IF D_LINES GT 0.
SORT T_DATE BY CPUDT EBELN EBELP DESCENDING.
READ TABLE T_DATE WITH KEY EBELN = T_PUR-EBELN.
IF SY-SUBRC = 0.
READ TABLE T_DATE INDEX 1.
MOVE: T_DATE-CPUDT TO T_PUR-CPUDT.
MODIFY T_PUR TRANSPORTING CPUDT
WHERE EBELN = T_PUR-EBELN AND EBELP = T_PUR-EBELP.
ENDIF.
ENDIF.
*--> GRN Days = GRN date - PO printed date
IF T_PUR-VSTAT = 1.
IF T_PUR-CPUDT IS INITIAL OR T_PUR-DATVR_PO IS INITIAL.
V_GRNDAY = '0'.
ELSE.
* v_grnday = t_pur-cpudt - t_pur-datvr_po.
* v_grntemp = t_pur-cpudt - t_pur-datvr_po. "DEVK951017
PERFORM CALC_ACT_WORKDAY "DEVK951017
USING T_PUR-DATVR_PO T_PUR-CPUDT V_GRNTEMP. "DEVK951017
PERFORM CONVERT_NEG_TO_BRACKET USING V_GRNTEMP
CHANGING V_GRNDAY.
ENDIF.
ELSEIF T_PUR-VSTAT = 2 OR T_PUR-VSTAT = 0.
IF T_PUR-CPUDT IS INITIAL OR T_PUR-AEDAT IS INITIAL.
V_GRNDAY = '0'.
ELSE.
* v_grnday = t_pur-cpudt - t_pur-datvr_po.
* v_grntemp = t_pur-cpudt - v_grntemp. "DEVK951017
PERFORM CALC_ACT_WORKDAY "DEVK951017
USING T_PUR-AEDAT T_PUR-CPUDT V_GRNTEMP. "DEVK951017
PERFORM CONVERT_NEG_TO_BRACKET USING V_GRNTEMP
CHANGING V_GRNDAY.
ENDIF.
ENDIF.
ENDFORM. " GET_LATEST_GRNDATE
*& Form GET_HEADER_ITEM
FORM GET_HEADER_ITEM.
DATA: V_OBJNR LIKE PRPS-OBJNR,
V_TEMP(4) TYPE C.
clear t_pr.
loop at t_pr.
SELECT EBELN EBELP FROM EKET
INTO (EKET-EBELN, EKET-EBELP)
WHERE BANFN EQ T_PR-BANFN AND BNFPO EQ T_PR-BNFPO.
SELECT EBELN FRGZU FROM EKKO
INTO (EKKO-EBELN, EKKO-FRGZU)
WHERE EBELN EQ EKET-EBELN.
SELECT EBELP ANFNR ANFPS AEDAT FROM EKPO
INTO (EKPO-EBELP, EKPO-ANFNR, EKPO-ANFPS, EKPO-AEDAT)
WHERE EBELN EQ EKET-EBELN AND EBELP EQ EKET-EBELP
AND BSTYP EQ 'F'.
MOVE-CORRESPONDING T_PR TO T_PUR.
MOVE: EKET-EBELN TO T_PUR-EKET_EBELN,
EKET-EBELP TO T_PUR-EKET_EBELP,
EKKO-EBELN TO T_PUR-EKKO_EBELN,
EKKO-FRGZU TO T_PUR-EKKO_FRGZU,
EKPO-EBELP TO T_PUR-EKPO_EBELP,
EKPO-ANFNR TO T_PUR-ANFNR,
EKPO-ANFPS TO T_PUR-ANFPS,
EKPO-AEDAT TO T_PUR-AEDAT.
V_FLAG2 = 'Y'.
APPEND T_PUR.
ENDSELECT.
ENDSELECT.
ENDSELECT.
IF V_FLAG2 NE 'Y'.
MOVE-CORRESPONDING T_PR TO T_PUR.
APPEND T_PUR.
ENDIF.
*--> get project code name
CONCATENATE 'PR' T_PR-PS_PSP_PNR INTO V_OBJNR.
SELECT SINGLE POSID INTO T_PR-POSID FROM PRPS WHERE OBJNR EQ V_OBJNR.
SPLIT T_PR-POSID AT '/' INTO T_PUR-POSID V_TEMP.
MODIFY T_PUR TRANSPORTING POSID WHERE PS_PSP_PNR EQ T_PR-PS_PSP_PNR.
CLEAR V_FLAG2.
ENDLOOP.
ENDFORM. " GET_HEADER_ITEM
*& Form WRITE_DETAILS
FORM WRITE_DETAILS.
WRITE:/ '|', 2 T_PUR-BANFN, "PR no
12 '|', 13 T_PUR-BNFPO, "item no
41 '|', 42 T_PUR-TXZ01, "mat description
103 '|', 104 T_PUR-BADAT, "PR creation date
125 '|', 126 V_PRDAY LEFT-JUSTIFIED, "PR days
131 '|',
153 '|', 154 V_RFQDAY LEFT-JUSTIFIED, "RFQ days
203 '|', 204 V_PODAY LEFT-JUSTIFIED, "PO days
209 '|', 210 T_PUR-VSTAT,
222 '|', 223 V_GRNDAY LEFT-JUSTIFIED, "GRN days
228 '|', 229 V_STADAY LEFT-JUSTIFIED, "Standard days
237 '|', 238 V_ACTDAY LEFT-JUSTIFIED, "Actual days
244 '|', 245 V_VARDAY LEFT-JUSTIFIED, "Variance days
255 '|'.
IF T_PUR-MATNR IS INITIAL.
WRITE: 21 '|', 22 '-'.
ELSE.
WRITE: 21 '|', 22 T_PUR-MATNR. "mat no
ENDIF.
IF T_PUR-EKKO_EBELN IS INITIAL.
WRITE: 83 '|', 84 '-'.
ELSE.
WRITE: 83 '|', 84 T_PUR-EKKO_EBELN. "PO number
ENDIF.
IF T_PUR-EKPO_EBELP EQ '00000' OR T_PUR-EKPO_EBELP IS INITIAL.
WRITE: 94 '|', 95 '-'.
ELSE.
WRITE: 94 '|', 95 T_PUR-EKPO_EBELP. "PO item no
ENDIF.
IF T_PUR-UDATE_PR EQ '00000000'.
WRITE: 114 '|', 115 '-'.
ELSE.
WRITE: 114 '|', 115 T_PUR-UDATE_PR. "PR released date
ENDIF.
IF T_PUR-RFQ_AEDAT EQ '00000000'.
WRITE: 132 '-', 142 '|'.
ELSE.
WRITE: 132 T_PUR-RFQ_AEDAT, 142 '|'. "RFQ creation date
ENDIF.
IF T_PUR-UDATE_RFQ EQ '00000000'.
WRITE: 143 '-'.
ELSE.
WRITE: 143 T_PUR-UDATE_RFQ. "RFQ maintained date
ENDIF.
IF T_PUR-AEDAT EQ '00000000'.
WRITE: 159 '|', 160 '-'.
ELSE.
WRITE: 159 '|', 160 T_PUR-AEDAT. "PO creation date
ENDIF.
IF T_PUR-EINDT EQ '00000000'.
WRITE: 170 '|', 171 '-'.
ELSE.
WRITE: 170 '|', 171 T_PUR-EINDT. "PO required date
ENDIF.
IF T_PUR-UDATE_PO EQ '00000000'.
WRITE: 181 '|', 182 '-'.
ELSE.
WRITE: 181 '|', 182 T_PUR-UDATE_PO. "PO released date
ENDIF.
IF T_PUR-VSTAT = 1.
* if t_pur-datvr_po eq '00000000'.
* write: 192 '|', 193 '-'.
* else.
WRITE: 192 '|', 193 T_PUR-DATVR_PO. "PO printed date
* endif.
* elseif t_pur-vstat = 2 or t_pur-vstat = 0. "DEVK951017
ELSEIF T_PUR-VSTAT = 2. "DEVK951017
WRITE: 192 '|', 193 T_PUR-AEDAT. "PO creation date
ELSEIF T_PUR-VSTAT = 0. "DEVK951017
WRITE: 192 '|', 193 '-'. "PO printed date not shown "DEVK951017
ENDIF.
IF T_PUR-CPUDT EQ '00000000'.
WRITE: 211 '|', 212 '-'.
ELSE.
WRITE: 211 '|', 212 T_PUR-CPUDT. "GRN delivered date
ENDIF.
ENDFORM. " WRITE_DETAILS
*& Form CHECK_TZEPURDAY
FORM CHECK_TZEPURDAY.
* CLEAR T_PRDAY.
* READ TABLE T_PRDAY INDEX 1.
* IF SY-SUBRC NE 0.
* FORMAT COLOR COL_NEGATIVE ON.
* WRITE:/ '*** No Table Entries Found in Table ZEPURDAY ***'.
* FORMAT COLOR OFF.
* ENDIF.
ENDFORM. " CHECK_TZEPURDAY
*& Form GET_STAND_DAY
FORM GET_STAND_DAY.
*--> PR release days
* CLEAR T_PRDAY.
* READ TABLE T_PRDAY WITH KEY PR_TYPE = T_PUR-BSART.
* IF SY-SUBRC EQ 0.
* CLEAR V_LEN.
* CONDENSE T_PUR-FRGZU.
* V_LEN = STRLEN( T_PUR-FRGZU ).
* IF V_LEN EQ 0.
* V_RELPR = 0.
* ELSEIF V_LEN EQ '1'.
* V_RELPR = T_PRDAY-PR_RE1.
* ELSEIF V_LEN EQ '2'.
* V_RELPR = T_PRDAY-PR_RE1 + T_PRDAY-PR_RE2.
* ELSEIF V_LEN EQ '3'.
* V_RELPR = T_PRDAY-PR_RE1 + T_PRDAY-PR_RE2 + T_PRDAY-PR_RE3.
* ELSE.
* V_RELPR = T_PRDAY-PR_RE1 + T_PRDAY-PR_RE2 +
* T_PRDAY-PR_RE3 + T_PRDAY-PR_RE4.
* ENDIF.
*--> PO release days
* CLEAR V_LEN2.
* CONDENSE T_PUR-EKKO_FRGZU.
* V_LEN2 = STRLEN( T_PUR-EKKO_FRGZU ).
* IF V_LEN2 EQ 0.
* V_RELPO = 0.
* ELSEIF V_LEN2 EQ '1'.
* V_RELPO = T_PRDAY-PO_RE1.
* ELSEIF V_LEN2 EQ '2'.
* V_RELPO = T_PRDAY-PO_RE1 + T_PRDAY-PO_RE2.
* ELSEIF V_LEN2 EQ '3'.
* V_RELPO = T_PRDAY-PO_RE1 + T_PRDAY-PO_RE2 + T_PRDAY-PO_RE3.
* ELSE.
* V_RELPO = T_PRDAY-PO_RE1 + T_PRDAY-PO_RE2 +
* T_PRDAY-PO_RE3 + T_PRDAY-PO_RE4.
* ENDIF.
CHECK = ' '. "DEVK951017
IF NOT ( T_PUR-EKKO_EBELN IS INITIAL ) AND "DEVK951017
T_PUR-ANFNR IS INITIAL AND T_PUR-KNTTP = 'P'.
PERFORM CHECK_RFQ. "DEVK951017
** IF CHECK = 'X'.
** V_STADAY = T_PRDAY-PR_CRT + V_RELPR + T_PRDAY-PO_CRT +
*"DEVK951017
** V_RELPO + T_PRDAY-PO_PRN + T_PRDAY-GRN_CRT.
** ENDIF.
*ELSE.
**--> Standard Days
* V_STADAY = T_PRDAY-PR_CRT + V_RELPR + T_PRDAY-RFQ_CRT +
* T_PRDAY-RFQ_MAN + T_PRDAY-PO_CRT +
* V_RELPO + T_PRDAY-PO_PRN + T_PRDAY-GRN_CRT.
** + t_prday-pay_crt + t_prday-inv_crt.
"DEVK951017
*ENDIF.
ENDIF. "DEVK951017
ENDFORM. " GET_STAND_DAY
*& Form GET_ACT_DAY
FORM GET_ACT_DAY.
DATA: V_CPUDT LIKE SY-DATUM.
* IF T_PUR-CPUDT IS INITIAL OR T_PUR-BADAT IS INITIAL.
* V_ACTDAY = '0'.
* ELSE.
* V_ACTDAY = T_PUR-CPUDT - T_PUR-BADAT.
* ENDIF.
V_CPUDT = SY-DATUM.
IF T_PUR-CPUDT IS INITIAL.
* v_actday = v_cpudt - t_pur-badat. "DEVK951017
PERFORM CALC_ACT_WORKDAY "DEVK951017
USING T_PUR-BADAT V_CPUDT V_ACTDAY.
ELSEIF T_PUR-BADAT IS INITIAL.
V_ACTDAY = '0'.
ELSE.
* v_actday = t_pur-cpudt - t_pur-badat. "DEVK951017
PERFORM CALC_ACT_WORKDAY "DEVK951017
USING T_PUR-BADAT T_PUR-CPUDT V_ACTDAY.
ENDIF.
ENDFORM. " GET_ACT_DAY
*& Form GET_VAR_DAY
FORM GET_VAR_DAY.
DATA: V_TEMP2(8).
V_TEMP2 = V_STADAY - V_ACTDAY.
PERFORM CONVERT_NEG_TO_BRACKET USING V_TEMP2
CHANGING V_VARDAY.
ENDFORM. " GET_VAR_DAY
*& Form CONVERT_NEG_TO_BRACKET
FORM CONVERT_NEG_TO_BRACKET USING P_V_TEMP
CHANGING P_V_DAY.
SEARCH P_V_TEMP FOR '-'.
IF SY-SUBRC = 0.
SHIFT P_V_TEMP RIGHT BY 1 PLACES.
SHIFT P_V_TEMP LEFT DELETING LEADING SPACE.
CONCATENATE '(' P_V_TEMP ')' INTO P_V_DAY.
ELSE.
SHIFT P_V_TEMP LEFT DELETING LEADING SPACE.
MOVE P_V_TEMP TO P_V_DAY.
ENDIF.
ENDFORM. " CONVERT_NEG_TO_BRACKET
*& Form CALC_ACT_WORKDAY -DEVK951017
* -->lowdt -Low Date *
* -->Highdt -High Date *
* -->days -Total Days *
FORM CALC_ACT_WORKDAY USING LOWDT HIGHDT DAYS.
DATA: DAT LIKE SY-DATUM.
DAYS = 0.
DAT = LOWDT.
DO.
CALL FUNCTION 'DATE_CHECK_WORKINGDAY'
EXPORTING
DATE = DAT
FACTORY_CALENDAR_ID = 'MY'
MESSAGE_TYPE = 'I'
EXCEPTIONS
DATE_AFTER_RANGE = 1
DATE_BEFORE_RANGE = 2
DATE_INVALID = 3
DATE_NO_WORKINGDAY = 4
FACTORY_CALENDAR_NOT_FOUND = 5
MESSAGE_TYPE_INVALID = 6
OTHERS = 7.
IF SY-SUBRC = 0.
DAYS = DAYS + 1.
ENDIF.
DAT = DAT + 1.
IF DAT GE HIGHDT.
EXIT.
ENDIF.
ENDDO.
ENDFORM. " CALC_ACT_WORKDAY
*& Form CHECK_RFQ
* text
* --> p1 text
* <-- p2 text
FORM CHECK_RFQ.
DATA: KONNR LIKE EKPO-KONNR,
AEDAT LIKE EKKO-AEDAT.
SELECT SINGLE P~KONNR K~AEDAT INTO (KONNR, AEDAT)
FROM EKPO AS P INNER JOIN EKKO AS K
ON P~EBELN = K~EBELN WHERE P~EBELN = T_PUR-EKKO_EBELN
AND P~EBELP = T_PUR-EKPO_EBELP AND K~BSTYP = 'K'
AND P~KONNR = K~KONNR.
IF SY-SUBRC = 0.
IF AEDAT < T_PUR-BADAT.
CHECK = 'X'.
ENDIF.
ENDIF.
ENDFORM. " CHECK_RFQ
By the way, it's my first time trying to modify other people's codes, is there a proper way to do this. I find it more difficult to modify people's code than to write my own. Perhaps you guys could give me some advice, so i'll know what to do when i'm assigned to do it again next time?Even though you think AT NEW will work on just the field that you mentioned, it is not. Your field BSART is about 6th or 7th field in your internal table. So any change in any of the field values before BSART will trigger this AT NEW BSART code.
You have to declare your own variables to keep track of the current value of BSART and previous value of the same. Also, remember that it may not have been sorted by BSART. So your logic may not work and if you change the sort, then your previous AT NEW may not work. So be sure of what you want to do there.
Srinivas -
Problem in alv grid display (it is not filtering the data in print preview)
Hi Every One,
Its very urgent for me to deliver this report ....
I applied sort criteria on my final internal table which is pupulated and then i passed to the function module...
when i execute the program it is showing me the perfect output..when i take a print preview it is not filtering the data instead it is showing me the normal uotput i.e..,without sort criteria...
here is the code plz go thru it and tell me were i am doing wrong...
i thank u one and all ...and plz debub the code on the system and let me know....
REPORT tracking-quotation NO STANDARD PAGE HEADING MESSAGE-ID zrv_message LINE-COUNT 65 LINE-SIZE 110.
Includes
This include contains declarations
INCLUDE ZMM_TRACKING_QUOTATION_T.
This include contains code for the performs
INCLUDE ZMM_TRACKING_QUOTATION_F.
AT SELECTION SCREEN *
AT SELECTION-SCREEN.
This perform will validate the fields
PERFORM f_validate_sel_screen.
Start-Of-Selection
START-OF-SELECTION.
This perform will read the values from the database.
PERFORM selection.
This perform will build the field catalogue
PERFORM f_build_catalogue.
This perform will build the sort
PERFORM f_event_sort.
This perform will build the layout
PERFORM f_build_layout.
This perform will build the event
PERFORM f_event_build.
This perform will build the comment
PERFORM f_comment_build.
This perform will display the list
PERFORM f_list_display.
End-Of-Selection
END-OF-SELECTION.
*& Include ZMM_TRACKING_QUOTATION_T *
T a b l e s D e c l a r a t i o n s *
TABLES: eban,
ebkn,
ekko,
eket,
lfa1,
ekpo.
Selection Screen Declaration
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-100.
SELECT-OPTIONS: bednr FOR eban-bednr,
ps_psp FOR ebkn-ps_psp_pnr,
kostl FOR ebkn-kostl,
erdat FOR ebkn-erdat.
SELECTION-SCREEN END OF BLOCK b1.
Type Pools D e c l a r a t i o n s *
TYPE-POOLS: slis.
V a r i a b l e s *
DATA : rt_fieldcat TYPE slis_t_fieldcat_alv,
i_layout TYPE slis_layout_alv,
i_event TYPE slis_t_event,
i_listheader TYPE slis_t_listheader,
l_sort TYPE slis_t_sortinfo_alv,
wa_sort TYPE slis_sortinfo_alv.
I n t e r n a l T a b l e s *
DATA: BEGIN OF i_final_tab OCCURS 0,
name1 LIKE lfa1-name1,
banfn LIKE eban-banfn,
badat LIKE eban-badat,
bnfpo LIKE eban-bnfpo,
txz01 LIKE eban-txz01,
menge LIKE eban-menge,
bednr LIKE eban-bednr,
frgdt LIKE eban-frgdt,
lfdat LIKE eban-lfdat,
ps_psp_pnr LIKE ebkn-ps_psp_pnr,
bwbdt LIKE ekko-bwbdt,
aedat LIKE ekko-aedat,
lifnr LIKE ekko-lifnr,
ihran LIKE ekko-ihran,
ebeln LIKE ekpo-ebeln,
ebelp LIKE ekpo-ebelp,
plifz LIKE ekpo-plifz,
eindt LIKE eket-eindt,
END OF i_final_tab.
DATA: BEGIN OF itab OCCURS 0,
name1 LIKE lfa1-name1,
banfn LIKE eban-banfn,
badat LIKE eban-badat,
bnfpo LIKE eban-bnfpo,
txz01 LIKE eban-txz01,
menge(17),
bednr LIKE eban-bednr,
frgdt LIKE eban-frgdt,
lfdat LIKE eban-lfdat,
ps_psp_pnr LIKE ebkn-ps_psp_pnr,
bwbdt LIKE ekko-bwbdt,
aedat LIKE ekko-aedat,
lifnr LIKE ekko-lifnr,
ihran LIKE ekko-ihran,
ebeln LIKE ekpo-ebeln,
ebelp LIKE ekpo-ebelp,
plifz LIKE ekpo-plifz,
eindt LIKE eket-eindt,
END OF itab.
*& Include ZMM_TRACKING_QUOTATION_F *
**& Form FIELDCAT_INIT
text
-->P_GT_FIELDCAT[] text
FORM f_build_catalogue.
DATA : ls_fieldcat TYPE slis_fieldcat_alv.
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'BANFN'.
ls_fieldcat-tabname = 'itab'.
ls_fieldcat-seltext_m = 'PR Number'.
ls_fieldcat-ref_tabname = 'EBAN'.
ls_fieldcat-fix_column = ''.
ls_fieldcat-emphasize = ''.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-tabname = 'ITAB'.
ls_fieldcat-fieldname = 'BNFPO'.
ls_fieldcat-ref_tabname = 'EBAN'.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-tabname = 'ITAB'.
ls_fieldcat-fieldname = 'BADAT'.
ls_fieldcat-ref_tabname = 'EBAN'.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-tabname = 'ITAB'.
ls_fieldcat-fieldname = 'TXZ01'.
ls_fieldcat-ref_tabname = 'EBAN'.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-tabname = 'ITAB'.
ls_fieldcat-fieldname = 'MENGE'.
ls_fieldcat-ref_tabname = 'ITAB'.
ls_fieldcat-seltext_l = 'Quantity'.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-tabname = 'ITAB'.
ls_fieldcat-fieldname = 'PS_PSP_PNR'.
ls_fieldcat-ref_tabname = 'EBKN'.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-tabname = 'ITAB'.
ls_fieldcat-fieldname = 'BEDNR'.
ls_fieldcat-ref_tabname = 'EBAN'.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-tabname = 'ITAB'.
ls_fieldcat-fieldname = 'FRGDT'.
ls_fieldcat-ref_tabname = 'EBAN'.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-tabname = 'ITAB'.
ls_fieldcat-fieldname = 'LFDAT'.
ls_fieldcat-ref_tabname = 'EBAN'.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-tabname = 'ITAB'.
ls_fieldcat-fieldname = 'EBELN'.
ls_fieldcat-ref_tabname = 'EKPO'.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-tabname = 'ITAB'.
ls_fieldcat-fieldname = 'EBELP'.
ls_fieldcat-ref_tabname = 'EKPO'.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-tabname = 'ITAB'.
ls_fieldcat-fieldname = 'AEDAT'.
ls_fieldcat-ref_tabname = 'EKKO'.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-tabname = 'ITAB'.
ls_fieldcat-fieldname = 'LIFNR'.
ls_fieldcat-ref_tabname = 'EKKO'.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-tabname = 'ITAB'.
ls_fieldcat-fieldname = 'NAME1'.
ls_fieldcat-ref_tabname = 'LFA1'.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-tabname = 'ITAB'.
ls_fieldcat-fieldname = 'IHRAN'.
ls_fieldcat-ref_tabname = 'EKKO'.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-tabname = 'ITAB'.
ls_fieldcat-fieldname = 'EINDT'.
ls_fieldcat-ref_tabname = 'EKET'.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-tabname = 'ITAB'.
ls_fieldcat-fieldname = 'PLIFZ'.
ls_fieldcat-ref_tabname = 'EKPO'.
APPEND ls_fieldcat TO rt_fieldcat.
ENDFORM. " FIELDCAT_INIT
*& Form selection
text
--> p1 text
<-- p2 text
FORM selection .
SELECT
lfa1~name1
eban~banfn
eban~badat
eban~bnfpo
eban~txz01
eban~menge
eban~bednr
eban~frgdt
eban~lfdat
ebkn~ps_psp_pnr
ekko~bwbdt
ekko~aedat
ekko~lifnr
ekko~ihran
ekpo~ebeln
ekpo~ebelp
ekpo~plifz
eket~eindt
FROM lfa1 INNER JOIN ekko ON ( lfa1lifnr = ekkolifnr )
INNER JOIN ekpo ON ( ekkoebeln = ekpoebeln )
INNER JOIN eket ON ( ekpoebeln = eketebeln
AND
ekpoebelp = eketebelp )
INNER JOIN eban ON ( ebanbanfn = eketbanfn
AND
ebanbnfpo = eketbnfpo )
INNER JOIN ebkn ON ( ebanbanfn = ebknbanfn
AND
ebanbnfpo = ebknbnfpo )
INTO TABLE i_final_tab WHERE eban~bednr IN bednr AND
ebkn~ps_psp_pnr IN ps_psp AND
ebkn~kostl IN kostl AND
ebkn~erdat IN erdat AND
ekko~bstyp <> 'F'.
LOOP AT i_final_tab.
itab-name1 = i_final_tab-name1.
itab-banfn = i_final_tab-banfn.
itab-badat = i_final_tab-badat.
itab-bnfpo = i_final_tab-bnfpo.
itab-txz01 = i_final_tab-txz01.
itab-menge = i_final_tab-menge.
itab-bednr = i_final_tab-bednr.
itab-frgdt = i_final_tab-frgdt.
itab-lfdat = i_final_tab-lfdat.
itab-ps_psp_pnr = i_final_tab-ps_psp_pnr.
itab-aedat = i_final_tab-aedat.
itab-lifnr = i_final_tab-lifnr.
itab-ihran = i_final_tab-ihran.
itab-ebeln = i_final_tab-ebeln.
itab-ebelp = i_final_tab-ebelp.
itab-plifz = i_final_tab-plifz.
itab-eindt = i_final_tab-eindt.
APPEND itab.
CLEAR itab.
ENDLOOP.
ENDFORM. " selection
*& Form f_event_build
text
--> p1 text
<-- p2 text
FORM f_event_build .
DATA wa_event TYPE slis_alv_event.
CLEAR: wa_event,
i_event.
*read event top-of-page
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = i_event.
IF sy-subrc <> 0.
ENDIF.
*Prepare event table
READ TABLE i_event WITH KEY name = 'TOP_OF_PAGE' INTO wa_event.
IF sy-subrc EQ 0.
MOVE 'TOP_OF_PAGE' TO wa_event-form.
APPEND wa_event TO i_event.
ENDIF.
ENDFORM. " f_event_build
*& Form f_comment_build
text
--> p1 text
<-- p2 text
FORM f_comment_build .
DATA: wa_listheader TYPE slis_listheader.
CLEAR wa_listheader.
wa_listheader-typ = 'H'.
wa_listheader-info = 'Tracking Of Quotation For Purchase Requisition'.
APPEND wa_listheader TO i_listheader.
CLEAR wa_listheader.
wa_listheader-typ = 'S'.
wa_listheader-info = 'SMS-DEMAG Pvt. Ltd.'.
APPEND wa_listheader TO i_listheader.
CLEAR wa_listheader.
wa_listheader-typ = 'S'.
wa_listheader-info = 'R1- Nehru Enclave'.
APPEND wa_listheader TO i_listheader.
CLEAR wa_listheader.
wa_listheader-typ = 'S'.
wa_listheader-info = 'New Delhi - '.
APPEND wa_listheader TO i_listheader.
ENDFORM. " f_comment_build
*& Form f_build_layout
text
--> p1 text
<-- p2 text
FORM f_build_layout .
CLEAR i_layout.
i_layout-colwidth_optimize = 'X'.
i_layout-zebra = 'X'.
i_layout-totals_text = 'Total'.
ENDFORM. " f_build_layout
*& Form f_list_display
text
--> p1 text
<-- p2 text
FORM f_list_display .
*sort itab by name1
banfn
badat
bnfpo
txz01
menge
bednr
frgdt
lfdat
ps_psp_pnr
bwbdt
aedat
lifnr
ihran
ebeln
ebelp
plifz
eindt.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
is_layout = i_layout
it_fieldcat = rt_fieldcat
it_events = i_event
it_sort = l_sort
TABLES
t_outtab = itab.
IF sy-subrc <> 0.
ENDIF.
ENDFORM. " f_list_display
*& Form TOP_OF_PAGE
text
--> p1 text
<-- p2 text
FORM top_of_page.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = i_listheader
i_logo = 'ENJOYSAP_LOGO'.
ENDFORM. "TOP_OF_PAGE
*& Form f_event_sort
text
--> p1 text
<-- p2 text
FORM f_event_sort .
wa_sort-spos = 1.
wa_sort-up = 'X'.
wa_sort-tabname = 'i_final_tab'.
wa_sort-fieldname = 'BANFN'.
wa_sort-subtot = ' '.
APPEND wa_sort TO l_sort.
CLEAR WA_SORT.
wa_sort-spos = 5.
wa_sort-up = 'X'.
wa_sort-tabname = 'i_final_tab'.
wa_sort-fieldname = 'MENGE'.
wa_sort-subtot = ' '.
APPEND wa_sort TO l_sort.
*CLEAR WA_SORT.
wa_sort-spos = 2.
wa_sort-up = 'X'.
wa_sort-tabname = 'i_final_tab'.
wa_sort-fieldname = 'BNFPO'.
wa_sort-subtot = ' '.
APPEND wa_sort TO l_sort.
*CLEAR WA_SORT.
wa_sort-spos = 3.
wa_sort-up = 'X'.
wa_sort-tabname = 'i_final_tab'.
wa_sort-fieldname = 'BADAT'.
wa_sort-subtot = ' '.
APPEND wa_sort TO l_sort.
*CLEAR WA_SORT.
wa_sort-spos = 4.
wa_sort-up = 'X'.
wa_sort-tabname = 'i_final_tab'.
wa_sort-fieldname = 'TXZ01'.
wa_sort-subtot = ' '.
APPEND wa_sort TO l_sort.
*CLEAR WA_SORT.
wa_sort-spos = 7.
wa_sort-up = 'X'.
wa_sort-tabname = 'i_final_tab'.
wa_sort-fieldname = 'BEDNR'.
wa_sort-subtot = ' '.
APPEND wa_sort TO l_sort.
*CLEAR WA_SORT.
wa_sort-spos = 6.
wa_sort-up = 'X'.
wa_sort-tabname = 'i_final_tab'.
wa_sort-fieldname = 'PS_PSP_PNR'.
wa_sort-subtot = ' '.
APPEND wa_sort TO l_sort.
*CLEAR WA_SORT.
wa_sort-spos = 8.
wa_sort-up = 'X'.
wa_sort-tabname = 'i_final_tab'.
wa_sort-fieldname = 'FRGDT'.
wa_sort-subtot = ' '.
APPEND wa_sort TO l_sort.
*CLEAR WA_SORT.
wa_sort-spos = 9.
wa_sort-up = 'X'.
wa_sort-tabname = 'i_final_tab'.
wa_sort-fieldname = 'LFDAT'.
wa_sort-subtot = ' '.
APPEND wa_sort TO l_sort.
*CLEAR WA_SORT.
CLEAR wa_sort.
wa_sort-up = 'X'.
wa_sort-tabname = 'i_final_tab'.
wa_sort-spos = 10.
wa_sort-fieldname = 'EBELN'.
wa_sort-subtot = 'X'.
APPEND wa_sort TO l_sort.
*CLEAR WA_SORT.
CLEAR wa_sort.
wa_sort-up = 'X'.
wa_sort-tabname = 'i_final_tab'.
wa_sort-spos = 11.
wa_sort-fieldname = 'EBELP'.
wa_sort-subtot = ' '.
APPEND wa_sort TO l_sort.
*CLEAR WA_SORT.
CLEAR wa_sort.
wa_sort-up = 'X'.
wa_sort-tabname = 'i_final_tab'.
wa_sort-spos = 12.
wa_sort-fieldname = 'AEDAT'.
wa_sort-subtot = ' '.
APPEND wa_sort TO l_sort.
*CLEAR WA_SORT.
CLEAR wa_sort.
wa_sort-up = 'X'.
wa_sort-tabname = 'i_final_tab'.
wa_sort-spos = 13.
wa_sort-fieldname = 'LIFNR'.
wa_sort-subtot = ' '.
APPEND wa_sort TO l_sort.
*CLEAR WA_SORT.
CLEAR wa_sort.
wa_sort-up = 'X'.
wa_sort-tabname = 'i_final_tab'.
wa_sort-spos = 14.
wa_sort-fieldname = 'NAME1'.
wa_sort-subtot = ' '.
APPEND wa_sort TO l_sort.
*CLEAR WA_SORT.
CLEAR wa_sort.
wa_sort-up = 'X'.
wa_sort-tabname = 'i_final_tab'.
wa_sort-spos = 15.
wa_sort-fieldname = 'IHRAN'.
wa_sort-subtot = ' '.
APPEND wa_sort TO l_sort.
*CLEAR WA_SORT.
CLEAR wa_sort.
wa_sort-up = 'X'.
wa_sort-tabname = 'i_final_tab'.
wa_sort-spos = 16.
wa_sort-fieldname = 'EINDT'.
wa_sort-subtot = ' '.
APPEND wa_sort TO l_sort.
*CLEAR WA_SORT.
*sort l_sort by spos.
CLEAR wa_sort.
wa_sort-spos = 1.
wa_sort-fieldname = 'BANFN'.
wa_sort-down = 'X'.
wa_sort-tabname = 'itab'.
wa_sort-subtot = ' '.
APPEND wa_sort TO l_sort.
wa_sort-spos = 5.
wa_sort-down = 'X'.
wa_sort-tabname = 'itab'.
wa_sort-fieldname = 'MENGE'.
wa_sort-subtot = ' '.
APPEND wa_sort TO l_sort.
*CLEAR WA_SORT.
CLEAR wa_sort.
wa_sort-spos = 2.
wa_sort-fieldname = 'BNFPO'.
wa_sort-down = 'X'.
wa_sort-tabname = 'itab'.
wa_sort-subtot = ' '.
APPEND wa_sort TO l_sort.
wa_sort-spos = 3.
wa_sort-down = 'X'.
wa_sort-tabname = 'itab'.
wa_sort-fieldname = 'BADAT'.
wa_sort-subtot = ' '.
APPEND wa_sort TO l_sort.
*CLEAR WA_SORT.
wa_sort-spos = 4.
wa_sort-down = 'X'.
wa_sort-tabname = 'itab'.
wa_sort-fieldname = 'TXZ01'.
wa_sort-subtot = ' '.
APPEND wa_sort TO l_sort.
*CLEAR WA_SORT.
wa_sort-spos = 7.
wa_sort-down = 'X'.
wa_sort-tabname = 'itab'.
wa_sort-fieldname = 'BEDNR'.
wa_sort-subtot = ' '.
APPEND wa_sort TO l_sort.
*CLEAR WA_SORT.
wa_sort-spos = 6.
wa_sort-down = 'X'.
wa_sort-tabname = 'itab'.
wa_sort-fieldname = 'PS_PSP_PNR'.
wa_sort-subtot = ' '.
APPEND wa_sort TO l_sort.
*CLEAR WA_SORT.
wa_sort-spos = 8.
wa_sort-down = 'X'.
wa_sort-tabname = 'itab'.
wa_sort-fieldname = 'FRGDT'.
wa_sort-subtot = ' '.
APPEND wa_sort TO l_sort.
*CLEAR WA_SORT.
wa_sort-spos = 9.
wa_sort-down = 'X'.
wa_sort-tabname = 'itab'.
wa_sort-fieldname = 'LFDAT'.
wa_sort-subtot = ' '.
APPEND wa_sort TO l_sort.
*CLEAR WA_SORT.
CLEAR wa_sort.
wa_sort-down = 'X'.
wa_sort-tabname = 'itab'.
wa_sort-spos = 10.
wa_sort-fieldname = 'EBELN'.
wa_sort-subtot = 'X'.
APPEND wa_sort TO l_sort.
*CLEAR WA_SORT.
CLEAR wa_sort.
wa_sort-down = 'X'.
wa_sort-tabname = 'itab'.
wa_sort-spos = 11.
wa_sort-fieldname = 'EBELP'.
wa_sort-subtot = ' '.
APPEND wa_sort TO l_sort.
*CLEAR WA_SORT.
CLEAR wa_sort.
wa_sort-down = 'X'.
wa_sort-tabname = 'itab'.
wa_sort-spos = 12.
wa_sort-fieldname = 'AEDAT'.
wa_sort-subtot = ' '.
APPEND wa_sort TO l_sort.
*CLEAR WA_SORT.
CLEAR wa_sort.
wa_sort-down = 'X'.
wa_sort-tabname = 'itab'.
wa_sort-spos = 13.
wa_sort-fieldname = 'LIFNR'.
wa_sort-subtot = ' '.
APPEND wa_sort TO l_sort.
*CLEAR WA_SORT.
CLEAR wa_sort.
wa_sort-down = 'X'.
wa_sort-tabname = 'itab'.
wa_sort-spos = 14.
wa_sort-fieldname = 'NAME1'.
wa_sort-subtot = ' '.
APPEND wa_sort TO l_sort.
*CLEAR WA_SORT.
CLEAR wa_sort.
wa_sort-down = 'X'.
wa_sort-tabname = 'itab'.
wa_sort-spos = 15.
wa_sort-fieldname = 'IHRAN'.
wa_sort-subtot = ' '.
APPEND wa_sort TO l_sort.
*CLEAR WA_SORT.
CLEAR wa_sort.
wa_sort-spos = 16.
wa_sort-fieldname = 'EINDT'.
wa_sort-tabname = 'itab'.
wa_sort-down = 'X'.
wa_sort-subtot = ' '.
APPEND wa_sort TO l_sort.
*CLEAR WA_SORT.
*sort l_sort by spos.
ENDFORM. " f_event_sort
*& Form f_validate_sel_screen
text
--> p1 text
<-- p2 text
FORM f_validate_sel_screen .
*Tracking number
SELECT SINGLE * FROM eban WHERE bednr IN bednr.
IF sy-subrc NE 0.
MESSAGE e013.
ENDIF.
*Wbs Element
SELECT SINGLE * FROM ebkn WHERE ps_psp_pnr IN ps_psp.
IF sy-subrc NE 0.
MESSAGE e014.
ENDIF.
*Cost center
SELECT SINGLE * FROM ebkn WHERE kostl IN kostl.
IF sy-subrc NE 0.
MESSAGE e015.
ENDIF.
*Date
SELECT SINGLE * FROM ebkn WHERE erdat IN erdat.
IF sy-subrc NE 0.
MESSAGE e012.
ENDIF.
ENDFORM. " f_validate_sel_screenHey Ravi,
As you said it is urgent to deliver the report, i will suggest you temporary solution while i debug the program.
In the FM "REUSE_ALV_GRID_DISPLAY", use layout to generate your sorted report for now as shown following:
<b>DATA: G_VARIANT LIKE DISVARIANT.</b>
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
IS_LAYOUT = I_LAYOUT
IT_FIELDCAT = RT_FIELDCAT
IT_EVENTS = I_EVENT
IT_SORT = L_SORT
<b>is_variant = g_variant</b>
TABLES
T_OUTTAB = ITAB.
IF SY-SUBRC <> 0.
ENDIF.
Where g_variant is your custom layout which you will make as default for output.
Hope this helps and let me know if you need more details.
In the mean time, i will look in to the program.
Regards,
Vicky
PS: Award points if helpful -
Geting select option value on the basis of filtering criteria
Hi
I have a selection parameter field is PRPS-WERKS. when user will go for f4 help, the value should come as filtered on the basis of the condition : select the respective WBS ELEMENT (PRPS- PSPNR) and select the respective PR LINE item. (The relation is PRPS-PSPNR=EBKN-PS_PSP_PNR and EBKN-BANFN = EBAN-BANFN and EBKN-BNFPO = EBAN-BNFPO).now the value iof WERKS is not comming from the database table PRPS itself. how to manage this thing?Hi,
Refer the link select option in smartforms and read what i suggested..
Regards,
Dhina.. -
Updating Purchase Order data - BAPI_PO_CHANGE?
Hi,
I have been searching for a SAP standard tool that can update a Purchase Order upon its execution. The closest function module I could find was BAPI_PO_CHANGE. However, it was documented as a restriction that updating of service data is not possible with this function module (I have also tested this).
Are there any other possible mechanisms which can be called/used for the purpose of updating a PO including its services? It would be most desirable if the following fields on a Purchase Order can be changed/updated via this mechanism (fields in bold are data found in a service):
Field Field name
Percentage EBKN-VPROZ
Distribution Indicator EBAN-VRTKZ
Project EBKN-PROJN
Order EBKN-AUFNR
Responsibility Cost Centre EBKN-ZZMRESP
WBS Element EBKN-PS_PSP_PNR
Cost Centre EBKN-KOSTL
Unblocking User ESLL-USERF2_TXT
User for Approval ESLL-USERF1_TXT
Currency EBAN-WAERS
Quantity EBAN-MENGE
Price EBAN-PREIS
Price unit EBAN-PEINH
Overall Limit ESUH-SUMLIMIT
Expected Value ESUH-COMMITMENT
Net Value ESLL-NETWR
Thanks in advance.
~ AndiHi,
You can try these FM to update info record.
ME_DB_UPDATE_INFORECORDS
ME_UPDATE_INFORECORD
ME_UPDATE_INFORECORD_COND
ME_UPDATE_INFORECORD_PD
Check the sample code on BAPI_PO_CHANGE
http://www.sap-img.com/abap/sample-abap-code-on-bapi-po-change.htm
Regards,
Shiva Kumar -
hi folks...
i haev a requirement regarding ALE configuration...reqirement goes like this....once you create sales order in Va01, the daet should go to other SAP system through IDOCS automatically/....is it possible..if so can any one help me the configuration steps to acheive so.......if possible pls prvide me any step by step docs...thnx in advance...
santosh....Hi ,
1. Check any badi or userexit is exit for sales order.
2. In this exit or badi put the code which send idoc.
3. I have one program which send idoc ..i am sending purchase requistion idoc to other system.Check it.
*& Report Z_ARIBA_PURC_REQ_PULL *
REPORT Z_ARIBA_PURC_REQ_PUL no standard page heading.
**********************TABLE DECLARATION*******************************
TABLES : EBAN, EBKN, T024E.
*********************VARIABLE-DECLARATION****************************
---------> Segment Name <----------
CONSTANTS:
C_Z1APRHDR LIKE EDIDD-SEGNAM VALUE 'Z1APRHDR',
C_Z1APRITM LIKE EDIDD-SEGNAM VALUE 'Z1APRITM',
C_Z1APRSPT LIKE EDIDD-SEGNAM VALUE 'Z1APRSPT',
**************--> Idoc Type <--
C_PR_IDOC_TYPE like EDIDC-IDOCTP value 'ZARIBAPR'.
******************INPUT PARAMETERS DECLARATION************************
PARAMETERS : P_BANFN LIKE EBAN-BANFN,
P_MESTYP LIKE EDMSG-MSGTYP OBLIGATORY,
P_LOGSYS LIKE TBDLST-LOGSYS.
Data declarations
DATA: T_EDIDD LIKE EDIDD OCCURS 0 WITH HEADER LINE.
DATA: T_COMM_IDOC LIKE EDIDC OCCURS 0 WITH HEADER LINE.
DATA: T_CONTROL_RECORD LIKE EDIDC OCCURS 0 WITH HEADER LINE.
DATA: T_PR_HDR LIKE ZARPRHEADER,
T_PR_ITEM1 LIKE ZARPRITEM,
T_PR_SPLIT1 LIKE ZARPRSPLIT.
DATA : BEGIN OF T_PR_ITEM,
RQNUM TYPE BANFN,
BNFPO(5) TYPE C,
FLIEF TYPE FLIEF,
SUPLC TYPE FLIEF,
CONID TYPE FLIEF,
DELTA TYPE ERNAM,
LFDAT TYPE LFDAT,
MATKL TYPE MATKL,
MENGE(15) TYPE C,
PREIS(15) TYPE C,
WAERS(5) TYPE C,
MEINS(3) TYPE C,
WERKS TYPE WERKS_D,
MATNR TYPE MATNR,
TXZ02 TYPE MAKTX,
IDNLF TYPE IDNLF,
SUPAP(20) TYPE C,
EPSTP TYPE EPSTP,
KNTTP TYPE KNTTP,
EKGRP TYPE EKGRP,
STATU TYPE STATU,
BEDNR TYPE BEDNR,
END OF T_PR_ITEM.
DATA : BEGIN OF T_PR_SPLIT,
BANFN TYPE BANFN,
BNFPO(5) TYPE C,
ZEBKN(2) TYPE C,
VPROZ(3) TYPE C,
NETWR(18) TYPE C,
AMTCR(18) TYPE C,
MENGE(17) TYPE C,
KOSTL TYPE KOSTL,
SAKTO TYPE SAKTO,
ANLN1 TYPE ANLN1,
PS_PSP_PNR(8) TYPE C,
APLZL(40) TYPE C,
END OF T_PR_SPLIT.
DATA: COUNTER TYPE I.
Internal tables
DATA: IT_EBAN LIKE EBAN OCCURS 0 WITH HEADER LINE.
Spilt Accounting Internal Table
DATA : BEGIN OF IT_EBKN OCCURS 10,
BANFN LIKE EBKN-BANFN,
BNFPO LIKE EBKN-BNFPO,
ZEBKN LIKE EBKN-ZEBKN,
VPROZ LIKE EBKN-VPROZ,
SAKTO LIKE EBKN-SAKTO,
KOSTL LIKE EBKN-KOSTL,
ANLN1 LIKE EBKN-ANLN1,
PS_PSP_PNR LIKE EBKN-PS_PSP_PNR,
APLZL LIKE EBKN-APLZL,
VPTNR LIKE EBKN-VPTNR,
NETWR LIKE EBKN-NETWR,
END OF IT_EBKN.
Program Logic
START-OF-SELECTION.
SELECT *
INTO TABLE IT_EBAN
FROM EBAN
WHERE BANFN EQ P_BANFN
AND BSART EQ 'ZAR'.
IF SY-SUBRC NE 0.
EXIT.
ELSE.
DESCRIBE TABLE IT_EBAN LINES COUNTER.
IF COUNTER GT 0.
SELECT BANFN BNFPO ZEBKN VPROZ SAKTO KOSTL ANLN1 PS_PSP_PNR APLZL
VPTNR NETWR
INTO TABLE IT_EBKN FROM EBKN
FOR ALL ENTRIES IN IT_EBAN
WHERE BANFN EQ IT_EBAN-BANFN AND
BNFPO EQ IT_EBAN-BNFPO.
ENDIF.
PERFORM CONTROL_REC.
PERFORM DATA_POPULATE.
PERFORM IDOC_DISTRIBUTION.
ENDIF.
END-OF-SELECTION.
*& Form CONTROL_REC
text
--> p1 text
<-- p2 text
FORM CONTROL_REC .
T_CONTROL_RECORD-mestyp = P_MESTYP.
T_CONTROL_RECORD-idoctp = C_PR_IDOC_TYPE.
T_CONTROL_RECORD-rcvprt = 'LS'.
T_CONTROL_RECORD-rcvprn = P_LOGSYS.
ENDFORM. " CONTROL_REC
FORM DATA_POPULATE ************************
FORM DATA_POPULATE .
Purchase Requisition Header Information.
READ TABLE IT_EBAN WITH KEY BANFN = P_BANFN BINARY SEARCH.
IF SY-SUBRC EQ 0.
T_PR_HDR-RQNUM = IT_EBAN-BANFN.
T_PR_HDR-RQDATE = IT_EBAN-BADAT.
T_PR_HDR-RQNAM = IT_EBAN-ERNAM.
T_PR_HDR-WERKS = IT_EBAN-WERKS.
CLEAR T024E.
SELECT SINGLE *
FROM T024E
WHERE EKORG = IT_EBAN-EKORG.
T_PR_HDR-BUKRS = T024E-BUKRS.
T_PR_HDR-EKORG = IT_EBAN-EKORG.
T_PR_HDR-BADAT = IT_EBAN-BADAT.
T_PR_HDR-FRGDT = IT_EBAN-FRGDT.
Fill the administrative section of the data record
T_EDIDD-SEGNAM = C_Z1APRHDR.
T_EDIDD-SDATA = T_PR_HDR.
APPEND T_EDIDD.
CLEAR T_EDIDD.
ENDIF.
Purchase Requisition Item Information
LOOP AT IT_EBAN
WHERE BANFN = P_BANFN.
T_PR_ITEM-RQNUM = IT_EBAN-BANFN.
T_PR_ITEM-BNFPO = IT_EBAN-BNFPO.
T_PR_ITEM-FLIEF = IT_EBAN-FLIEF.
T_PR_ITEM-SUPLC = IT_EBAN-FLIEF.
T_PR_ITEM-CONID = IT_EBAN-FLIEF.
T_PR_ITEM-DELTA = 'ARIBASYSTEM'.
T_PR_ITEM-LFDAT = IT_EBAN-LFDAT.
T_PR_ITEM-MATKL = IT_EBAN-MATKL.
T_PR_ITEM-MENGE = IT_EBAN-MENGE.
T_PR_ITEM-PREIS = IT_EBAN-PREIS.
T_PR_ITEM-WAERS = IT_EBAN-WAERS.
T_PR_ITEM-MEINS = IT_EBAN-MEINS.
T_PR_ITEM-WERKS = IT_EBAN-WERKS.
T_PR_ITEM-DELTO = ' '.
T_PR_ITEM-MATNR = IT_EBAN-MATNR.
T_PR_ITEM-TXZ02 = IT_EBAN-TXZ01.
T_PR_ITEM-IDNLF = IT_EBAN-IDNLF.
T_PR_ITEM-SUPAP = ' '.
T_PR_ITEM-EPSTP = IT_EBAN-PSTYP..
T_PR_ITEM-KNTTP = IT_EBAN-KNTTP.
T_PR_ITEM-EKGRP = IT_EBAN-EKGRP.
T_PR_ITEM-STATU = IT_EBAN-STATU.
T_PR_ITEM-BEDNR = IT_EBAN-BEDNR.
Fill the administrative section of the data record
T_EDIDD-SEGNAM = C_Z1APRITM.
T_EDIDD-SDATA = T_PR_ITEM.
APPEND T_EDIDD.
CLEAR T_EDIDD.
Split Accounting Information
LOOP AT IT_EBKN
WHERE BANFN = IT_EBAN-BANFN
AND BNFPO = IT_EBAN-BNFPO.
T_PR_SPLIT-BANFN = IT_EBKN-BANFN.
T_PR_SPLIT-BNFPO = IT_EBKN-BNFPO.
T_PR_SPLIT-ZEBKN = IT_EBKN-ZEBKN.
IF IT_EBAN-VRTKZ IS INITIAL.
T_PR_SPLIT-VPROZ = '100'.
ELSE.
T_PR_SPLIT-VPROZ = IT_EBKN-VPROZ.
ENDIF.
T_PR_SPLIT-NETWR = ' '.
T_PR_SPLIT-AMTCR = ' '.
T_PR_SPLIT-MENGE = IT_EBAN-MENGE.
T_PR_SPLIT-VPTNR = ' '.
T_PR_SPLIT-KOSTL = IT_EBKN-KOSTL.
T_PR_SPLIT-SAKTO = IT_EBKN-SAKTO.
T_PR_SPLIT-ANLN1 = IT_EBKN-ANLN1.
T_PR_SPLIT-PS_PSP_PNR = IT_EBKN-PS_PSP_PNR.
T_PR_SPLIT-APLZL = IT_EBKN-APLZL.
Fill the administrative section of the data record
T_EDIDD-SEGNAM = C_Z1APRSPT.
T_EDIDD-SDATA = T_PR_SPLIT.
APPEND T_EDIDD.
ENDLOOP.
ENDLOOP.
ENDFORM. " DATA_POPULATE
**********************Form IDOC_DISTRIBUTION*************************
FORM IDOC_DISTRIBUTION .
CALL FUNCTION 'MASTER_IDOC_DISTRIBUTE'
EXPORTING
MASTER_IDOC_CONTROL = T_CONTROL_RECORD
OBJ_TYPE = ''
CHNUM = ''
TABLES
COMMUNICATION_IDOC_CONTROL = T_COMM_IDOC
MASTER_IDOC_DATA = T_EDIDD
EXCEPTIONS
ERROR_IN_IDOC_CONTROL = 1
ERROR_WRITING_IDOC_STATUS = 2
ERROR_IN_IDOC_DATA = 3
SENDING_LOGICAL_SYSTEM_UNKNOWN = 4
OTHERS = 5.
IF SY-SUBRC <> 0.
MESSAGE E001 WITH R_BANFN.
ELSE.
LOOP AT T_COMM_IDOC.
WRITE:/ 'IDoc generated', T_COMM_IDOC-docnum.
ENDLOOP.
COMMIT WORK.
ENDIF.
ENDFORM. -
Pending Purchase Requisition (PR) qunatity
Dear Sir,
We have a business scenario where PRs have account assignment as a WBS element . We need to get information pertaining to Item wise pending PRs quantity for a WBS element .
Kindly guide us as is there any standard Function-module is there for this . Incase we need to write a code , what is the efficinent logic which should be used in writing the code .
We would be highly greatful for the kind help and <removed_by_moderator>.
Regards
B Mittal
Edited by: Julius Bussche on Jul 8, 2008 5:12 PMDear Mr. Mittal:
If you are looking for the purchase requsitions for a WBS element you should search using the following Joint:
EBAN-->EBKN where
EBAN-KNTTP = "Q" (for project stock) or = "P" (with project expenses)
EBAN-LOEKZ = space (not deleted)
EBAN-EBAKZ = space (no closed requisitions)
EBKN-PS_PSP_PNR = your project internal code.
I don't know if you are using multiple account assignment in your requisitions. If you are using this funcionality is possible have more than one entry on EBKN for each record in EBAN.
Be awared about the WBS internal/external format. You should use thefollowing function modules to execute this conversion.
CONVERSION_EXIT_ABPSP_INPUT
CONVERSION_EXIT_ABPSP_OUTPUT
Best regards,
Jose Luis -
FM - KBLD - The difference between POSID and PS_PSP_PNR
Hi,
What is the difference between POSID and PS_PSP_PNR in
structure KBLD?
When each of them is being used?
Thanks,
Eyal.Have you noticed that the data types for these two fileds are different thought the field desc is the same?
POSID is for WBS elemnt in ext format while PS_PSP_PNR has the internal format. Double click on the Data elements of these fields in SE11 & you can see the Conversion routines tied to them.
~Suresh -
How do you determine the SPML posid for identities or roles,
We are currently on 11.1.1.3.0
There are multiple SPML operations to update or delete identities or roles. And all these require us to pass in a posID (either identity:NNN or role:NNN).
My question is how does one get the posID programatically? So far the only way I know of is a manual process. To get the users posID, its displayed on the OIM admin console when viewing the details for a user. However for a role, I have had to look it up in the database table, UGP.UGP_KEY.
There are some lookup operations in the WSDL but as of 11.1.1.3.0, they are all unimplemented.
Thanks
Aspi Engineer
Putnam InvestmentsI raised an SR with oracle about this and their response was that the only way to do this is through the lookup methods which would be implemented in future patches.
-
Mass Maintennace for EBKN not EBAN
Dear Experts,
I need to perform mass maintenance for a lot of PRs .. so I used T-Code MEMASSRQ which perform this on PRs but I found that this program only run for standard Items not account assignment items .
The data I want to change is in the table EBKN not EBAN which the program is dealing with
How to solve this problem ?
Thanks in advancedDear,
Mass maintainance in MEMASSRQ for PR is provided only for table EBAN.
You cann't process the Mass maintainance of account assignment of table EBKN in this transaction.
You can either go for BDC or LSMW to modify PR as per your requirement for multiple PR's
rgds
gsc -
Statement not accesible : "MOVE-CORRESPONDING ebkn TO *ebkn."
hi guys,
(system upgraded from 4.6 to 6.0 and made unicode compatible)
thr r two problems........
1. "MOVE-CORRESPONDING ebkn TO *ebkn." is not accessible, is it something related to mirror image......... how to resolve this.
2. Refresh it_tab - "Refresh and clear statements are not accesible" .
These are present inside includes..... ( is it somewhere related to use of subroutines prior to the use of refresh or clear statement......)
Those tables are defined prior to the statement Refresh or Clear.......Hi Mohd,
please paste error message(s) in detail:
source name(s)
source line(1)
full error message including message class, type and number
If you get W messages (warnings), you may ignore them.
Regards,
Clemens -
FM to convert posid (wbs element ) to pspnr (wbs element)
hi ,
Requirement like
Input wbs element posid = M-GA-0022-007 ( i.e 24 char )
output wbs element pspnr = 00000619 (i.e 8 numc )
so any Funtion module which convert the posid(24 char ) to pspnr ( 8 numc) ?Check these Functions
From 8 to 24 char
CALL FUNCTION 'CONVERSION_EXIT_ABPSP_OUTPUT'
EXPORTING
input = nr_num
IMPORTING
output = nr_char.
From 24Char to 8 Char
CALL FUNCTION 'CONVERSION_EXIT_ABPSP_INPUT'
EXPORTING
input = wbs
IMPORTING
output = wpspnr -
Performance ME51 table EBKN partially active
Hello group,
we suddenly had a performance issue, and we found that suddenly table EBKN appeared as "patially active" in the database. After activating the performance problems were gone. But we have no clue as to how the table got the status "partially active" and what this means. We got no errors or warnings when activating.
Doe sanyone have a clue as to what the cause is for the status "partially active"?
Regards, Léon HoeneveldHi,
> I've checked with SE01 Transport organizer if any transport contained table EBKN.
it's not necessarily the table but could be one of the includes .... .
Partially active means that a part of the table (e.g. an include) was not active while the table (the part without the include) was active. You can try to find that part and search that in transports.
In the cases i had i was like this.
Regaring your performance problems: I wonder if they have to do with a partially activated table. Honestly i doubt it.
Programs working on partially activated tables should either work or dump but i never heard of performance problems
related to partially activated tables....
Kind regards,
Hermann -
Hi all,
I'm having a problem with entries in the table PRPS. Someone entered data in the table with format BExx_100000.
After that, they activated a coding mask saying that the format must be BExx.10000.
Now we're receiving a shortdump when executing the search help saying that 10_00000 cannot be interpreted as a number. The coding mask has been already used, so we cannot delete the coding mask...
How can we proceed ?
thanks for the help !Hey Neil,
thanks for the tip !
Luckely for us, we were not the only one who had this problem
SAP has a note (453280) were they include a program to solve issues like this. I ran program zzadjustposid which allowed us to adjust all posid's.
Sandly enough it was my functional colleague which had the idea to search for an Oss note, so that's something which I willhear for the next 3 months -
Move VBAP-PS_PSP_PNR number to DXVBAP in EXITS
HI Experts,
I have to use "EXIT'_SAPLVEDA_001" for FM " IDOC_INBOUND_ORDERS"
to enhance the inbound idoc , Here i need to pass the PS_PSP_PNR number from VBAP table to DXVBAP parameter which available in Exits " "EXIT'_SAPLVEDA_001". That PS_PSP_PNR number already available in Inbound IDOC under E1EDP02 Segment but the DXVBAP parameter in Exit does not refer to any Associated type
In this case How can i move the PS_PSP_PNR number to that DXVBAP.
Thanks in AdvanceINCLUDE LVEDACOM.
DATA: lt_xvbap LIKE STANDARD TABLE OF xvbap.
lt_xvbap[] = dxvbap[].
Then you should be able to access the PS_PSP_PNR field while processing the internal table lt_xvbap.
Or, another way would be:
INCLUDE LVEDACOM.
FIELD-SYMBOLS: <xvbap> LIKE xvbap.
LOOP AT dxvbap assigning <xvbap>.
"here you have access to <xvbap>-PS_PSP_PNR.
ENDLOOP.
Maybe you are looking for
-
I am looking for an app that allows you to store your photos on the net etc. then you are able to view them on you iPad/iPhone without using all the memory. I have too many photos they don't all fit but I would like to view them. Does anyone know of
-
How to create table view with reference table
Hi experts, How to create table view with reference table in SE11, plz gve me stp by stp procedure. pints grnded for hlp.
-
Song Name Field Not Showing up when Ipod connected to ITunes
I have one of the first IPOD's (15GB). When connected to ITunes and I click on music to see my whole list, it does not display the "song names". I've been through all the help screens, and they say to "check mark" the song name field. When you bring
-
On start up my mac is showing a folder and flashing question mark sign?
On start up my mac shows a folder sign & flashing question mark?? Help and Why??
-
Setting Up Roland A-Pro Control surfaces with Logic
I have struggled with Logic Pro 8.0.3 and a new Roland A-500Pro midi keyboard which was reputed to be "easy to configure with a Mac". Despite many discussions with a Roland help person (he tried very hard), The A-Pro control maps provided just don't