BAPI/ BDC for repartnering of customers in SAP
HI Gurus!
Our MDM goes through a tedious data clean-up process when moving one ship-to partner from one sold-to partner to a new sold-to partner.
They are required to delete the ship-to partner from current sold-to location in all sales organizations. Then partner the sold-to information for each sales organization.
If the ship-to location has a business location ID. Expire the current role and change the operator to the new Sold-to.
So I need to create a program to accomplish the above steps to will improve data integrity and reduce the number of accounts to manage.
So i need to develop a program that can re-partner ship-to locations from one ship-to partner from one sold-to partner to a new sold-to partner. Produce an exception log for any bill-to, payer, customer contact information that has moved but could possibly be incorrect. Create a new role in the Business Location ID.
Using an ALV only allowing user to move records that can be transferred:
u2022 Only allow ship-to transfer for non-marked for deletion records.
u2022 Only allow transfer of ship-to records that are currently partnered to sold-to.
u2022 Do not allow transfer of ship-to records that have different sold-to/bill-to/payer accounts. These will need to be move manually.
u2022 Only allow change if the valid Operator number is the same customer number as the sold-to or the re-partnered sold-to.
So I was just wondering if there is any BAPI that can be used for it or dow e go by BDC or if there is a way to do this in a better manner.
COuld anyone please help me assist in as how to approch the program and go forward please.
Thanks
Aarav
Which "partnering" are you talking about?
The whole idea about a BAPI is that you create the transaction and calling context yourself, then you can use the stable interface of the BAPI for the core business logic below it (also remotely, and consistantly beyond release boundaries and the user's influence).
I can understand that Rob and many others are starting to complain about your obscure and unclear questions.
Also, if you close another thread with a "." then I will delete your boss's user ID on SDN... (just joking - please close threads properly. The comment field is not mandatory).
Cheers,
Julius
Similar Messages
-
BAPI /BDC for contract data VA41
hi all,
We have a requirement. We have Contract data in legacy system, and need to migrate that into SAP (VA41). Should i use BAPI or BDC for this.
If i have to use BAPI, Please let me know the BAPI name.
Regards,
KavithaHi Kavitha,
May be this thread provides you some help.
Have a look.
Link:[Thread|Re: Creating Contracts using BAPI_CONTRACT_CREATEFROMDATA;
Have a best day ahead. -
MB1B BDC/BAPI PROBLEM (FOR SAP IS -RETAILS)
i am getting coding block error in mb1b recording while it is running correctly otherwise.i have also tried through bapi but no data is being posted and bapi gives error that data is not maintain in perticular plant whereas the data is there in the plant.
REGDShi please if u dont mind send me BDC for MB1B
please please help me
[email protected] -
FM or BAPI or BDC for clearing open items...
Hello Gurus,
I have to write a code to clear/ close 12 million open G/L items in SAP. Is there a standard SAP FM or BAPI to do this ? Or do I have to write a BDC for this. If I have to write BDC, do I write BDC on T-Code F.13, FB05 or other T-Code.
Regards,
Jainam.
Edited by: Jainam Shah on Sep 23, 2010 5:13 PMIf you have configured the correct clearing criteria in the IMG, then you can just run program SAPF124. Why did you need a shell program with a BDC - are you trying to clear by document within your clearing criteria?
-
hi,
Is there any Bapi or BDC for me12.i think There is no BAPI but you can use ME_DIRECT_INPUT_INFORECORD. otherwise wait for another replies...
Alternatively you can use these FM's
codeME_DB_UPDATE_INFORECORDS Updating info records in database
ME_UPDATE_INFORECORD Update program for purchasing info record
ME_UPDATE_INFORECORD_COND Update price in info record during maintenance from condition transac
ME_UPDATE_INFORECORD_PD Update info records from purchasing documents
Hope this ll be helpful
Thanks & Regards
vinsee -
Hi All,
I need the sample BDC or BAPI Program for Purchase Order Creations upload.
Regards
MustafaHi Mustafa,
The BAPI for PO creation is BAPI_PO_CREATE1.
Have a look at this thread.Link : [Thread|Reg BAPI_PO_CREATE1;.
Hope your query resolves quickly.
Have a best day ahead. -
Is there a BAPI I can use instead of BDC for MMAM.
I want to change material types for a bunch of records in batch. CAn I call a BAPI that would do this instead of BDC for MMAM
hi,
try using the following bapis:
BAPI_MATERIAL_MAINTAINDATA_RT
BAPI_MATERIAL_EDIT
i hope it helps.
regards
arjun -
Hi
I am trying to create a upload program for Maintenance plan using IP01.
If you have a BDC or BAPI program for this, please provide me same.
Regards,
VeeraHi,
Use Function Module:MAINTENANCE_PLAN_POST -
"Java and BAPI Technology for SAP" by by Ken Kroes - Is this book useful?
Howdy partners,
I've got a 'book' called "Java and BAPI Technology for SAP" by by Ken Kroes, Anil Thakur, Gareth M. deBruyn, Robert Lyfareff.
Now, does anyone know if the info in this book is still relevant to the modern SAP world? I mean its still talking about ITS and stuff like that?
Any input will be appreciated.With the blue cover? I have one with the something similar title, but it's quite out of date. There was lot of improvement on the Java side.
So I would prefer something newer from SAP-PRESS. Check the SAP-PRESS site.
BTW I don't consider ITS as an old technology...it was just integrated recently into WAS 640 to make it more powerful. This is the only available technology, which converts classic Dynpro to Webpage dynamically.
Peter -
Hi
I am trying to perform BDC for transaction F-54 (Clear Vendor Down Payment). On the second screen of the transaction, I have to select a row from the table display based on some criteria eg assignment = 'xxx'. Is it true that BDC would not be able to do this?
What alternatives do I have? Are there any BAPIs or function modules for this transaction?
Appreciate any tips. Thanks.Hi,
you must be careful with BDC. It´s a tool for loading data from an external source into SAP, therefore some processing of criteria is restricted or not possible.
You say you have to select a line from the table according to certain criteria. I assume that the information exists already in SAP (someone saved it before). In this case, this is not going to be possible to select the line, unless you can read the data that shows up in the table in order to apply your criteria per coding.
Now, if you had the information in an internal table, you can apply the selection criteria and then select the necessary line and process the BDC.
Try to use transaction SHDB for recording a transaction and then you can read the generated code for BDC and decide, whether it can help you. -
Hi,
I need to make a BDC to upload transaction data for Vendor invoice thru fb60. Can someone help me with making this BDC. I have multiple invoice line items where G/L Accounts can be same for multiple line items.
plz any help soon will be appreciated ...hi Raj,
Here a Example:
report ZTEST
no standard page heading line-size 255.
include bdcrecx1.
start-of-selection.
perform open_group.
perform bdc_dynpro using 'SAPMF05A' '1100'.
perform bdc_field using 'BDC_OKCODE'
'=DUMMY'.
perform bdc_field using 'RF05A-BUSCS'
'R'.
perform bdc_field using 'BDC_CURSOR'
'INVFO-XMWST'.
perform bdc_field using 'INVFO-ACCNT'
'4711'. "LIFNR
perform bdc_field using 'INVFO-BUDAT'
'07.07.2006'.
perform bdc_field using 'INVFO-WRBTR'
'1000'.
perform bdc_field using 'INVFO-WAERS'
'EUR'.
perform bdc_field using 'INVFO-XMWST'
'X'.
perform bdc_field using 'INVFO-MWSKZ'
'V4'.
perform bdc_dynpro using 'SAPMF05A' '1100'.
perform bdc_field using 'BDC_OKCODE'
'=BU'.
perform bdc_field using 'RF05A-BUSCS'
'R'.
perform bdc_field using 'BDC_CURSOR'
'INVFO-XBLNR'.
perform bdc_field using 'INVFO-ACCNT'
'4711'. "LIFNR
perform bdc_field using 'INVFO-XBLNR'
'test'.
perform bdc_field using 'INVFO-WRBTR'
'1.000,00'.
perform bdc_field using 'INVFO-XMWST'
'X'.
perform bdc_field using 'INVFO-MWSKZ'
'V4'.
perform bdc_dynpro using 'SAPMF05A' '1100'.
perform bdc_field using 'INVFO-BLDAT'
'07062006'.
perform bdc_field using 'INVFO-XBLNR'
'TEST'.
perform bdc_field using 'ACGL_ITEM-HKONT(01)'
'467000'.
perform bdc_field using 'ACGL_ITEM-WRBTR(01)'
' 1000'.
perform bdc_field using 'ACGL_ITEM-KOSTL(01)'
'1000'.
perform bdc_transaction using 'FB60'.
perform close_group.
OR Also u can use the
U can use the std batchinput RFBIBL00 (or a BAPI, like BAPI_ACC_DOCUMENT_POST ) instead of to write an own BDC program for FB60.
FB60 is enjoy trx and it couldn't support the BDC for all its functionalities.
For more infor abt the BDC
http://www.sap-img.com/abap/learning-bdc-programming.htm
Assing the points if helpfulll
ranjit
null
null -
Bapi Bdc Combination to create customer
Dear all,
I want to create a customer master from external system. What are the standard bapis are there they re not suitable for my requirement. I approach it in the following way. I did a bdc for xd01 and trying to call it from a rfc fm which i prepared. But the data that i passes from this fm is not reaching my bdc program. If any body have a good idea on this please share your idea with me .
1) I created an import parameter in this i created a structure.
2) the same structure i declare with the same name in bdc report(se38).
The code in the fm is in this way
DATA:
t_cust TYPE zcust_table .(this is the structure name in my fm import tab)
EXPORT t_cust TO MEMORY ID 'TABLE'.
SUBMIT ZBDC_CUSTOMER AND RETURN.
3)
DATA :BEGIN OF zcust OCCURS 100 .
INCLUDE STRUCTURE zcust_table.
DATA:END OF ZCUST.
START-OF-SELECTION.
IMPORT t_cust FROM MEMORY ID 'TABLE'.(Thi is my decalration in se38 bdc program.)
when i executed my fm the value that given in fm is not reaching my table which i declared in bdc program.
Regards,
Madhu.Hi,
Populate all the customer details address details and personal details in KNA1 structure.
Populate Company code details in KNB1 structure.
Populate Sales area details in KNVV structure.
Populate dunning data in KNB5 table.
Populate Tax data in KNVI table
In all the structures other than customer number we have to fill all the primary key fields.
Call the SD_CUSTOMER_MAINTAIN_ALL function module to create customer as below.
Create Customer in SAP
CALL FUNCTION 'SD_CUSTOMER_MAINTAIN_ALL'
EXPORTING
i_kna1 = fs_kna1
i_knb1 = fs_knb1
i_knvv = fs_knvv
i_bapiaddr1 = fs_add1
i_bapiaddr2 = fs_add2
pi_postflag = c_true
IMPORTING
e_kunnr = w_kunnr
TABLES
t_xknb5 = t_knb5
t_xknvi = t_knvi
EXCEPTIONS
client_error = 1
kna1_incomplete = 2
knb1_incomplete = 3
knb5_incomplete = 4
knvv_incomplete = 5
kunnr_not_unique = 6
sales_area_not_unique = 7
sales_area_not_valid = 8
insert_update_conflict = 9
number_assignment_error = 10
number_not_in_range = 11
number_range_not_extern = 12
number_range_not_intern = 13
account_group_not_valid = 14
parnr_invalid = 15
bank_address_invalid = 16
tax_data_not_valid = 17
no_authority = 18
company_code_not_unique = 19
dunning_data_not_valid = 20
knb1_reference_invalid = 21
cam_error = 22
OTHERS = 23.
Check sysubrc to know the error .
Please let me know if you need any further details.
Regards
Madhu -
Hi Sapgurus,
I written one bdc program for CJ20N. My requirement is to create project defination by using existing project defination.
In recording iam clicking network overview buttton but
that ok-code is not capturing what might be the reason.
Iam also atta ching the code please have look and let me know the changes required.
Thanks & regards
Rahul
==========================================
report ZTESTPS4
no standard page heading line-size 255.
include ymm_bdcrecx1.
start-of-selection.
DATA : BEGIN OF IT_DATA OCCURS 0,
VSPSPID1(24), "Project Defination
POST1(40) , "PS Short Description
PLFAZ(10), "Project planned Start Date
PLSEZ(10), "Project Planned finish Date
VORLAGE(24), "Reference Project Defination
SUCHEN(24), "Character String to be Searched
ERSETZEN(24), "character String to be Inserted
AUFNR1(12), "NetWork Number
AUFNR2(12), "NetWork Number
POST2(40), "PS Short Description
END OF IT_DATA.
start-of-selection.
Internal Table T_BDCDATA to store BDC data
Batchinputdata of single transaction
DATA: T_BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE.
Internal Table T_BDC_MSG to store BDC messages
DATA: T_BDC_MSG LIKE STANDARD TABLE OF BDCMSGCOLL INITIAL
SIZE 0 WITH HEADER LINE.
DATA: V_FILE LIKE RLGRAP-FILENAME ,
V_COUNT(5) TYPE C,
V_MESSAGE_CNT(5) TYPE C .
START-OF-SELECTION.
PERFORM OPEN_GROUP.
PERFORM DATA_UPLOAD.
PERFORM CALL_TRANSACTION.
PERFORM CLOSE_GROUP.
PERFORM WRITE_ERROR.
*& Form DATA_UPLOAD
text
--> p1 text
<-- p2 text
FORM DATA_UPLOAD.
*call function ws_upload to retrieve data from a flat file in the
*presentation server into an internal table
CALL FUNCTION 'UPLOAD'
EXPORTING
FILENAME = V_FILE
FILETYPE = 'DAT'
TABLES
DATA_TAB = IT_DATA
EXCEPTIONS
CONVERSION_ERROR = 1
INVALID_TABLE_WIDTH = 2
INVALID_TYPE = 3
NO_BATCH = 4
UNKNOWN_ERROR = 5
GUI_REFUSE_FILETRANSFER = 6
OTHERS = 7.
if ws_upload fails then display appropriate message
IF SY-SUBRC <> 0.
MESSAGE E000 WITH 'Data not Uploaded into internal table'.
ENDIF.
ENDFORM. " DATA_UPLOAD
*& Form CALL_TRANSACTION
text
--> p1 text
<-- p2 text
FORM CALL_TRANSACTION.
DATA : V_IVDAT(10) TYPE C,
V_AKTIV(10) TYPE C,
V_MESSAGE(404) TYPE C.
REFRESH T_BDCDATA.
CLEAR T_BDCDATA.
V_COUNT = 0.
V_MESSAGE_CNT = 0.
LOOP AT IT_DATA .
V_COUNT = V_COUNT + 1.
perform bdc_dynpro using 'SAPLCNPB_M' '1000'.
perform bdc_field using 'BDC_OKCODE'
'=COPY_PRJ'.
perform bdc_dynpro using 'SAPLCJWB' '0110'.
perform bdc_field using 'BDC_CURSOR'
'RCWKP-VORLAGE'.
perform bdc_field using 'BDC_OKCODE'
'=LETC'.
perform bdc_field using 'RCWKP-VSPSPID'
IT_DATA-VSPSPID1.
perform bdc_field using '*PROJ-POST1'
IT_DATA-POST1.
perform bdc_field using '*PROJ-PLFAZ'
IT_DATA-PLFAZ.
perform bdc_field using '*PROJ-PLSEZ'
IT_DATA-PLSEZ.
perform bdc_field using 'RCWBS-PROFL'
perform bdc_field using 'RCWKP-VORLAGE'
IT_DATA-VORLAGE.
perform bdc_field using 'RCWBT-INCLA'
'X'.
perform bdc_field using 'RC62C-COPY_MAT'
'X'.
perform bdc_field using 'RC62C-COPY_AOB'
'X'.
perform bdc_field using 'RC62C-COPY_PST'
'X'.
perform bdc_field using 'RC62C-COPY_MLS'
'X'.
perform bdc_field using 'RC62C-COPY_DOCL'
'X'.
perform bdc_dynpro using 'SAPLCJWB' '0900'.
perform bdc_field using 'BDC_CURSOR'
'PROJ-PSPID'.
perform bdc_field using 'BDC_OKCODE'
'=NUM2'.
perform bdc_dynpro using 'SAPLCJWB' '0560'.
perform bdc_field using 'BDC_CURSOR'
'RCWKP-ERSETZEN'.
perform bdc_field using 'BDC_OKCODE'
'=NUM2'.
perform bdc_field using 'RCWKP-SUCHEN'
IT_DATA-SUCHEN.
perform bdc_field using 'RCWKP-ERSETZEN'
IT_DATA-ERSETZEN.
perform bdc_dynpro using 'SAPLCJWB' '0900'.
perform bdc_field using 'BDC_OKCODE'
'/ENEB'.
perform bdc_field using 'BDC_CURSOR'
'PROJ-PSPID'.
perform bdc_field using 'PROJ-POST1'
'Unit Testing'.
perform bdc_dynpro using 'SAPLSPO3' '0100'.
perform bdc_field using 'BDC_CURSOR'
'SPOP-VARVALUE1'.
perform bdc_field using 'BDC_OKCODE'
'=PICK'.
perform bdc_field using 'SPOP-VARVALUE1'
IT_DATA-AUFNR1.
perform bdc_dynpro using 'SAPLSPO3' '0100'.
perform bdc_field using 'BDC_CURSOR'
'SPOP-VARVALUE1'.
perform bdc_field using 'BDC_OKCODE'
'=PICK'.
perform bdc_field using 'SPOP-VARVALUE1'
IT_DATA-AUFNR2.
perform bdc_dynpro using 'SAPLCNPB_M' '1000'.
perform bdc_field using 'BDC_OKCODE'
'=LTCT'.
*perform bdc_field using 'BDC_CURSOR'
'PROJ-PSPID'.
*perform bdc_field using 'PROJ-PSPID'
'TESTESTSANG8'.
*perform bdc_field using 'PROJ-POST1'
'Unit Testing'.
*perform bdc_field using 'PROJ-VERNR'
'762001'.
*perform bdc_field using 'PROJ-VBUKR'
'7620'.
*perform bdc_field using 'PROJ-WERKS'
'SPI'.
*perform bdc_field using 'PROJ-PLFAZ'
'01.01.2008'.
*perform bdc_field using 'PROJ-PLSEZ'
'31.10.2008'.
*perform bdc_field using 'PROJ-FUNC_AREA'
'600'.
*perform bdc_field using 'PROJ-PRCTR'
'76201-CH'.
*perform bdc_field using 'PROJ-SPROG'
'01.01.2008'.
*perform bdc_field using 'PROJ-EPROG'
'31.01.2008'.
perform bdc_dynpro using 'SAPLCNPB_M' '1000'.
perform bdc_field using 'PROJ-PSPID'
IT_DATA-VSPSPID1.
perform bdc_field using 'PROJ-POST1'
IT_DATA-POST2.
perform bdc_field using 'BDC_OKCODE'
'=SAVE'.
perform bdc_transaction using 'CJ20N'.
perform close_group.
perform close_group.
LOOP AT T_MESSTAB WHERE REC_NO IS INITIAL.
AT FIRST.
V_MESSAGE_CNT = V_MESSAGE_CNT + 1.
T_MESSTAB-REC_NO = V_COUNT.
ENDAT.
MODIFY T_MESSTAB TRANSPORTING REC_NO.
ENDLOOP.
REFRESH T_BDCDATA.
CLEAR T_BDCDATA.
ENDLOOP.
SKIP.
WRITE : /10 'Record Number ', 30 'Error Message'.
SKIP.
endform.
*& Form WRITE_ERROR
text
--> p1 text
<-- p2 text
FORM WRITE_ERROR.
LOOP AT T_MESSTAB.
WRITE : /10 T_MESSTAB-REC_NO , 30 T_MESSTAB-MESSAGE.
ENDLOOP.
ULINE /10(100).
WRITE : /10 'No of Records : ' , V_COUNT.
WRITE : /10 'No of Erroneous Records : ' , V_MESSAGE_CNT.
ULINE /10(100).
ENDFORM. " WRITE_ERROR
*& Form CHECK_BDC
text
--> p1 text
<-- p2 text
FORM CHECK_BDC.
DATA: L_CHECK LIKE YMMT_CHECK_BDC-YCHECK.
SELECT SINGLE YCHECK INTO L_CHECK FROM YMMT_CHECK_BDC
WHERE PROGRAMM EQ SY-REPID
AND YCHECK EQ 'X'.
IF SY-SUBRC NE 0.
MESSAGE S000(YM) WITH 'Execution not possible'.
STOP.
ENDIF.
ENDFORM. " CHECK_BDC
=================================
Include Program
INCLUDE YMM01_BDCRECX1 *
***INCLUDE BDCRECX1.
for programs doing a data transfer by creating a batch-input session
and
for programs doing a data transfer by CALL TRANSACTION USING
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS SESSION RADIOBUTTON GROUP CTU. "create session
SELECTION-SCREEN COMMENT 3(20) TEXT-S07 FOR FIELD SESSION.
selection-screen position 45.
PARAMETERS CTU RADIOBUTTON GROUP CTU default 'X'. "call
"transaction
SELECTION-SCREEN COMMENT 48(20) TEXT-S08 FOR FIELD CTU.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 3(20) TEXT-S01 FOR FIELD GROUP.
selection-screen position 25.
PARAMETERS GROUP(12). "group name of session
SELECTION-SCREEN COMMENT 48(20) TEXT-S05 FOR FIELD CTUMODE.
selection-screen position 70.
PARAMETERS CTUMODE LIKE CTU_PARAMS-DISMODE DEFAULT 'N'.
"A: show all dynpros
"E: show dynpro on error only
"N: do not display dynpro
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 3(20) TEXT-S02 FOR FIELD USER.
selection-screen position 25.
PARAMETERS: USER(12) DEFAULT SY-UNAME. "user for session in batch
SELECTION-SCREEN COMMENT 48(20) TEXT-S06 FOR FIELD CUPDATE.
selection-screen position 70.
PARAMETERS CUPDATE LIKE CTU_PARAMS-UPDMODE DEFAULT 'L'.
"S: synchronously
"A: asynchronously
"L: local
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 3(20) TEXT-S03 FOR FIELD KEEP.
selection-screen position 25.
PARAMETERS: KEEP AS CHECKBOX. "' ' = delete session if finished
"'X' = keep session if finished
SELECTION-SCREEN COMMENT 48(20) TEXT-S09 FOR FIELD E_GROUP.
selection-screen position 70.
parameters E_GROUP(12). "group name of error-session
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 3(20) TEXT-S04 FOR FIELD HOLDDATE.
selection-screen position 25.
PARAMETERS: HOLDDATE LIKE SY-DATUM.
SELECTION-SCREEN COMMENT 51(17) TEXT-S02 FOR FIELD E_USER.
selection-screen position 70.
PARAMETERS: E_USER(12) DEFAULT SY-UNAME. "user for error-session
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 51(17) TEXT-S03 FOR FIELD E_KEEP.
selection-screen position 70.
PARAMETERS: E_KEEP AS CHECKBOX. "' ' = delete session if finished
"'X' = keep session if finished
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 51(17) TEXT-S04 FOR FIELD E_HDATE.
selection-screen position 70.
PARAMETERS: E_HDATE LIKE SY-DATUM.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN SKIP.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(33) TEXT-S10 FOR FIELD NODATA.
PARAMETERS: NODATA DEFAULT '/' LOWER CASE. "nodata
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(33) FOR FIELD SMALLLOG.
PARAMETERS: SMALLLOG as checkbox. "' ' = log all transactions
"'X' = no transaction logging
SELECTION-SCREEN END OF LINE.
data definition
Batchinputdata of single transaction
DATA: BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE.
DATA : BEGIN OF T_MESSTAB OCCURS 0,
REC_NO(5) TYPE C,
MESSAGE(250) TYPE C,
END OF T_MESSTAB.
messages of call transaction
DATA: MESSTAB LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.
error session opened (' ' or 'X')
DATA: E_GROUP_OPENED.
message texts
TABLES: T100.
at selection screen *
AT SELECTION-SCREEN.
group and user must be filled for create session
IF SESSION = 'X' AND
GROUP = SPACE OR USER = SPACE.
MESSAGE E613(MS).
ENDIF.
open dataset *
FORM OPEN_DATASET USING P_DATASET.
OPEN DATASET P_DATASET IN TEXT MODE.
IF SY-SUBRC <> 0.
WRITE: / TEXT-E00, SY-SUBRC.
STOP.
ENDIF.
ENDFORM.
close dataset *
FORM CLOSE_DATASET USING P_DATASET.
CLOSE DATASET P_DATASET.
ENDFORM.
create batchinput session *
(not for call transaction using...) *
FORM OPEN_GROUP.
IF SESSION = 'X'.
SKIP.
WRITE: /(20) 'Create group'(I01), GROUP.
SKIP.
open batchinput group
CALL FUNCTION 'BDC_OPEN_GROUP'
EXPORTING CLIENT = SY-MANDT
GROUP = GROUP
USER = USER
KEEP = KEEP
HOLDDATE = HOLDDATE.
WRITE: /(30) 'BDC_OPEN_GROUP'(I02),
(12) 'returncode:'(I05),
SY-SUBRC.
ENDIF.
ENDFORM.
end batchinput session *
(call transaction using...: error session) *
FORM CLOSE_GROUP.
IF SESSION = 'X'.
close batchinput group
CALL FUNCTION 'BDC_CLOSE_GROUP'.
WRITE: /(30) 'BDC_CLOSE_GROUP'(I04),
(12) 'returncode:'(I05),
SY-SUBRC.
ELSE.
IF E_GROUP_OPENED = 'X'.
CALL FUNCTION 'BDC_CLOSE_GROUP'.
WRITE: /.
WRITE: /(30) 'Fehlermappe wurde erzeugt'(I06).
ENDIF.
ENDIF.
ENDFORM.
Start new transaction according to parameters *
FORM BDC_TRANSACTION USING TCODE.
DATA: L_MSTRING(480).
DATA: L_SUBRC LIKE SY-SUBRC.
batch input session
IF SESSION = 'X'.
CALL FUNCTION 'BDC_INSERT'
EXPORTING TCODE = TCODE
TABLES DYNPROTAB = BDCDATA.
IF SMALLLOG <> 'X'.
WRITE: / 'BDC_INSERT'(I03),
TCODE,
'returncode:'(I05),
SY-SUBRC,
'RECORD:',
SY-INDEX.
ENDIF.
call transaction using
ELSE.
REFRESH MESSTAB.
CALL TRANSACTION TCODE USING BDCDATA
MODE CTUMODE
UPDATE CUPDATE
MESSAGES INTO MESSTAB.
L_SUBRC = SY-SUBRC.
IF SMALLLOG <> 'X'.
WRITE: / 'CALL_TRANSACTION',
TCODE,
'returncode:'(I05),
L_SUBRC,
'RECORD:',
SY-INDEX.
LOOP AT MESSTAB WHERE MSGTYP = 'E'.
SELECT SINGLE * FROM T100 WHERE SPRSL = MESSTAB-MSGSPRA
AND ARBGB = MESSTAB-MSGID
AND MSGNR = MESSTAB-MSGNR.
IF SY-SUBRC = 0.
L_MSTRING = T100-TEXT.
IF L_MSTRING CS '&1'.
REPLACE '&1' WITH MESSTAB-MSGV1 INTO L_MSTRING.
REPLACE '&2' WITH MESSTAB-MSGV2 INTO L_MSTRING.
REPLACE '&3' WITH MESSTAB-MSGV3 INTO L_MSTRING.
REPLACE '&4' WITH MESSTAB-MSGV4 INTO L_MSTRING.
ELSE.
REPLACE '&' WITH MESSTAB-MSGV1 INTO L_MSTRING.
REPLACE '&' WITH MESSTAB-MSGV2 INTO L_MSTRING.
REPLACE '&' WITH MESSTAB-MSGV3 INTO L_MSTRING.
REPLACE '&' WITH MESSTAB-MSGV4 INTO L_MSTRING.
ENDIF.
CONDENSE L_MSTRING.
T_MESSTAB-MESSAGE = L_MSTRING(250) .
APPEND T_MESSTAB.
ELSE.
ENDIF.
ENDLOOP.
SKIP.
ENDIF.
Erzeugen fehlermappe ************************************************
IF L_SUBRC <> 0 AND E_GROUP <> SPACE.
IF E_GROUP_OPENED = ' '.
CALL FUNCTION 'BDC_OPEN_GROUP'
EXPORTING CLIENT = SY-MANDT
GROUP = E_GROUP
USER = E_USER
KEEP = E_KEEP
HOLDDATE = E_HDATE.
E_GROUP_OPENED = 'X'.
ENDIF.
CALL FUNCTION 'BDC_INSERT'
EXPORTING TCODE = TCODE
TABLES DYNPROTAB = BDCDATA.
ENDIF.
ENDIF.
REFRESH BDCDATA.
ENDFORM.
Start new screen *
FORM BDC_DYNPRO USING PROGRAM DYNPRO.
CLEAR BDCDATA.
BDCDATA-PROGRAM = PROGRAM.
BDCDATA-DYNPRO = DYNPRO.
BDCDATA-DYNBEGIN = 'X'.
APPEND BDCDATA.
ENDFORM.
Insert field *
FORM BDC_FIELD USING FNAM FVAL.
IF FVAL <> ' '.
CLEAR BDCDATA.
BDCDATA-FNAM = FNAM.
BDCDATA-FVAL = FVAL.
APPEND BDCDATA.
ENDIF.
ENDFORM.
==========================================Hi,
As Tx. CJ20N is an Enjoy SAP Transaction, it is not possible to use this effectively in BDCs. So i suggest that you use following methods:
BAPI: BAPI_PROJECT_MAINTAIN to create & maintain a Project. check the BAPI documentation for the details.
Else use Tx. CJ20 in the BDC.
Best Regards, Murugesh -
hi friends.
how to create a bdc for va01... i need step by step procedure. please help me...Hi
BDC (Batch Data Communication) works based on the data in the Internal table of structure "BDCDATA", and some of the very important lines with information (in sequence) Dynpro, Cursor-field and Data Fields, then call Transaction / Session Creation Logic.
In Call Transaction method of BDC, the Message is handled manually using the structure "BDCMSGCOLL" and by refering to messages in "T100" Table. [Refer the standard Include BECRECX1 for more information.
BDC can be created by Recording tool or my scracth creating a new program. Use transaction code 'SHDB'.
A sample code by using the Recording method (Here both Call transaction and Session Method of BDC will be created by standard Recording tool [this you can find in include BDCRECX1])
Code Only the Program, withoug Include BDCRECX1 (This std, inclu you can find)
***INCLUDE BDCRECX1.
* for programs doing a data transfer by creating a batch-input session
* and
* for programs doing a data transfer by CALL TRANSACTION USING
selection-screen begin of line.
parameters session radiobutton group ctu. "create session
selection-screen comment 3(20) text-s07 for field session.
selection-screen position 45.
parameters ctu radiobutton group ctu. "call transaction
selection-screen comment 48(20) text-s08 for field ctu.
selection-screen end of line.
selection-screen begin of line.
selection-screen comment 3(20) text-s01 for field group.
selection-screen position 25.
parameters group(12). "group name of session
selection-screen comment 48(20) text-s05 for field ctumode.
selection-screen position 70.
parameters ctumode like ctu_params-dismode default 'N'.
"A: show all dynpros
"E: show dynpro on error only
"N: do not display dynpro
selection-screen end of line.
selection-screen begin of line.
selection-screen comment 3(20) text-s02 for field user.
selection-screen position 25.
parameters: user(12) default sy-uname. "user for session in batch
selection-screen comment 48(20) text-s06 for field cupdate.
selection-screen position 70.
parameters cupdate like ctu_params-updmode default 'L'.
"S: synchronously
"A: asynchronously
"L: local
selection-screen end of line.
selection-screen begin of line.
selection-screen comment 3(20) text-s03 for field keep.
selection-screen position 25.
parameters: keep as checkbox. "' ' = delete session if finished
"'X' = keep session if finished
selection-screen comment 48(20) text-s09 for field e_group.
selection-screen position 70.
parameters e_group(12). "group name of error-session
selection-screen end of line.
selection-screen begin of line.
selection-screen comment 3(20) text-s04 for field holddate.
selection-screen position 25.
parameters: holddate like sy-datum.
selection-screen comment 51(17) text-s02 for field e_user.
selection-screen position 70.
parameters: e_user(12) default sy-uname. "user for error-session
selection-screen end of line.
selection-screen begin of line.
selection-screen comment 51(17) text-s03 for field e_keep.
selection-screen position 70.
parameters: e_keep as checkbox. "' ' = delete session if finished
"'X' = keep session if finished
selection-screen end of line.
selection-screen begin of line.
selection-screen comment 51(17) text-s04 for field e_hdate.
selection-screen position 70.
parameters: e_hdate like sy-datum.
selection-screen end of line.
selection-screen skip.
selection-screen begin of line.
selection-screen comment 1(33) text-s10 for field nodata.
parameters: nodata default '/' lower case. "nodata
selection-screen end of line.
selection-screen begin of line.
selection-screen comment 1(33) text-s11 for field smalllog.
parameters: smalllog as checkbox. "' ' = log all transactions
"'X' = no transaction logging
selection-screen end of line.
* data definition
* Batchinputdata of single transaction
data: bdcdata like bdcdata occurs 0 with header line.
* messages of call transaction
data: messtab like bdcmsgcoll occurs 0 with header line.
* error session opened (' ' or 'X')
data: e_group_opened.
* message texts
tables: t100.
* at selection screen *
at selection-screen.
* group and user must be filled for create session
if session = 'X' and
group = space or user = space.
message e613(ms).
endif.
* open dataset *
form open_dataset using p_dataset.
open dataset p_dataset
for input in text mode
encoding default.
if sy-subrc <> 0.
write: / text-e00, sy-subrc.
stop.
endif.
endform.
* close dataset *
form close_dataset using p_dataset.
close dataset p_dataset.
endform.
* create batchinput session *
* (not for call transaction using...) *
form open_group.
if session = 'X'.
skip.
write: /(20) 'Create group'(i01), group.
skip.
* open batchinput group
call function 'BDC_OPEN_GROUP'
exporting client = sy-mandt
group = group
user = user
keep = keep
holddate = holddate.
write: /(30) 'BDC_OPEN_GROUP'(i02),
(12) 'returncode:'(i05),
sy-subrc.
endif.
endform.
* end batchinput session *
* (call transaction using...: error session) *
form close_group.
if session = 'X'.
* close batchinput group
call function 'BDC_CLOSE_GROUP'.
write: /(30) 'BDC_CLOSE_GROUP'(i04),
(12) 'returncode:'(i05),
sy-subrc.
else.
if e_group_opened = 'X'.
call function 'BDC_CLOSE_GROUP'.
write: /.
write: /(30) 'Fehlermappe wurde erzeugt'(i06).
e_group_opened = ' '.
endif.
endif.
endform.
* Start new transaction according to parameters *
form bdc_transaction using tcode.
data: l_mstring(480).
data: l_subrc like sy-subrc.
* batch input session
if session = 'X'.
call function 'BDC_INSERT'
exporting tcode = tcode
tables dynprotab = bdcdata.
if smalllog <> 'X'.
write: / 'BDC_INSERT'(i03),
tcode,
'returncode:'(i05),
sy-subrc,
'RECORD:',
sy-index.
endif.
* call transaction using
else.
refresh messtab.
call transaction tcode using bdcdata
mode ctumode
update cupdate
messages into messtab.
l_subrc = sy-subrc.
if smalllog <> 'X'.
write: / 'CALL_TRANSACTION',
tcode,
'returncode:'(i05),
l_subrc,
'RECORD:',
sy-index.
loop at messtab.
select single * from t100 where sprsl = messtab-msgspra
and arbgb = messtab-msgid
and msgnr = messtab-msgnr.
if sy-subrc = 0.
l_mstring = t100-text.
if l_mstring cs '&1'.
replace '&1' with messtab-msgv1 into l_mstring.
replace '&2' with messtab-msgv2 into l_mstring.
replace '&3' with messtab-msgv3 into l_mstring.
replace '&4' with messtab-msgv4 into l_mstring.
else.
replace '&' with messtab-msgv1 into l_mstring.
replace '&' with messtab-msgv2 into l_mstring.
replace '&' with messtab-msgv3 into l_mstring.
replace '&' with messtab-msgv4 into l_mstring.
endif.
condense l_mstring.
write: / messtab-msgtyp, l_mstring(250).
else.
write: / messtab.
endif.
endloop.
skip.
endif.
** Erzeugen fehlermappe ************************************************
if l_subrc <> 0 and e_group <> space.
if e_group_opened = ' '.
call function 'BDC_OPEN_GROUP'
exporting client = sy-mandt
group = e_group
user = e_user
keep = e_keep
holddate = e_hdate.
e_group_opened = 'X'.
endif.
call function 'BDC_INSERT'
exporting tcode = tcode
tables dynprotab = bdcdata.
endif.
endif.
refresh bdcdata.
endform.
* Start new screen *
form bdc_dynpro using program dynpro.
clear bdcdata.
bdcdata-program = program.
bdcdata-dynpro = dynpro.
bdcdata-dynbegin = 'X'.
append bdcdata.
endform.
* Insert field *
form bdc_field using fnam fval.
if fval <> nodata.
clear bdcdata.
bdcdata-fnam = fnam.
bdcdata-fval = fval.
append bdcdata.
endif.
endform.
Refer this link as an example:
<b>http://www.sap-img.com/abap/bdc-example-using-table-control-in-bdc.htm</b>
Alternatively, Press the Item To Top Button(The 4th from left)Under the Item Table control, every time you want to enter item details,
This would bring the item to the top of the table control every time.
Record the transaction this way, and code for your BDC.
Another alternative is to use a bapi:
<b>BAPI_SALESORDER_CREATEFROMDAT2</b>
Regards,
Rk
Message was edited by:
Rk Pasupuleti -
Hi,
I need to develop BDC for transaction FAGLSKF. I tried recording the transaction and found that the line items are not getting recorded since the transaction uses an editable ALV and not a table control. I have seen some post regarding this but everyone is saying to use some FM's but all these FM's are not yet released by SAP & even if i use it I still have to seperately take care of validations. Please let me know if anyone has faced this issue and found an alternative.
Thanks,
AntonyHi ,
Check this BAPI Function module BAPI_ACC_STAT_KEY_FIG_POST.
Regards,
Ashok.
Maybe you are looking for
-
Flash player plugin has been blocked
It also says this Add-ons Extensions Themes Collections More- Add-ons for Firefox Blocklist Flash Player Plugin between 11.0 and 11.... Flash Player Plugin between 11.0 and 11.7.700.169 (click-to-play) has been blocked for your protection. Why w
-
My previous post relating to this has not inspired any responses, so I'll try to simplify the question. I'm using Acrobat Pro 8 with MAC (OS 10.4.11). In Acrobat help documents, it is said that advanced search options may be selected at the bottom of
-
RMI Codebase Passing Arguments
I'm new to RMI and Java.How do you pass arguments using serialization in RMI? I'll be passing the arguments from a servlet. for example if i want to pass a string object from a servlet to the calling client service. Thanks
-
DTW error in oInventoryGenEntry
Getting the following error when trying to import inventory with batch quantities using oInventoryGenEntry: Internal Error (-5002) occuredApplication-defined or object-defined erroroInvenotryGenEntry Import is using the templates document.csv, docume
-
I have one query below to tune. Here one table USER_RETAILER_MAP and its column BELONGS_TO having value only 'Y' and 'N'. Created bitmap index but i am not getting any cost difference. Please share your idea ,how to tune and what process should follo