Purchase requisition and cost center authorization check
Hi all,
in a R/3 4.7, I need to check the cost center (or profit center) when managing (create/modify/view) purchase requisitions.
I have not found any auths object which perform this check.
Any idea ?
A BADI seems to be he only solution, inserting an authorizaton check.
Thanks
Andrea
Hi
use the BADI in SE18 Tcode
ME_REQ_POSTED
implement this and use
the Method POSTED has the parameter IM_EBKN which has KOSTL field
this will work
see the sample code for this BADI
BAdI Name: ZPUR_RFQ (Implementation name) Purchase Requisitions
Definition Name: ME_REQ_POSTED
Interface Name : IF_EX_ME_REQ_POSTED
Implementing Class: ZCL_IM_PUR_REQ
Method : POSTED
METHOD if_ex_me_req_posted~posted .
TYPE-POOLS: pgrt.
DATA: t_txpdat TYPE STANDARD TABLE OF txpdat.
DATA: s_txpdat TYPE txpdat.
DATA: t_ident TYPE pgrt_t_obj_ident.
DATA: s_ident TYPE pgrt_obj_ident.
DATA: ident_tmp TYPE eketkey.
DATA: nmrid_init TYPE txpdat-nmrid.
DATA t_obj_event TYPE pgrt_t_obj_event.
DATA s_obj_event TYPE pgrt_obj_event.
DATA t_event TYPE pgrt_t_event.
DATA s_event TYPE pgrt_event.
DATA change_yes TYPE c.
IF l_s_eban-estkz NE 'B'.
CLEAR v_mtart.
SELECT SINGLE mtart INTO v_mtart FROM mara WHERE matnr = l_s_eban-matnr.
IF v_mtart EQ 'ZERS' OR v_mtart EQ 'FHMI' OR v_mtart EQ 'UNBW'.
MESSAGE e000(zm_msg) WITH 'You are not allowed' 'to create PR for stock items'.
ENDIF.
ENDIF.
IF l_s_eban-knttp NE 'F' OR l_s_eban-pstyp NE '9'.
IF l_s_eban-knttp NE 'A'.
IF ( l_s_eban-pstyp NE '9' AND l_s_eban-pstyp NE 'D' ) AND l_s_eban-matnr EQ space.
MESSAGE e000(zm_msg) WITH 'You cannot create' 'a PR without material number'.
ENDIF.
ENDIF.
ENDIF.
ENDLOOP.
ENDMETHOD.
reward points if useful
regards
Anji
Similar Messages
-
Payment method and cost center validation check in MIRO while save or simul
Hi,
I want to put a validation check between payment method and cost center while posting MIRO against PO (MIGO done) . If my payment method and cost center matches then system should allow that entry otherwise should popup a message .
We tried this with user_exit - EXIT_SAPLMRMP_010 enhancement LMR1M001 .
But thing is it is not getting triggered at all either at the time of simulation or at the time of saving . We are also looking into BADI - update_invoice .
Any body having any idea on this please share.
ThanksHi,
Please don't open multiple threads for the same question..Please close this one..
THanks,
Naren -
Purchase Requisition - Validate Cost Center
Hi,
I need to check the data when creating a Purchase Requisition with reference to an existing Purchase Requisition. Currently, I am using the user exit EXIT_SAPLMEREQ_005 to carry out these checks.
One of the checks that I need to do is to validate Cost Center. However, in this user exit, there is no cost center found in any of the imported parameters. Hence, I tried to use the function module 'COBL_RECEIVE'. However, the Cost Center retrieved is not refreshed and is incorrect. Are there any other ways where I can retrieve the correct Cost Center that is populated from the reference Purchase Requisition?
Will appreciate any help in resolving this issue.
Thanks lots.
Cheers,
LiyanHi
use the BADI in SE18 Tcode
ME_REQ_POSTED
implement this and use
the Method POSTED has the parameter IM_EBKN which has KOSTL field
this will work
see the sample code for this BADI
BAdI Name: ZPUR_RFQ (Implementation name) Purchase Requisitions
Definition Name: ME_REQ_POSTED
Interface Name : IF_EX_ME_REQ_POSTED
Implementing Class: ZCL_IM_PUR_REQ
Method : POSTED
METHOD if_ex_me_req_posted~posted .
TYPE-POOLS: pgrt.
DATA: t_txpdat TYPE STANDARD TABLE OF txpdat.
DATA: s_txpdat TYPE txpdat.
DATA: t_ident TYPE pgrt_t_obj_ident.
DATA: s_ident TYPE pgrt_obj_ident.
DATA: ident_tmp TYPE eketkey.
DATA: nmrid_init TYPE txpdat-nmrid.
DATA t_obj_event TYPE pgrt_t_obj_event.
DATA s_obj_event TYPE pgrt_obj_event.
DATA t_event TYPE pgrt_t_event.
DATA s_event TYPE pgrt_event.
DATA change_yes TYPE c.
IF l_s_eban-estkz NE 'B'.
CLEAR v_mtart.
SELECT SINGLE mtart INTO v_mtart FROM mara WHERE matnr = l_s_eban-matnr.
IF v_mtart EQ 'ZERS' OR v_mtart EQ 'FHMI' OR v_mtart EQ 'UNBW'.
MESSAGE e000(zm_msg) WITH 'You are not allowed' 'to create PR for stock items'.
ENDIF.
ENDIF.
IF l_s_eban-knttp NE 'F' OR l_s_eban-pstyp NE '9'.
IF l_s_eban-knttp NE 'A'.
IF ( l_s_eban-pstyp NE '9' AND l_s_eban-pstyp NE 'D' ) AND l_s_eban-matnr EQ space.
MESSAGE e000(zm_msg) WITH 'You cannot create' 'a PR without material number'.
ENDIF.
ENDIF.
ENDIF.
ENDLOOP.
ENDMETHOD.
reward points if useful
regards
Anji -
How to control cost center authorization when do ABSO/ABAA
Dear :
As our system organization structure is with mutiple profit center and
cost centers, in order to avoid processing TCODE ABSO/ABAA with wrong
input, we want to make authorization check with cost centers, as there
is no standard authorization check and control in TCODE ABSO/ABSS , we
want to know how could we realize the requirement
to control the TCODE with cost center authorization check, thanks in
advance.Hi,
check SAPNET note 370082 + related notes + 698401 / 565436.
Best regards, Christian -
Create Purchase Order to cost center
Hi,
Will it be possible to create a purchase requisition from the MRP run which has account assignment K and default a cost center.
At the moment I need manually to update the requisition item line with 'k' and costcenter before converting to a purchase order.
br,
AndersThe purpose of MRP run is to make sure that you always have enough stock.
An order to cost center will not increase stock.
Means: MRP is not able to create requisitions for cost center consumption. If you change a requisition created by MRP to be ordered to a cost center, then the next MRP run will create a new requisition to stock. -
Changes in short text in Purchase Requisition and Purchase Order
Dear experts,
Can you help me with the following issue:
During creation of Purchase Requisition and Purchase Order with Account assignment category K-Cost center the field Short text to allow input of data in it.
In all other cases During creation of Purchase Requisition and Purchase Order without Account assignment category K-Cost center the field Short text to be forbidden for input of data
Is it possible?
Thank you
RegardsDear Vasil Pavlov ,
This cannot be realize in sap standard system. You may want to write your own coding using
ME_PROCESS_REQ and ME_PROCESS_PO for purchase requisition and purchase order respectively.
Best Regards,
Loke Foong -
PO with account category and cost center as mandatory fields.
Hi everyone.
Pls. I need help with the next proces.
I have to customize a PO with Account Category as mandatory and the PO always must have the same G/L account and Cost Center.
Thanks for your help.
Regards.Hi..
Maintain Default Cost Centers for the Cost Elements in OKB9 transaction..Please check with your Controlling Consultant for this...
And SPRO > MM > Purchasing > Account Assignment > Maintain Account Assignment Categories > For Account Assignment Category (For e.g. "K" - Cost Center), in detailed screen, "Derive acct. assgt." should be active
Cheers
Ravi. -
Creating purchase Requisition and release Overview
Hello,
We have some User which have the authorization to create a purchase Requisition and also to release it by themselves.
We have to Monitor this cases and I' looking for a possibility to check this on a easy way.
I found the Report "Changedocu_read". There I can check several changes in the PR and see who released it. But there I can not see which User created the PR.
The table EBAN has the informations about the User who created the PR and if it had to be released and some more informations. But the informations who released the PR is missing.
I tryed a table-join of the tables EBAN and CDHDR. But it was not possible, because the PR Number (Filed "BANFN" in the EBAN) has not the same format as the number in the Filed "object value" in the table CDHDR.
Perhaps someone has an idea ?
Or there is an Standard Transaction which I did not found to have an overview of the PR and the releases
It would be enough to see following informations with one Join or Transaction:
-PR Number
-Creation Date
- Transaction code
-Change Date
-Release Status
-Released date
-Released by User
I have the same Topic also by purchase orders and the release of them.
Thank you in advance
Regards
DirkThanks both for the quick reply.
@AKPT
The Transaction is nice and helpful to Display some informations. But similar results I also receive when I use the Programm : "changedoc_read". I also had the idea to join the informations of the 2 sources in Excel. For me this Workaround would be ok.
But unfortunately I' m looking for an simply way (for the Enduser). To get this informations mentioned above in one overview directly in SAP.
They have to use this check regularly, to Monitor if there were some wrong Releases.
If there is not such a way then we have to join it in Excel.
But if you have some other suggestions I'm happy to hear them.
Regards
Dirk -
Shipment cost-G/L Acc and cost center automatically
Hi gurus,
I want to get G/L account and Cost center automatically during shipment cost creation I mentioned account assignment category as "U" in the purchase order.currently it is manually entered at the time of shipment cost creation.
How can i determine the G/Laccount and cost center automatically at the time of shipment cost creation?
Is it possible or not.
Thanks in advanceDear Sameer,
Reqd. settings are reqd. o maintain under
*1*. T. Code: OBYC
maintain the G/L accounts against the vaild combination, i.e.
Chart of accounts
Transaction
General modifier
Val Class
GL Account
Note: T. Code: OMWD - Assign Val. Grp. Code to Avl Area, if not.
*2*. T. Code: OKB9 - GL Account / Cost Element & Cost Center Linking
Maintain entries for default account assignment i.e. maintain entry for combination:
Company Code -- Cost Element (G/L), and assign Cost Center in "Detail per Profit Cener" from Dialog structure.
Once done, check setting in
T. Code: T_56
(SPRO --> IMG --> Logisitcs-Execution --> Transporation --> Shipment Costs --> Shipment Cost Document --> Shipment Cost Type and Item Category)
From left-hand side Dialog structure, Click: Assign shipment cost types and item category
Check, Column: Automatic Propsal, is maintained as "Automatc" or "Manual" for valid Item Category.
Best Regards,
Amit -
Sourcing: Shows wrong company code and cost center
Hello
We have implemented SRM4.0 SP8. When we display shopping carts in sourcing cockpit before aggregate to create a PO, we check that SC from different companies doesnt show the correct company code and cost center. We have a central purchase group that aggregates SC from different enterprises. For two SC, the second displays a wrong company code and cost center.
Example:
First SC:
SC -> A123
Company -> SNLL
Cost center > AAA
Second SC:
SC -> A124
Company -> SNPP
Const center -> BBB
When displaying the second SC it shows company code SNLL and Cost center AAA each is incorrect. In DB data is correct for each SC, company code (table BBP_PDBEI) and cost center per item (BBP_PDACC). Even if we aggregate both SC to create one PO, this document has correct data per item (different company code, requester, cost center) the only issue is related with the information showed in ITS/HTML in sourcing cockpit before aggregation.
Do you have any idea how can we resolve this?
Thanks in advanceHi
Seems like a SRM bug.. with the Support pack 8... Try upgrade to latest support pack in SRM system, if possible...
Also Please create a customer OSS message with SAP !!
Do let me know.
Regards
- Atul -
Not updating G/L account and cost center with BAPI BAPI_PO_CREATE1
Hello Friends,
The two fields G/L ACCOUNT and Cost Center is not updated using BAPI BAPI_PO_CREATE1. I am unable to understand why? This is what i am passing to account assignment structure( POACCOUNT). Filled POACCOUNTX structre as well. I have passed company code at the header level.
PO_ITEM = 00010
SERIAL_NO = 01
CREAT_DATE = sy-datum
GL_ACCOUNT = 621000
COSTCENTER = 1000
CO_AREA = 4000
Please let me know why it is not updating anything i missed while passing?
2>I need to update GR quantity but this field is not available in the BAPI ..Please let me know how to update this field.
Any help is highly appreciated.
Regards,
RajHi, I have a problem I use the bapi BAPI_PO_CREATE1, I pass the table pt_poaccount in the parameter poaccount but the bapi when register my purchase order doesn't register correctly the values KOSTL, AUFNR, PS_PSP_PNR, NPLNR of the tablepoaccount and register the default values of the contract. Please i need help with this.
CLEAR s_poaccount.
s_poaccount-po_item = <fs_datos>-ebelp.
s_poaccount-serial_no = w_serial.
s_poaccount-costcenter = <fs_datos>-kostl.
s_poaccount-orderid = <fs_datos>-aufnr.
s_poaccount-wbs_element = <fs_datos>-ps_psp_pnr.
s_poaccount-network = <fs_datos>-nplnr.
s_poaccount-activity = <fs_datos>-vornr.
s_poaccount-quantity = <fs_datos>-menge.
s_poaccount-net_value = <fs_datos>-brtwr.
s_poaccount-creat_date = sy-datum.
s_poaccount-itm_number = <fs_datos>-ebelp.
s_poaccount-co_area = '1001'.
APPEND s_poaccount TO pt_poaccount.
CLEAR s_poaccountx.
s_poaccountx-po_item = <fs_datos>-ebelp.
s_poaccountx-serial_no = w_serial.
s_poaccountx-po_itemx = 'X'.
s_poaccountx-serial_nox = 'X'.
s_poaccountx-creat_date = 'X'.
s_poaccountx-itm_number = 'X'.
s_poaccountx-co_area = 'X'.
s_poaccountx-costcenter = 'X'.
s_poaccountx-orderid = 'X'.
s_poaccountx-wbs_element = 'X'.
s_poaccountx-network = 'X'.
s_poaccountx-activity = 'X'.
s_poaccountx-quantity = 'X'.
s_poaccountx-net_value = 'X'.
APPEND s_poaccountx TO pt_poaccountx.
CALL FUNCTION 'BAPI_PO_CREATE1'
EXPORTING
poheader = pe_poheader
poheaderx = pe_poheaderx
IMPORTING
exppurchaseorder = pi_exppurchaseorder
TABLES
return = pt_return
poitem = pt_poitem
poitemx = pt_poitemx
poschedule = pt_poschedule
poschedulex = pt_poschedulex
poaccount = pt_poaccount
poaccountx = pt_poaccountx
poservices = pt_poservices
posrvaccessvalues = pt_posrvaccessvalues.
The BAPI is register with these values as default however i pass other values in table
pt_poaccount -
Control G/L account and Cost Center for movement type 251
Dear Friends,
I would like to use mov. type 251 for GI for sale and like to control over G/L account and Cost center.
The G/L account is by default from the valuation class of the the material and if the user will enter wrong G/L
we had done the customising in OMJJ movement type 251 - Account grouping - Unchecked the check box of column
"Check account assignment" - Impact is " the system always uses the G/L accounts or account assignments determined automatically"
I also made default cost center for G/L account and plant wise through OKB9.
Now I would like to suppress/dispaly the G/L account and cost center - for same I had done Setting in Entry control menu of OMJJ for 251 of field Account control - Value - "-" field is suppressed. But it is not working.
Please advise to solve this situation.
Thanks & Regards
RajanDear Rajan
Yes, I have checked in MB1A earlier. We have separate node for Field seletion layout for Enjoy transaction MIGO for mvt type in which the G/L account (KONTO) an Cost center (KOSTL) have only optional or required entry selection.
warm regards
Ramakrishna. -
Default G/L acct and Cost center in service PO with added Freight line also
Hi,
I am doing Service PO my requirement is we need default G/l account and cost center in Service PO, we have added one line as Freight charges that is also required default g/l account.
please suggest me the configuration.
Thanks
ShitalHi,
Can be set with help of following t.codes to have default G/L account with cost center in Service PO
OME9, OMGO ,OMQW & OBYC
Also check the blog:
http://www.bluemarlinsys.com/ns/0603-03.asp
Regards,
Biju K -
Purchase requisitions and purchase orders
Hello Gurus,
In contrast, by default, both purchase requisitions and purchase orders can be generated automatically for the item category ALES, will you please tell me the sequence and where to create purchase requisitions and purchase orders ?
Many thanks,Hello,
The PO is getting created automatically because of the Create PO automatically check in the item categroy ALES.
But in normal case, the PR will be generated, it is a request for purchase, it should get approved by the purchasign dept, then create PO with reference to the PR.
Prase -
Report on list of purchase requisitions and related POs..
Hi,
I have a requirement to generate a simple abap report to display a list of purchase requisitions and its related POs. If my understanding is correct, for a single purchase requisition, multiple POs can exist, right ? Can someone help me with the select query for this ? also can you let me know typically what can be the basic fields displayd in such a report ?
I need to understand the relationship between the tables involved for pur req and Pur orders.
thanksHi check this code... to get PO and PR related to SO..
REPORT z_so_info.
TABLES: vbak, vbap, afko, afpo.
*Field catalog
TYPE-POOLS: slis.
DATA: lv_repid TYPE sy-repid VALUE sy-repid,
xfield TYPE slis_t_fieldcat_alv,
afield TYPE slis_fieldcat_alv.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(25) text-002.
SELECT-OPTIONS: so_so FOR vbak-vbeln OBLIGATORY.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK b1.
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-003.
PARAMETERS:
p_kunnr LIKE vbak-kunnr, " sold-to
p_kunwe LIKE vbak-kunnr. " ship-to
SELECTION-SCREEN END OF BLOCK b2.
*Constants
CONSTANTS: c_zor TYPE vbak-auart VALUE 'ZOR',
c_we TYPE vbpa-parvw VALUE 'WE',
c_ag TYPE vbpa-parvw VALUE 'AG'.
c_space TYPE space.
*Ranges
RANGES: ra_parvw FOR vbpa-parvw,
ra_kunnr FOR vbpa-kunnr.
*Tables
DATA: BEGIN OF gt_output OCCURS 0,
vbeln LIKE vbak-vbeln, " sales order number
posnr LIKE vbap-posnr, " SO item number
matnr LIKE vbap-matnr, " material number
sh LIKE vbpa-kunnr, " Ship-to
sp LIKE vbpa-kunnr, " Sold-to
lifnr LIKE ekko-lifnr, " Vendor
bstnk LIKE vbak-bstnk, " PO number
banfn LIKE vbep-banfn, " Purchase requi
po_st TYPE char30, " PO status text
pstyv TYPE vbap-pstyv, " Item catagory
aufnr LIKE afpo-aufnr, " Production Order
prd_stat TYPE string, " Prd order status
END OF gt_output.
DATA: wa_output LIKE gt_output.
FIELD-SYMBOLS: <fs_output> LIKE gt_output.
*Table for sales order and PO
TYPES : BEGIN OF gs_data,
vbeln TYPE vbak-vbeln,
posnr TYPE vbap-posnr,
pstyv TYPE vbap-pstyv,
matnr TYPE vbap-matnr,
END OF gs_data.
DATA: gt_data TYPE STANDARD TABLE OF gs_data,
wa_data TYPE gs_data.
*Table for Production Orders
TYPES: BEGIN OF gs_prd,
aufnr TYPE afpo-aufnr,
posnr TYPE afpo-posnr,
kdauf TYPE afpo-kdauf,
kdpos TYPE afpo-kdpos,
wepos TYPE afpo-wepos, "Goods Receipt Indicator
elikz TYPE afpo-elikz, "Delivery Completed Indicator
objnr TYPE aufk-objnr, "Object number
getri TYPE afko-getri, "Confirmed Order Finish Date
gltri TYPE afko-gltri, "Actual finish date
END OF gs_prd.
DATA: gt_prd TYPE STANDARD TABLE OF gs_prd,
wa_prd TYPE gs_prd.
*Table for partner data
TYPES: BEGIN OF gs_partner,
vbeln TYPE vbak-vbeln,
posnr TYPE vbap-posnr,
parvw TYPE vbpa-parvw,
kunnr TYPE vbpa-kunnr,
END OF gs_partner.
DATA: gt_partner TYPE STANDARD TABLE OF gs_partner,
wa_partner TYPE gs_partner.
TYPES: BEGIN OF gs_po,
ebeln TYPE ekkn-ebeln,
ebelp TYPE ekkn-ebelp,
vbeln TYPE ekkn-vbeln,
vbelp TYPE ekkn-vbelp,
END OF gs_po.
DATA: gt_po TYPE STANDARD TABLE OF gs_po,
wa_po TYPE gs_po.
TYPES: BEGIN OF gs_preq,
vbeln TYPE vbep-vbeln,
posnr TYPE vbep-posnr,
banfn TYPE vbep-banfn,
END OF gs_preq.
DATA: gt_preq TYPE STANDARD TABLE OF gs_preq,
wa_preq TYPE gs_preq.
TYPES: BEGIN OF gs_po_stat,
ebeln TYPE ekko-ebeln,
procstat TYPE ekko-procstat,
lifnr TYPE ekko-lifnr,
END OF gs_po_stat.
DATA: gt_po_stat TYPE STANDARD TABLE OF gs_po_stat,
wa_po_stat TYPE gs_po_stat.
*Field symbols
FIELD-SYMBOLS: <fs> TYPE tj02t-txt04,
<fs_temp> TYPE tj02t-txt04,
<fs_stat> TYPE char30.
START-OF-SELECTION.
PERFORM fr_build_range.
PERFORM fr_get_data.
PERFORM fr_build_fc.
PERFORM fr_output.
*& Form fr_get_data
text
--> p1 text
<-- p2 text
FORM fr_get_data.
*Get SO
SELECT avbeln aposnr apstyv amatnr
FROM vbap AS a
JOIN vbak AS b
ON avbeln = bvbeln
JOIN vbpa AS c
ON bvbeln = cvbeln
INTO TABLE gt_data
WHERE b~vbeln IN so_so
AND b~auart EQ c_zor "Only Sales Orders
AND c~kunnr IN ra_kunnr. "from selection screen
DELETE ADJACENT DUPLICATES FROM gt_data COMPARING vbeln posnr.
*get data of the production order
IF NOT gt_data[] IS INITIAL.
SELECT aaufnr aposnr akdauf akdpos awepos aelikz
b~objnr
FROM afpo AS a
JOIN aufk AS b
ON aaufnr = baufnr
INTO TABLE gt_prd
FOR ALL ENTRIES IN gt_data
WHERE a~kdauf EQ gt_data-vbeln
AND a~kdpos EQ gt_data-posnr.
ENDIF.
*Get partner data
IF NOT gt_data[] IS INITIAL.
SELECT vbeln posnr parvw kunnr
FROM vbpa
INTO TABLE gt_partner
FOR ALL ENTRIES IN gt_data
WHERE vbeln EQ gt_data-vbeln.
ENDIF.
*Get Purchase Order
IF NOT gt_data[] IS INITIAL.
SELECT ebeln ebelp vbeln vbelp
FROM ekkn
INTO TABLE gt_po
FOR ALL ENTRIES IN gt_data
WHERE vbeln EQ gt_data-vbeln
AND vbelp EQ gt_data-posnr.
SELECT vbeln posnr banfn
FROM vbep
INTO TABLE gt_preq
FOR ALL ENTRIES IN gt_data
WHERE vbeln EQ gt_data-vbeln
AND posnr EQ gt_data-posnr.
ENDIF.
IF NOT gt_po[] IS INITIAL.
SELECT aebeln aprocstat a~lifnr
FROM ekko AS a
JOIN ekpo AS b
ON aebeln = bebeln
INTO TABLE gt_po_stat
FOR ALL ENTRIES IN gt_po
WHERE b~ebeln EQ gt_po-ebeln
AND b~ebelp EQ gt_po-ebelp.
ENDIF.
*Move data to output table
LOOP AT gt_data INTO wa_data.
wa_output-vbeln = wa_data-vbeln.
wa_output-posnr = wa_data-posnr.
wa_output-pstyv = wa_data-pstyv.
wa_output-matnr = wa_data-matnr.
READ TABLE gt_po INTO wa_po WITH KEY vbeln = wa_data-vbeln
vbelp = wa_data-posnr.
IF sy-subrc EQ 0.
wa_output-bstnk = wa_po-ebeln.
READ TABLE gt_po_stat INTO wa_po_stat WITH KEY ebeln = wa_po-ebeln.
IF sy-subrc EQ 0.
wa_output-lifnr = wa_po_stat-lifnr.
CASE wa_po_stat-procstat.
WHEN '01'.
wa_output-po_st = 'Version in process'.
WHEN '02'.
wa_output-po_st = 'Active'.
WHEN '03'.
wa_output-po_st = 'In release'.
WHEN '04'.
wa_output-po_st = 'Partially released'.
WHEN '05'.
wa_output-po_st = 'Released Completely'.
WHEN '08'.
wa_output-po_st = 'Rejected'.
ENDCASE.
ENDIF. "inner read subrc
ENDIF. "outer read subrc
READ TABLE gt_preq INTO wa_preq WITH KEY vbeln = wa_data-vbeln
posnr = wa_data-posnr.
IF sy-subrc EQ 0.
wa_output-banfn = wa_preq-banfn.
ENDIF.
READ TABLE gt_prd INTO wa_prd WITH KEY kdauf = wa_data-vbeln
kdpos = wa_data-posnr.
IF sy-subrc EQ 0.
wa_output-aufnr = wa_prd-aufnr.
*get the purchase requisition for production order as well
SELECT SINGLE banfn
FROM ebkn
INTO wa_output-banfn
WHERE aufnr EQ wa_prd-aufnr.
*Get the status of the production order
PERFORM fr_get_prd_stat USING wa_prd-objnr
CHANGING wa_output-prd_stat.
ENDIF. " sy-subrc
READ TABLE gt_partner INTO wa_partner WITH KEY vbeln = wa_data-vbeln
parvw = c_we.
IF sy-subrc EQ 0.
wa_output-sh = wa_partner-kunnr.
ENDIF.
READ TABLE gt_partner INTO wa_partner WITH KEY vbeln = wa_data-vbeln
parvw = c_ag.
IF sy-subrc EQ 0.
wa_output-sp = wa_partner-kunnr.
ENDIF.
APPEND wa_output TO gt_output.
CLEAR: wa_data, wa_prd,wa_partner,wa_output.
ENDLOOP.
ENDFORM. " fr_get_data
*& Form fr_build_range
text
--> p1 text
<-- p2 text
FORM fr_build_range .
*Range for partner function
MOVE 'I' TO ra_parvw-sign.
MOVE 'EQ' TO ra_parvw-option.
MOVE 'SH' TO ra_parvw-low. " we
APPEND ra_parvw.
CLEAR ra_parvw.
MOVE 'I' TO ra_parvw-sign.
MOVE 'EQ' TO ra_parvw-option.
MOVE 'SP' TO ra_parvw-low. " ag
APPEND ra_parvw.
CLEAR ra_parvw.
*Range for ship-to and sold-to
MOVE 'I' TO ra_kunnr-sign.
MOVE 'EQ' TO ra_kunnr-option.
MOVE p_kunnr TO ra_kunnr-low.
APPEND ra_kunnr.
CLEAR ra_kunnr.
MOVE 'I' TO ra_kunnr-sign.
MOVE 'EQ' TO ra_kunnr-option.
MOVE p_kunwe TO ra_kunnr-low.
APPEND ra_kunnr.
CLEAR ra_kunnr.
ENDFORM. " fr_build_range
*& Form fr_build_fc
text
--> p1 text
<-- p2 text
FORM fr_build_fc .
sales order number
afield-fieldname = 'VBELN'.
afield-seltext_s = 'Sales #'.
afield-ref_tabname = 'VBAK'.
APPEND afield TO xfield. CLEAR afield.
sales ITEM number
afield-fieldname = 'POSNR'.
afield-seltext_s = 'Item #'.
afield-ref_tabname = 'VBAP'.
APPEND afield TO xfield. CLEAR afield.
Material Number
afield-fieldname = 'MATNR'.
afield-seltext_s = 'Material #'.
afield-ref_tabname = 'VBAP'.
afield-outputlen = 10.
APPEND afield TO xfield. CLEAR afield.
*Vendor Number
afield-fieldname = 'LIFNR'.
afield-seltext_s = 'Vendor Num.'.
afield-ref_tabname = 'EKKO'.
APPEND afield TO xfield. CLEAR afield.
ship-to-party
afield-fieldname = 'SH'.
afield-seltext_s = 'Ship-to'.
afield-ref_tabname = 'VBPA'.
APPEND afield TO xfield. CLEAR afield.
sold-to-party
afield-fieldname = 'SP'.
afield-seltext_s = 'Sold-to'.
afield-ref_tabname = 'VBPA'.
APPEND afield TO xfield. CLEAR afield.
*PO number
afield-fieldname = 'BSTNK'.
afield-seltext_s = 'PO NUM'.
afield-ref_tabname = 'EKKO'.
APPEND afield TO xfield. CLEAR afield.
*PO status
afield-fieldname = 'PO_STAT'.
afield-seltext_s = 'Step'.
afield-ref_tabname = 'zbacklog_v2'.
APPEND afield TO xfield. CLEAR afield.
*PO step status
afield-fieldname = 'PO_ST'.
afield-seltext_s = 'PO.Status'.
afield-ref_tabname = 'zbacklog_v2'.
APPEND afield TO xfield. CLEAR afield.
*Purchase requisition
afield-fieldname = 'BANFN'.
afield-seltext_s = 'Pur. Req.'.
afield-ref_tabname = 'VBEP'.
APPEND afield TO xfield. CLEAR afield.
*Item catagory
afield-fieldname = 'PSTYV'.
afield-seltext_s = 'Itm. Catg'.
afield-ref_tabname = 'VBAP'.
APPEND afield TO xfield. CLEAR afield.
*Prodcution Order number
afield-fieldname = 'AUFNR'.
afield-seltext_m = 'Prod.Order'.
afield-ref_tabname = 'AFKO'.
APPEND afield TO xfield. CLEAR afield.
*PRODCUTION status
afield-fieldname = 'PRD_STAT'.
afield-seltext_s = 'Prd. Step'.
afield-ref_tabname = 'zbacklog_v2'.
afield-outputlen = 20.
APPEND afield TO xfield. CLEAR afield.
*PRODUCTION step status
afield-fieldname = 'PRD_ST'.
afield-seltext_s = 'Prd. Status'.
afield-ref_tabname = 'zbacklog_v2'.
APPEND afield TO xfield. CLEAR afield.
ENDFORM. " fr_build_fc
*& Form fr_output
text
--> p1 text
<-- p2 text
FORM fr_output .
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = sy-repid
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
I_STRUCTURE_NAME =
IS_LAYOUT =
it_fieldcat = xfield[]
i_default = 'X'
i_save = 'A'
TABLES
t_outtab = gt_output
EXCEPTIONS
program_error = 1
OTHERS = 2.
ENDFORM. " fr_output
*& Form fr_get_prd_stat
text
-->P_WA_PRD_OBJNR text
FORM fr_get_prd_stat USING p_objnr CHANGING p_prd_stat.
DATA: lt_status TYPE STANDARD TABLE OF jstat,
wa_status TYPE jstat,
lv_status TYPE tj02t-txt04,
lv_temp2 TYPE char5,
lv_buff TYPE string.
CALL FUNCTION 'STATUS_READ'
EXPORTING
client = sy-mandt
objnr = p_objnr
only_active = 'X'
TABLES
status = lt_status
EXCEPTIONS
object_not_found = 1
OTHERS = 2.
LOOP AT lt_status INTO wa_status.
IF wa_status-stat(1) EQ 'I'.
SELECT txt04 FROM tj02t
INTO lv_status
WHERE istat EQ wa_status-stat
AND spras EQ 'E'.
ENDSELECT.
lv_temp2 = lv_status.
CONCATENATE lv_temp2 p_prd_stat INTO p_prd_stat
SEPARATED BY ','.
ENDIF.
CLEAR: wa_status, lv_status, lv_temp2.
ENDLOOP.
lv_buff = p_prd_stat.
*Status of Production Order
IF lv_buff CS 'CRTD'.
p_prd_stat = 'Not Active'.
ENDIF.
IF lv_buff CS 'REL'.
IF lv_buff CS 'GMPS'.
p_prd_stat = 'Printed In Prod'.
ELSE.
p_prd_stat = 'Printed'.
ENDIF.
ENDIF.
IF lv_buff CS 'TECO'.
p_prd_stat = 'Technically Compt.'.
ENDIF.
ENDFORM. " fr_get_prd_stat
Maybe you are looking for
-
Access is denied Error while accessing WPC webpage
Hello, I am getting following error while trying to access a web page created through Web Page Composer. I am able to access correctly if I assign WPC role to user but I don't want assign this to user as I want it to be read only for this user. Pleas
-
Load Balancing Access manager using Citrix Netscaler
Anyone have any experience with this? Have the netscaler doing round robin cookie insert. Can't find any good examples. Do I need to add com.iplanet.am.lbcookie.name=something to AMConfig.properties and then put that name on the netscaler? Thanks in
-
I dont have User Name and Password
Hi guys I need reinstall my OS but and don't remember the Username and password what I can do???
-
Putting things on top of objects?
Somebody got an idea why the interactive objects always come on top of everything else? how can I put a small icon that is jpg or just a frame on top of the Object?
-
Airport extreme: join network or extend network
I have 2 other routers in my house: 1 airport express and 1 airport extreme (4th generation). my question is when I set the other two up is it better to join a network or extend a network? or does it make any difference in connection and speed?