H**This code is automatically generated by YASH program , please do not make any

changes**
C* Program Name: YH1634_BDC_PO
Creation: 24/01/2011*
C*
*
C* SAP Name
: YH1634_BDC_PO
Application:
*
C*
*
C* Author
: Anjan Paul
Type: 1
*
C*_____________________________________________________________________*
C* Description : This Program upload a file with VENDOR and PURCHASE *
C*
ORDER information into sap system using BDC in session*
C*
method
*
C*_____________________________________________________________________*
C* Inputs:
*
C* Tables:
*
C*
N/A
*
C* Select options:
*
C*
N/A
*
C* Parameters:
*
C*
N/A
*
C* Outputs: Transfer data into sap tables through transaction 'XK01' *
C*
and 'ME21'
C*
C*_____________________________________________________________________*
C* External Routines
*
C* Function Modules:
*
C*
*
C* Transactions
:
*
C* Programs
:
*
C*_____________________________________________________________________*
C* Return Codes: No
*
C*_____________________________________________________________________*
C* Ammendments:
*
C*
Programmer
Date
Req. #
Action
*
C* ================ ========== ====== ==============================*
C*
*
C***********************************************************************
CREPORT yh1634_bdc_po.
C*"Selection screen elements............................................
CPARAMETERS:
C p_file TYPE dynpread-fieldname,
" File Path
C p_ven RADIOBUTTON GROUP rg1 ,
" Vendor
C p_po RADIOBUTTON GROUP rg1.
" PO
C
C
C*"--------------------------------------------------------------------*
C* Internal table declaration to hold bdc data
*
C*"--------------------------------------------------------------------*
CDATA:
C t_bdcdata TYPE TABLE OF bdcdata.
C
C
C*"--------------------------------------------------------------------*
C* Data declaration of the structure to hold bdc header data
*
C*"--------------------------------------------------------------------*
CDATA:
C fs_bdcdata TYPE bdcdata.
C
C*---------------------------------------------------------------------*
C* Data structure declaration for vendor master
*
C*---------------------------------------------------------------------*

CDATA:
C BEGIN OF fs_lifnr,
C
lifnr TYPE lfa1-lifnr,
" Vendor no
C END OF fs_lifnr.
C
C*---------------------------------------------------------------------*
C* Internal table declaration for vendor master
*
C*---------------------------------------------------------------------*
CDATA:
C t_lifnr LIKE TABLE OF fs_lifnr.
C
C
C*---------------------------------------------------------------------*
C* Data structure declaration for vendor master with po
*
C*---------------------------------------------------------------------*
CDATA:
C BEGIN OF fs_lfm1,
C
lifnr TYPE lfm1-lifnr,
" Vendor no
C
ekorg TYPE lfm1-ekorg,
" Purchase Organisation
C
ekgrp TYPE lfm1-ekgrp,
" Purchase group
C END OF fs_lfm1.
C
C*---------------------------------------------------------------------*
C* Intenal tablew declaration for vendor master with po
*
C*---------------------------------------------------------------------*
CDATA:
C t_lfm1 LIKE TABLE OF fs_lfm1.
C
C
C*"--------------------------------------------------------------------*
C* Data declaration of the structure to hold uploding data
*
C*"--------------------------------------------------------------------*
CDATA:
C BEGIN OF fs_fielddata,
C
flag,
" Identification
C
bukrs(4) ,
" Company code
C
ekorg(4),
" Pur Org
C
ktokk(4),
" Acc Grp
C
anred(15),
" Title
C
name1(35),
" Name
C
sortl(10),
" Search item
C
pfort(35),
" Postal code
C
land1(3),
" Country
C
regio(3),
" Region
C
C
C
akont(10) ,
" Reconciliation no
C
fdgrv(10),
" Cash management
C
waers(5),
" Curr
C
bsart(4),
" Document Type
C
ekgrp(3),
" Purchasing Group
C
bedat(10),
" PO date
C
C
ematn(18),
" Material no
C
txz01(40),
" Material text
C
netpr(11),
" Price
C
menge(13),
" Qty
C
werks(4),
" Plant
C
lifnr(10),
CEND OF fs_fielddata.

