2007 Apr 10 2:52 PM
I have a text file. I need to extract the contents from the file and based on the action code make changes to the sales order.
The following is the structure of the file . How do I upload the data, extract and assign the fields and make changes to the sales order (delivery block)
DATA: BEGIN OF credit_detail,
formattype(2) TYPE c,
groupclientnumber(4) TYPE n,
clientnumber(4) TYPE n,
juliandate(3) TYPE c,
hrextraction(2) TYPE c,
recordtype(2) TYPE c,
citcustnum(7) TYPE n,
clientcustnum(15) TYPE c,
custnum(30) TYPE c,
clientordernum(22) TYPE c,
citrefnum(10) TYPE c,
orderamt(8) TYPE n,
appamt(8) TYPE n,
actioncode(2) TYPE c,
reasoncode1(2) TYPE c,
reasoncode2(2) TYPE c,
reasoncode3(2) TYPE c,
reasoncode4(2) TYPE c,
reasoncode5(2) TYPE c,
orderdate(6) TYPE c,
startshipdate(6) TYPE c,
endshipdate(6) TYPE c,
terms(3) TYPE n,
lineamt(9) TYPE n,
linetype TYPE n,
appnum(3) TYPE n,
futureuse(62) TYPE c,
END OF credit_detail.
DATA: BEGIN OF credit_total,
formattype(2) TYPE c,
groupclientnumber(4) TYPE n,
clientnumber(4) TYPE n,
juliandate(3) TYPE c,
hrextraction(2) TYPE c,
recordtype(2) TYPE n,
filler(7) TYPE n,
recordcnt(5) TYPE n,
totalamt(9) TYPE n,
futureuse(187) TYPE c,
END OF credit_total.
2007 Apr 10 3:01 PM
Hi,
You can use OPEN DATASET statement (file is stored in application server) or FM GUI_UPLOAD (file is stored in PC) to read the file and store the information data into an internal table(s).
Next step is to process the data in internal table(s) and prepare the input parameters for calling BAPI BAPI_SALESDOCUMENT_CHANGE to update sales order's delivery block.
The ORDER_HEADER_IN and ORDER_HEADER_INX parameters have the field for delivery block.
In the ORDER_HEADER_INX has the field UPDATEFLAG as 'U' for updating the sales order.
Hope this will help and give an idea.
Regards,
Ferry Lianto
2007 Apr 10 2:58 PM
data : it_creditdetail like table of credit_detaol,
it_credittotal like table of credit_total.
data :v_filename type string.
v_filename = 'C:\TEST.txt'. (ur file name.)
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = V_FILENAME
HAS_FIELD_SEPARATOR = '#'
tables
data_tab = IT_creditdetail.
Now all the details will be available in the internal table similarly do it for total table & write ur logic.
2007 Apr 10 3:00 PM
hi
There are different methods avaiable.
1) DIRECT INPUT
using a progrom to upload data. standard programs available for different transactions.
2) RECORDING (BATCH INPUT)
You will record your sequence of screen through recording and then use this recording to upload data using batch input sessions.
Transaction : SM35.
3) CALL Transaction.
you will the data into BDCDATA table and then call the corresponding transaction.
check this link for details.
http://www.sapbrain.com/TUTORIALS/TECHNICAL/BDC_tutorial.html
or
<b>If you want to upload the data to an internal table then you can use the FM 'GUI_UPLOAD'</b>
once u get the data in internal table u can assign the fields and make changes.
regards
ravish
<b>plz reward if helpful</b>
2007 Apr 10 3:01 PM
Hi,
You can use OPEN DATASET statement (file is stored in application server) or FM GUI_UPLOAD (file is stored in PC) to read the file and store the information data into an internal table(s).
Next step is to process the data in internal table(s) and prepare the input parameters for calling BAPI BAPI_SALESDOCUMENT_CHANGE to update sales order's delivery block.
The ORDER_HEADER_IN and ORDER_HEADER_INX parameters have the field for delivery block.
In the ORDER_HEADER_INX has the field UPDATEFLAG as 'U' for updating the sales order.
Hope this will help and give an idea.
Regards,
Ferry Lianto