BDC Uploading from flat file to VA01.
i have a flat file, where i have to upload data into VA01, but it should suppose to multiple materials under same customer and it should not get saved until end user decide whether data is ok or not. my problem is, how to make multiple entries of diff materials in VA01 for single customer. Please give me any solution, and if possible provide me any examples. thank you.
Hi Kalyan,
Here is the sample code for you ....... but i tis better you use the BAPI
<b>BAPI_SALESORDER_CREATEFROMDAT1 or BAPI_SALESORDER_CREATEFROMDAT2</b>
REPORT ZSD00001 MESSAGE-ID ZZ.
TABLES: VBAK, VBAP.
TABLES: ZSOM1, ZSOM2.
SELECTION-SCREEN: BEGIN OF BLOCK FORT WITH FRAME TITLE TEXT-002.
PARAMETERS: P_FILE RADIOBUTTON GROUP B2 DEFAULT 'X',
P_TABLE RADIOBUTTON GROUP B2,
P_REPORT RADIOBUTTON GROUP B2.
SELECTION-SCREEN SKIP 1.
PARAMETER: VIEW RADIOBUTTON GROUP VIEW,
ERRORS RADIOBUTTON GROUP VIEW,
NO_DIS RADIOBUTTON GROUP VIEW DEFAULT 'X'.
SELECTION-SCREEN: END OF BLOCK FORT.
SELECTION-SCREEN: BEGIN OF BLOCK FILE WITH FRAME TITLE TEXT-001.
PARAMETERS:
IDLEX RADIOBUTTON GROUP B1 DEFAULT 'X',
DBLEX RADIOBUTTON GROUP B1,
BDC_NAME(12) TYPE C DEFAULT 'idllapso',
IDLH(99) TYPE C DEFAULT
'/usr/sap/D01/DVEBMGS00/ISAP/interfaces/laptop/in/idlordht.txt',
IDLI(99) TYPE C DEFAULT
'/usr/sap/D01/DVEBMGS00/ISAP/interfaces/laptop/in/idlordit.txt',
ARC_FIL DEFAULT ' ' AS CHECKBOX.
SELECTION-SCREEN: END OF BLOCK FILE.
SELECTION-SCREEN: BEGIN OF BLOCK TAB WITH FRAME TITLE TEXT-003.
SELECT-OPTIONS: O_IHREZ FOR ZSOM1-IHREZ,
O_VBELN FOR ZSOM1-IHREZ,
O_MESS FOR ZSOM1-MESS DEFAULT 'W'.
SELECTION-SCREEN: END OF BLOCK TAB.
DATA:
* Data counters.
RECS_IN(4) TYPE N VALUE 0,
BDC_RECS_OUT(4) TYPE N VALUE 0,
BDC_RECS_ERR(4) TYPE N VALUE 0,
DATA_IN_RECS(4) TYPE N VALUE 0,
* Data constants
TRUE(1) TYPE C VALUE 'X',
FALSE(1) TYPE C VALUE ' ',
* Data variables
ABAPNAME LIKE SY-REPID,
ABAPTITLE LIKE SY-TITLE,
SAVE_UCOMM LIKE SY-UCOMM,
V_IHREZ LIKE VBAK-IHREZ.
* inbound header structure
DATA: BEGIN OF IDLORDH OCCURS 1000,
SO-NUMBER(5) TYPE N, "The order number given by the Vax - Alwa
ORDER-TYPE(1) TYPE N, "1 - Under-Bond Sale 3 - Duty-Paid Order
CUST-NO(7) TYPE N, "Id for customer
BRANCH-NO(4) TYPE N, "Id of customer's branch
PC-DATE-REQD(8) TYPE C, "Date that customer required the order
IDL-ORDER-NO(5) TYPE N, "Laptop's Order Number
SPEC-INS-1(40) TYPE C, "Text detailing special instruction for t
SPEC-INS-2(40) TYPE C, "Part 2 of above
PC-ORDER-DATE(8) TYPE C, "Date order was entered on the Laptop
ORDER-METHOD(1) TYPE N, "Always 5 for laptop
FOR-COLLECTION(1) TYPE C, "Y if customers is collecting order else
CASH-RECEIVED(9) TYPE N, "N/A
CASH-SHEET-NO(6) TYPE N, "N/A
CUST-ORDER-NO(14) TYPE C, "Customers Order Number - Optional
HOLD-FOR-PRICING(1) TYPE C, "Y if this order is held because no price
PC-PRICE-EFF-DATE(8) TYPE C, "Defaults to order date
NO-ITEMS(4) TYPE N, "Number of items for this order in detail
TOTAL-QTY-ORDERED(9) TYPE N, "Number of cases on this order
TOTAL-CE-ORDERED(9) TYPE N, "Number of case equivalents on this order
ORDER-STATUS(1) TYPE N, "Always 0 for new orders
SITE-PREFIX(1) TYPE C, "Plant from where the delivery will be ma
PC-USER-NO(3) TYPE N. "laptop user who crested order
DATA: END OF IDLORDH.
DATA: BEGIN OF IDLORDI OCCURS 1000,
SO-NUMBER(5) TYPE N, "The order number given by the Vax - Alway
ORDER-ENTRY-CODE(5) TYPE N, "Part Id
PC-DATE-REQD(8) TYPE C, "Date the customer required order.
QTY-TO-ORDER(4) TYPE N, "Number of units on the order.
PC-USER-NO(3) TYPE N, "Id of rep. Who created the order
IDL-ORDER-NO(5) TYPE N, "Laptop's Order Number
FREE-QTY-ORDERED(4) TYPE N, "Number of free units on the order.
PROMOTION-NO(4) TYPE N. "If Free units on the order, this is promo
DATA: END OF IDLORDI.
* Internal table to hold the mapped data.
DATA: BEGIN OF DATA_IN OCCURS 1000,
RTYPE(1) TYPE C,
* header
AUART LIKE VBAK-AUART, "order type
VKORG LIKE VBAK-VKORG, "sales org
VTWEG LIKE VBAK-VTWEG, "dist.channel
SPART LIKE VBAK-SPART, "division
KUNNR LIKE KUAGV-KUNNR, "customer num
* vkbur like vbak-vkbur, "sales off
* vkgrp like vbak-vkgrp, "sales grp
BSTNK LIKE VBAK-BSTNK, "po num
IHREZ LIKE VBAK-IHREZ, "po reference
BSTDK LIKE VBAK-BSTDK, "po date
KPRGBZ LIKE RV45A-KPRGBZ, "date type
* ketdat like rv45a-ketdat, "req delivery date
KETDAT(8) TYPE C , "req delivery date
PRSDT LIKE VBKD-PRSDT, "pricing date
LIFSK LIKE VBAK-LIFSK, "delivery block
INCO1 LIKE VBKD-INCO1, "inco terms
INCO2 LIKE VBKD-INCO2, "inco descript.
FAKSK LIKE VBAK-FAKSK, "biling block
KUNDE LIKE RV02P-KUNDE, "shipto
ltext1(256) type c, "Special text1
ltext2(256) type c, "Special text2
BSARK LIKE VBAK-BSARK, "ordering method
BNAME LIKE VBAK-BNAME, "orderer
WERKS LIKE VBAP-WERKS, "Site Prefix
* item
POSNR LIKE VBAP-POSNR, "item
MATNR LIKE VBAP-MATNR, "material
MENGE(15) TYPE C, "qty
FREE_MENGE(15) TYPE C, "Free qty ordered
PSTYV LIKE VBAP-PSTYV, "item category
ROUTE LIKE VBAP-ROUTE, "Collect or not
* vrkme(3) type c, "uom
* itext(40), "item txt
END OF DATA_IN.
DATA: BEGIN OF I_MATERIAL OCCURS 0,
MATNR LIKE MARA-MATNR,
ORDER LIKE IDLORDI-ORDER-ENTRY-CODE,
END OF I_MATERIAL.
DATA: BEGIN OF I_MAIL OCCURS 0.
INCLUDE STRUCTURE SOLI.
DATA: END OF I_MAIL.
* Internal table to contain BDC data.
DATA: BEGIN OF BDCDATA OCCURS 1000.
INCLUDE STRUCTURE BDCDATA.
DATA: END OF BDCDATA.
DATA: BEGIN OF MESSTAB OCCURS 0.
INCLUDE STRUCTURE BDCMSGCOLL.
DATA: END OF MESSTAB.
DATA: BEGIN OF I_OUTPUT OCCURS 1000.
INCLUDE STRUCTURE DATA_IN.
DATA: END OF I_OUTPUT.
DATA: OLD_RTYPE LIKE DATA_IN-RTYPE,
V_VBELN LIKE VBAK-VBELN,
V_ITEM_NO(2) TYPE N,
V_MAIL(1) TYPE C,
V_VIEW(1) TYPE C,
V_IDL-ORDER-NO LIKE IDLORDH-IDL-ORDER-NO,
V_PC-USER-NO LIKE IDLORDH-PC-USER-NO.
AT SELECTION-SCREEN.
* Check name of BDC session has been supplied.
IF BDC_NAME EQ SPACE.
SET CURSOR FIELD 'BDC_NAME'.
MESSAGE E002 WITH 'No batch-input session name supplied'.
ENDIF.
START-OF-SELECTION.
MOVE: SY-REPID TO ABAPNAME,
SY-TITLE TO ABAPTITLE.
IF VIEW = 'X'. V_VIEW = 'A'. ENDIF.
IF ERRORS = 'X'. V_VIEW = 'E'. ENDIF.
IF NO_DIS = 'X'. V_VIEW = 'N'. ENDIF.
IF P_FILE = 'X'.
* Read the input files.
PERFORM READ_FILES.
* Map the data.
PERFORM MAP_DATA.
* Create the BDC sessions.
PERFORM CREATE_BDC_SESSIONS.
MESSAGE I002 WITH 'Run the Report to check which orders have been
CREATED'.
ELSEIF P_TABLE = 'X'.
V_VIEW = 'A'.
* Load Data from table.
PERFORM F_TABLE_LOAD.
* Create the BDC sessions.
PERFORM CREATE_BDC_SESSIONS.
MESSAGE I002 WITH 'Run the Report to check which orders have been
CREATED'.
ELSEIF P_REPORT = 'X'.
*Submit report.
SUBMIT ZSDRLAPS AND RETURN
USING SELECTION-SETS OF PROGRAM 'ZSDILAPT'
WITH O_IHREZ IN O_IHREZ
WITH O_VBELN IN O_VBELN
WITH O_MESS IN O_MESS.
ENDIF.
* Archive the input file.
IF ARC_FIL NE SPACE.
PERFORM DEL_INP_FILE.
ENDIF.
IF V_MAIL = 1.
MOVE 'CTRL F6 to Execute the LAPTOP Error log Program' TO I_MAIL-LINE.
APPEND I_MAIL.
CLEAR I_MAIL.
CALL FUNCTION 'Z_SEND_MESSAGE'
EXPORTING
MAIL_TO = 'LAPTOPS'
MAIL_TITLE = 'LAPTOP SALES ORDERS'
ATTACH_TYPE = 'R'
NAME = 'ZSDRLAPS'
TABLES
CONTENTS = I_MAIL
EXCEPTIONS
PERS_NO_USERID = 1
OTHERS = 2.
ENDIF.
END-OF-SELECTION.
* FORM CREATE_BDC_SESSION *
* This form will create a BDC session. *
FORM CREATE_BDC_SESSIONS.
REFRESH BDCDATA.
CLEAR BDCDATA.
OLD_RTYPE = SPACE.
READ TABLE DATA_IN INDEX 1.
OLD_RTYPE = DATA_IN-RTYPE.
CLEAR DATA_IN.
LOOP AT DATA_IN.
IF OLD_RTYPE EQ '2' AND DATA_IN-RTYPE EQ '1'.
PERFORM BDC_FIELD USING 'BDC_OKCODE' '/11'.
CALL TRANSACTION 'VA01' USING BDCDATA MODE V_VIEW UPDATE 'S'
MESSAGES INTO MESSTAB.
* if sy-subrc ne 0.
PERFORM F_MESSAGE_ANALYSIS.
* endif.
REFRESH BDCDATA.
ENDIF.
IF DATA_IN-RTYPE = 1.
PERFORM TRANS_VA01_HEADER.
ELSE.
PERFORM TRANS_VA01_ITEM.
ENDIF.
OLD_RTYPE = DATA_IN-RTYPE.
MOVE-CORRESPONDING DATA_IN TO I_OUTPUT.
APPEND I_OUTPUT.
CLEAR I_OUTPUT.
ENDLOOP.
PERFORM BDC_FIELD USING 'BDC_OKCODE' '/11'.
* Call transaction
CALL TRANSACTION 'VA01' USING BDCDATA MODE V_VIEW UPDATE 'S'
MESSAGES INTO MESSTAB.
* if sy-subrc ne 0.
PERFORM F_MESSAGE_ANALYSIS.
* endif.
REFRESH BDCDATA.
ENDFORM.
* FORM RANS_va01_header. *
* Set up BDCDATA table for transaction VA01. *
FORM TRANS_VA01_HEADER.
* Process program SAPMV45a screen 0101
* CREATE sales order Initial screen
PERFORM BDC_NEW_DYNPRO USING 'SAPMV45A' '0101'.
PERFORM BDC_FIELD USING 'VBAK-AUART' DATA_IN-AUART.
PERFORM BDC_FIELD USING 'VBAK-VKORG' DATA_IN-VKORG.
PERFORM BDC_FIELD USING 'VBAK-VTWEG' DATA_IN-VTWEG.
PERFORM BDC_FIELD USING 'VBAK-SPART' DATA_IN-SPART.
* perform bdc_field using 'VBAK-VKBUR' data_in-vkbur.
* perform bdc_field using 'VBAK-VKGRP' data_in-vkgrp.
PERFORM BDC_FIELD USING 'BDC_OKCODE' '/0'.
* Process program SAPMV45a screen 0402
PERFORM BDC_NEW_DYNPRO USING 'SAPMV45A' '0402'.
* Overview screen
PERFORM BDC_FIELD USING 'KUAGV-KUNNR' DATA_IN-KUNNR.
PERFORM BDC_FIELD USING 'VBAK-BSTNK' DATA_IN-BSTNK.
PERFORM BDC_FIELD USING 'VBAK-BSTDK' DATA_IN-BSTDK.
PERFORM BDC_FIELD USING 'RV45A-KPRGBZ' DATA_IN-KPRGBZ.
PERFORM BDC_FIELD USING 'RV45A-KETDAT' DATA_IN-KETDAT.
* perform bdc_field using 'VBKD-PRSDT' data_in-prsdt.
PERFORM BDC_FIELD USING 'BDC_OKCODE' 'KKAU'.
* Header Bus data
PERFORM BDC_NEW_DYNPRO USING 'SAPMV45A' '0300'.
PERFORM BDC_FIELD USING 'VBAK-LIFSK' DATA_IN-LIFSK.
PERFORM BDC_FIELD USING 'VBKD-INCO1' DATA_IN-INCO1.
PERFORM BDC_FIELD USING 'VBKD-INCO2' DATA_IN-INCO1.
PERFORM BDC_FIELD USING 'VBAK-FAKSK' DATA_IN-FAKSK.
PERFORM BDC_FIELD USING 'BDC_OKCODE' 'KPAR'.
* Partner
PERFORM BDC_NEW_DYNPRO USING 'SAPDV02P' '0624'.
PERFORM BDC_FIELD USING 'RV02P-KUNDE(4)' DATA_IN-KUNDE.
* text
IF DATA_IN-LTEXT1 NE SPACE.
PERFORM CREATE_TEXT.
ENDIF.
PERFORM BDC_FIELD USING 'BDC_OKCODE' 'KBES'.
* Purchase order data
PERFORM BDC_NEW_DYNPRO USING 'SAPMV45A' '0351'.
PERFORM BDC_FIELD USING 'VBAK-BSARK' DATA_IN-BSARK.
PERFORM BDC_FIELD USING 'VBAK-BNAME' DATA_IN-BNAME.
PERFORM BDC_FIELD USING 'VBAK-IHREZ' DATA_IN-IHREZ.
PERFORM BDC_FIELD USING 'BDC_OKCODE' 'UER1'.
ENDFORM.
* FORM TRANS_VA01_ITEM *
FORM TRANS_VA01_ITEM.
PERFORM BDC_NEW_DYNPRO USING 'SAPMV45A' '0402'.
IF OLD_RTYPE = '1'. "ie, this is the first item.
PERFORM BDC_FIELD USING 'VBAP-MATNR(001)' DATA_IN-MATNR.
PERFORM BDC_FIELD USING 'RV45A-KWMENG(001)' DATA_IN-MENGE.
PERFORM BDC_FIELD USING 'BDC_OKCODE' '/0'.
PERFORM BDC_NEW_DYNPRO USING 'SAPMV45A' '0402'.
PERFORM BDC_FIELD USING 'RV45A-VBAP_SELKZ(001)' 'X'.
PERFORM BDC_FIELD USING 'BDC_OKCODE' 'PKAU'.
PERFORM TRANS_VA01_ITEM_DETAILS.
ELSE.
PERFORM BDC_FIELD USING 'BDC_OKCODE' 'POAN'. "create item
PERFORM BDC_NEW_DYNPRO USING 'SAPMV45A' '0402'.
PERFORM BDC_FIELD USING 'VBAP-MATNR(002)' DATA_IN-MATNR.
IF DATA_IN-MENGE = SPACE.
PERFORM BDC_FIELD USING 'RV45A-KWMENG(002)' DATA_IN-FREE_MENGE.
ELSE.
PERFORM BDC_FIELD USING 'RV45A-KWMENG(002)' DATA_IN-MENGE.
ENDIF.
PERFORM BDC_FIELD USING 'BDC_OKCODE' '/0'.
PERFORM BDC_NEW_DYNPRO USING 'SAPMV45A' '0402'.
PERFORM BDC_FIELD USING 'RV45A-VBAP_SELKZ(002)' 'X'.
PERFORM BDC_FIELD USING 'BDC_OKCODE' 'PKAU'.
PERFORM TRANS_VA01_ITEM_DETAILS.
ENDIF.
ENDFORM.
*& Form TRANS_VA01_ITEM_DETAILS
* text
* --> p1 text
* <-- p2 text
FORM TRANS_VA01_ITEM_DETAILS.
*Business Data
PERFORM BDC_NEW_DYNPRO USING 'SAPMV45A' '0450'.
PERFORM BDC_FIELD USING 'VBAP-WERKS' DATA_IN-WERKS.
IF DATA_IN-MENGE = SPACE.
PERFORM BDC_FIELD USING 'VBAP-PSTYV' 'TANN'.
ENDIF.
* perform bdc_field using 'VBAP-PSTYV' 'TAN'.
* route mapping
IF DATA_IN-ROUTE = 'D'.
PERFORM BDC_FIELD USING 'VBAP-ROUTE' '000001'.
ELSE.
ENDIF.
PERFORM BDC_FIELD USING 'VBAP-FAKSK' DATA_IN-FAKSK.
PERFORM BDC_FIELD USING 'BDC_OKCODE' 'UER1'.
ENDFORM. " TRANS_VA01_ITEM_DETAILS
* FORM BDC_NEW_DYNPRO *
* Updates the BDCDATA table with the program and screen number *
* of the next screen. *
FORM BDC_NEW_DYNPRO USING PROGRAM DYNPRO.
CLEAR BDCDATA.
BDCDATA-PROGRAM = PROGRAM.
BDCDATA-DYNPRO = DYNPRO.
BDCDATA-DYNBEGIN = 'X'.
APPEND BDCDATA.
ENDFORM.
* FORM BDC_FIELD *
* Updates the BDCDATA table with the field name and value of *
* the current screen. *
* --> FIELD - Field name *
* --> VALUE - Field value *
FORM BDC_FIELD USING FIELD VALUE.
IF VALUE NE SPACE.
CLEAR BDCDATA.
BDCDATA-FNAM = FIELD.
BDCDATA-FVAL = VALUE.
APPEND BDCDATA.
ENDIF.
ENDFORM.
*& Form READ_FILE
* text
* --> p1 text
* <-- p2 text
FORM READ_FILES.
* Read order headers
OPEN DATASET IDLH FOR INPUT IN TEXT MODE.
IF SY-SUBRC NE 0.
MESSAGE E002(ZZ) WITH 'Cannot find file in directory'.
ENDIF.
DO.
READ DATASET IDLH INTO IDLORDH.
IF SY-SUBRC NE 0.
EXIT.
ENDIF.
APPEND IDLORDH.
ENDDO.
CLOSE DATASET IDLH.
* Read order items
OPEN DATASET IDLI FOR INPUT IN TEXT MODE.
IF SY-SUBRC NE 0.
MESSAGE E002(ZZ) WITH 'Cannot find file in directory'.
ENDIF.
DO.
READ DATASET IDLI INTO IDLORDI.
IF SY-SUBRC NE 0.
EXIT.
ENDIF.
APPEND IDLORDI.
ENDDO.
CLOSE DATASET IDLI.
ENDFORM. " READ_FILE_INTO_CUST
*& Form DEL_INP_FILE
* text
* --> p1 text
* <-- p2 text
FORM DEL_INP_FILE.
DATA: PARAX(128).
DATA: PARAM(200).
DATA: CMDSTR(18),
CMD_RESULT LIKE BTCXPM OCCURS 10 WITH HEADER LINE,
LINES TYPE I.
DATA: PATH1(60) TYPE C.
DATA: PATH2(60) TYPE C.
DATA: NAME(20) TYPE C.
DATA: INTNAME(20) TYPE C VALUE 'LAPTOP',
V_FILENAME1(20) TYPE C VALUE 'ORDHT',
V_FILENAME2(20) TYPE C VALUE 'ORDIT'.
DATA: V_DATE LIKE SY-DATUM.
V_DATE = SY-DATUM+4(4).
CLEAR PARAX.
* build IN directory
PATH1 ='/'.
WRITE SY-SYSID TO PATH1+1(3). "D01 or T01 or P01 !
WRITE 'INT/' TO PATH1+4(4). "Interfaces
WRITE INTNAME TO PATH1+8(20).
CONDENSE PATH1 NO-GAPS.
WRITE '/IN' TO PATH1+30(5).
CONDENSE PATH1 NO-GAPS.
* build ARCH directory
PATH2 ='/'.
WRITE SY-SYSID TO PATH2+1(3). "D01 or T01 or P01 !
WRITE 'INT/' TO PATH2+4(4). "Interfaces
WRITE INTNAME TO PATH2+8(20).
CONDENSE PATH2 NO-GAPS.
WRITE '/ARCH' TO PATH2+30(5).
CONDENSE PATH2 NO-GAPS.
DO 2 TIMES.
CASE SY-INDEX.
WHEN 1.
IF IDLEX = 'X'.
CONCATENATE 'IDL' V_FILENAME1 INTO NAME.
ELSE.
CONCATENATE 'DB' V_FILENAME1 INTO NAME.
ENDIF.
* name = filename1.
WHEN 2.
IF IDLEX = 'X'.
CONCATENATE 'IDL' V_FILENAME2 INTO NAME.
ELSE.
CONCATENATE 'DB' V_FILENAME2 INTO NAME.
ENDIF.
* name = filename2.
ENDCASE.
CMDSTR = 'ZMOV'.
WRITE ' OBJ( TO PARAM.
WRITE PATH1 TO PARAM+7(50).
WRITE '/' TO PARAM+50(1).
CONDENSE PARAM NO-GAPS.
WRITE NAME TO PARAM+70(12).
CONDENSE PARAM NO-GAPS.
WRITE )@TOOBJ( TO PARAM+70(13).
CONDENSE PARAM NO-GAPS.
WRITE PATH2 TO PARAM+82(60).
CONDENSE PARAM NO-GAPS.
WRITE '/' TO PARAM+140(1).
CONDENSE PARAM NO-GAPS.
WRITE V_DATE TO PARAM+140(4).
CONDENSE PARAM NO-GAPS.
WRITE NAME TO PARAM+140(15).
CONDENSE PARAM NO-GAPS.
WRITE )' TO PARAM+142(5).
CONDENSE PARAM NO-GAPS.
REPLACE '@' WITH ' ' INTO PARAM.
* replace '@' with ' ' into param.
MOVE PARAM(127) TO PARAX(127).
CALL FUNCTION 'SXPG_CALL_SYSTEM'
EXPORTING
COMMANDNAME = CMDSTR
PARAMETERS = PARAX
TABLES
EXEC_PROTOCOL = CMD_RESULT
EXCEPTIONS
NO_PERMISSION = 1
COMMAND_NOT_FOUND = 2
OTHERS = 4.
IF SY-SUBRC <> 0. "extenal command not executed
MESSAGE I002 WITH 'error calling external command - call sys admin'.
ENDIF.
ENDDO.
ENDFORM. " DEL_INP_FILE
*& Form CREATE_TEXT
* text
* --> p1 text
* <-- p2 text
FORM CREATE_TEXT.
PERFORM BDC_FIELD USING 'BDC_OKCODE' 'KTEX'.
* Text overview
PERFORM BDC_NEW_DYNPRO USING 'SAPMV45A' '0150'.
PERFORM BDC_FIELD USING 'RTEXT-SELKZ(02)' 'X'.
PERFORM BDC_FIELD USING 'RTEXT-SPRAS(02)' 'E'.
PERFORM BDC_FIELD USING 'BDC_OKCODE' 'TEDE'.
* Text editor
PERFORM BDC_NEW_DYNPRO USING 'SAPLSTXX' '1100'.
PERFORM BDC_FIELD USING 'BDC_OKCODE' '/06'.
PERFORM BDC_NEW_DYNPRO USING 'SAPLSTXX' '1100'.
PERFORM BDC_FIELD USING 'BDC_CURSOR' 'RSTXT-TXLINE(02)'.
PERFORM BDC_FIELD USING 'RSTXT-TXLINE(02)' DATA_IN-LTEXT2(70).
PERFORM BDC_FIELD USING 'BDC_OKCODE' '/06'.
PERFORM BDC_NEW_DYNPRO USING 'SAPLSTXX' '1100'.
PERFORM BDC_FIELD USING 'BDC_CURSOR' 'RSTXT-TXLINE(02)'.
PERFORM BDC_FIELD USING 'RSTXT-TXLINE(02)' DATA_IN-LTEXT1(70).
PERFORM BDC_FIELD USING 'BDC_CURSOR' 'RSTXT-TXLINE(04)'.
* perform bdc_field using 'BDC_OKCODE' '/06'.
* perform bdc_new_dynpro using 'SAPLSTXX' '1100'.
* PERFORM BDC_FIELD USING 'RSTXT-TXLINE(004)' DATA_IN-ltext+140(70).
* PERFORM BDC_FIELD USING 'BDC_OKCODE' '/06'.
* PERFORM BDC_NEW_DYNPRO USING 'SAPLSTXX' '1100'.
* PERFORM BDC_FIELD USING 'RSTXT-TXLINE(005)' DATA_IN-ltext+210(46).
* PERFORM BDC_FIELD USING 'BDC_OKCODE' '/06'.
PERFORM BDC_NEW_DYNPRO USING 'SAPLSTXX' '1100'.
PERFORM BDC_FIELD USING 'BDC_OKCODE' 'TXVB'.
PERFORM BDC_NEW_DYNPRO USING 'SAPLSTXX' '1100'.
PERFORM BDC_FIELD USING 'BDC_OKCODE' 'TXEX'.
PERFORM BDC_NEW_DYNPRO USING 'SAPMV45A' '0150'.
ENDFORM. " CREATE_TEXT
*& Form MAP_DATA
* text
* --> p1 text
* <-- p2 text
FORM MAP_DATA.
TABLES: KNB1, CABN, AUSP.
TABLES: ZPM1.
DATA: V_CUST_NO(11) TYPE C.
CLEAR IDLORDH.
CLEAR DATA_IN.
SELECT * FROM CABN
WHERE ATNAM = 'ORDER_ENTRY_CODE'.
EXIT.
ENDSELECT.
SELECT OBJEK ATWRT INTO (I_MATERIAL-MATNR, I_MATERIAL-ORDER)
FROM AUSP
WHERE ATINN = CABN-ATINN.
APPEND I_MATERIAL.
ENDSELECT.
LOOP AT IDLORDH.
MOVE '1' TO DATA_IN-RTYPE.
* Order type.
DATA_IN-AUART = 'ZOR'.
* Sales organisation
IF IDLEX EQ 'X'.
DATA_IN-VKORG = '1100'. "idl domestic.
ELSE.
DATA_IN-VKORG = '1350'. "dillion bass domestic.
ENDIF.
* Distribution Channel
DATA_IN-VTWEG = '10'.
* Division
DATA_IN-SPART = '10'.
* Customer Number
IF IDLORDH-CUST-NO(1) = SPACE.
CONCATENATE '0' IDLORDH-CUST-NO INTO V_CUST_NO.
CONDENSE V_CUST_NO NO-GAPS.
ELSE.
V_CUST_NO = IDLORDH-CUST-NO.
ENDIF.
DO 4 TIMES.
IF IDLORDH-BRANCH-NO CS SPACE.
REPLACE SPACE WITH '0' INTO IDLORDH-BRANCH-NO.
ENDIF.
ENDDO.
move idlordh-branch-no to v_cust_no+7(4).
select * from knb1 where eikto = v_cust_no.
EXIT.
ENDSELECT.
MOVE KNB1-KUNNR TO DATA_IN-KUNNR.
* Sales Office
*ata_in-vkbur.
* Sales Group
*ata_in-vkgrp
* PO number
DATA_IN-BSTNK = IDLORDH-CUST-ORDER-NO.
* PO ref number
IF IDLORDH-IDL-ORDER-NO(1) EQ SPACE.
MOVE IDLORDH-IDL-ORDER-NO TO V_IDL-ORDER-NO.
REPLACE SPACE WITH '0' INTO V_IDL-ORDER-NO.
ENDIF.
MOVE IDLORDH-PC-USER-NO TO V_PC-USER-NO.
DO 3 TIMES.
REPLACE SPACE WITH '0' INTO V_PC-USER-NO.
ENDDO.
CONCATENATE V_IDL-ORDER-NO '-' V_PC-USER-NO INTO V_IHREZ.
DATA_IN-IHREZ = V_IHREZ.
* PO Date
DATA_IN-BSTDK = IDLORDH-PC-ORDER-DATE.
DO 2 TIMES.
REPLACE '/' WITH '.' INTO IDLORDH-PC-ORDER-DATE.
ENDDO.
DATA_IN-BSTDK = IDLORDH-PC-ORDER-DATE.
* Date Type
*ata_in-kprgbz
* Required Delivery Date
DO 2 TIMES.
REPLACE '/' WITH '.' INTO IDLORDH-PC-DATE-REQD.
ENDDO.
DATA_IN-KETDAT = IDLORDH-PC-DATE-REQD.
*pricing date
*ata_in-prsdt
*delivery block
*ata_in-lifsk
*inco terms.
IF IDLORDH-FOR-COLLECTION = 'Y'.
DATA_IN-INCO1 = 'EXW'.
ELSE.
DATA_IN-INCO1 = 'CIF'.
ENDIF.
*inco description
*ata_in-inco2
*billing block
IF IDLORDH-HOLD-FOR-PRICING = 'Y'.
DATA_IN-FAKSK = '99'.
ENDIF.
*shipto
*ata_in-kunde
*special text
DATA_IN-LTEXT1 = IDLORDH-SPEC-INS-1.
DATA_IN-LTEXT2 = IDLORDH-SPEC-INS-2.
*ordering method
DATA_IN-BSARK = 'LAPT'.
*plant.
SELECT * FROM ZPM1
WHERE ZLPLANT = IDLORDH-SITE-PREFIX.
EXIT.
ENDSELECT.
DATA_IN-WERKS = ZPM1-ZWERKS.
*orderer
*data_in-bname
APPEND DATA_IN.
CLEAR DATA_IN.
LOOP AT IDLORDI WHERE IDL-ORDER-NO = IDLORDH-IDL-ORDER-NO AND
PC-USER-NO = IDLORDH-PC-USER-NO.
MOVE '2' TO DATA_IN-RTYPE.
*item
*material no.
READ TABLE I_MATERIAL WITH KEY ORDER = IDLORDI-ORDER-ENTRY-CODE.
DATA_IN-MATNR = I_MATERIAL-MATNR.
*Order quantity
DATA_IN-MENGE = IDLORDI-QTY-TO-ORDER.
DATA_IN-FREE_MENGE = IDLORDI-FREE-QTY-ORDERED.
*plant.
DATA_IN-WERKS = ZPM1-ZWERKS.
*ata_in-pstyv
* route
* vrkme
* itext
APPEND DATA_IN.
IF IDLORDI-FREE-QTY-ORDERED > 0.
CLEAR DATA_IN-MENGE.
APPEND DATA_IN.
ENDIF.
CLEAR DATA_IN.
ENDLOOP.
ENDLOOP.
ENDFORM. " MAP_DATA
*& Form F_MESSAGE_ANALYSIS
* <-- p2 text
FORM F_MESSAGE_ANALYSIS.
DATA: V_FIRST(1) TYPE C VALUE '1',
V_COUNT(2) TYPE N,
V_MESSAGE(1) TYPE C,
V_MESSLINES(2) TYPE N.
CLEAR: V_IHREZ, V_MESSLINES.
DESCRIBE TABLE MESSTAB LINES V_MESSLINES.
READ TABLE MESSTAB WITH KEY MSGTYP = 'S' MSGID = 'V1' MSGNR = '311'.
IF SY-SUBRC = 0.
IF V_MESSLINES = 1.
V_MESSAGE = 'S'.
ELSE.
V_MESSAGE = 'W'.
V_MAIL = 1.
ENDIF.
V_VBELN = MESSTAB-MSGV2(08).
ELSE.
V_MESSAGE = 'E'.
V_MAIL = 1.
ENDIF.
V_FIRST = 1.
LOOP AT I_OUTPUT.
IF V_FIRST = 1.
MOVE I_OUTPUT-IHREZ TO V_IHREZ.
CLEAR V_FIRST.
ENDIF.
ZSOM1-VBELN = V_VBELN.
ZSOM1-ITEM_NO = V_ITEM_NO.
ZSOM1-MESS = V_MESSAGE.
MOVE-CORRESPONDING I_OUTPUT TO ZSOM1.
ZSOM1-IHREZ = V_IHREZ.
MODIFY ZSOM1.
CLEAR ZSOM1.
V_ITEM_NO = V_ITEM_NO + 1.
ENDLOOP.
LOOP AT MESSTAB.
V_COUNT = V_COUNT + 1.
ZSOM2-MCOUNT = V_COUNT.
ZSOM2-IHREZ = V_IHREZ.
CASE MESSTAB-MSGTYP.
WHEN 'E'.
MOVE-CORRESPONDING MESSTAB TO ZSOM2.
WHEN 'A'.
MOVE-CORRESPONDING MESSTAB TO ZSOM2.
WHEN 'W'.
MOVE V_VBELN TO ZSOM2-VBELN.
MOVE-CORRESPONDING MESSTAB TO ZSOM2.
WHEN 'I'.
MOVE V_VBELN TO ZSOM2-VBELN.
MOVE-CORRESPONDING MESSTAB TO ZSOM2.
WHEN 'S'.
MOVE V_VBELN TO ZSOM2-VBELN.
MOVE-CORRESPONDING MESSTAB TO ZSOM2.
ENDCASE.
MODIFY ZSOM2.
CLEAR ZSOM2.
ENDLOOP.
REFRESH: MESSTAB, I_OUTPUT.
CLEAR: MESSTAB, I_OUTPUT.
CLEAR: V_FIRST, V_VBELN, V_IHREZ, V_ITEM_NO, V_COUNT, V_MESSAGE.
ENDFORM. " F_MESSAGE_ANALYSIS
*& Form F_TABLE_LOAD
FORM F_TABLE_LOAD.
SELECT * FROM ZSOM1
WHERE IHREZ IN O_IHREZ
AND MESS = 'E'.
IF NOT ZSOM1-VBELN IS INITIAL.
CHECK ZSOM1-VBELN IN O_VBELN.
ENDIF.
MOVE-CORRESPONDING ZSOM1 TO DATA_IN.
APPEND DATA_IN.
CLEAR DATA_IN.
ENDSELECT.
ENDFORM. " F_TABLE_LOAD
Similar Messages
-
Va31 shedule line agreement data upload from flat file
Hi abapers
I have to upload some data (va31) from flat file to my database (shedule line agreement data) I am using user exit for it...Cant get which user exit will solve the purpose and where to check it from..I tried using SDTRM001 , meeta001 and and the va45A series but its not working. I used break point on these user exits but its not stoping at break point.
Can any one help me where to find which user exit will work in this case?
Thanks in Advance
AnnuHi Prash,
Check these posts:
Re: Increasing the length of Infoobject from 60 to 240 characters
Re: InfoObject > 60
Bye
Dinesh -
Error occurred in the data uploading from Flat File in BPC NW
Hi,
I am doing Migration project from BPC MS to NW.
In this i am loading data from flat file to BPC NW. One error occured in this process that is Record Duplication.
Total 17000 records in that 7000 recards rejected by the reason of duplication.
The Information about Package Log
/CPMB/MODIFY completed in 0 seconds
/CPMB/CONVERT completed in 2 seconds
/CPMB/LOAD completed in 7 seconds
/CPMB/CLEAR completed in 0 seconds
[Selection]
FILE= DATAMANAGER\DATAFILES\Aprilmayjun_2011_Budget_V1.CSV
TRANSFORMATION= DATAMANAGER\TRANSFORMATIONFILES\ZAPRMAYJUN_2011BUDGET.xls
CLEARDATA= No
RUNLOGIC= Yes
CHECKLCK= No
[Messages]
Task name CONVERT:
No 1 Round:
Record count: 17064
Accept count: 17064
Reject count: 0
Skip count: 0
Task name LOAD:
Reject count: 7230
Submit count: 9834
Application: CorpBudget Package status: WARNING
Could you help me in this at the earliest.
Thanks and Regards
KrishnaHi,
You cannot send the duplicated with the standard import package. You need to create or add a new package and link to /CPMB/APPEND process chain and do the import. This would consider the duplicate entries also. It looks like you need somehow load all the records including the duplicate ones.
So on excel go to Manage Data -> Maintain Data management -> organize package list and add a new package and link to the standard BPC process chain /CPMB/APPEND.
Thanks,
Sreeni -
Procurement Card data upload from flat file to database
Hi All,
I need to upload Procurement Card data from a flat file to the database in the table BBP_PCMAS.
I found a BAPI BAPI_PCARD_CREATEMULTIPLE which uploads the data perfectly, however the structure PCMASTER that it takes as input does not contain the field for Blocking reason PCBLOCK - Reason for blocking procurement card. I need to upload this file as well from the flat file.
Any suggestions?
ThanksHi,
You are correct the function module BAPI_PCARD_CREATEMULTIPLE does not contain the PCBLOCK field.
Alternatively what you can do is read the PC data after it is created and modify it with the PCBLOCK appropiately. The necessary function modules are given below.
BBP_PCMAS_READ_PCMAS - Read Data
BBP_PCMAS_MODIFY_PCMAS - Modify Data
Note: BBP_PCMAS_MODIFY_PCMAS is a Update Task FM. Hence it shoild be called as given below, ( refer form write_data of the FM BAPI_PCARD_CREATEMULTIPLE)
call function 'BBP_PCMAS_MODIFY_PCMAS' in update task
exporting
i_pcmas = i_pcmas
* I_PCMAS_OLD =
* I_DELETE =
tables
t_pcacc = i_pcacc
* T_PCACC_OLD =
exceptions
not_found = 1
others = 2.
Regards
Kathirvel -
Upload from flat file to table
Hi experts,
i need to upload the following file in a table with the columns names as field names in my database table
weekly_eft_repo 1.0 Page: 1
CDC:00304 / Sat Oct-31-2009 Weekly EFT Sweep for 25/10/09 - 31/10/09 Effective Date 03/11/09 Sat Oct-31-2009 22:06:14
*Bill to*
*Retailer Retailer Name Name on Bank Account Bank ABA Bank Acct On-line Amount Instant Amount Total Amount*
======== ============================== ============================== ========== ==================== =============== =============== ===============
0200101 Triolet Popular Store Triolet Popular Store 111111111 62030100130659 10,868.00 0.00 10,868.00
0200103 Le Cacharel Snack Le Cacharel Snack 111111111 62030100130813 9,728.00 0.00 9,728.00
0200104 Advanced Co-operative Self Ser Advanced Co-operative Self Ser 111111111 111111111 7,334.00 0.00 7,334.00
0200105 Chez Popo Supermarket Chez Popo Supermarket 111111111 61030100044898 30,932.00 0.00 30,932.00
0200106 Vana Supermarket Vana Supermarket 111111111 111111111 17,775.00 0.00 17,775.00
0200107 Mont Choisy Store Mont Choisy Store 111111111 62030100130804 8,840.00 0.00 8,840.00
0200108 Vijay Store Vijay Store 111111111 62030100131229 16,416.00 0.00 16,416.00
0200109 Neptune Confection Neptune Confection 111111111 62030100130931 11,077.00 0.00 11,077.00
0200110 Antoine Store Antoine Store 111111111 111111111 2,470.00 0.00 2,470.00Database table
TABLE weekly_eft_report_temp
Name Null? Type
BILL_TO_RETAILER NOT NULL VARCHAR2(15)
RETAILER_NAME VARCHAR2(100)
NAME_ON_BANK_ACCOUNT VARCHAR2(100)
BANK_ABA VARCHAR2(1)
BANK_ACCT VARCHAR2(1)
ON_LINE_AMOUNT NUMBER
INSTANT_AMOUNT NUMBER
TOTAL_AMOUNT NUMBER I am having lots of difficulty in doing so. Can anyone plz help me. ThanksHi Damorgan,
I am having a little problem with my external table though and dont seem to find the solution. can you help me on this one please.
For my external table
create table weekly_eft_temp
(line varchar2(4000))
ORGANIZATION EXTERNAL (
TYPE oracle_loader
DEFAULT DIRECTORY GTECHFILES
ACCESS PARAMETERS (
RECORDS DELIMITED BY NEWLINE
CHARACTERSET WE8MSWIN1252
BADFILE 'weekly_eft.bad'
DISCARDFILE 'weekly_eft.dis'
LOGFILE 'weekly_eft.log'
FIELDS TERMINATED BY X'0D' RTRIM
REJECT ROWS WITH ALL NULL FIELDS
line char(4000)
LOCATION ('weekly_eft_report_c00381.rep')
PARALLEL
REJECT LIMIT UNLIMITED ;There is no problem with this. My external table is populated ok.
My problem lies in my sql query. I am not able seperate my field so that they can be inserted into their appropriate fields in my table
INSERT INTO weekly_eft_report_temp
(Bill_to_Retailer ,
Retailer_Name ,
Name_on_Bank_Account ,
Bank_ABA ,
Bank_Acct ,
On_line_Amount ,
Instant_Amount ,
Total_Amount ,
CDC ,
SOURCE ,
INSERTED_DATE ,
UPLOADED
select
case when Bill_to_Retailer is null then lag(RETAILER_NO, decode(PRODUCT, ''Loto'', 1, ''Inst Tk'', 2 )) over (order by line_no) else null end as RETAILER_NO,
Bill_to_Retailer ,
Retailer_Name ,
Name_on_Bank_Account ,
Bank_ABA ,
Bank_Acct ,
On_line_Amount ,
Instant_Amount ,
Total_Amount ,
'00381' ,
'weekly_eft_report_c00381.rep' ,
sysdate ,
'N'
from (
select
Bill_to_Retailer ,
Retailer_Name ,
Name_on_Bank_Account ,
Bank_ABA ,
Bank_Acct ,
On_line_Amount ,
Instant_Amount ,
Total_Amount
from
( select
rownum as line_no,
regexp_substr(line, '[^ ]+', 1, 1) as Bill_to_Retailer ,
regexp_substr(line, '[^ ]+', 1, 2) as Retailer_Name ,
regexp_substr(line, '[^ ]+', 1, 3) as Name_on_Bank_Account ,
regexp_substr(line, '[^ ]+', 1, 4) as Bank_ABA ,
regexp_substr(line, '[^ ]+', 1, 5) as Bank_Acct ,
regexp_substr(line, '[^ ]+', 1, 6) as On_line_Amount ,
regexp_substr(line, '[^ ]+', 1, 7) as Instant_Amount ,
regexp_substr(line, '[^ ]+', 1, 8) as Total_Amount
from weekly_eft_temp )
-- where regexp_like(line, '^( +Bill to Retailer)')
The result of my query is as follows:
weekly_eft_repo 1.0 L o t t o t
CDC:00381 / Sat Jan-16-2010 Weekly EFT Sweep for
Bill to
Retailer Retailer Name Name on Bank Account Bank
======== ============================== ============================== ========== ==================== =============== =============== ===============
0200101 Triolet Popular Store Triolet Popular Store 111111111
0200103 Le Cacharel Snack Le Cacharel Snack 111111111
0200104 Advanced Co-operative Self Ser Advanced Co-operative Self
0200105 Chez Popo Supermarket Chez Popo Supermarket 111111111
0200106 Vana Supermarket Vana Supermarket 111111111 62030100133937 37,636.00
0200107 Mont Choisy Store Mont Choisy Store 111111111
0200108 Vijay Store Vijay Store 111111111 62030100131229 30,948.00
0200109 Neptune Confection Neptune Confection 111111111 62030100130931 23,769.00
0200110 Antoine Store Antoine Store 111111111 62030100134575 35,048.00
0200111 P.S.C Cold Storage P.S.C Cold Storage 111111111
0200113 Mini Prix Boutique Mini Prix Boutique 111111111
0200114 Hotel Cassim Hotel Cassim 111111111 62030100133914 171,802.00
0200116 Aman Snack Aman Snack 111111111 62030100129481 32,224.00
0200117 Best For Less Company Ltd Best For
0200118 Central Way Central Way 111111111 111111111 34,956.00
0200119 Amba Veerapen Amba Veerapen 111111111 62030100129436 35,817.00
0200121 Tang Way Tang Way 111111111 111111111 117,542.00
0200122 Football Pools Collector Football Pools Collector 111111111
0200123 Kim Lee Kim Lee 111111111 62030100129422 19,782.00
0200126 Chez Andrex Chez Andrex 111111111 11111111 141,732.00
0200127 Sungkoora Pools & Lottery Hous Sungkoora PoolsThe problem is that is that i want to take data only after the ====== and also it is seperating the names which is right. Can you please help me. Many thanks -
Need simple ABAP OO reports, BAPI's and BDC upload using flat file.
Hello experts,
I am currently practicing ABAP and I would like to request some example codes for ABAP Objects, BAPIs, BDC's, etc.
Thanks!hi viray,
check these...
BAPI'S..
http://help.sap.com/saphelp_47x200/helpdata/en/e0/9eb2370f9cbe68e10000009b38f8cf/frameset.htm
http://help.sap.com/saphelp_47x200/helpdata/en/3e/ecf226942511d2ad4b080009b0fb56/frameset.htm
http://www.sapgenie.com/abap/bapi/index.htm
Abap Objects
http://www.sapgenie.com/abap/OO/index.htm
http://sap.ittoolbox.com/documents/industry-articles/introducing-abap-objects-982
http://help.sap.com/saphelp_nw04/helpdata/en/ce/b518b6513611d194a50000e8353423/content.htm
bdc's...
http://www.sappoint.com/abap/bdcconcept.pdf
http://wiki.ittoolbox.com/index.php/Topic:ABAP_-_BDC
http://www.sap-img.com/bdc.htm
hope these help,
do reward if it helps,
priya.
Message was edited by: Priya -
Loading Hierarchy from flat file giving dump
Hi gurus,
i am trying to load data from flat file to hierarchy, when i am trying to schedule the infopackage its giving message PLEASE SELECT THE VALID INFOOBJECT and if i proceed even its giving a dump :-ASSIGN LENGTH 0.
i tired using i-doc method...then i am getting records in to BW in red and the same error
InfoObject INFOOBJECT is not available.
i followed the blog
/people/prakash.bagali/blog/2006/02/07/hierarchy-upload-from-flat-files
> points will be assigned for inputs.
Message was edited by:
ravi ahi guys,
my heirarchy is different from the one in the blog. should i mark all the infoobjects in all nodes as hierarchy relavant or only the bottom one? i also brought the 0hier_node from the business content. i dont know what other valid infoobject is missing ......plz help........
the following are more details about the dump
Program error: ASSIGN with length 0 in program "SAPLRRSV".
Error analysis
An ASSIGN statement in the program "SAPLRRSV" contained a field symbol with
length 0. This is not possible.
length 0.
This is not possible -
I have to load hierarchy from flat file
Hi Guys,
I build a balance sheet Report,which is showing the report based on financial statement item(0glaccext)hierarchy.
But previously client is maintaining some third party system,so client wants to load all the GL accounts in to BW.
When i load the GL accounts in to BW using flat file,in report it is not showing based on hierarchy for the flat file GL accounts.
So i need to load the hierarchy also for those GL accounts,how to load the GL accounts using flat file to maintain the hierarchy based on Assets,liabilities etc...Abdul,
You might want to take a look here:
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/0403a990-0201-0010-38b3-e1fc442848cb
or else see this weblog:
/people/prakash.bagali/blog/2006/02/07/hierarchy-upload-from-flat-files
assign points if useful
kalyan -
Upload data from flat file to OVKK using BDC
Hi All,
I want to upload data from flat file to OVKK tcode using BDC.
OVKK is a maintaince view with a table control.
So please send me code for uploading data to OVKK through BDC.
Thanks & Regards,
Siva.BHi,
Welcome to SDN!!!!!!!!!!
Can you see this example for Table control.
http://www.sap-img.com/abap/bdc-example-using-table-control-in-bdc.htm
Today this is the second post on the same issue and same Tranx.
1st try through SHDB and check the code.
Thanks.
If this helps you reward with points. -
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 -
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 -
How to upload the BP master details in huge amount from flat file to CRM database
Hi,
Could you any body please help me initially the best method to upload Business partner data from flat file and if possible with any sample code available?
Basically I am an ABAP consultant. In ERP I used to do BDC or lsmw in generally?
This is a mission critical thing for me.Hi Chitturi,
I did not come across the scenario for custom include fields from BAPI of partner creation. But if the fields are not appearing in the import/tables structure fields then you probably need to update the corresponding DB Table for those fields separately,else BAPI will update the same. You will get partner guid and partner number from export parameters of the BAPI.
Regards,
Dipesh
Message was edited by: Joaquin Fornas -
How to upload products in CRM from flat file
Hi,
My requirement is to uplaod products from flat file. Flat file contains Products details. I have tried BDC method but didnt help much.
Please tell me is there any BAPI or other methods avialble to useiin CRM 4.0.
Regards
RamprasadHi ,
Can you tell for which transaction you want BAPI or Function Module to upload data ?
What issue you are facing in BDC so that I can help you. -
How to upload schedule line from flat files to sap file
dear all,
i want to upload the schedule lines from flat files to sap schedulle lines
but the flat files have 15 schedule lines and the data is as per date
so how to upload that and the fields available in flat files are more than the sap screen
we are having more than 6 items
and 15scedule lines its abt 90data to be upload
for one customer in every 15 day
so how to do this
is there any direct use in functional side
with out the help of any abap
but my user will do it
so he need a permanent solution
with regards
subratHi Subrat ,
u can upload the data either ( Master /Transaction) data with the help of lsmw. for that all u need to do is go through the lsmw and do it. in that u can go Batch input recording/ BAPI/ IDOC any of that. here i am sending the LSMW Notes go through it and do the work.
once u create the LSMW project then u can ask the data from user or u can explain the user about the program and can run the flat file to upload the data.
if u require LSMW material Just send me blank mail from u. my mail id is [email protected]
Reward if Helpful.
Regards,
Praveen Kumar.D -
How to upload data from flat file to datastore object in BI 7.0
Dear friends,
Please tell me
step by step process for upload data from flat file to datastore object in BI 7.0
<removed by moderator>
please help me
Thanks,
D.prabhu
Edited by: Siegfried Szameitat on Aug 17, 2011 11:40 AMCreate transformation on thr data source and keep the DSO as the target and load.
Ravi Thothadri
Maybe you are looking for
-
Error when scheduling the report
hello: I have a workbook when i schedule it, it gives me the following error ORA-04063: Package body "SYSTEM.EUL5_BATCH_USER" has errors ORA-06508: PL/SQL: could not find program unit being called: "SYSTEM.EUL5_BATCH_USER" ORA-06512: at line 2 The on
-
Can not create a new portal using Oracle and the Administration tools.
Using the Personalization Server admin tool. My database is Oracle 8.0.5 (NT). I used the db/oracle/create* scripts to the create the necessary database tables. I was able to successfully create users, groups, and portlets, but when I try to create a
-
How to handle empty boxes to fill a pallet layer in Packing Instructions
Hi, I would like to know if it is possible to automatically add empty boxes in an outbound delivery of finished goods when the delivery is complete. e.g. In the packing Instructions I have the following 1 Pallet 12 boxes of finished goods ( 4 boxes
-
RCFaces integration with JDeveloper?
Hi gang Before I go nuts trying to get this to work, has anybody successfully installed and used RCFaces components with JDeveloper 10.1.3.1 ADF Faces components? Regards, CM.
-
Premiere CS3 - unable to open MPEG-4 files
Hi! I have footage from 2 different cameras. Project involved combining these 2 for DVD as end destination. Half of the footage is in quicktime format and the other half is MPEG-4. I am unable to import the MPEG-4 files into Premiere - I get the erro