C
C*"--------------------------------------------------------------------*
C* Internal table to hold uploading data
*
C*"--------------------------------------------------------------------*
CDATA:
C t_fielddata
LIKE TABLE OF fs_fielddata,
C t_fielddata1
LIKE TABLE OF fs_fielddata,
C t_fielddata_ven LIKE TABLE OF fs_fielddata,
C t_fielddata_po
LIKE TABLE OF fs_fielddata.
C
C*"--------------------------------------------------------------------*
C* Work Variable
*
C*"--------------------------------------------------------------------*
CDATA:
C w_er
TYPE i,
" No of Line
C w_file1 TYPE string,
" File pat
C w_file TYPE ibipparms-path,
" File path
C w_ekorg TYPE lfm1-ekorg,
" po
C w_ktokk TYPE lfa1-ktokk,
" Account group
C w_burks TYPE lfb1-bukrs,
" Company code
C w_name1 TYPE lfa1-name1.
" Name
C
C*w
C*"--------------------------------------------------------------------*
C*
AT SELECTION-SCREEN ON VALUE-REQUEST
*
C*"--------------------------------------------------------------------*
CAT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
C PERFORM get_filepath.
C
C*"--------------------------------------------------------------------*
C*
AT SELECTION-SCREEN
*
C*"--------------------------------------------------------------------*
CAT SELECTION-SCREEN.
C PERFORM get_file_inf.
C
C
C*"--------------------------------------------------------------------*
C*
START-OF-SELECTION
*
C*"--------------------------------------------------------------------*
CSTART-OF-SELECTION.
C* WRITE: w1w.
C
C* Prepare vendor and po table
C LOOP AT t_fielddata INTO fs_fielddata.
C
IF fs_fielddata-flag = 'v'.
C
IF p_ven IS NOT INITIAL.
C
APPEND fs_fielddata TO t_fielddata_ven.
C
ENDIF.
" IF p_ven IS NOT INITIAL
C
w_ekorg = fs_fielddata-ekorg .
C
w_ktokk = fs_fielddata-ktokk .
C
w_burks = fs_fielddata-bukrs .
C
w_name1 = fs_fielddata-name1 .
C
ELSE.
C
IF fs_fielddata-flag = 'h'.
C
fs_fielddata-ekorg = w_ekorg .
C
fs_fielddata-ktokk = w_ktokk .
C
fs_fielddata-bukrs = w_burks.
C
fs_fielddata-name1 = w_name1.
C
ENDIF.
" IF fs_fielddata-flag = 'h'
C
IF p_ven IS INITIAL.

C
APPEND fs_fielddata TO t_fielddata_po.
C
ENDIF.
" IF p_ven IS INITIAL
C
ENDIF.
" IF fs_fielddata-flag = 'v'
C ENDLOOP.
" LOOP AT t_fielddata ...
C
C REFRESH t_fielddata.
C
C SORT t_fielddata_ven.
C
C DELETE ADJACENT DUPLICATES FROM t_fielddata_ven
C
COMPARING ktokk ekorg name1.
C
C IF p_ven IS NOT INITIAL.
C
" Upload Vendor
C
PERFORM create_vendor.
C ELSE.
C
" Upload PO
C
PERFORM create_po.
C ENDIF.
" IF p_ven IS NOT INITIAL
C
C
C
C
C
C*&-------------------------------------------------------------------*
C*&
Form OPEN_GROUP
C*&-------------------------------------------------------------------*
C*
This subroutine is for opening the session
C*--------------------------------------------------------------------*
C
CFORM open_group USING lw_grww TYPE apqi-groupid.
C
C CALL FUNCTION 'BDC_OPEN_GROUP'
C
EXPORTING
C
group
= lw_grww
C
keep
= 'X'
C
user
= sy-uname
C
EXCEPTIONS
C
client_invalid
= 1
C
destination_invalid = 2
C
group_invalid
= 3
C
group_is_locked
= 4
C
holddate_invalid
= 5
C
internal_error
= 6
C
queue_error
= 7
C
running
= 8
C
system_lock_error = 9
C
user_invalid
= 10
C
OTHERS
= 11.
C IF sy-subrc <> 0.
C
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
C
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
C
C ELSE.
C
FORMAT COLOR 1.
C
WRITE:/ 'New Session' , lw_grww , 'open' .
C ENDIF.
" If sy-subrc ...
C
CENDFORM.
" OPEN_GROUP
C

