Purchase requistion me51
hi friends,
Please can anyone post the code for purchase requistion me51.
Points will be rewarded for the code given.
r
report ZSUM_BDC_ME51 no standard page heading line-size 255.
*include bdcrecx1.
data: bdc_DATA like bdcdata occurs 0 with header line,
mess_tab like bdcmsgcoll occurs 0 with header line.
DATA: BEGIN OF ITAB OCCURS 0 ,
WERKS LIKE T001W-WERKS,
BNFPO LIKE EBAN-BNFPO,
MATNR LIKE MARA-MATNR,
MENGE LIKE EBAN-MENGE,
END OF ITAB.
*parameters: dataset(132) lower case.
DO NOT CHANGE - the generated data section - DO NOT CHANGE
If it is nessesary to change the data section use the rules:
1.) Each definition of a field exists of two lines
2.) The first line shows exactly the comment
'* data element: ' followed with the data element
which describes the field.
If you don't have a data element use the
comment without a data element name
3.) The second line shows the fieldname of the
structure, the fieldname must consist of
a fieldname and optional the character '_' and
three numbers and the field length in brackets
4.) Each field must be type C.
Generated data section with specific formatting - DO NOT CHANGE
*data: begin of record,
data element: BBSRT
BSART_001(004),
data element: LPEIN
LPEIN_002(001),
data element: EWERK
WERKS_003(004),
data element: EKGRP
EKGRP_004(003),
data element: AUFEB
BNFPO_005(005),
data element: MATNR
MATNR_01_006(018),
data element: BAMNG
MENGE_01_007(017),
data element: TXZ01
TXZ01_008(040),
data element: BAMNG
MENGE_009(017),
data element: EEIND
EEIND_010(010),
data element: LPEIN
LPEIN_011(001),
data element: EKGRP
EKGRP_012(003),
data element: BADAT
BADAT_013(010),
data element: FRGDT
FRGDT_014(010),
data element: BAPRE
PREIS_015(014),
data element: WAERS
WAERS_016(005),
data element: EPEIN
PEINH_017(005),
data element: REPOS
REPOS_018(001),
data element: AUFEB
BNFPO_019(005),
data element: MATNR
MATNR_02_020(018),
data element: BAMNG
MENGE_02_021(017),
data element: TXZ01
TXZ01_022(040),
data element: BAMNG
MENGE_023(017),
data element: EEIND
EEIND_024(010),
data element: LPEIN
LPEIN_025(001),
data element: EKGRP
EKGRP_026(003),
data element: BADAT
BADAT_027(010),
data element: FRGDT
FRGDT_028(010),
data element: BAPRE
PREIS_029(014),
data element: WAERS
WAERS_030(005),
data element: EPEIN
PEINH_031(005),
data element: REPOS
REPOS_032(001),
data element: AUFEB
BNFPO_033(005),
end of record.
End generated data section ***
*start-of-selection.
CALL FUNCTION 'UPLOAD'
EXPORTING
CODEPAGE = ' '
FILENAME = 'C:\p01.txt'
FILETYPE = 'BIN'
ITEM = ' '
FILEMASK_MASK = ' '
FILEMASK_TEXT = ' '
FILETYPE_NO_CHANGE = ' '
FILEMASK_ALL = ' '
FILETYPE_NO_SHOW = ' '
LINE_EXIT = ' '
USER_FORM = ' '
USER_PROG = ' '
SILENT = 'S'
IMPORTING
FILESIZE =
CANCEL =
ACT_FILENAME =
ACT_FILETYPE =
TABLES
data_tab = itab
EXCEPTIONS
CONVERSION_ERROR = 1
INVALID_TABLE_WIDTH = 2
INVALID_TYPE = 3
NO_BATCH = 4
UNKNOWN_ERROR = 5
GUI_REFUSE_FILETRANSFER = 6
OTHERS = 7
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
loop at itab.
perform bdc_dynpro using 'SAPMM06B' '0100'.
perform bdc_field using 'BDC_CURSOR'
'EBAN-BSART'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'EBAN-BSART'
'NB'.
perform bdc_field using 'RM06B-LPEIN'
'T'.
perform bdc_field using 'EBAN-WERKS'
ITAB-WERKS.
perform bdc_dynpro using 'SAPMM06B' '0106'.
perform bdc_field using 'BDC_CURSOR'
'RM06B-EKGRP'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'RM06B-BNFPO'
ITAB-BNFPO.
perform bdc_dynpro using 'SAPMM06B' '0106'.
perform bdc_field using 'BDC_CURSOR'
'EBAN-MENGE(01)'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'EBAN-MATNR(01)'
ITAB-MATNR.
perform bdc_field using 'EBAN-MENGE(01)'
ITAB-MENGE.
perform bdc_dynpro using 'SAPMM06B' '0102'.
perform bdc_field using 'BDC_CURSOR'
'EBAN-MENGE'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
*perform bdc_field using 'RM06B-EEIND'
record-EEIND_010.
*perform bdc_field using 'RM06B-LPEIN'
record-LPEIN_011.
*perform bdc_field using 'EBAN-EKGRP'
record-EKGRP_012.
*perform bdc_field using 'EBAN-BADAT'
record-BADAT_013.
*perform bdc_field using 'EBAN-FRGDT'
record-FRGDT_014.
*perform bdc_field using 'EBAN-PREIS'
record-PREIS_015.
*perform bdc_field using 'EBAN-WAERS'
record-WAERS_016.
*perform bdc_field using 'EBAN-PEINH'
record-PEINH_017.
*perform bdc_field using 'EBAN-REPOS'
record-REPOS_018.
perform bdc_dynpro using 'SAPMM06B' '0106'.
perform bdc_field using 'BDC_CURSOR'
'EBAN-MENGE(02)'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
*perform bdc_field using 'RM06B-BNFPO'
record-BNFPO_019.
*perform bdc_field using 'EBAN-MATNR(02)'
record-MATNR_02_020.
*perform bdc_field using 'EBAN-MENGE(02)'
record-MENGE_02_021.
perform bdc_dynpro using 'SAPMM06B' '0102'.
perform bdc_field using 'BDC_CURSOR'
'EBAN-MENGE'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
*perform bdc_field using 'EBAN-MENGE'
ITAB-MENGE_023.
*perform bdc_field using 'RM06B-EEIND'
record-EEIND_024.
*perform bdc_field using 'RM06B-LPEIN'
record-LPEIN_025.
*perform bdc_field using 'EBAN-EKGRP'
record-EKGRP_026.
*perform bdc_field using 'EBAN-BADAT'
record-BADAT_027.
*perform bdc_field using 'EBAN-FRGDT'
record-FRGDT_028.
*perform bdc_field using 'EBAN-PREIS'
record-PREIS_029.
*perform bdc_field using 'EBAN-WAERS'
record-WAERS_030.
*perform bdc_field using 'EBAN-PEINH'
record-PEINH_031.
*perform bdc_field using 'EBAN-REPOS'
record-REPOS_032.
perform bdc_field using 'EBAN-TXZ01'
'BEARING 2"X2"'.
perform bdc_field using 'EBAN-MENGE'
'65'.
perform bdc_field using 'RM06B-EEIND'
'2005/01/03'.
perform bdc_field using 'RM06B-LPEIN'
'D'.
perform bdc_field using 'EBAN-EKGRP'
'M11'.
perform bdc_field using 'EBAN-BADAT'
'2005/01/03'.
perform bdc_field using 'EBAN-FRGDT'
'2005/01/03'.
perform bdc_field using 'EBAN-PREIS'
' 1,120.00'.
perform bdc_field using 'EBAN-WAERS'
'EUR'.
perform bdc_field using 'EBAN-PEINH'
'1'.
perform bdc_field using 'EBAN-REPOS'
'X'.
perform bdc_dynpro using 'SAPMM06B' '0102'.
perform bdc_field using 'BDC_CURSOR'
'EBAN-MENGE'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'EBAN-TXZ01'
'DRILLING PIPE 10"'.
perform bdc_field using 'EBAN-MENGE'
'75'.
perform bdc_field using 'RM06B-EEIND'
'2005/01/03'.
perform bdc_field using 'RM06B-LPEIN'
'D'.
perform bdc_field using 'EBAN-EKGRP'
'M11'.
perform bdc_field using 'EBAN-BADAT'
'2005/01/03'.
perform bdc_field using 'EBAN-FRGDT'
'2005/01/03'.
perform bdc_field using 'EBAN-PREIS'
' 0.53'.
perform bdc_field using 'EBAN-WAERS'
'EUR'.
perform bdc_field using 'EBAN-PEINH'
'1'.
perform bdc_field using 'EBAN-REPOS'
'X'.
perform bdc_dynpro using 'SAPMM06B' '0106'.
perform bdc_field using 'BDC_CURSOR'
'RM06B-BNFPO'
perform bdc_field using 'BDC_OKCODE'
'=BU'.
*perform bdc_field using 'RM06B-BNFPO'
CALL TRANSACTION 'ME51' USING BDC_DATA MODE 'A'.
endLOOP.
*perform close_group.
*perform close_dataset using dataset.
*& Form bdc_field
text
-->P_0166 text
-->P_0167 text
form bdc_field using FNAM FVAL.
CLEAR BDC_DATA.
BDC_DATA-FNAM = FNAM.
BDC_DATA-FVAL = FVAL.
APPEND BDC_DATA.
ENDFORM.
*endform. " bdc_field
*& Form bdc_dynpro
text
-->P_0076 text
-->P_0077 text
form bdc_dynpro using PROGRAM DYNPRO.
CLEAR BDC_DATA.
BDC_DATA-PROGRAM = PROGRAM.
BDC_DATA-DYNPRO = DYNPRO.
BDC_DATA-DYNBEGIN = 'X'.
APPEND BDC_DATA.
ENDFORM.
*endform.
I hope it should help you -
data: bdc_DATA like bdcdata occurs 0 with header line,
mess_tab like bdcmsgcoll occurs 0 with header line.
DATA: BEGIN OF ITAB OCCURS 0 ,
tcnt TYPE i, "Table Counter
WERKS LIKE T001W-WERKS,
BNFPO LIKE EBAN-BNFPO,
MATNR LIKE MARA-MATNR,
MENGE LIKE EBAN-MENGE,
END OF ITAB.
*parameters: dataset(132) lower case.
DO NOT CHANGE - the generated data section - DO NOT CHANGE
If it is nessesary to change the data section use the rules:
1.) Each definition of a field exists of two lines
2.) The first line shows exactly the comment
'* data element: ' followed with the data element
which describes the field.
If you don't have a data element use the
comment without a data element name
3.) The second line shows the fieldname of the
structure, the fieldname must consist of
a fieldname and optional the character '_' and
three numbers and the field length in brackets
4.) Each field must be type C.
Generated data section with specific formatting - DO NOT CHANGE
*data: begin of record,
data element: BBSRT
BSART_001(004),
data element: LPEIN
LPEIN_002(001),
data element: EWERK
WERKS_003(004),
data element: EKGRP
EKGRP_004(003),
data element: AUFEB
BNFPO_005(005),
data element: MATNR
MATNR_01_006(018),
data element: BAMNG
MENGE_01_007(017),
data element: TXZ01
TXZ01_008(040),
data element: BAMNG
MENGE_009(017),
data element: EEIND
EEIND_010(010),
data element: LPEIN
LPEIN_011(001),
data element: EKGRP
EKGRP_012(003),
data element: BADAT
BADAT_013(010),
data element: FRGDT
FRGDT_014(010),
data element: BAPRE
PREIS_015(014),
data element: WAERS
WAERS_016(005),
data element: EPEIN
PEINH_017(005),
data element: REPOS
REPOS_018(001),
data element: AUFEB
BNFPO_019(005),
data element: MATNR
MATNR_02_020(018),
data element: BAMNG
MENGE_02_021(017),
data element: TXZ01
TXZ01_022(040),
data element: BAMNG
MENGE_023(017),
data element: EEIND
EEIND_024(010),
data element: LPEIN
LPEIN_025(001),
data element: EKGRP
EKGRP_026(003),
data element: BADAT
BADAT_027(010),
data element: FRGDT
FRGDT_028(010),
data element: BAPRE
PREIS_029(014),
data element: WAERS
WAERS_030(005),
data element: EPEIN
PEINH_031(005),
data element: REPOS
REPOS_032(001),
data element: AUFEB
BNFPO_033(005),
end of record.
End generated data section ***
*start-of-selection.
PERFORM upload_data.
loop at itab.
perform bdc_dynpro using 'SAPMM06B' '0100'.
perform bdc_field using 'BDC_CURSOR'
'EBAN-BSART'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'EBAN-BSART'
'NB'.
perform bdc_field using 'RM06B-LPEIN'
'T'.
perform bdc_field using 'EBAN-WERKS'
ITAB-WERKS.
perform bdc_dynpro using 'SAPMM06B' '0106'.
perform bdc_field using 'BDC_CURSOR'
'RM06B-EKGRP'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'RM06B-BNFPO'
ITAB-BNFPO.
perform bdc_dynpro using 'SAPMM06B' '0106'.
perform bdc_field using 'BDC_CURSOR'
'EBAN-MENGE(01)'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'EBAN-MATNR(01)'
ITAB-MATNR.
perform bdc_field using 'EBAN-MENGE(01)'
ITAB-MENGE.
perform bdc_dynpro using 'SAPMM06B' '0102'.
perform bdc_field using 'BDC_CURSOR'
'EBAN-MENGE'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
*perform bdc_field using 'RM06B-EEIND'
record-EEIND_010.
*perform bdc_field using 'RM06B-LPEIN'
record-LPEIN_011.
*perform bdc_field using 'EBAN-EKGRP'
record-EKGRP_012.
*perform bdc_field using 'EBAN-BADAT'
record-BADAT_013.
*perform bdc_field using 'EBAN-FRGDT'
record-FRGDT_014.
*perform bdc_field using 'EBAN-PREIS'
record-PREIS_015.
*perform bdc_field using 'EBAN-WAERS'
record-WAERS_016.
*perform bdc_field using 'EBAN-PEINH'
record-PEINH_017.
*perform bdc_field using 'EBAN-REPOS'
record-REPOS_018.
perform bdc_dynpro using 'SAPMM06B' '0106'.
perform bdc_field using 'BDC_CURSOR'
'EBAN-MENGE(02)'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
*perform bdc_field using 'RM06B-BNFPO'
record-BNFPO_019.
*perform bdc_field using 'EBAN-MATNR(02)'
record-MATNR_02_020.
*perform bdc_field using 'EBAN-MENGE(02)'
record-MENGE_02_021.
perform bdc_dynpro using 'SAPMM06B' '0102'.
perform bdc_field using 'BDC_CURSOR'
'EBAN-MENGE'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
*perform bdc_field using 'EBAN-MENGE'
ITAB-MENGE_023.
*perform bdc_field using 'RM06B-EEIND'
record-EEIND_024.
*perform bdc_field using 'RM06B-LPEIN'
record-LPEIN_025.
*perform bdc_field using 'EBAN-EKGRP'
record-EKGRP_026.
*perform bdc_field using 'EBAN-BADAT'
record-BADAT_027.
*perform bdc_field using 'EBAN-FRGDT'
record-FRGDT_028.
*perform bdc_field using 'EBAN-PREIS'
record-PREIS_029.
*perform bdc_field using 'EBAN-WAERS'
record-WAERS_030.
*perform bdc_field using 'EBAN-PEINH'
record-PEINH_031.
*perform bdc_field using 'EBAN-REPOS'
record-REPOS_032.
perform bdc_field using 'EBAN-TXZ01'
'BEARING 2"X2"'.
perform bdc_field using 'EBAN-MENGE'
'65'.
perform bdc_field using 'RM06B-EEIND'
'2005/01/03'.
perform bdc_field using 'RM06B-LPEIN'
'D'.
perform bdc_field using 'EBAN-EKGRP'
'M11'.
perform bdc_field using 'EBAN-BADAT'
'2005/01/03'.
perform bdc_field using 'EBAN-FRGDT'
'2005/01/03'.
perform bdc_field using 'EBAN-PREIS'
' 1,120.00'.
perform bdc_field using 'EBAN-WAERS'
'EUR'.
perform bdc_field using 'EBAN-PEINH'
'1'.
perform bdc_field using 'EBAN-REPOS'
'X'.
perform bdc_dynpro using 'SAPMM06B' '0102'.
perform bdc_field using 'BDC_CURSOR'
'EBAN-MENGE'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'EBAN-TXZ01'
'DRILLING PIPE 10"'.
perform bdc_field using 'EBAN-MENGE'
'75'.
perform bdc_field using 'RM06B-EEIND'
'2005/01/03'.
perform bdc_field using 'RM06B-LPEIN'
'D'.
perform bdc_field using 'EBAN-EKGRP'
'M11'.
perform bdc_field using 'EBAN-BADAT'
'2005/01/03'.
perform bdc_field using 'EBAN-FRGDT'
'2005/01/03'.
perform bdc_field using 'EBAN-PREIS'
' 0.53'.
perform bdc_field using 'EBAN-WAERS'
'EUR'.
perform bdc_field using 'EBAN-PEINH'
'1'.
perform bdc_field using 'EBAN-REPOS'
'X'.
perform bdc_dynpro using 'SAPMM06B' '0106'.
perform bdc_field using 'BDC_CURSOR'
'RM06B-BNFPO'
perform bdc_field using 'BDC_OKCODE'
'=BU'.
*perform bdc_field using 'RM06B-BNFPO'
CALL TRANSACTION 'ME51' USING BDC_DATA MODE 'A'.
endLOOP.
FORM upload_data.
*local variable declaration
DATA : lv_index TYPE i,
l_count TYPE i.
*local constants declaration
CONSTANTS:
lc_start_col TYPE i VALUE '1' ,
lc_start_row TYPE i VALUE '2' ,
lc_end_col TYPE i VALUE '256' ,
lc_end_row TYPE i VALUE '65536'.
*local field symbol declaration
FIELD-SYMBOLS : <lf_s>.
*loacal internal table declaration
DATA : li_intern TYPE kcde_cells OCCURS 0 WITH HEADER LINE.
*refresh internal table for each loop
CLEAR: li_intern,
l_count .
REFRESH li_intern.
to upload the data in excel on the presentation server this function
module converts the data from excel file into an internal table
containing row no col no and value
CALL FUNCTION 'KCD_EXCEL_OLE_TO_INT_CONVERT'
EXPORTING
filename = 'Give file location here'
i_begin_col = lc_start_col
i_begin_row = lc_start_row
i_end_col = lc_end_col
i_end_row = lc_end_row
TABLES
intern = li_intern
EXCEPTIONS
inconsistent_parameters = 1
upload_ole = 2.
checking for data in internal table
CHECK NOT li_intern[] IS INITIAL.
sorting internal table
SORT li_intern BY row col.
collecting data into an internal table
LOOP AT li_intern.
MOVE: li_intern-col TO lv_index.
lv_index = lv_index + 1.
ASSIGN COMPONENT lv_index OF STRUCTURE itab TO <lf_s>.
MOVE : li_intern-value TO <lf_s>.
AT END OF row.
l_count = l_count + 1.
itab = l_count.
APPEND itab.
ENDAT. " at end of row
ENDLOOP. " loop at li_intern
if it useful please award points
Similar Messages
-
How to find purchase requistion
Hi Abapers,
I want to fetch all Purchase requistions in my report please tell me Table name , field name .
Tell me differernce in Purchase order / Purchase Requistions .
How we create a new purchase requistions.??
ThanksHi,
Table Name : <b>EBAN</b>
Field Name : <b>BANFN</b>
<b>Difference Between Purchase Order & Purchase Requisition:</b>
1. Purchase requisitions are internal documents you use to request your Purchasing department to procure a particular quantity of a material or a service for a particular date.
Purchase requisitions are either created manually by the department responsible or automatically by MRP.
A purchase order is a formal request to a vendor to supply certain goods or services under the stated conditions.
You can create purchase orders without reference, or with reference to a purchase requisition, a request for quotation, or another purchase order.
2.Purchase requisitions are either created manually by the department responsible or automatically by MRP.
3.you can create purchase orders without reference, or with reference to a purchase requisition, a request for quotation, or another purchase order.
4.Purchase Requisition is created first..
<b>Creating New Purchase Requisition:</b>
Transaction : <b>ME51</b>
Regards,
Padmam. -
I want to make Requistioner field Mandatory in the Purchase requistion.
Whenever i create purchase requistion i want to make Requistioner field mandatory. I have checked the filed selection NBB and changed to mandatory and ME51 also made mandatory after that also whenever i create with ME51 PR is going to next screen without asking for requistioner.
Please let me know where actullay i have to make mandatory so that whenever i create it should ask the requistioner.
Thanks.H,
You also select the field Requisitioner as mandatory for below field selection>
AKTH,ME51 & ME51N
Because always the field selection: mandatoey , display & optional will work in
Setting Priority
Hide 1
Display 2
Required entry 3
Optional entry 4
SAM
Edited by: Saminathan Gopalan on Jun 22, 2010 3:25 PM -
hi,
can any body plz answer me , what is the difference between purchase order and purchase requistion.Hi Sri
PR- asking approval to ur company to purchase the materials
means Concerned Departments will raise the request that these good have to
be needed and have to purchase(We can say Purchase Requisition is an Internal Order with in the departments of the company)
see ME51 for better understandability.
PO- after getting approval, send a po to vendor to get materials here you are raising the request to the Outside Vendors.
see ME21 for better understandability.
Regards,
Sree
Regards -
Error while Creating PO from Purchase Requistion in Third Party Sales
Dear Team,
While Creating the Purchase Order from Purchase Requistion in Third Party Sales. When I am saving the PO I am getting the Error in GL Account Cannot be Used. I have disabled the field G/L Account in settings of Account Assignment Category of Third Party. Still I am facing that Error while Creating Purchase Order. Can you guide me where we do this Assignment of G/L Account so that I can change the G/L Account.
Thanks,
Farhan.Dear Farhan,
1. Go to T. Code: FS00 and enter GL number and Company Code and go to Tab: Create/bank/interest, write down the field status group.
2. Go to T. Code: OBC4 and Select your Field Status Variant and Double Click: Field Status Group (From Left-hand Dialog Structure)
Double-Click on to Field Status Group (as noted down from in Step 1).
From Select group, Select Additional account assignments and make Earmarked Funds, as optional.
Best Regards,
Amit -
Error in vendor selection while creating Purchase requistions
Hi,
I was using bapi_requestion_create to create purchase requistion with different quotas for different vendors.
Ex: vendor A with 60%
vendor B with 40%
If the required quantity is 100 items then it has to split 60 items to vendor A and create seperate Puechase Requistion.
and for 40items with another Purchase requsition.
Currently iam able to split the noof purshcase requisiton but it was picking only with one vendor.
MY Code :
*******Split PRs with respect to Quota ************************
data : lv_lines type i,
lv_qty type p DECIMALS 4.
lv_qty = it_oo-qty.
DESCRIBE TABLE t_equp LINES lv_lines.
IF lv_lines GT 1.
clear : w_equp.
loop at t_equp into w_equp
where qunum = w_equk-qunum.
refresh : t_req_item.
clear : w_eord,
t_req_item[],
t_req_item.
READ TABLE t_eord INTO w_eord
WITH KEY matnr = it_oo_sum_purch-matnr_sap
werks = it_oo_sum_purch-plant
lifnr = w_equp-lifnr.
if sy-subrc is initial.
it_oo_purch-AGREE = w_eord-EBELN. "To Fill ALV
it_oo_purch-ITEM = w_eord-EBELP. "To Fill ALV
it_oo_purch-FORNEC = w_equp-LIFNR. "To Fill ALV
t_req_item-doc_type = c_zbmr.
t_req_item-pur_group = it_oo-ekgrp.
t_req_item-material = it_oo_sum_purch-matnr_sap.
t_req_item-plant = it_oo_sum_purch-plant.
t_req_item-AGREEMENT = w_eord-EBELN.
t_req_item-AGMT_ITEM = w_eord-EBELP.
t_req_item-FIXED_VEND = w_equp-LIFNR.
t_req_item-QUOTA_ARR = w_equk-qunum.
t_req_item-QUOTARRITM = w_equp-qupos.
t_req_item-gr_ind = c_x.
t_req_item-ir_ind = c_x.
t_req_item-MRP_CONTR = 'NOV'.
CONCATENATE it_oo_sum_purch-due_dte+4(4)
it_oo_sum_purch-due_dte+2(2)
it_oo_sum_purch-due_dte(2)
INTO t_req_item-deliv_date.
t_req_item-QUANTITY = ( w_equp-QUOTE / 100 ) * lv_QTY.
endif.
********Rounding off values*******************
data : lv_int(20) type c,
lv_dec(20) type c,
lv_tot(20) type c.
clear : lv_int ,
lv_dec,
lv_tot.
lv_tot = t_req_item-QUANTITY.
split lv_tot at '.' into lv_int lv_dec.
if lv_dec(1) ge '5'.
lv_int = lv_int + 1.
endif.
t_req_item-QUANTITY = lv_int.
APPEND t_req_item.
clear : v_number.
Create purchase requisition by group
CALL FUNCTION 'BAPI_REQUISITION_CREATE'
IMPORTING
number = v_number
TABLES
requisition_items = t_req_item
return = t_return.
ERRO
IF t_return-type CO 'AE'.
CLEAR: v_msg, v_x.
CALL FUNCTION 'WRITE_MESSAGE'
EXPORTING
msgid = sy-msgid
msgno = sy-msgno
msgty = sy-msgty
msgv1 = sy-msgv1
msgv2 = sy-msgv2
msgv3 = sy-msgv3
msgv4 = sy-msgv4
IMPORTING
messg = v_msg.
PERFORM zf_grava_log_erro_oo
USING it_oo_purch it_oo_sum_purch v_msg v_x.
SUCESSO - Atualiza Tabela zsytmm_pr_po
ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = c_X.
CLEAR: v_msg, v_x.
CONCATENATE text-026 v_number INTO v_msg
SEPARATED BY space.
it_oo_sum_purch-QTY = t_req_item-QUANTITY.
PERFORM zf_grava_log_sucesso_oo
USING it_oo_purch it_oo_sum_purch v_msg v_x.
CLEAR: zsytmm_pr_po.
vl_item = c_00001.
zsytmm_pr_po-banfn = v_number.
zsytmm_pr_po-bnfpo = vl_item.
zsytmm_pr_po-ebeln = c_false.
zsytmm_pr_po-ebelp = c_false.
zsytmm_pr_po-zshmode = it_oo_purch-shipm.
MODIFY zsytmm_pr_po.
ENDIF.
endloop.Hi,
You have to fill DES_VENDOR & FIXED_VEND of structure REQUISITION_ITEMS while calling BAPI. But while going through your code,
* t_req_item-FIXED_VEND = w_equp-LIFNR
is commented, uncomment the same and add line for DES_VENDOR also.
Regards
Vinod -
User Exit -- To include purchase requistion/purchase order in COOIS report
In a MTO envirnoment, trying to include purchase requistion/purchase order
with requested delivery date information in COOIS report. Is there a
user exit for this ?Hi,
Please follow this an Example:-
The COOIS report (Order Info System) gives the complete information regarding Production Order like header report, Operation report, Component Report, document report.
This document deals with the addition of extra fields in the output display of COOIS.
For the demo purpose, I have added the material group (MATKL) for the production order material for header report.
BADI Name: WORKORDER_INFOSYSTEM
Method: TABLES_MODIFY_LAY
In the method TABLES_MODIFY_LAY there are many table parameters for different data display of the production order .In this scenario only the header detail structure is being extended with append structure.
Add the extra fields to be displayed to through append structure to IOHEADER_TAB, here MATKL.
In the method write the code for updating the field value.
DATA : BEGIN OF st_matkl,
matkl TYPE matkl,
END OF st_matkl.
DATA : st_header TYPE ioheader.
LOOP AT ct_ioheader INTO st_header.
IF NOT st_header IS INITIAL.
SELECT SINGLE matkl
FROM mara
INTO st_matkl
WHERE matnr = st_header-matnr.
ENDIF.
st_header-matkl = st_matkl-matkl.
MODIFY ct_ioheader FROM st_header.
ENDLOOP.
Regards,
Ravi -
How to configure purchase requistion in third party sale pls send me detail
dear expert
how to configure purchase requistion in third party sale pls send me details. waiting your valuable reply
vickyyou can find the details in the below links
Re: THird party sales complete scenario
http://wiki.sdn.sap.com/wiki/display/ERPLO/PROCEDURETOCREATETHIRDPARTY+SALES
http://www.sap-img.com/sap-sd/process-flow-for-3rd-party-sales.htm
Regards -
Unable to create a PO via Purchase Requistion
Hi Gurus ,
I am facing a Problem while creating a Purchase order with ref. to a Purchase Requistion.
System is showing an error "Purchase requisitions of document_type ZVS or item category L may not be assigned to purchase orders of document type ZVS or item category L".
Doc. type of Pur. Req. & PO is ZVS
Item Category for PR & PO is L
Kindly Guide.
Regards
HoneyGoto
SPRO-> Materials Management -> Purchasing -> Purchase order -> Define Document Types
Select your document type ZVS and click on allowed item categories & check whether item category L is assigned.
Then select link purchase requisition - document type. Here check whether your purchase requisition document type ZVS and item category L combination is maintained. -
Planned order and Purchase requistion both is generating in MRP
Dear All,
At the time of MRP explosion for Finished material, system is generating Planned order and purchase requistion, both, for detailed material, (e.g. the BOM is a single level BOM). Whereas, I want to generate Purchase requistion for all. I am not getting that for which logic it generating Planned order as well as purchase requisition.
Pl. explain.
Thanks,
Prasun.Hi Prasun
The procurement proposal indicator dependes on the procurement type assigned in material master. If you assign prod Type F it will automatically generate PR. If the procurement type is E or X the system will generate plan order .
This configured in Plan order type LA means it should be for in house production E.
There are two ways of solving this. If you want always PR for FERT. Assign Proc type F in material master MRP view. It will always generate PR for that particular material.
Or
You can run MRP with planning mode 3 create PR in front screen.
Regards
J . Saravan -
Planned order to purchase requistion
Dear gurus,
I have configured the purchase requsition number ranges.While running MRP and while making manual purchase requistions i am getting the correct number range.but my pblm is while converting planned order to purchase requistion.i am getting the different number range.i checked in omi3.it is client specific number range.My requirement is in corresponding plant if i convert planned order to purchase req i should get the same number range as of mrp generated prs in that plant.
Gurus please through some light
-gunaHi,
Goto tcode OPPQ , select your plant .
Select the number range field. Here you can find pur. req.
Check this no range by selecting display icon.
If the no range is different goto tcode OMI2 (for planning run)not OMI3 (manual), change your no range.
Now run mrp & check the no. range.
Regards,
Dharma -
The relationship between production order and purchase requistion After running MPS
Dear Experts:
I met a issue . My users want to know the relationship between production order and purchase requistion . In my company we create production order and purchase req. by running MRP. our operations are:
1. T-CODE: MD41 create planned order .
2. T-CODE: CO41 convert planned order to production order .
3. T-CODE: MD15 convert planned order to purchase Requisition.
but I can't find the relation of them. would you like to give me some advices? thank you very much.Hello
On the standard MTS process there is no link between the requirement (STO) and the replenishment element (production order).
See the below extraction from note 12955:
There is no index that the system could use to determine which issue element (sales order, planning, reservation, dependent requirement, ...) is covered by a certain receipt element (purchase order, production order, purchase requisition, planned order, stock level ...).
A production order, for example, can be created to cover several different requirements, even when you are using lot sizing procedure EX.
You can use transaction MD09 or MD04to determine the pegged requirements, but they are calculated dynamically and there is not fixed link between requirement and receipt.
BR
Caetano -
Purchase Requistion - Agent Determination using responsibilities - Issue
Hi Everyone,
I am new to workflow. I am having an issue wrt Purchase Requistion - Agent Determination using responsibilities.
Created some 30 to 40 resposibilities with combination of inputs - R1, P1 & Cost Center
Checked rule with responsibilities in Simulation mode and for the given inputs shows correct output.
Same config is present both in DEV and ACP. Simulation works fine in both systems.
But when I created Purchase Req. in DEV and save it. Workitem is generated for the correct agent. But when I do the same test in Quality, it fails and created Workitems for several agents.
Checked container info. in both systems,no.of agents is the ONLY difference (i.e. 1 in DEV and 30+ agents in Quality).
Put shred some light on this issue.
Workflow Used: BUS2009
Task : TS00007986
Thanks a ton in advance.
Regards,
KrishnaHi,
Open the workflow (WS*******) with SWDD and see the bindings for the rule in the approval step (using TS00007986). Do they look the same in both environments? Are you passing the same parameters for the rule?
Another thing that you should check is a possible authorisation error. Maybe the users are not authorised to execute the needed functions for finding the agent inside the rule (common problem).
Also try to read the technical workflow log (Start a workflow, open SWI1 and drill-down to the workflow log). Can you see some error messages there? You will probably find a message saying that "cannot execute agent rule" or something like that. It is WF behaviour that if it cannot find an agent it will send the work item to all possible agents (unless otherwise configured).
Regards,
Karri -
I am facing a problem in the sales order the purchase requistion no is not
Hello SD Gurus,
I am facing a prob in the sales order the purchase requistion is not coming, is there any config settings is required.
In my bcness process after creating the SO automatically through wokflow the Purchase order will trigger.
I have checked in the SO which is existing in the schedule line the purchase requistion is not showing.
In the schedule line functionality is perfect.
Other than this is it required more..............
Gurus i am waiting for your reply.......................
Regards,
KishoreHi kishore
Firstly in VOV6 select the schedule line CS and check wheather in that schedule line the following data has been maintained or not
Document type : NB
Item category : 5( Third party)
Account assignment category : X ( Account assignment )
Secondly go to VOV7 and select the item category TAS and check the following data
Automatic PO generation has been checked on or not
Billing relevance should be F
Regards
Srinath -
How to change the Purchase Organization filed in the Purchase requistion..
Hello All,
I am creating the requirement of material through MD62. Later I am runiing MRP through MDO3 to create the purchase requistion against that. Now my requirement is that if the source list is not maintainted ( ME01) for that material, I want to change the purchase organization field for the puchasre requistion created through MD03.
Can any one help me how can I changed that though programming. Any user exit or badi for that .
Note* : I am working in SAP 4.6 system.
Thanks and Regards,Hi, Umesh:
Picture1 is my OPJP initial screen ,I want to change to be Picture B . but I got an error .
In fact , I don't have project stock . but I have sales order stock.
I try to change 'Q' to other option . but I got the same error.
picture 1
picture 2
Maybe you are looking for
-
Using a number variable in an SQL statement
Hi, I am trying to use a variable in an sql statement and I have run into problems when the variable is a number. The following line of code works if the variable is a string but not if it is a number. "SELECT TOP 1 UUT_STATUS FROM UNIT_UUT_RESULT WH
-
Getting the name of the column using MDM API
Hi I want to know the Column name from fieldId, can any one help me on this. I am using the following code to get the data but i nedd column name to which the data is refering ArrayList mdmData=new ArrayList(); RecordResultSet rs=(RecordResultSet)obj
-
Customer Master Creation -- Request form template
Hi , Is there anyone could provide me the request form template for customer master creation ? We would like the request department fill this and pass it to the master data creation person . Thanks and regards Shubin
-
Error in Custom Rule EVALUATE_AGENT_VIA_RULE
Hi, I am working on a workflow and have created a custom rule for a workflow. When I simulate this rule, it returns 1 users but when workflow is triggered, Possible agents and Actual agents are blank. i am getting error in Rule EVALUATE_AGENT_VIA_RUL
-
URGENT: Custom Behavior Problem
I'm writing an application which must plot a 3D curve. It has 3 panels, each of which has a 2D projection of the curve (xy, xz, yz). Moving the points on the panels will change the properties of the underlying 3D curve. When I start the application,