Add partners to E1EDKA1-PARVW?
Hello IDOC experts
I have an interface from an external partner that creates a sales order from a purchase order through XI which works fine after the help I recveived yesterday, thanks .
We have another scenario where the partner can send an addtional end customer number. in the XI I need to create an additional E1EDKA1 segment for this new partner type but the field PARVW only allows certain entries.
is there a config table or check table where I can insert new partner functions?
Thanks in advance, hopefully!
cheers
Nick
Hi Nick
Just below the hardcoding in the else condition i found below code:
<b> ELSE.
get all entries for TPAR
SELECT * FROM (DBNAME_TPAR) INTO table BASIS_TPAR.
ENDIF.</b>
In this case it can take from the partner function table TPAR.
Kind Regards
Eswar
Similar Messages
-
INVOIC02 IDOC E1EDKA1 PARVW value meaning
I checked WE60 documentation and cannot determine what the meaning of
/INVOIC02/IDOC/E1EDKA1/PARVW = "EN"
I am tasked with setting up a new mapping rule and am trying to correlate the IDOC E1EDKA1 vendor numbers to the PO and Invoice values. WE60 has all other PARVW values documented but this one. Is there another way to determine what Invoice field is used to populate this value so I can correlate the data value?Hi Bryan,
As far i know the PARVW will not be having value "EN" , the abbrevation of EN is "English" which will be sent in the field /INVOIC02/IDOC/E1EDKA1/SPRAS [Language Key].
The Values generated in PARVW will be LF or RS , so this seems to be a wrong data entry and you can avoid this.
For PARVW you also refer this page
[http://help.sap.com/saphelp_di46c2/helpdata/EN/44/f50abfea3b11d194dc0000e83dd751/content.htm]
-Muru -
CRM_ORDER_MAINTAIN - Add Partners
Dear Experts,
I try to create the tasks with CRM_ORDER_MAINTAIN and was successful. However the Partners are not being updated properly. I have 2 partners for the task. Employee responsible & Sold-to-party. Though I debugged the tx: CRMD_ORDER & passed the right set of parameters, I could not find any success.
Best Regards, MurugeshHi,
My requirement is as follows:
I have to develop a FM which has transaction id, Ship to, Bill to and Payer as import parameters. For this transaction id I have to update the partners that I receive. I was using the FM CRM_ORDER_MAINTAIN but unsuccessfully. Looking forward for your help..
Thanks in advance...
Susanth Kumar -
Reduce E1EDKA1 in IDoc regarding partner type
Hi,
im looking for an "non SAP XI" way to reduce the E1EDKA1 in the ORDERS IDoc.
I want the following:
IF E1EDKA1 PARVW = AG then the segment shouldn´t be reduced.
IF E1EDKA1 PARVW = WE then the segment shouldn´t be reduced.
IF E1EDKA1 PARVW = ZZ then the segment muste be reduced.
any ideas to realize that ?
I tried with BD56 and filtering technics but without success
Thx,
GordonHi,
It can be done with user exit "EXIT_SAPLIEDP_902"
Regards,
Aubin -
CJ20N BAPI to add Partner functions
I am looking for a bapi to add partners to a WBS element. I have managed to add partners to the project definition using BAPI_BUS2001_PARTNER_CREATE_M but for the underlying WBS element I am not able to find a BAPI
Thanks
Yvescheck the theard it may help u.
Re: add a new tab in transaction ME51N
Regards
Kiran Sure -
Populating partners through BAPI_CUSTOMERCONTRACT_CHANGE
Hi All,
I am creating contracts using the FM BAPI_CUSTOMERCONTRACT_CHANGE.
When I gave a partner number as 0 or Blank, it was not populating that partner in the contract.
But when i am creating the Contract Manually, it was creating partners with 0 as partner number.
Is it possible to add partners with Partner number 0 through BAPI_CUSTOMERCONTRACT_CHANGE?
If so, please let me know the procedure.
Regards,
Sreekanth.GHello Sreekanth,
When you are creating contracts using BAPI_CONTRACT_CREATEFROMDATA, you must had 3 function partenrs to create the contract.
Try:
DO 3 TIMES.
CASE syst-index.
WHEN 1. wa_contract_partners-partn_role = 'PH'.
WHEN 2. wa_contract_partners-partn_role = 'WE'.
WHEN 3. wa_contract_partners-partn_role = 'AG'.
ENDCASE.
wa_contract_partners-partn_numb = ls_header_data-value_0006.
APPEND wa_contract_partners TO bapi-contract_partners.
FREE wa_contract_partners.
ENDDO. -
SO via inbound EDI. partner problem LIFNR - PARTN
Hi,
Working on PO -> SO interface. Question on populating VOE4 (EDPAR).
in the inbound IDOC I have this segment:
E1EDKA1:
PARVW: AG
PARTN: external customer number (in my case it is purchasing organisation)
LIFNR: 'blank'
In forums it is told that segment LIFNR should be populated by external customer number.
What is the difference between PARVW and LIFNR? Does VOE4 look at PARTN for substitution?
in my case seems that it ignores PARTN at all..
Thanks,
ArtashesI think what you need is the following.
On the EDIDC record, field SNDPRN, you need to have the Sold To customer number mapped. You'll also need to have the SoldTo setup in WE20 with a partner profile.
You can send in an Order to SAP with a Logical System in the above field but you then have to have the PARTN fields filled in with the correct Sold To Ship To. Which you typically would not have.
On the KA1 segments, you'll need two KA1 segments, one for the Sold To and the Other for the Ship To. Since you already would know the Sold To since you put it in the EDIDC record, just fill it in the PARTN field, unless your partner wants their store number back. Personally I would set it up this way with the external store number.
So you'll want a KA1 record with the AG qualifier for the Sold To and the LIFNR field filled in with the partners external number for the Sold To. This could be the Duns number or N1/04 code.
On the second KA1 for the ship to, set the qualifier to WE for Ship To and then fill in the LIFNR with the external store number.
You'll now need entries in VOE4 for each KA1. Customer would be the same as the Customer in the EDIDC record, field SNDPRN. external function is either SP or SH. External Number is the external number, either the DUNS number for the Sold To (Most likely) or the N1/04 code for the ship to. Int No is the Internal customer number for the Sold To and Ship To.
Sold To 55555
Customer Sender ID/Dunning # 123456789
External Ship To Store # 321
WE20 setup for Sold To 55555
VOE4 setup for 55555 SP SOLD TO 123456789 55555
VOE4 setup for 55555 SH SHIP TO 321 55555
I think what SAP Messed up on is the fact that we should not have an external cross reference or hard coding mechanism to populat the SNDPRN with a customer number for inbound transactions in order for the EDPAR table to work correctly. You can have a logical system at the EDIDC level but would need to populate the correct Sold To and Ship To on the KA1 segments. When using the LIFNR fields, SAP Uses the SNDPRN, External Partner Number and Partner Function on the KA1 record to determine the Internal Customer Number.
If anyone else has an opinion please let me know. I would love a way to be able to cross reference the Dunning Number for a partner to a Sold To within SAP and allow for the LIFNR fields to be used for the Ship To's. -
IDOC ORDERS05: Segment E1EDPA1Doc.item partner information is not filled
Hello,
I'm working on the AFS-Retail Interface for Orders.
In the first step we create a sales contract in AFS with the combined demand from a retail purchase order and in a second step the sales order call-offs which are the Retail orders for the stores (NB; one PO for one store).
The problem is in the sales order call-off. In the Retail outbound IDOC the information about the relevant ship-to stands only the header segment E1EDKA1 (PARVW = WE).
In the AFS IDOC inbound the ship-to is written in the header partners of the sales order. But because the information is missing on item level the information is copied from the sales contract which leads to the wrong ship-to for the items in the sales order.
For the communication we are using the basic type orders05. Is there a possibility to fill the item partner segments E1EDPA1 out of the standard or do I need to implement an user exit in the Retail IDOC outbound process so that the partner information is filled also on item level?
Thanks in advance.
Regards,
ChristineHi Christine
I am working on SAP AFS 6.0.. I Had same issue.....When sales order ref to a contract....i resoved it
u need to write user exit for this....
Ramesh -
Hi All,
I am doing File to IDoc scenario( Bypass) for Orders05.
File is picking succesfully and not posting the idoc in the SAP..
My source file(idoc-xml) consists of all the required data to post the idoc including the segment 'E1EDK01'.
but the error it is showing is <b>" Obligatory node 'E1EDK01' missing in the structure ORDERS05 "</b>
Please suggest me ASAP what is going wrong .
Thanks in Advance.
Regards
Seema.The source File is not the idoc XML. It is invalid. You might need to ask the source to change the XML or use a Mapping to do this.
This is how it should look, ( check the parts in bold),
<?xml version="1.0"?>
<ORDERS05>
<IDOC <b>BEGIN ="1"</b>>
<EDI_DC40 SEGMENT="EDI_DC40">
<DOCNUM>1</DOCNUM>
<DIRECT>2</DIRECT>
<IDOCTYP>ORDERS05</IDOCTYP>
<CIMTYP></CIMTYP>
<MESTYP>ORDERS</MESTYP>
<SNDPOR>XXXXXXXXX</SNDPOR>
<SNDPRT>LS</SNDPRT>
<SNDPFC></SNDPFC>
<SNDPRN>XXXXXXXX</SNDPRN>
<RCVPOR>XXXXXX</RCVPOR>
<RCVPRT>LS</RCVPRT>
<RCVPFC></RCVPFC>
<RCVPRN>XXXXXXXX</RCVPRN>
<CREDAT>20070511</CREDAT>
<CRETIM>152803</CRETIM>
</EDI_DC40>
<E1EDK01 <b>SEGMENT = "1"</b>><BELNR>AAAAAAAAA123</BELNR>
</E1EDK01<b>SEGMENT = "1"</b>>
<E1EDKA1 ><PARVW>EK</PARVW> <ILNNR>231654845121</ILNNR>
</E1EDKA1>
<E1EDKA1 <b>SEGMENT = "1"</b>><PARVW>LF</PARVW>
<NAME1>international</NAME1>
<NAME2>Delhi</NAME2>
<ILNNR>2121211545</ILNNR>
</E1EDKA1><E1EDK02 <b>SEGMENT = "1"</b>><QUALF>001</QUALF>
<BELNR>AAAAAAAAA123</BELNR>
</E1EDK02><E1EDK02 <b>SEGMENT = "1"</b>><QUALF>002</QUALF>
<BELNR>AAAAAAAAA123</BELNR>
</E1EDK02><E1EDP01><POSEX>45</POSEX>
<E1EDP19 <b>SEGMENT = "1"</b>><QUALF>001</QUALF>
<IDTNR>00000000002150059</IDTNR>
<KTEXT>Reddy</KTEXT>
</E1EDP19><E1EDP19>
<QUALF>003</QUALF>
<IDTNR>5484218521214</IDTNR>
</E1EDP19></E1EDP01>
</IDOC></ORDERS05>
Regards
Bhavesh
PS : You need to add SEGMENT = "1" for every segment. Please do add it if I have missed in the XML above. -
Re: IDOC User Exits
Posted: Aug 1, 2006 10:43 AM Reply E-mail this post
Hi
I have a basic doubt. We can modify or add new segments and change existing values to segments only for outbound idoc.
I have a requirement where a particular field in a segment would be empty for an inbound idoc. Is it possible to change inbound idoc values after the idoc is created and before it gets posted.
Please let me know,
Regards,
B.AnandhUpdating IDoc data in segments.
STEP 1 - Open document to edit
CALL FUNCTION 'EDI_DOCUMENT_OPEN_FOR_EDIT'
EXPORTING
document_number = t_docnum
IMPORTING
idoc_control = itab_edidc
TABLES
idoc_data = itab_edidd
EXCEPTIONS
document_foreign_lock = 1
document_not_exist = 2
document_not_open = 3
status_is_unable_for_changing = 4
OTHERS = 5.
STEP 2 - Loop at itab_edidd and change data
LOOP AT itab_edidd WHERE segnam = 'E1EDKA1'.
e1edka1 = itab_edidd-sdata.
IF e1edka1-parvw = 'LF'.
e1edka1-partn = t_eikto.
itab_edidd-sdata = e1edka1.
MODIFY itab_edidd.
EXIT.
ENDIF.
ENDLOOP.
STEP 3 - Change data segments
CALL FUNCTION 'EDI_CHANGE_DATA_SEGMENTS'
TABLES
idoc_changed_data_range = itab_edidd
EXCEPTIONS
idoc_not_open = 1
data_record_not_exist = 2
OTHERS = 3. -
Idoc fields need to be formatted before being sent
Hi Gurus,
I have a problem, Need to format fields, is there a way to formate within an idoc after the idoc has been created, but prior to the
idoc being sent.
idoc type - Pexr2002
I need to add decimals to the value.
Answers are highlu rewarded.
Thanks in advance.
jogHi,
You can do the following steps and ensure the outbound partner profile (WE20) for output mode is set to collect IDocs.
The example codes can be found in website
http://www.sapgenie.com/sapedi/idoc_abap.htm
STEP 1 - Open document to edit
CALL FUNCTION 'EDI_DOCUMENT_OPEN_FOR_EDIT'
EXPORTING
document_number = t_docnum
IMPORTING
idoc_control = itab_edidc
TABLES
idoc_data = itab_edidd
EXCEPTIONS
document_foreign_lock = 1
document_not_exist = 2
document_not_open = 3
status_is_unable_for_changing = 4
OTHERS = 5.
STEP 2 - Loop at itab_edidd and change data
LOOP AT itab_edidd WHERE segnam = 'E1EDKA1'.
e1edka1 = itab_edidd-sdata.
IF e1edka1-parvw = 'LF'.
e1edka1-partn = t_eikto.
itab_edidd-sdata = e1edka1.
MODIFY itab_edidd.
EXIT.
ENDIF.
ENDLOOP.
STEP 3 - Change data segments
CALL FUNCTION 'EDI_CHANGE_DATA_SEGMENTS'
TABLES
idoc_changed_data_range = itab_edidd
EXCEPTIONS
idoc_not_open = 1
data_record_not_exist = 2
OTHERS = 3.
STEP 3a - Change control record
CALL FUNCTION 'EDI_CHANGE_CONTROL_RECORD'
EXPORTING
idoc_changed_control = itab_edidc
EXCEPTIONS
idoc_not_open = 1
direction_change_not_allowed = 2
OTHERS = 3.
STEP 4 - Close Idoc
Update IDoc status
CLEAR t_itab_edids40.
t_itab_edids40-docnum = t_docnum.
t_itab_edids40-status = '51'.
t_itab_edids40-repid = sy-repid.
t_itab_edids40-tabnam = 'EDI_DS'.
t_itab_edids40-mandt = sy-mandt.
t_itab_edids40-stamqu = 'SAP'.
t_itab_edids40-stamid = 'B1'.
t_itab_edids40-stamno = '999'.
t_itab_edids40-stapa1 = 'Sold to changed to '.
t_itab_edids40-stapa2 = t_new_kunnr.
t_itab_edids40-logdat = sy-datum.
t_itab_edids40-logtim = sy-uzeit.
APPEND t_itab_edids40.
CALL FUNCTION 'EDI_DOCUMENT_CLOSE_EDIT'
EXPORTING
document_number = t_docnum
do_commit = 'X'
do_update = 'X'
write_all_status = 'X'
TABLES
status_records = t_itab_edids40
EXCEPTIONS
idoc_not_open = 1
db_error = 2
OTHERS = 3.
Other alternative, you can use this user exits EXIT_SAPLBD11_001 (enhancement ALE00001
) to change the segment field value.
Hope this will help.
Regards,
Ferry Lianto -
Hi,
i have a requirement where based on a condition i need to add a new segment dynamically in Inbound IDOC.
I have written the code in the user exit of the inbound FM. Its adding new segments and process it perfectly.
But when i see the IDOC in we02 or we19, i am not able to see the newly added segment.
Will the newly added segment in FM appear in the We02?
PS: i have changed the idoc_control-maxsegnum.
Regards,
NiyazHi Niyaz,
Check out the below program ....Similar to your requirement
IDoc creation from inbound file
REPORT ZS7BM000006 message-id ZS7.
*/ Program Name: Creation of DESADV & INVOIC IDocs from file E021
*/ Description : This program reads in external file E021 containing
* shipping and invoice data from internal vendors and
* creates one DESADV and one INVOIC IDoc per invoice.
*/ Transaction : n/a - run from job Z_ccc_S7B_Annnnn, where
* 'ccc' = 3-digit client and 'nnnnn' = zero-filled
* sequence number matching the scheduled job for E020.
tables: lfa1,
lfm1,
ekpo,
eine,
e1edk01,
e1edk02,
e1edk07,
e1edk08,
e1edk06,
e1edk03,
e1edka1,
e1edka2,
e1edp07,
e1edp09,
e1edp19,
e1edp01,
e1edp02,
e1edp26,
e1edp04,
e1eds01,
e1eds02,
zst7f_ty_vendors.
parameters: p_path like PATH-PATHEXTERN
default '/ftp/atac/in/'.
data: INFILE LIKE PATH-PATHEXTERN,
back_path(7) type c value 'backup/',
offset like sy-fdpos,
p07_ctr like sy-index,
invoice_total type p decimals 3,
d_seg_num like sy-index,
i_seg_num like sy-index.
data: OUTFILE LIKE PATH-PATHEXTERN,
today(8) type c.
data: begin of uty_vendors occurs 10,
lifnr like lfa1-lifnr,
waers like lfm1-waers,
name_abbr like zst7f_ty_vendors-name_abbr,
ship_days like zst7f_ty_vendors-ship_days,
end of uty_vendors.
data: iZSS7B21 like ZSS7B21.
data: desadvdata like edi_dd occurs 5 with header line.
data: invoicdata like edi_dd occurs 5 with header line.
data: dedidc like edi_dc occurs 1 with header line.
data: iedidc like edi_dc occurs 1 with header line.
data: begin of ie021 occurs 10,
lifnr like lfa1-lifnr,
ship_days like zst7f_ty_vendors-ship_days,
invoice_no like e1edk08-vbeln,
stat like e1edk01-action,
po_number(10) type n,
po_lineno(5) type n,
slip_number like e1edp09-vbeln,
shipto_id like e1edka1-partn,
vendor_id like e1edka1-partn,
endcust_name like e1edka1-name1,
cust_partno like e1edp09-kdmat, "char 35
vendor_partno like e1edp09-matnr, "char 35
invoice_qty like e1edp09-lfimg,
qty_uom like e1edp01-menee,
unit_price like e1edp01-vprei,
price_uom like e1edp01-pmene,
price_qty like e1edp01-peinh,
line_amount like e1edp26-betrg,
currency like e1edk01-curcy,
etd like e1edk06-datum, "ship date
eta like e1edk06-datum, "delivery date
ship_id like e1edk08-traid,
ship_method like e1edk08-traty,
create_date like e1edk03-datum,
plant like ekpo-werks,
end of ie021.
data: save_po like ie021-po_number,
save_line like ie021-po_lineno,
save_stat like ie021-stat,
save_invoice like ie021-invoice_no.
constants: hun_thou type p decimals 5 value '100000',
thou type p decimals 3 value '1000'.
*& DEFINITION: append_idoc_rec
* add a data record to the IDoc internal table
define append_idoc_rec.
&1-tabnam = &1-segnam.
&2_seg_num = &2_seg_num + 1.
&1-segnum = &2_seg_num.
shift &1-segnum left deleting leading space.
append &1.
clear &1.
end-of-definition. " append_idoc_rec
* MAIN PROCESSING LOOP
START-OF-SELECTION.
today = sy-datum.
* find all internal vendors
select a~lifnr
b~waers
c~name_abbr c~ship_days
into corresponding fields of table uty_vendors
from lfa1 as a
inner join lfm1 as b
on a~lifnr = b~lifnr
inner join zst7f_ty_vendors as c
on a~lifnr = c~lifnr
where a~ktokk = 'ZZTY' and
b~ekorg = '7100' and
c~ship_code = ' '.
perform init_desadv.
perform init_invoic.
concatenate 'SAP' sy-sysid(3) into: iedidc-sndpor, dedidc-sndpor.
loop at uty_vendors.
clear ie021. refresh ie021.
if not uty_vendors-name_abbr is initial.
* datafiles are received with naming convention:
* E020_<customer name abbreviation>_UTY
concatenate p_path 'E021_' uty_vendors-name_abbr '_UTY'
into infile.
if not sy-subrc is initial. "pathname too long
* Filename too long: &
message i016 with infile.
continue.
endif.
condense infile.
OPEN DATASET INFILE FOR INPUT IN TEXT MODE.
if not sy-subrc is initial.
*'Cannot open dataset & on &'
message i013 with infile sy-datum.
continue.
else.
concatenate p_path back_path 'E021_'
uty_vendors-name_abbr '_UTY' today
into outfile.
if not sy-subrc is initial. "pathname too long
* Filename too long: &
message i016 with outfile.
continue.
endif.
condense outfile.
OPEN DATASET OUTFILE FOR OUTPUT IN TEXT MODE.
* if the datestamped file cannot be created, do not process the
* input file, because the input file is deleted after processing,
* and there would be no record of the data.
if not sy-subrc is initial.
*'ERROR opening file & for output'
close dataset infile.
message i033 with outfile.
continue. "process next vendor's file
endif.
do.
read dataset infile into izss7b21.
case sy-subrc.
when 0.
transfer izss7b21 to outfile.
if izss7b21-datacode = 'T'. "trailer rec
perform process_one_vendor using infile.
exit. "process next vendor's file
endif.
check: izss7b21-datacode = 'A'. "data rec
case izss7b21-status.
when ' '. "new
ie021-stat = '000'.
when 'M'. "modification
ie021-stat = '002'.
when 'D'. "deletion
ie021-stat = '003'.
endcase.
move-corresponding uty_vendors to ie021.
move-corresponding izss7b21 to ie021.
perform convert_po_no using izss7b21-pono_poline
changing ie021-po_number
ie021-po_lineno.
perform convert_dates using ie021-lifnr
izss7b21-etd
izss7b21-eta
izss7b21-ship_method
izss7b21-create_date
changing ie021-eta
ie021-ship_days.
perform quantity_conversion
using izss7b21-qty_uom
izss7b21-invoice_qty
izss7b21-unit_price
changing ie021-qty_uom
ie021-invoice_qty
izss7b21-line_amount.
perform money_conversion
using izss7b21-currency
izss7b21-unit_price
izss7b21-price_uom
izss7b21-line_amount
changing ie021-currency
ie021-price_uom
ie021-price_qty
ie021-unit_price
ie021-line_amount.
perform SAP_vendor_partno
changing ie021-cust_partno.
append ie021.
when 4. "EOF
perform process_one_vendor using infile.
exit. "process next vendor's file
when others.
*ERROR reading dataset & - &
message i015 with infile sy-datum.
exit.
endcase.
enddo.
close dataset: infile, outfile.
delete dataset infile.
endif.
endif.
endloop. "UTY_VENDORS
*& Form process_one_vendor
* Pre-processed records from one vendor file are now in the
* internal table ie021 - ready to create IDocs
FORM process_one_vendor using value(infile).
sort ie021 by invoice_no stat po_number po_lineno.
loop at ie021.
if ( ie021-invoice_no <> save_invoice or
ie021-stat <> save_stat ).
if sy-tabix > 1.
perform post_idocs using ie021-stat.
endif.
perform idoc_header_segs using ie021-stat.
endif.
if ( ie021-stat <> save_stat or
ie021-po_number <> save_po or
ie021-po_lineno <> save_line or
ie021-invoice_no <> save_invoice ).
if ( sy-tabix > 1 and
ie021-stat = '000' ).
perform idoc_poheader_segs.
endif.
endif.
perform idoc_item_segs using ie021-stat.
save_po = ie021-po_number.
save_line = ie021-po_lineno.
save_invoice = ie021-invoice_no.
save_stat = ie021-stat.
endloop.
perform post_idocs using ie021-stat.
* File successfully processed: &
message s035 with infile.
ENDFORM. " process_one_vendor
*& Form convert_po_no
* Break the PO number & line field into separate fields
FORM convert_po_no using value(infield)
changing po_number like ie021-po_number
po_line like ie021-po_lineno.
data: cpos like sy-fdpos,
lpos like sy-fdpos,
cline(6) type c.
* if the infield contains a hyphen, assume that the preceding characters
* represent the po number, if they are numeric. The po line number is
* assumed to be all numeric characters after the hyphen.
if infield ca '-'.
if infield(sy-fdpos) co ' 0123456789'. "numeric
po_number = infield(sy-fdpos).
cpos = sy-fdpos + 1.
endif.
else. "no hyphen - PTY
if infield(2) = '71'. "SAP number range
cpos = 10.
else. "SyteLine number
cpos = 6.
endif.
if infield(cpos) co ' 0123456789'. "numeric
po_number = infield(cpos).
endif.
endif.
if not po_number is initial.
while infield+cpos(1) co '0123456789'.
cline+lpos(1) = infield+cpos(1).
lpos = lpos + 1.
cpos = cpos + 1.
endwhile.
shift cline left deleting leading '0'.
if not cline is initial.
po_line = cline.
endif.
endif.
* Put out a warning in the job log, but create the IDoc to save the data
if ( po_number is initial or
po_line is initial ).
* PO number - line item conversion failed: &
message i034 with infield.
endif.
ENDFORM. " convert_po_no
*& Form convert_dates
* Convert ship date to delivery date, if necessary
FORM convert_dates using value(vendor_no)
value(i_ship_date)
value(i_delivery_date)
value(i_ship_code)
value(i_create_date)
changing o_delivery_date
ship_days.
data: ship_date type d.
* if delivery date not sent, calculate it from ship date plus
* ship days.
* Note that this logic could leave delivery date blank,
* if ship date is not numeric.
if ( i_delivery_date is initial or
i_delivery_date co ' 0' ). "no delivery date sent
if ( i_ship_date co ' 0123456789' and
i_ship_date cn ' 0' ). "ship date sent
* move the ship date into a date field to add days
ship_date = i_ship_date.
elseif ( i_create_date co ' 0123456789' and
i_create_date cn ' 0' ).
ship_date = i_create_date.
endif.
if not i_ship_code is initial.
select single ship_days from zst7f_ty_vendors
into ship_days
where lifnr = vendor_no
and ship_code = i_ship_code.
endif.
if not ship_date is initial.
if ship_days > 0.
ship_date = ship_date + ship_days.
o_delivery_date = ship_date.
shift o_delivery_date left deleting leading ' '.
endif.
endif.
else. "delivery date sent
o_delivery_date = i_delivery_date.
endif.
ENDFORM. " convert_dates
*& Form quantity_conversion
* The quantities in the input file are implied 3-decimal,
* so need to be converted into a "real" number.
* Also, the unit of measure may be 'KP' indicating that the qty
* is given in thousands.
FORM quantity_conversion USING value(i_UOM)
value(i_invoice_qty)
value(i_unit_price)
CHANGING o_uom like iE021-qty_UOM
o_invoice_qty like IE021-INVOICE_QTY
c_LINE_AMOUNT like izss7b21-line_amount.
data: f_invoice_qty type f.
data: n_invoice_qty like lips-kcmeng.
data: f_unit_price type f.
data: f_line_amt type f.
data: n_line_amt0 type p decimals 0.
if ( i_invoice_qty co ' 0123456789' and
i_invoice_qty cn ' 0' ).
f_invoice_qty = i_invoice_qty.
* if no extended price is sent, calculate it
if c_line_amount is initial.
* the qty is implied 3-dec, the price is still implied
* 5-dec, and line amount should be implied 3-dec.
f_unit_price = i_unit_price.
f_line_amt = ( f_invoice_qty * f_unit_price ) / 100000.
n_line_amt0 = f_line_amt.
c_line_amount = n_line_amt0.
shift c_line_amount left deleting leading space.
endif.
* if the invoice qty is per 1000, the implied 3-dec times 1000 equals
* the unconverted value. Otherwise, divide by 1000 to get the PCE qty
if i_uom = 'KP'.
n_invoice_qty = f_invoice_qty.
else.
n_invoice_qty = f_invoice_qty / thou.
endif.
endif.
o_uom = 'PCE'.
if not n_invoice_qty is initial.
o_invoice_qty = n_invoice_qty.
shift o_invoice_qty left deleting leading space.
else.
clear o_invoice_qty.
endif.
ENDFORM. " quantity_conversion
*& Form money_conversion
* Add the implied decimals and store price-per qty, if
* price per 1,000 is sent.
FORM money_conversion USING value(I_CURR)
value(i_UNIT_PRICE)
value(i_UOM)
value(i_LINE_AMOUNT)
CHANGING o_CURRENCY like ie021-currency
o_PRICE_UOM like ie021-price_uom
o_PRICE_QTY like ie021-price_qty
o_UNIT_PRICE like ie021-unit_price
o_LINE_AMOUNT like ie021-line_amount.
data: n_unit_price type p decimals 5,
n_line_amount type p decimals 3.
* not all of the vendors send the currency code, so use the vendor
* master default
case i_curr(2).
when 'US'.
o_currency = 'USD'.
when 'JP'.
o_currency = 'JPY'.
when others.
o_currency = uty_vendors-waers.
endcase.
* unit price is implied 5-dec
if ( i_unit_price cn ' 0' and
i_unit_price co ' 0123456789' ).
n_unit_price = i_unit_price.
n_unit_price = n_unit_price / hun_thou.
endif.
* line price is implied 3-dec
if ( i_line_amount co ' 0123456789' and
i_line_amount cn ' 0' ).
n_line_amount = i_line_amount.
n_line_amount = n_line_amount / thou.
endif.
* 'KP' = price per thousand
if i_uom = 'KP'.
o_price_qty = '1000'.
else.
o_price_qty = '1'.
endif.
o_price_uom = 'PCE'.
if not n_unit_price is initial.
o_unit_price = n_unit_price.
shift o_unit_price left deleting leading space.
else.
clear o_unit_price.
endif.
if not n_line_amount is initial.
o_line_amount = n_line_amount.
shift o_line_amount left deleting leading space.
else.
clear o_line_amount.
endif.
ENDFORM. " money_conversion
*& Form SAP_vendor_partno
* replace UTY part number sent by vendor with SAP material no.
* from PO line item.
FORM SAP_vendor_partno changing cust_partno like ie021-cust_partno.
tables: makt.
data: partno_sent like makt-maktx.
partno_sent = cust_partno.
clear: makt, cust_partno.
select single matnr from ekpo into cust_partno
where ebeln = ie021-po_number and
ebelp = ie021-po_lineno.
if sy-subrc is initial.
*compare material description to part number sent by vendor
select single maktx from makt into makt-maktx
where matnr = cust_partno.
if partno_sent <> makt-maktx.
* 'Part No. Mismatch: PO & - &, Part sent &, SAP mat.no. &'
message i031 with ie021-po_number ie021-po_lineno
partno_sent makt-maktx.
endif.
else. "PO line not found
*try to find SAP material number using 20-char catalog no. sent
select single matnr from makt into cust_partno
where maktx = partno_sent.
if not sy-subrc is initial.
* 'SAP material no. not found for & - PO & - &'
message i032 with partno_sent ie021-po_number ie021-po_lineno.
endif.
endif.
*if not found, IDoc will go to workflow for missing material no.
ENDFORM. " SAP_vendor_partno
*& Form idoc_header_segs
* create internal table entries for header segments.
* DESADV:
* E1EDK07
* E1EDKA1
* E1EDK03
* E1EDK08
* E1EDKA2
* E1EDK06
* INVOIC:
* E1EDK01
* E1EDKA1(s)
* E1EDK02
* E1EDK03(s)
FORM idoc_header_segs using value(desadv_ok).
* INVOIC
clear i_seg_num.
invoicdata-segnam = 'E1EDK01'.
e1edk01-action = ie021-stat.
if ie021-currency(2) = 'US'.
e1edk01-curcy = 'USD'.
else.
e1edk01-curcy = 'JPY'.
endif.
invoicdata-sdata = e1edk01.
append_idoc_rec invoicdata i.
clear e1edka1.
invoicdata-segnam = 'E1EDKA1'.
e1edka1-parvw = 'RE'.
e1edka1-partn = ie021-shipto_id.
invoicdata-sdata = e1edka1.
append_idoc_rec invoicdata i.
clear e1edka1.
invoicdata-segnam = 'E1EDKA1'.
e1edka1-parvw = 'LF'.
e1edka1-partn = ie021-lifnr.
e1edka1-lifnr = ie021-shipto_id.
invoicdata-sdata = e1edka1.
append_idoc_rec invoicdata i.
if not ie021-endcust_name is initial.
clear e1edka1.
invoicdata-segnam = 'E1EDKA1'.
e1edka1-parvw = 'WE'.
e1edka1-name1 = ie021-endcust_name.
invoicdata-sdata = e1edka1.
append_idoc_rec invoicdata i.
endif.
clear e1edk02.
invoicdata-segnam = 'E1EDK02'.
e1edk02-qualf = '009'.
e1edk02-belnr = ie021-invoice_no.
invoicdata-sdata = e1edk02.
append_idoc_rec invoicdata i.
clear e1edk03.
invoicdata-segnam = 'E1EDK03'.
e1edk03-iddat = '012'.
e1edk03-datum = ie021-create_date.
invoicdata-sdata = e1edk03.
append_idoc_rec invoicdata i.
invoicdata-segnam = 'E1EDK03'.
e1edk03-iddat = '024'.
invoicdata-sdata = e1edk03.
append_idoc_rec invoicdata i.
check desadv_ok = '000'.
* DESADV
clear d_seg_num.
desadvdata-segnam = 'E1EDK07'.
e1edk07-action = ie021-stat.
e1edk07-bolnr = ie021-invoice_no.
desadvdata-sdata = e1edk07.
append_idoc_rec desadvdata d.
clear e1edka1.
desadvdata-segnam = 'E1EDKA1'.
desadvdata-sdata = e1edka1.
append_idoc_rec desadvdata d.
clear e1edk03.
desadvdata-segnam = 'E1EDK03'.
desadvdata-sdata = e1edk03.
append_idoc_rec desadvdata d.
clear e1edk08.
desadvdata-segnam = 'E1EDK08'.
e1edk08-vbeln = ie021-invoice_no.
e1edk08-traid = ie021-ship_id.
e1edk08-traty = ie021-ship_method.
desadvdata-sdata = e1edk08.
append_idoc_rec desadvdata d.
clear e1edka2.
desadvdata-segnam = 'E1EDKA2'.
desadvdata-sdata = e1edka2.
append_idoc_rec desadvdata d.
clear e1edk06.
desadvdata-segnam = 'E1EDK06'.
e1edk06-iddat = '025'. "document date
e1edk06-datum = ie021-create_date.
desadvdata-sdata = e1edk06.
append_idoc_rec desadvdata d.
if not ie021-eta is initial.
clear e1edk06.
desadvdata-segnam = 'E1EDK06'.
e1edk06-iddat = '001'. "delivery date
e1edk06-datum = ie021-eta.
desadvdata-sdata = e1edk06.
append_idoc_rec desadvdata d.
endif.
if not ie021-etd is initial.
clear e1edk06.
desadvdata-segnam = 'E1EDK06'.
e1edk06-iddat = '010'. "ship date
e1edk06-datum = ie021-etd.
desadvdata-sdata = e1edk06.
append_idoc_rec desadvdata d.
endif.
ENDFORM. " idoc_header_segs
*& Form idoc_poheader_segs
* create internal table entries for DESADV PO/item segments
* E1EDP07
FORM idoc_poheader_segs.
*DESADV
clear e1edp07.
desadvdata-segnam = 'E1EDP07'.
e1edp07-bstnk = ie021-po_number.
e1edp07-posex = ie021-po_lineno.
desadvdata-sdata = e1edp07.
append_idoc_rec desadvdata d.
p07_ctr = p07_ctr + 1.
ENDFORM. " idoc_poheader_segs
*& Form idoc_item_segs
* create internal table entries for PO item segments:
* DESADV: E1EDP09
* INVOIC: E1EDP01 Qtys
* E1EDP02 ref nos. (PO number / line)
* E1EDP19 part numbers
* E1EDP26 amounts
* E1EDP04 taxes
FORM idoc_item_segs using value(desadv_ok).
data: n_line_amt type p decimals 3.
*INVOIC
clear e1edp01.
invoicdata-segnam = 'E1EDP01'.
e1edp01-menee = ie021-qty_uom.
e1edp01-menge = ie021-invoice_qty.
e1edp01-vprei = ie021-unit_price.
e1edp01-pmene = ie021-price_uom.
e1edp01-peinh = ie021-price_qty.
e1edp01-netwr = ie021-line_amount.
invoicdata-sdata = e1edp01.
append_idoc_rec invoicdata i.
clear e1edp02.
invoicdata-segnam = 'E1EDP02'.
e1edp02-qualf = '001'.
e1edp02-belnr = ie021-po_number.
e1edp02-zeile = ie021-po_lineno.
invoicdata-sdata = e1edp02.
append_idoc_rec invoicdata i.
clear e1edp19.
invoicdata-segnam = 'E1EDP19'.
e1edp19-qualf = '001'.
e1edp19-idtnr = ie021-cust_partno.
invoicdata-sdata = e1edp19.
append_idoc_rec invoicdata i.
clear e1edp19.
invoicdata-segnam = 'E1EDP19'.
e1edp19-qualf = '002'.
e1edp19-idtnr = ie021-vendor_partno.
invoicdata-sdata = e1edp19.
append_idoc_rec invoicdata i.
clear e1edp26.
invoicdata-segnam = 'E1EDP26'.
e1edp26-qualf = '003'.
e1edp26-betrg = ie021-line_amount.
invoicdata-sdata = e1edp26.
append_idoc_rec invoicdata i.
* dummy tax seg
clear e1edp04.
invoicdata-segnam = 'E1EDP04'.
e1edp04-msatz = '0.00'.
invoicdata-sdata = e1edp04.
append_idoc_rec invoicdata i.
n_line_amt = ie021-line_amount.
invoice_total = invoice_total + n_line_amt.
check desadv_ok = '000'.
*DESADV
clear e1edp09.
desadvdata-segnam = 'E1EDP09'.
e1edp09-vbeln = ie021-slip_number.
e1edp09-matnr = ie021-vendor_partno.
e1edp09-vrkme = ie021-qty_uom.
e1edp09-lfimg = ie021-invoice_qty.
desadvdata-sdata = e1edp09.
append_idoc_rec desadvdata d.
ENDFORM. " idoc_item_segs
*& Form post_idocs
* create database IDocs from the idocdata tables and clear tables.
FORM post_idocs using value(desadv_ok).
*INVOIC
clear e1eds01.
invoicdata-segnam = 'E1EDS01'.
e1eds01-sumid = '010'.
e1eds01-summe = invoice_total.
e1eds01-waerq = ie021-currency.
shift e1eds01-summe left deleting leading space.
invoicdata-sdata = e1eds01.
append_idoc_rec invoicdata i.
CALL FUNCTION 'INBOUND_IDOC_PROCESS'
TABLES
IDOC_CONTROL = iedidc
IDOC_DATA = invoicdata.
commit work.
*DESADV
if desadv_ok = '000'.
clear e1eds02.
desadvdata-segnam = 'E1EDS02'.
e1eds02-sumid = '001'.
e1eds02-summe = p07_ctr.
shift e1eds02-summe left deleting leading space.
desadvdata-sdata = e1eds02.
append_idoc_rec desadvdata d.
CALL FUNCTION 'INBOUND_IDOC_PROCESS'
TABLES
IDOC_CONTROL = dedidc
IDOC_DATA = desadvdata.
commit work.
endif.
refresh: desadvdata,
invoicdata.
clear:
desadvdata,
invoicdata,
p07_ctr,
invoice_total,
save_stat,
save_po,
save_line,
save_invoice.
ENDFORM. " post_idocs
*& Form init_desadv
* add a DESDAV control record and initialize fields
FORM init_desadv.
clear dedidc. refresh dedidc.
* initialize control record:
move: '2' to dedidc-direct,
'DESADV01' to dedidc-doctyp,
'DESADV' to dedidc-mestyp,
'F' to dedidc-std,
'E021' to dedidc-stdmes,
'LS' to dedidc-sndprt,
'TY_VENDORS' to dedidc-sndprn,
sy-datlo to dedidc-credat,
sy-timlo to dedidc-cretim.
append dedidc.
ENDFORM. " init_desadv
*& Form init_invoic
* add a INVOIC control record and initialize fields
FORM init_invoic.
clear iedidc. refresh iedidc.
* initialize control record:
move: '2' to iedidc-direct,
'INVOIC01' to iedidc-doctyp,
'INVOIC' to iedidc-mestyp,
'MM' to iedidc-mescod,
'F' to iedidc-std,
'E021' to iedidc-stdmes,
'LS' to iedidc-sndprt,
'TY_VENDORS' to iedidc-sndprn,
sy-datlo to iedidc-credat,
sy-timlo to iedidc-cretim.
append iedidc.
ENDFORM. " init_invoic
REWARD POINTS IF HELPFUL
Lakshmiraj.A -
How to include email address of the consignee in ORDERS05 purchase orders?
Helllo,
how can the email address of the consignee be included to the address data in purchase orders of the type ORDERS05?
The email address should fit somewhere in here:
< E1EDKA1 >
< PARVW > WE </ PARVW >
< LIFNR > 1234</ LIFNR >
< NAME1 > COMPANYNAME </ NAME1 >
< NAME2 > A.NONYMUS </ NAME2 >
< STRAS > 1 Highstreet </ STRAS >
< STRS2 > 1.C.110 </ STRS2 >
< ORT01 > Ratingen </ ORT01 >
< PSTLZ > 40882</ PSTLZ >
< TELF1 > +49 2102 123456 </ TELF1 >
The email address is part of the ADDRESS DETAILS of the purchase order.
The dynpro field is: SZA1_D0100-SMTP_ADDR
Is it possible to send this address only to a specific vendor?
Your help is very much appreciated!
KarstenHello there,
Following is the URL for the widget.
http://www.adobe.com/cfusion/exchange/index.cfm?event=extensionDetail&extid=3072025
Thanks,
Vish -
Configured Sales Order Items using BAPI_SALESORDER_CREATE
Hello
I am trying to use the BAPI_SALESORDER_CREATEFROMDAT2 to create a Sales Order for a Configured Item .
I get my item on the Sales Order but no Configuration Data behind it .
I am populating the the order_items_in & order_items_inx tables and linking using po_itm_no fields .
I am also populating the order_cfgs_ref , order_cfgs_inst , order_cfgs_value fields with the relevant Characteristics data .
I have looked at the SAP Note 549563 and can see no differences between the info on that and what I am doing .
Does anyone have any advice or experience of doing this ?
Regards
PaulHi all,
I managed to create a dummy sales order in SAP R/3 using the DCOM Connector and Borland Delphi 7.0 Professional.
Hoping the below listed example will help, here we go:
ctrlBAPI: TSAPBAPIControl;
var
order, header, items, partners, ret: Variant;
try
order := ctrlBAPI.GetSAPObject('SalesOrder');
header := ctrlBAPI.DimAs(order, 'CreateFromDat1', 'OrderHeaderIn');
items := ctrlBAPI.DimAs(order, 'CreateFromDat1', 'OrderItemsIn');
partners := ctrlBAPI.DimAs(order, 'CreateFromDat1', 'OrderPartners');
ret := ctrlBAPI.DimAs(order, 'CreateFromDat1', 'Return');
// The values....
header.Value('DOC_TYPE') := 'TA';
{ the order type is as you see it when you log in with language 'DE' }
header.Value('SALES_ORG') := '2000';
header.Value('DISTR_CHAN') := '10';
header.Value('DIVISION') := '10';
header.Value('REQ_DATE_H') := now;
header.Value('PURCH_NO') := 'Test BAPI Delphi';
partners.Rows.Add;
partners.Value(1, 'PARTN_ROLE') := 'AG';
{ The partner function is as you see it when you log in with language 'DE' }
partners.Value(1, 'PARTN_NUMB') := 'M9531057';
// Line 1...
items.Rows.Add;
items.Value(1, 'MATERIAL') := '000000000000000354';
items.Value(1, 'REQ_QTY') := '00000003';
// Line 2
items.Rows.Add;
items.Value(2, 'MATERIAL') := '000000000000003595';
items.Value(2, 'REQ_QTY') := '00000005';
// Insert this order in R/3...
order.CreateFromDat1( OrderHeaderIn := header,
OrderItemsIn := items,
OrderPartners := partners,
Return := ret);
ShowMessage('Return type: ' + ret.Value('TYPE') + #13 + 'Message: ' + ret.Value('MESSAGE'));
except
on E:Exception do
ShowMessage(E.Message)
end;
If you need more help, do not hesitate to ask,
Bogdan CIOC -
Create Sales order from a Purchase order through IDOCs in the same system
Hi,
I have been trying to create Sales ordes in the same SAP system, through the Purchase order generated.
The Purchase order generated, passes the information through an outbound I DOC to a SO inbound I doc, I am getting the following error
Partner number A2815 for customer 2815 , partner function WE does not exist.
Message no. VG140
but in my case the ship to party (partner function WE) is the same as Sold to party (partner function AG)
can any body please help how to map it
Sreeram PHello Sreeram ,
See note 1339290, which corrects the parameters of error message VG140.
Also, the sold to party (SP) is determined in several ways:
1. If the sender partner in the control record is a logical system (LS), an E1EDKA1 segment with the SP must be sent.
E1EDKA1-PARVW = AG
E1EDKA1-PARTN = valid partner in the receiving system
Otherwise the system takes the partner number from the control record into the field E1EDKA1-PARTN and this is not a valid partner.
2. If the sender partner in the control record is a SP, we take this SP from the sender partner into the sold-to party number. Excepted another SP was sent in the segment E1EDKA1-PARNR, then the SP from the control record has no effect.
The E1EDKA1 segment for the SP should be sent always before the E1EDKA1 segment of the ship-to party (SH).
Regards,
Maybe you are looking for
-
I am trying to integrate EBS 12.1.3 with Enterprise Manager 11g
HI Experts I need to integrate EBS 12.1.3 with Enertprise Manager 11g grid control. I have applied patch 8333939 to my OMS Instance successfully. But I am not able to apply the same to my agent home. I am following this doc. http://docs.oracle.com/cd
-
Wiki migration from 10.6.8 to 10.10 Server 4 no data loaded
I'm trying to migrate wiki from an old OSX Server 10.6.8 to a brand new installation of 10.10.1 with Server App ver 4. I followed the article at http://krypted.com/mac-os-x/setup-os-x-yosemite-server-as-a-wiki-server/ I used the migration method: 1)
-
Dear All We have develop one Z Report to take a Print out of Goods Receipt Note, where we have mentioned a colums of Excise Invoice Document Number and its date now, i want to restrict or validate that if material is excisable then if after making of
-
Shared Services 9.3.1 Configuration Failed!
Hi I installed Shared Services 9.3.1. I have Oracle DB Xpress Edition. Also, Is Oracle Xpress Edition supported with Essbase? When I tried to configure shared Services to "Configure Database". It failed. :-( Following is the error from configtool.log
-
Nesting App Modules from ADFLibs - jdev 11.1.2.3
Hello: I have a dashboard application with 6 tabs. On each tab is a bounded task flow from an ADFLib. Note: each BTF has its own App Module. In the Master DashBoard App, the ADFLibs BTF's are dropped as regions in each tab. The Master App has its ow