C
C*&-------------------------------------------------------------------*
C*&
Form FILL
C*&-------------------------------------------------------------------*
C*
This subroutine is for inserting data into t_bdcdata
C*--------------------------------------------------------------------*
CFORM fill USING
value(p_0248)
C
value(p_0249)
C
value(p_0250)
C
value(p_0251)
C
value(p_0252) .
C
C CLEAR fs_bdcdata.
C
C
C IF p_0250 EQ 'X'.
C
fs_bdcdata-program = p_0248.
C
fs_bdcdata-dynpro = p_0249.
C
fs_bdcdata-dynbegin = p_0250.
C
APPEND fs_bdcdata TO t_bdcdata.
C ELSE.
C
CLEAR fs_bdcdata.
C
fs_bdcdata-fnam = p_0251.
C
fs_bdcdata-fval = p_0252.
C
CONDENSE fs_bdcdata-fval NO-GAPS.
C
APPEND fs_bdcdata TO t_bdcdata.
C ENDIF.
" IF p_0250 ...
C
CENDFORM.
" FILL
C*&-------------------------------------------------------------------*
C*&
Form INSERT
C*&-------------------------------------------------------------------*
C*
This subroutine is for inserting t_bdcdata into session
C*--------------------------------------------------------------------*
C
CFORM insert USING lw_tcode TYPE tstc-tcode.
C
C DATA: lw_er TYPE i.
C DESCRIBE TABLE t_bdcdata LINES lw_er.
C
C IF lw_er > 0.
C
CALL FUNCTION 'BDC_INSERT'
C
EXPORTING
C
tcode
= lw_tcode
C*
CTUPARAMS
= ' '
C
TABLES
C
dynprotab
= t_bdcdata
C
EXCEPTIONS
C
internal_error
= 1
C
not_open
= 2
C
queue_error
= 3
C
tcode_invalid
= 4
C
printing_invalid
= 5
C
posting_invalid
= 6
C
OTHERS
= 7
C
.
C
IF sy-subrc <> 0.
C
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
C
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
C

C
ENDIF.
" IF sy-subrc <> ...
C
C ENDIF.
" IF lw_er > 0
CENDFORM.
" INSERT
C
C*&-------------------------------------------------------------------*
C*&
Form CLOSE
C*&-------------------------------------------------------------------*
C*
This subroutine is for closing bdc group
C*--------------------------------------------------------------------*
CFORM close .
C CALL FUNCTION 'BDC_CLOSE_GROUP'
C
EXCEPTIONS
C
not_open
= 1
C
queue_error = 2
C
OTHERS
= 3.
C
C IF sy-subrc <> 0.
C
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
C
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
C ENDIF.
" IF sy-subrc <> 0
C*
CENDFORM.
" CLOSE
C
C
C
C*&-------------------------------------------------------------------*
C*&
Form GET_FILEPATH
C*&-------------------------------------------------------------------*
C*
This subroutine get filepathw
C*--------------------------------------------------------------------*
CFORM get_filepath .
C
C CALL FUNCTION 'F4_FILENAME'
C
EXPORTING
C
field_name = p_file
C
IMPORTING
C
file_name = w_file.
C
C p_file = w_file.
C MOVE w_file TO w_file1.
CENDFORM.
" GET_FILEPATH
C*&-------------------------------------------------------------------*
C*&
Form GET_FILE_INF
C*&-------------------------------------------------------------------*
C*
This subroutine is for uploading flat file to internal table
C*--------------------------------------------------------------------*
CFORM get_file_inf .
C
C CALL FUNCTION 'GUI_UPLOAD'
C
EXPORTING
C
filename = w_file1
C
filetype
= 'ASC'
C
has_field_separator
= 'X'
C* HEADER_LENGTH
= 0
C
C
TABLES
C
data_tab
= t_fielddata
C EXCEPTIONS
C
file_open_error
= 1

