IDOC creation from a flat file
We currently receive a large volume of invoices from freight companies that move our product from point A to B.
I will receive a file from the vendor with 10 fields. The fields are BOL, shipdate, shipfrom_pt, shipto_pt, volume, rate, surcharge, total, invoice_no, invoice_dt.
I may also get them to plug in the Vendor number on creation.
Currently, our staff uses paper invoice with the BOL & shipdate to locate the PO in our system, then lookup the PO, and if the total in SAP matches to the total on the paper invoice, it is marked for payment (that is the short of it).
We have eVision already in place which I use to build an iDOC for our Utility bills we receive. But these occur once a month, whereas we may receive 50+ invoices from a freight vendor.
Do I have enough information to create an iDOC in SAP, in which SAP will know how to locate and reconcile? The invoic01 documentation is extensive and examples are nill. Help on identifying the segments, fields and values necessary to generate an iDOC.
The alternative is to import the file into SAP and write an ABAP pgm, with BAPI's to search and create the invoice.
I wanted to go with iDOC as it is SAP's proprietary form for handling inbound records.
Ralph
Hi Ralph,
In my opinion, you must have a PO Number for Invoice if you want to use standard functionality. You will probably need to create IDOC using an ABAP program which reads this file and search for PO based on the information available to you. I also notice that you are missing material number as well, how do you match the item number in the PO ?
I don't see a way aroung without writing an ABAP program to handle this logic, but you can still use IDOC ( which comes with the standard processing logic and that is a big advantage ) so that you need to write only the PO matching logic.
or if you are not inclined to write a separate program for uploading file into SAP and formatting IDOC, you can write your own process code (FM)for INVOICE01. Inside this process code (FM), you can put your PO matching logic and then call standard FM (process code). This is what I usually do.
Cheers,
Sanjeev
Cheers,
Sanjeev
Similar Messages
-
Multiple idoc segments from single flat file
hi,
I want to upload data throught LSMW, in a single row i have many item. can anyone give me idea, how to proceed.
2. i have to show a custom error report linked to lsmw.. how to do it..
waiting for your reply
Thanks & Regards
DineshWhat object do you need to load?
What exactly is in the file (what kind of data) ?
If it is a simple file with few fields, then i think a recording is the fastest methods. It does give you a detailed error log.
But all this depends on the file you have -
Multiple idocs from single flat file
Hi All
I want to send data from a flat file to SAP(file to idoc)
My flat file structure is
id,name,number,city
2,R1,234,SD
2,R2,457,MD
3,R4,789,HG
3,R6,235.HG
The Field 'id' will change..after every change in 'id' ,seperate idoc should be created.
I have checked the following thread.
Re: Content conversion for seperate idoc
In the above thread ,it is asked to map v.no with remove context and use SPLIT BY VALUE on value change then do the mapping accordingly ,you can create 3 idocs for the same.
I'm confused about how to do these mappings.
Please explain the mapping in detail.
Please help
Regards
Reemaif your source data type is like
MT_Source
Record 0-unbounded
id ----1
name -----1
number -----1
city -------1
then in the sender file communication channel you have to specify file content conversion parameters as
Parameter name parametervalue
Document Name MT_Source
Recordset Structure Record,*
choose + to add more parameters
Name Value
Record.fieldSeparator ,
Record.fieldNames id,name,number,city
Record.endSeparator 'nl'
then do the maping
as
id ---->removeContext---->SplitByValue(Value change)---->Target Idoc
map according to your requirement for other fields -
Need to create sale order from the flat file & mail has to be sent
Hi Experts,
I have a requirement to create a sale order from a flat file and once the oder is created, mail has to be sent to customer as well as to internal user with the order details. I want to know how this process can be implemented and what adapters are needed to execute this.
it would be very helpful, if i get an step-by-step procedure.
Points assured for any helpful answers.
Thanks in Advance
JaiHI Jai,
You need to create two interfaces as file will be sending the Sales oreder details that you need to capture in IDOC or RFC and then have to trigger to create the sales order. For this Standard BAPIs are also available.
These RFC or BAPIs will response with Sales order details that you need to divert to Mail adapter with the use of BPM and also have to go for Async to Sync bridge.
File -
>XI (BPM) ---> BAPI/RFC (Request)
MailAdapter <- XI (BPM) <--- BAPI/RFC (Response)
For this refer below links for step by step
/people/arpit.seth/blog/2005/06/27/rfc-scenario-using-bpm--starter-kit - File to RFC
https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/1685 [original link is broken] [original link is broken] [original link is broken] - File to Mail
/people/krishna.moorthyp/blog/2005/06/09/walkthrough-with-bpm - Walk through BPM
/people/siva.maranani/blog/2005/05/22/schedule-your-bpm - Schedule BPM
/people/sriram.vasudevan3/blog/2005/01/11/demonstrating-use-of-synchronous-asynchronous-bridge-to-integrate-synchronous-and-asynchronous-systems-using-ccbpm-in-sap-xi - Use of Synch - Asynch bridge in ccBPM
https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/1403 [original link is broken] [original link is broken] [original link is broken] - Use of Synch - Asynch bridge in ccBPM
If you will use IDOC then In IDOC inbound processing you need to trigger for Sales order creation and then have to send the Sales Order generated IDOC as an Outbound to Mail Adapter
Flat file -
> XI ---> IDOC
IDOC -
> XI ---> Mail
This will be bit easy scenario to develope as compare to using BAPI with BPM
/people/ravikumar.allampallam/blog/2005/06/24/convert-any-flat-file-to-any-idoc-java-mapping - Any flat file to any Idoc
configuring IDOC-XI-Mail scenario using following web-log:
/people/michal.krawczyk2/blog/2005/03/07/mail-adapter-xi--how-to-implement-dynamic-mail-address
/people/sravya.talanki2/blog/2005/08/18/triggering-e-mails-to-shared-folders-of-sap-is-u - Triggering Email from folder
Thanks
Swarup -
Creating idoc,downloading them in flat-files,sending them in zipped form
Hi Friends,
Presently I have a requirement regarding creation of WPDBBY idocs, downloading them in flat files and sending the files in zipped form to the user.
1. In the first program bonusbuy records have to be fetched which have been created/changed during the selection period. for every selected bonusbuy record transaction WPMA is executed which will create an WPDBBY Idoc for the Bonusbuy.
2. In the second program the idocs created are taken as input. first all deletion idocs are sorted. A deletion idoc can be recognized because it only has one segment (E1WPBB01) and in this segment the field AENDKENNZ equals DELE. For every idoc a file is created The name of this file is determined via the Logical file from the selection screen, with a sequence number. It is then saved. All files are zipped en send. After processing of the Idocs, the Idoc status is changed to u201818u2019.
If any of you have information about how to do this then pls tell me. I will definitely reward points for your heplful answers. Thanks!
Regards,
AbhishekHi,
For creating zip files and related processing use class cl_abap_zip.
You can check sample code at
https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/dynamicTransformationofInternaltabledataintoXMLandCreatingaZIPFile
..very easy to use.
Regards,
Abhijit -
Reading special characters from a flat file and inserting into DB
I'm reading data with special characters like . etc from a flat file , assigning the data to variable in my anonymous block and inserting into my DB. But the show up as inverted ? s. Any clues about how to do this?
If i try to do the insert directly it works. It seems like the error occurs when reading this data into a variable
thanks for the help
Lalit Bhatialalit, this is probably an character set problem, the default on Database creation tends to be 7bit Ascii which does not support special characters, it's been a while since I set up a db in this way, but you need to change settings in oracle.ini. The db will need to be restarted for this. Also, to check current settings try:
select * from NLS_DATABASE_PARAMETERS
You want an 8bit, unicode or multibyte character set. Sorry I cannot remember moer off the top of my head, try searching on NLS or character set -
Generating Deeply nested XML from a flat file
Hi All,
I am working on a MQ to IDOC scenario.
I am getting a flat file as input. I need to convert it into XML( so that XI can understand it).
But conversion is into a "Deeply Nested XML from a Flat File" at sender side (JMS Adapter).
Any inputs on this.
Regards,
VikasYou can only convert flat file into xml structure with 3 levels.
If you need to convert flat file into deep nested xml structure, you have to do java mapping or xslt or abap mapping. There is a tool, I think it's called conversion agent by itemfield (bought by SAP), which can do pretty everything with conversion. Never used it though.
Jayson -
BAPI to upload line items from a flat file to VA01
Hi guys,
I have a requirement wherein i need to upload data containing line items from a flat file to VA01.Please tell me how do i go about this.
Thanks and regards,
Frank.Hi
Frank this code might help u and this is the BAPI to create sales document BAPI_SALESDOCU_CREATEFROMDATA1 if i am helpful to u in any way plzz reward and dont forget to reward me plzzz
for any further quiries my mail id [email protected]
Include YCL_CREATE_SALES_DOCU *
Form salesdocu
This Subroutine is used to create Sales Order
-->P_HEADER Document Header Data
-->P_HEADERX Checkbox for Header Data
-->P_ITEM Item Data
-->P_ITEMX Item Data Checkboxes
-->P_LT_SCHEDULES_IN Schedule Line Data
-->P_LT_SCHEDULES_INX Checkbox Schedule Line Data
-->P_PARTNER text Document Partner
<--P_w_vbeln text Sales Document Number
DATA:
lfs_return like line of t_return.
FORM create_sales_document changing P_HEADER like fs_header
P_HEADERX like fs_headerx
Pt_ITEM like t_item[]
Pt_ITEMX like t_itemx[]
P_LT_SCHEDULES_IN like t_schedules_in[]
P_LT_SCHEDULES_INX like t_schedules_inx[]
Pt_PARTNER like t_partner[]
P_w_vbeln like w_vbeln.
This Perform is used to fill required data for Sales order creation
perform sales_fill_data changing p_header
p_headerx
pt_item
pt_itemx
p_lt_schedules_in
p_lt_schedules_inx
pt_partner.
Function Module to Create Sales and Distribution Document
perform sales_order_creation using p_header
p_headerx
pt_item
pt_itemx
p_lt_schedules_in
p_lt_schedules_inx
pt_partner.
perform return_check using p_w_vbeln .
ENDFORM. " salesdocu
Form commit_work
To execute external commit *
FORM commit_work .
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = c_x
ENDFORM. " Commit_work
Include ycl_sales_order_header " To Fill Header data and Item data
Include ycl_sales_order_header.
Form return_check
To validate the sales order creation
FORM return_check using pr_vbeln type vbeln.
if pr_vbeln is initial.
LOOP AT t_return into lfs_return .
WRITE / lfs_return-message.
clear lfs_return.
ENDLOOP. " Loop at return
else.
perform commit_work. " External Commit
Refresh t_return.
fs_disp-text = text-003.
fs_disp-number = pr_vbeln.
append fs_disp to it_disp.
if p_del eq c_x or p_torder eq c_x or
p_pgi eq c_x or p_bill eq c_x.
perform delivery_creation. " Delivery order creation
endif. " If p_del eq 'X'......
endif. " If p_w_vbeln is initial
ENDFORM. " Return_check
*& Form sales_order_creation
text
-->P_P_HEADER text
-->P_P_HEADERX text
-->P_PT_ITEM text
-->P_PT_ITEMX text
-->P_P_LT_SCHEDULES_IN text
-->P_P_LT_SCHEDULES_INX text
-->P_PT_PARTNER text
FORM sales_order_creation USING P_P_HEADER like fs_header
P_P_HEADERX like fs_headerx
P_PT_ITEM like t_item[]
P_PT_ITEMX like t_itemx[]
P_P_LT_SCHEDULES_IN like t_schedules_in[]
P_P_LT_SCHEDULES_INX like t_schedules_inx[]
P_PT_PARTNER like t_partner[].
CALL FUNCTION 'BAPI_SALESDOCU_CREATEFROMDATA1'
EXPORTING
sales_header_in = p_p_header
sales_header_inx = p_p_headerx
IMPORTING
salesdocument_ex = w_vbeln
TABLES
return = t_return
sales_items_in = p_pt_item
sales_items_inx = p_pt_itemx
sales_schedules_in = p_p_lt_schedules_in
sales_schedules_inx = p_p_lt_schedules_inx
sales_partners = p_pt_partner.
ENDFORM. " sales_order_creation -
Extract hierarchy from a flat file
Hello,
Im trying to extract hierarchy from a flat file.
The hierarchy is built from 3 different infoObjects each infoObject represent different level in the hierarchy. I built the hierarchy in the last level of the hierarchy and put all the levels as external chars in the hierarchy.
(I used the blog: Hierarchy Upload from Flat files: /people/prakash.bagali/blog/2006/02/07/hierarchy-upload-from-flat-files )
When I extract the data into the PSA it looks fine but when I choose to update the PSA data into the infoObject the request stays yellow. Three is no dump and I cant find the job in SM50.
Please Advice,
DavidHi David,
Thats the problem with using PSA for flatfile hierarchy loads. If you can change the transfer method to "IDOC" then change and retry the load. The IDoc method gives you an advantrage when dealing with flatfiles as you can debug and notice which record # has errors.
Bye
Dinesh -
BAPI to upload data from a flat file to VA01
Hi guys,
I have a requirement wherein i need to upload data from a flat file to VA01.Please tell me how do i go about this.
Thanks and regards,
Frank.Hi
previously i posted code also
Include YCL_CREATE_SALES_DOCU *
Form salesdocu
This Subroutine is used to create Sales Order
-->P_HEADER Document Header Data
-->P_HEADERX Checkbox for Header Data
-->P_ITEM Item Data
-->P_ITEMX Item Data Checkboxes
-->P_LT_SCHEDULES_IN Schedule Line Data
-->P_LT_SCHEDULES_INX Checkbox Schedule Line Data
-->P_PARTNER text Document Partner
<--P_w_vbeln text Sales Document Number
DATA:
lfs_return like line of t_return.
FORM create_sales_document changing P_HEADER like fs_header
P_HEADERX like fs_headerx
Pt_ITEM like t_item[]
Pt_ITEMX like t_itemx[]
P_LT_SCHEDULES_IN like t_schedules_in[]
P_LT_SCHEDULES_INX like t_schedules_inx[]
Pt_PARTNER like t_partner[]
P_w_vbeln like w_vbeln.
This Perform is used to fill required data for Sales order creation
perform sales_fill_data changing p_header
p_headerx
pt_item
pt_itemx
p_lt_schedules_in
p_lt_schedules_inx
pt_partner.
Function Module to Create Sales and Distribution Document
perform sales_order_creation using p_header
p_headerx
pt_item
pt_itemx
p_lt_schedules_in
p_lt_schedules_inx
pt_partner.
perform return_check using p_w_vbeln .
ENDFORM. " salesdocu
Form commit_work
To execute external commit *
FORM commit_work .
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = c_x
ENDFORM. " Commit_work
Include ycl_sales_order_header " To Fill Header data and Item data
Include ycl_sales_order_header.
Form return_check
To validate the sales order creation
FORM return_check using pr_vbeln type vbeln.
if pr_vbeln is initial.
LOOP AT t_return into lfs_return .
WRITE / lfs_return-message.
clear lfs_return.
ENDLOOP. " Loop at return
else.
perform commit_work. " External Commit
Refresh t_return.
fs_disp-text = text-003.
fs_disp-number = pr_vbeln.
append fs_disp to it_disp.
if p_del eq c_x or p_torder eq c_x or
p_pgi eq c_x or p_bill eq c_x.
perform delivery_creation. " Delivery order creation
endif. " If p_del eq 'X'......
endif. " If p_w_vbeln is initial
ENDFORM. " Return_check
*& Form sales_order_creation
text
-->P_P_HEADER text
-->P_P_HEADERX text
-->P_PT_ITEM text
-->P_PT_ITEMX text
-->P_P_LT_SCHEDULES_IN text
-->P_P_LT_SCHEDULES_INX text
-->P_PT_PARTNER text
FORM sales_order_creation USING P_P_HEADER like fs_header
P_P_HEADERX like fs_headerx
P_PT_ITEM like t_item[]
P_PT_ITEMX like t_itemx[]
P_P_LT_SCHEDULES_IN like t_schedules_in[]
P_P_LT_SCHEDULES_INX like t_schedules_inx[]
P_PT_PARTNER like t_partner[].
CALL FUNCTION 'BAPI_SALESDOCU_CREATEFROMDATA1'
EXPORTING
sales_header_in = p_p_header
sales_header_inx = p_p_headerx
IMPORTING
salesdocument_ex = w_vbeln
TABLES
return = t_return
sales_items_in = p_pt_item
sales_items_inx = p_pt_itemx
sales_schedules_in = p_p_lt_schedules_in
sales_schedules_inx = p_p_lt_schedules_inx
sales_partners = p_pt_partner.
ENDFORM. " sales_order_creation
plzz reward if i am usefull plzz -
Overwrite partner address from a flat file
Hi,
I want to overwrite the partner address from a flat file while creating sales order.
I am using FM CRMXIF_ORDER SAVE .
what are values we have to pass to the deep structure partner_inputfields ?
Regards,
SivaHi Siva,
function CRMXIF_ORDER_SAVE is used for inbound information coming through the XIF, which means that an idoc or XML structure in translated in the structure that is given to the function [inbound parameter DATA with structure CRMXIF_BUSTRANS_T]. You can either try to fill up this structure as the standard integration would or you can try to create an XML from your java-application & send the information to the XIF which will then take care of the rest.
Option 1: look in transaction smw01 and find a business transaction message. You'll find a comparable structure in this bdoc that you can use as an example to fill the structure in the function.
--> this is a quick solution, but you cannot be sure that SAP will continu to use the function or that structure in future releases or SP-upgrades.
--> it will also be difficult todo errorhandling and will require more maintenance
Option 2: creating the xml (or idoc) from java will have to be done in a specific format. To pass it along to the XIF-adapter, you'll need some interaction tool like the business connector, SAP XI or a SOAP-server.
--> eventually, this will be the most stable solution I think, but it will require more work to set up.
Thanks. -
Error while uploading data from a flat file to the hierarchy
Hi guys,
after i upload data from a flat file to the hierarchy, i get a error message "Please select a valid info object" am loading data using PSA, having activated all external chars still get the problem..some help on this please..
regards
Srithere is o relation of infoobject name in flat file and infoobjet name at BW side.
please check with the object in the BW and their lengths and type of the object and check your flat file weather u have the same type there,
now check the sequence of the objects in the transfer rules and activate them.
there u go. -
What is the best way to load and convert data from a flat file?
Hi,
I want to load data from a flat file, convert dates, numbers and some fields with custom logic (e.g. 0,1 into N,Y) to the correct format.
The rows where all to_number, to_date and custom conversions succeed should go into table STG_OK. If some conversion fails (due to an illegal format in the flat file), those rows (where the conversion raises some exception) should go into table STG_ERR.
What is the best and easiest way to archive this?
Thanks,
Carsten.Hi,
thanks for your answers so far!
I gave them a thought and came up with two different alternatives:
Alternative 1
I load the data from the flat file into a staging table using sqlldr. I convert the data to the target format using sqlldr expressions.
The columns of the staging table have the target format (date, number).
The rows that cannot be loaded go into a bad file. I manually load the data from the bad file (without any conversion) into the error table.
Alternative 2
The columns of the staging table are all of type varchar2 regardless of the target format.
I define data rules for all columns that require a later conversion.
I load the data from the flat file into the staging table using external table or sqlldr without any data conversion.
The rows that cannot be loaded go automatically into the error table.
When I read the data from the staging table, I can safely convert it since it is already checked by the rules.
What I dislike in alternative 1 is that I manually have to create a second file and a second mapping (ok, I can automate this using OMB*Plus).
Further, I would prefer using expressions in the mapping for converting the data.
What I dislike in alternative 2 is that I have to create a data rule and a conversion expression and then keep the data rule and the conversion expression in sync (in case of changes of the file format).
I also would prefer to have the data in the staging table in the target format. Well, I might load it into a second staging table with columns having the target format. But that's another mapping and a lot of i/o.
As far as I know I need the data quality option for using data rules, is that true?
Is there another alternative without any of these drawbacks?
Otherwise I think I will go for alternative 1.
Thanks,
Carsten. -
Looking for a program to delete CVCs from a flat file, infocube, ztable.
I am looking for a program that will delete CVCs from a flat file, infocube, or ztable. Based on the research I have done, I would imagine the core of such a program would be the use of function module /sapapo/ts_plob_delete.
If anyone has such a program and would be willing to share it that would be great.
ShaneHi
Yes you can use this program, but I think the program /sapapo/ts_plob_delete will only delete the data from Master planning Object structure( MPOS). First you have to deactivate the planning are first than use this program which will delete everything and again activate the planning area.
If you want to delete the data flat files or infocube, you require to delete the data directly from the infocubes and add this job in the process chain to delete everything.
I hope this information help you.
Thanks
Amol -
Uploading the data from a flat file into ztable
Hi,
I have a requirement where I have to upload the data from 2 flat files into 2 z tables(ZRB_HDR,ZRB_ITM).From the 1st flat file only data for few fields have to be uploaded into ztable(ZRB_HRD) .Fromthe 2nd flat file data for all the fields have to me uploaded into ztable(ZRB_ITM). How can I do this?
Regards,
Hemahi,
declare two internal table with structur of your tables.
your flat files should be .txt files.
now make use of GUI_UPLOAD function module to upload your flatfile into internal tables.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = 'c:\file1.txt'
has_field_separator = 'X'
TABLES
data_tab = itab1
EXCEPTIONS
OTHERS = 1.
use this function twice for two tables.
then loop them individually and make use of insert command.
Maybe you are looking for
-
Server 2008 crash - black screen with mouse cursor
dell poweredge 2950 with Perc 5/I RAID, ESXi 4.1 host, Windows Server 2008 R2 SP1 VM After swapping out a failed raid5 drive this vm began displaying inpage operation error popups while checking folder permissions. event viewer errors: The file sys
-
Can't view terms & conditions in app store when trying to update apps
When trying to update my apps, I get a notification that says: iTunes Terms & Conditions Have Changed Before you can proceed you must read & accept the new Terms & Conditions I am given the options "Cancel" and "OK". Upon clicking "OK", however, the
-
Hi all, I'd like to know whether it's possible to kick off (start) multiple processes from within an OATS script, so that they run in parallel to the process that started them. I'm trying to simulate the real life scenario of a number of process str
-
Mountain Lion 10.8.2 allows for sorting of Notes by title, date created, or date edited. Does IOS 6 support sorting?
-
Error in Idoc Invoic01 ?
Hi all, I am using message type INVOIC and IDoc type INVOIC01 . Inbound process code SD08 and Outbound process code INVL. Out put type RD00 to create Logistics invoice verification when the billing document is created. It is giving error as 'A comp