C
file_read_error
= 2
C
no_batch
= 3
C
gui_refuse_filetransfer
= 4
C
invalid_type
= 5
C
no_authority
= 6
C
unknown_error
= 7
C
bad_data_format
= 8
C
header_not_allowed
= 9
C
separator_not_allowed
= 10
C
header_too_long
= 11
C
unknown_dp_error
= 12
C
access_denied
= 13
C
dp_out_of_memory
= 14
C
disk_full
= 15
C
dp_timeout
= 16
C
OTHERS
= 17
C
.
C IF sy-subrc <> 0.
C
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
C
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
C ENDIF.
C
CENDFORM.
" GET_FILE_INF
C
C
C
C*&--------------------------------------------------------------------*
C*&
Form get_vendor
C*&--------------------------------------------------------------------*
C*
This form get the vendor no
C*---------------------------------------------------------------------*
CFORM get_vendor USING lw_venname TYPE lfa1-name1
C
lw_ekgrp TYPE lfm1-ekgrp
C
lw_vno
TYPE lfa1-lifnr
C
lw_ekorg TYPE lfm1-ekorg
C
lw_ktokk TYPE lfa1-ktokk.
C
C SELECT lifnr
C
FROM lfa1
C
INTO TABLE t_lifnr
C WHERE name1 = lw_venname
C
AND ktokk = lw_ktokk.
C
C IF sy-subrc = 0.
C*loop at t_lifnr into fs_lifnr.
C
SELECT lifnr
C
ekorg
C
ekgrp
C
FROM lfm1
C
INTO TABLE t_lfm1
C
FOR ALL ENTRIES IN t_lifnr
C
WHERE lifnr = t_lifnr-lifnr
C
AND ekorg = lw_ekorg.
C
C
IF sy-subrc EQ 0.
C
READ TABLE t_lfm1 INTO fs_lfm1 INDEX 1.
C
lw_vno = fs_lfm1-lifnr.
C
EXIT.
C
ENDIF.
C ENDIF.

C
C REFRESH: t_lfm1, t_lifnr.
C CLEAR: fs_lfm1, fs_lifnr.
CENDFORM.
"get_vendor
C
C*&--------------------------------------------------------------------*
C*&
Form create_vendor
C*&--------------------------------------------------------------------*
C*
This form is for creating vendor data to BDC
C*---------------------------------------------------------------------*
CFORM create_vendor.
C
C PERFORM open_group USING 'YH134_VEN'.
C
C* Insert Vendor one by one
C DESCRIBE TABLE t_fielddata_ven LINES w_er.
C IF w_er EQ 0.
C
EXIT.
C ENDIF.
" If w_er ...
C
C REFRESH: t_bdcdata.
C CLEAR fs_bdcdata.
C
C PERFORM populate_vendor.
C
C PERFORM close.
C
CENDFORM.
"create_vendor
C
C*&--------------------------------------------------------------------*
C*&
Form create_po
C*&--------------------------------------------------------------------*
C*
This form is for creating po
C*---------------------------------------------------------------------*
CFORM create_po.
C
C
C PERFORM open_group USING 'YH1634_PO'.
C
C* Insert purchase requsition one by one
C DO.
C
DESCRIBE TABLE t_fielddata_po LINES w_er.
C
IF w_er EQ 0.
C
EXIT.
C
ENDIF.
" If w_er ...
C
C
REFRESH: t_bdcdata.
C
CLEAR fs_bdcdata.
C
C
C
PERFORM populate_po.
C
PERFORM insert USING 'ME21'.
C
C ENDDO.
" Do
C
C PERFORM close.
C
CENDFORM.
" create_po
C
C

C
C*&--------------------------------------------------------------------*
C*&
Form populate_vendor
C*&--------------------------------------------------------------------*
C*
This form is for populating vendor
C*---------------------------------------------------------------------*
CFORM populate_vendor.
C
C DO.
C
READ TABLE t_fielddata_ven INTO fs_fielddata INDEX 1.
C
C* If no records exit
C
IF sy-subrc NE 0.
C
EXIT.
C
ENDIF.
C
C
C
PERFORM get_vendor USING fs_fielddata-name1
C
fs_fielddata-ekgrp
C
fs_fielddata-lifnr
C
fs_fielddata-ekorg
C
fs_fielddata-ktokk .
C
C*
If vendor is not exist
C
IF fs_fielddata-lifnr IS INITIAL.
C
C*
If line is vendorw
C
PERFORM:
C
fill USING 'SAPMF02K' '0100' 'X' '' '',
C
fill USING '' '' '' 'RF02K-BUKRS' fs_fielddata-bukrs,
C
fill USING '' '' '' 'RF02K-EKORG' fs_fielddata-ekorg,
C
fill USING '' '' '' 'RF02K-KTOKK' fs_fielddata-ktokk,
C
fill USING '' '' '' 'BDC_OKCODE' '/00',
C
C
fill USING 'SAPMF02K' '0110' 'X' '' '',
C
fill USING '' '' '' 'LFA1-ANRED' fs_fielddata-anred,
C
fill USING '' '' '' 'LFA1-NAME1' fs_fielddata-name1,
C
fill USING '' '' '' 'LFA1-SORTL' fs_fielddata-sortl,
C
fill USING '' '' '' 'LFA1-PFORT' fs_fielddata-pfort,
C
fill USING '' '' '' 'LFA1-LAND1' fs_fielddata-land1,
C
fill USING '' '' '' 'LFA1-REGIO' fs_fielddata-regio,
C
fill USING '' '' '' 'BDC_OKCODE' '/00',
C
C
fill USING 'SAPMF02K' '0120' 'X' '' '',
C
fill USING '' '' '' 'BDC_OKCODE' '/00',
C
C
C
fill USING 'SAPMF02K' '0130' 'X' '' '',
C
fill USING '' '' '' 'BDC_OKCODE' '=ENTR',
C
C
fill USING 'SAPMF02K' '0380' 'X' '' '',
C
fill USING '' '' '' 'BDC_OKCODE' '=ENTR',
C
C
C
fill USING 'SAPMF02K' '0210' 'X' '' '',
C
fill USING '' '' '' 'LFB1-AKONT' fs_fielddata-akont,
C
fill USING '' '' '' 'LFB1-FDGRV' fs_fielddata-fdgrv,
C
fill USING '' '' '' 'BDC_OKCODE' '/00',
C
C

C
fill USING 'SAPMF02K' '0215' 'X' '' '',
C
fill USING '' '' '' 'BDC_OKCODE' '/00',
C
C
C
fill USING 'SAPMF02K' '0220' 'X' '' '',
C*
fill USING '' '' '' 'KNVK-NAMEV(01)' fs_fielddata-namev,
C*
fill USING '' '' '' 'KNVK-NAME1(01)' fs_fielddata-name1,
C
fill USING '' '' '' 'BDC_OKCODE' '/00',
C
C
fill USING 'SAPMF02K' '0310' 'X' '' '',
C
fill USING '' '' '' 'LFM1-WAERS' fs_fielddata-waers,
C
fill USING '' '' '' 'BDC_OKCODE' '/00',
C
C
fill USING 'SAPMF02K' '0320' 'X' '' '',
C
fill USING '' '' '' 'BDC_OKCODE' '=ENTR'.
C
C
ENDIF.
" IF fs_fielddata-lifnr IS ...
C
C
DELETE t_fielddata_ven INDEX 1.
C
C
PERFORM insert USING 'XK01'.
C
REFRESH t_bdcdata.
C
C ENDDO.
C
CENDFORM.
"populate_vendor
C
C
C
C*w&-------------------------------------------------------------------*
C*&
Form POPULATE
C*&--------------------------------------------------------------------*
C*
This subroutine is for populating t_bdcdata
C*---------------------------------------------------------------------*
C
CFORM populate_po .
C DATA:
C
lw_n(4) TYPE n,
" Item line no
C
lw_v1(20) TYPE c,
" Var for Matnr
C
lw_v2(20) TYPE c,
" Var for Menge
C
lw_v3(20) TYPE c,
" Var for werks
C
lw_v4(20) TYPE c,
" Var for werks
C
lw_v6(20) TYPE c,
" Var for werks
C
lw_in
TYPE i,
" Header line check
C
lw_vt
TYPE i,
" No of item line
C
lw_strn(300).
" Stringw
C*
w_countw TYPE i.
C
C DO.
C
CLEAR fs_fielddata-lifnr .
C
C
READ TABLE t_fielddata_po INTO fs_fielddata INDEX 1.
C* If no records exit
C
IF sy-subrc NE 0.
C
EXIT.
C
ENDIF.
C
C
C* If second header line come exit
C
IF fs_fielddata-flag = 'h' AND lw_in EQ 1 .

C
C
C
C
C*
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C*
C
C
C
C
C
C*
C
C
C
C*
C
C
C
C
C
C
C

lw_in = 0.
EXIT.
ENDIF.

" IF fs_fielddata-fl...

If 1st header line come fill 1st screen
IF fs_fielddata-flag = 'h' AND lw_in NE 1.
lw_in = 1.
PERFORM get_vendor USING fs_fielddata-name1
fs_fielddata-ekgrp
fs_fielddata-lifnr
fs_fielddata-ekorg
fs_fielddata-ktokk .
PERFORM:
fill USING
fill USING
fill USING
fill USING
fill USING
fill USING
fill USING

'SAPMM06E' '0100' 'X' '' '',
'' '' '' 'EKKO-LIFNR' fs_fielddata-lifnr,
'' '' '' 'EKKO-EKORG' fs_fielddata-ekorg,
'' '' '' 'RM06E-BSART' fs_fielddata-bsart,
'' '' '' 'RM06E-BEDAT' fs_fielddata-bedat,
'' '' '' 'EKKO-EKGRP' fs_fielddata-ekgrp,
'' '' '' 'BDC_OKCODE' '/00'.

IF fs_fielddata-lifnr IS INITIAL.
FORMAT COLOR 2.
CONCATENATE 'The vendor for'
fs_fielddata-name1
'is not created' 'for'
'account group'
fs_fielddata-ktokk
'Purchase org'
fs_fielddata-ekorg
INTO lw_strn
SEPARATED BY space.
WRITE:/ lw_strn .
FORMAT COLOR OFF.
ENDIF.

" IF fs_fielddata-lifnr...

Delete header line
DELETE t_fielddata_po INDEX 1.
ENDIF.

" IF fs_fielddata-flag ...

If item come fill it to t_fieldata1
IF fs_fielddata-flag = 'i'.
APPEND fs_fielddata TO t_fielddata1.
Delete item line
DELETE t_fielddata_po INDEX 1.
ENDIF.
ENDDO.

" IF fs_fielddata-flag = 'i'

DESCRIBE TABLE t_fielddata1 LINES lw_vt.

C PERFORM: fill USING 'SAPMM06E' '0120' 'X' '' ''.
C
C* loop for no of item line and insert item in second screen
C DO lw_vt TIMES.
C
READ TABLE t_fielddata1 INTO fs_fielddata INDEX sy-index.
C
lw_n = sy-index.
C
CONCATENATE 'EKPO-EMATN' '(' lw_n ')' INTO lw_v1.
C
CONCATENATE 'EKPO-TXZ01' '(' lw_n ')' INTO lw_v2.
C
CONCATENATE 'EKPO-MENGE' '(' lw_n ')' INTO lw_v3.
C
CONCATENATE 'EKPO-NETPR' '(' lw_n ')' INTO lw_v4.
C
CONCATENATE 'EKPO-WERKS' '(' lw_n ')' INTO lw_v6.
C
C
PERFORM: fill USING '' '' '' lw_v1 fs_fielddata-ematn,
C
fill USING '' '' '' lw_v2 fs_fielddata-txz01,
C
fill USING '' '' '' lw_v3 fs_fielddata-menge,
C
fill USING '' '' '' lw_v4 fs_fielddata-netpr,
C
fill USING '' '' '' lw_v6 fs_fielddata-werks.
C
C ENDDO.
" Do w_vt times
C
C PERFORM: fill USING '' '' '' 'BDC_OKCODE' '=BU'.
C REFRESH t_fielddata1.
C
CENDFORM.
" POPULATE
ATEXTPrograme for uploading vendor and po
ASUBC1
ARSTAT
ASECU
ADEVCLASSYH1634
ALDBNAME
ATYPE
AEDTX
AFIXPTX
AUCCHECKX
ASSET
DPGMIDR3TR
DOBJECTPROG
DLINE;U1;&PURPOSE&
DLINE;AS;To upload data from flat file to Sap for Vendor and Purchase Order.
DLINE;U1;&INTEGRATION&
DLINE;AS;
DLINE;U1;&PREREQUISITES&
DLINE;AS;1. The flat file must be tab delimited text file.
DLINE;AS;2. The Account group must be 'ZARG'.
DLINE;AS;3. You must run 'Upload Vendor' at first, then a session is created nam
e
DLINE;;'YH1634_VEN'. Then run the session from transaction SM35 to upload
DLINE;;vendor data .
DLINE;AS;Then you execute 'Upload PO'. Then a session is created name
DLINE;;'YH1634_PO'. Run the session from transaction SM35 to upload PO data.
DLINE;AS;4. The file must not contain any header information, only data are
DLINE;;requirew.
DLINE;AS;5. The reconciliation account must be 160000.
DLINE;AS;6. The material no must be in plant its mention.
DLINE;AS;7. This program consider the names of the vendor of a same purchase
DLINE;;organization as a same person. So it is created only once.
DLINE;U1;&FEATURES&
DLINE;AS;This program automatically divide the vendor and its PO into separate
DLINE;;table. You have to use same file for uploading Vendor and PO.
DLINE;AS; To uploading vendor this program first search for vendor is exists in

DLINE;;the same purchase organization or not. If not then create new vendor.
DLINE;AS; To uploading PO this program automatically created under the vendor it
DLINE;;is given in the file.
DLINE;U2;&SELECTION&
DLINE;AS;File (Tab Delimited text)
DLINE;AS;Upload Vendor
DLINE;AS;Upload PO
DLINE;AS;
DLINE;AS;
DLINE;AS;
DLINE;U2;&STANDARD_VARIANTS&
DLINE;AS;
DLINE;U2;&OUTPUT&
DLINE;AS;
DLINE;U1;&ACTIVITIES&
DLINE;AS;Create session .
DLINE;U1;&EXAMPLE&
DLINE;AS;The flat file must have following filed in following order DLINE;AS;Type |,,company code | Pur Org | Account Group | Title | Vendor name |
DLINE;;Search name | Postal code | Country | Region | Reconcilication no|
DLINE;; Account Management|,,Currency | Document Type | Account Group | PO date
DLINE;;| Material no | Description | Net Price | Quantity | Plant
DLINE;AS;
DLINE;AS;Field Value example:
DLINE;AS;v | 1000 | 1000 | ZARG | Mr | YH1634_1 | YH1634_1 | 900000 | IN | 1 |
DLINE;;160000 | A1 |EUR | ,,,,,,,,,,
DLINE;AS;h|,,|,,|,,|,,|,,|,,|,,|,,|,,|,,|,,|,,|,,| NB | 100 | 24.01.2011|,,,,,,,
,
DLINE;AS;i |,,|,,|,,|,,|,,|,,|,,|,,|,,|,,|,,|,,|,,|,,|,,|,,| 100-251| oil | 10.9
DLINE;;| 2 | 1000
DLINE;AS;i |,,|,,|,,|,,|,,|,,|,,|,,|,,|,,|,,|,,|,,|,,|,,|,,| 100-251| oil | 10.9
DLINE;;| 2 | 1000
DLINE;AS;
DLINE;AS;
DHEAD;DOKU;YH1634_BDC_PO;RE;E;;S_DOCU_SHOW;S_DOCUS1;00012;YH1634;701;20110125;16
0145;YH1634;701;20110125;172133;072;00000;;;0;;;;;;;;;;
DDOKSTATE
DTYPE
DDOKVERSION0012
T*%E*%R*%*%Programe for uploading vendor and po*%
36
T*%E*%S*%P_FILE*%
Enter File*%
18
T*%E*%S*%P_PO*%
Upload PO*%
17
T*%E*%S*%P_VEN*%
Upload Vendor*%
22
PTRK;YH1634;PROG;YH1634_BDC_PO

Sign up to vote on this title
UsefulNot useful