BDC for Transaction IA01 including recording from excel (sample Code)
Dear Experts,
Can anyone give me a sample BDC code for transaction IA01 from excel
Thanks in advance
Regards
Sayandeep
Hi,
Try This Code
report Y_P_GB01
no standard page heading line-size 255.
R O H M A N D H A A S C O M P A N Y *
======================================================================
Development ID : mqhpkl *
Creation Date : 24-11-2008 *
Developer Name : Paramesh Kalluri *
Program Title : Upload the Special Ledger data from Excel to SAP *
Description : *
Constants *
CONSTANTS: c_begcol TYPE i VALUE 1,
c_begrow TYPE i VALUE 1,
c_endcol TYPE i VALUE 10,
c_endrow TYPE i VALUE 10.
Types Declaration *
TYPES : begin of d_itab,
data element: BUKRS
BUKRS_001(004),
data element: DOCTY
DOCTY_002(002),
data element: RVERS
RVERS_003(003),
data element: BUDAT
DATE_004(010),
data element: RTCUR
RTCUR_005(005),
data element: GCURR_A
GCURR_006(005),
data element:
GD_USE_TARGET_LEDGER_007(001),
data element:
TARGET_LEDGER_008(002),
data element: UTAB_D
UTAB_009(030),
data element: VTCUR12
TSL_010(019),
end of d_itab.
Data Declarations *
DATA: it_bdcdata LIKE bdcdata OCCURS 0 WITH HEADER LINE,
it_bdcmsgcoll LIKE bdcmsgcoll OCCURS 0 WITH HEADER LINE,
XL_itab type alsmex_tabline occurs 0 with header line,
msg_disp TYPE string.
data : it_itab type standard table of d_itab,
wa_itab type d_itab.
Selection Screen *
SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS: p_file LIKE rlgrap-filename.
SELECTION-SCREEN: END OF BLOCK b1.
At Selection Screen for File *
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
perform f4_filename.
Start-of-selection *
start-of-selection.
*Uploading the data from excel to internal table
perform excel_upload.
*Uploading to SAP
perform chek_data.
if sy-subrc ne 0.
perform format_message.
endif.
end-of-selection.
*& Form F4_FILENAME
Find the file
--> p1 text
<-- p2 text
FORM F4_FILENAME .
CALL FUNCTION 'F4_FILENAME'
IMPORTING
FILE_NAME = p_file.
ENDFORM. " F4_FILENAME
*& Form CHEK_DATA
text
--> p1 text
<-- p2 text
FORM CHEK_DATA .
loop at it_itab into wa_itab.
perform bdc_dynpro using 'SAPMGBUK' '0102'.
perform bdc_field using 'BDC_CURSOR'
'GLU1-BUKRS'.
perform bdc_field using 'BDC_OKCODE'
'=ERF'.
perform bdc_field using 'GLU1-BUKRS'
wa_itab-bukrs_001.
perform bdc_field using 'GLU1-DOCTY'
wa_itab-docty_002.
perform bdc_field using 'GLU1-RVERS'
wa_itab-RVERS_003.
perform bdc_field using 'RGBUK-DATE'
wa_itab-DATE_004.
perform bdc_field using 'GLU1-RTCUR'
wa_itab-RTCUR_005.
perform bdc_field using 'RGBUK-GCURR'
wa_itab-GCURR_006.
perform bdc_field using 'GD_USE_TARGET_LEDGER'
wa_itab-GD_USE_TARGET_LEDGER_007.
perform bdc_field using 'TARGET_LEDGER'
wa_itab-TARGET_LEDGER_008.
perform bdc_field using 'T883S-UTAB'
wa_itab-UTAB_009.
perform bdc_dynpro using 'SAPMGBUK' '0110'.
perform bdc_field using 'BDC_CURSOR'
'GLU1-TSL'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'GLU1-TSL'
wa_itab-TSL_010.
perform bdc_dynpro using 'SAPMGBUK' '0110'.
perform bdc_field using 'BDC_OKCODE'
'/EBACK'.
perform bdc_field using 'BDC_CURSOR'
'GLU1-TSL'.
perform bdc_dynpro using 'SAPLSPO1' '0200'.
perform bdc_field using 'BDC_OKCODE'
'=YES'.
perform bdc_dynpro using 'SAPMGBUK' '0102'.
perform bdc_field using 'BDC_OKCODE'
'/EBACK'.
perform bdc_field using 'BDC_CURSOR'
'GLU1-BUKRS'.
CALL TRANSACTION 'GB01' USING IT_BDCDATA MODE 'A' UPDATE 'A' MESSAGES
INTO IT_BDCMSGCOLL.
CLEAR WA_ITAB.
refresh it_bdcdata.
ENDLOOP.
ENDFORM. " CHEK_DATA
*& Form EXCEL_UPLOAD
text
--> p1 text
<-- p2 text
FORM EXCEL_UPLOAD .
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
FILENAME = p_file
I_BEGIN_COL = c_begcol
I_BEGIN_ROW = c_begrow
I_END_COL = c_endcol
I_END_ROW = c_endrow
TABLES
INTERN = xl_itab.
EXCEPTIONS
INCONSISTENT_PARAMETERS = 1
UPLOAD_OLE = 2
OTHERS = 3
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
loop at xl_itab.
case xl_itab-col.
when '1'.
wa_itab-bukrs_001 = xl_itab-value.
when '2'.
wa_itab-docty_002 = xl_itab-value.
when '3'.
wa_itab-RVERS_003 = xl_itab-value.
when '4'.
wa_itab-DATE_004 = xl_itab-value.
when '5'.
wa_itab-RTCUR_005 = xl_itab-value.
when '6'.
wa_itab-GCURR_006 = xl_itab-value.
when '7'.
wa_itab-GD_USE_TARGET_LEDGER_007 = xl_itab-value.
when '8'.
wa_itab-TARGET_LEDGER_008 = xl_itab-value.
when '9'.
wa_itab-UTAB_009 = xl_itab-value.
when '10'.
wa_itab-TSL_010 = xl_itab-value.
*at end of row.
append wa_itab to it_itab.
*endat.
endcase.
at end of row.
append wa_itab to it_itab.
endat.
endloop.
ENDFORM. " EXCEL_UPLOAD
*& Form BDC_DYNPRO
text
-->P_0169 text
-->P_0170 text
FORM BDC_DYNPRO USING A B.
clear it_bdcdata.
it_bdcdata-PROGRAM = A.
it_bdcdata-DYNPRO = B.
it_bdcdata-DYNBEGIN = 'X'.
APPEND it_bdcdata.
ENDFORM. " BDC_DYNPRO
*& Form BDC_FIELD
text
-->P_0174 text
-->P_0175 text
FORM BDC_FIELD USING C D.
clear
it_bdcdata.
it_bdcdata-FNAM = C.
it_bdcdata-FVAL = D.
APPEND it_bdcdata.
ENDFORM. " BDC_FIELD
*& Form FORMAT_MESSAGE
text
--> p1 text
<-- p2 text
FORM FORMAT_MESSAGE .
LOOP AT IT_BDCMSGCOLL.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
ID = IT_BDCMSGCOLL-MSGID
LANG = '-D'
NO = it_bdcmsgcoll-msgnr
V1 = IT_BDCMSGCOLL-MSGV1
V2 = IT_BDCMSGCOLL-MSGV2
V3 = IT_BDCMSGCOLL-MSGV3
V4 = IT_BDCMSGCOLL-MSGV4
IMPORTING
MSG = MSG_DISP
EXCEPTIONS
NOT_FOUND = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
WRITE:/ MSG_DISP.
ENDLOOP.
ENDFORM. " FORMAT_MESSAGE
******************End of the Program**********
All the best
Similar Messages
-
Hi All, I developed a BDC for transaction IE02
Hi All, I developed a BDC for transaction IE02, when i am uploading data into this bdc 'validity period' is automatically taking the present system date, as in program i have not given any validations for this validity from Can anyone guide me on this as so why the data in validity from is taking present system date and how do i avoid it.
Thanks..!!!
Regards,
SwarnaHi Swarna,
AS you mention IE02 Validity From is not editable.
If you capturing this field in BDC then you can put hard-code date value sy-datum in this field , no need to chnage in excel or manual update every time.
and If you are not capturing this field in BDC then please try to use BAPI for uploading data.
like.
BAPI_EQUI_CHANGE or
BAPI_EQMT_MODIFY.
Regards,
Prasenjit -
Hi Experts,
I am trying to develop BDC for transaction J1IFQ .
When I do recording at the end I press SAVE it give me message that record is reconcilie and then I press logout.
But when I use same recording in my program it dosn't save data. I am not able to find out what is the problem, please guide me.
Thanking you.Hi Narayani
It seems you need to inspect the new flow of the transaction and your BDC program more carefully. You might have skiped somethings to change.
*--Serdar <a href="https://www.sdn.sap.com:443http://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.sdn.businesscard.sdnbusinesscard?u=qbk%2bsag%2bjiw%3d">[ BC ]</a> -
Program does BDC for transaction F-52 or f-53
Hi GuruI am functional person and working with a developer in a program . The program does BDC for transaction F-52 or f-53 . I am uploading a file ,so that the program picks it and o either F-52 or F-53 based on condition. When i try to upload the program with mulitple record ,i am getting the message difference is too large to clear . If i execute the same program without doing any changes again i can see few more records getting posted . when i do next time remaining records are posted . Insted of getting posted in one ,I have to execute the program more than once .can any one help me out why this is happening
i think you should ask your programmer to use transaction SM35 to process the BDC in foreground mode (first changing the mode to A). I would think you will see what's going wrong then. There are a few transactions that look different in foreground mode than in background and you will see where the difference is if you use this method to process
-
Hi,
I am trying to write BDC for transaction WB02 , wherein each site(Plant) in our company is to be made a customer of each other, so as to fecilitate inter-site movement of goods. the transaction works fine normally, but at the time of recording it comes to screen '315' and gets stuck and dont move ahead or either go back, it just gets stuck there, and has to be terminated.. i tried to replicate the transaction thru' BDC but it is getting stuck at the same screen.. can anybody tell me why this is happening and the possible solution for it..
thanks.
sharonHi,
What u can do is Read your Messages table with message types E(Error) and A(Abort). IF NOT sy-subrc IS INITIAlL means your transaction is successfull. So u can give your custom message saying IDOC sent successfully.
READ TABLE IT_BDCMSGCOLL WITh KEY TYPE = 'E'.
IF NOT sy-subrc IS INITIAL.
READ TABLE IT_BDCMSGCOLL WITH KEY TYPE = 'A'
IF NOT sy-subrc IS INITIAL.
MESSAGE i000 WITH 'IDOC sent successfully'.
ELSE.
MESSAGE i000 WITH 'Problem in sending IDOC'.
ENDIF.
ELSE.
MESSAGE i000 WITH 'Problem in sending IDOC'.
ENDIF.
Thanks,
Vinod. -
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. -
Import Transactions as Journal Voucher from Excel
Hi,
Customer would like to import transactions into Journal Voucher from Excel using the Administration > Data Import > Import Transactions from SAP Business One option. Please note that customer does not want to use DTW for data import.
Is there any documentation which I can refer to for importing transactions into JV in B1? Please provide the link if any.
Thanks and regards,
PriscillaHey Ramzi ,
I tried the code so many times and every time there is a sign error in this line :
If lRetCode <> 0 Then
sErrMsg = oCompany.GetLastErrorDescription
MsgBox sErrMsg & " - Ligne entete n°: " & j - 10, vbCritical, " ERREUR"
Worksheets("entete").Cells(j, 1).Font.Color = vbRed
can you help me to understand why i have msg error ?
Thanks in advance -
Creating bdc for transaction f-02 ?
Hi People,
I am going a bdc for transaction f-02 ..... my template involves 7 posting keys ( 40 50 31 01 29 09 70 ) ... depending up
on the posting key the next screen will change .......... can you people tel me how to do this and what are all the logic
involved in this program ?
thanks u all in advance.
SivaHi,
Please use the following format for your upload file template
DocDate1 ComCd1 Currency1 pstky1
DocDate1 ComCd1 Currency1 pstky2
DocDate1 ComCd1 Currency1 pstky3
DocDate2 ComCd2 Currency2 pstky1
DocDate2 ComCd2 Currency2 pstky2
Then use the following logic.
At New Currency1
add the header data
DocDate1 ComCd1 Currency1
Thus this code will run only once for every new Header
and remain in the screen till posting key are entered.
Regards,
Lokesh
Edited by: Lokesh Tibbani on Sep 5, 2008 12:17 PM -
Hi,
Any idea how to write BDC for transaction F-02?
The problem is how do we upload one item after another within the same loop?
Regards,
NabaYou may solve easily your problem writing the data in the LOOP like
LOOP AT IT_BSEG
" if first line, fill BDCDATA for header and the first line call
" if not first line, fill BDCDATA for the bottom of the previous line
" fill ok code for next line
" fill BDCDATA for the current line
ENDLOOP.
" fill ok code for save and call transaction
But it should be easier to use FM like [POSTING_INTERFACE_START|https://www.sdn.sap.com/irj/scn/advancedsearch?query=posting_interface_start&cat=sdn_all]; [POSTING_INTERFACE_DOCUMENT|https://www.sdn.sap.com/irj/scn/advancedsearch?cat=sdn_all&query=posting_interface_document&adv=false&sortby=cm_rnd_rankvalue] and [POSTING_INTERFACE_END|https://www.sdn.sap.com/irj/scn/advancedsearch?cat=sdn_all&query=posting_interface_end&adv=false&sortby=cm_rnd_rankvalue], those function modules will build the BDC flow.
Another, and better solution is to use [BAPI_ACC_DOCUMENT_POST|https://www.sdn.sap.com/irj/scn/advancedsearch?cat=sdn_all&query=bapi_acc_document_post&adv=false&sortby=cm_rnd_rankvalue].
Regards -
FM FOR CREATING NEW CONDITION RECORDS FROM INPUT FILE
Hello vikas,
I need to develop a interface program FOR CREATING NEW CONDITION RECORDS FROM INPUT FILE.
Is there ay function module to update or create the condtion records,
if u have any example interface program to update conditions records please send me.
regards
ram.This must be your compiler output.
Basically, it is telling you two things that are wrong - in syntax.
1. On line number 11 of the file RationalCollection1.java, the compiler expects a type identifier - that would be the object or return type such as int, String, boolean, etc.
The reason it is doing this is probably due to your not ending a previous statement - like the "expected ';'" error statement. Check your code, make sure that methods (brackets) are closed correctly and there are no open statements (i.e. missing the semi-colen at the end).
2. On line number 33 of the file RationalCollection1.java, the compiler expected the closing bracket. Thus, you didn't put the bracket where the compiler wants it.
It appears that you have skipped some lines of code. Those lines are the problem, post them - post lines 30-36 and 9-15 so we can see what is happening around those error lines. -
Transfer Customer Master records from one company code to another company.
hi ,
working on a rollout project ,
needed to transfer Customer Master records from one company code to another company code.
is there any sap standard BDC/T-code as in case of Vendor Master FK15,Fk16(T-CODE) .
thanks in advance.
rahul
Edited by: RAHUL SINGH on Jul 22, 2009 9:05 AMHi,
I think you should ask this question in functional consultant forum.
Thanks, -
How to do bdc for transaction cn22
Hi team,
I had done recording for cn22 for long text.Iam able to upload the data from the excel sheet and i can change the long text.But my problem is my long text is a paragraph and iam not able to do for a paragragh.my sample code is
REPORT ZCN22_TEST
NO STANDARD PAGE HEADING LINE-SIZE 255.
TYPE-POOLS: TRUXS.
*include bdcrecx1.
Generated data section with specific formatting - DO NOT CHANGE ***
TYPES: BEGIN OF TH_CAUFVD,
data element: AUFNR
AUFNR_001(012),
END OF TH_CAUFVD.
TYPES : BEGIN OF T_CAUFVD,
AUFNR_001(012),
VORNR_002(004),
FLG_SEL_01_003,
data element: TXLINE
TXLINE_02_004 type txline,
TXLINE_02_004 TYPE STRING,
END OF T_CAUFVD.
DATA :FLG_SEL_01_003 TYPE C.
*FLG_SEL_01_003 = X.
*& Internal Table
DATA :IH_CAUFVD TYPE STANDARD TABLE OF TH_CAUFVD,
I_CAUFVD TYPE STANDARD TABLE OF T_CAUFVD,
I_BDCDATA TYPE TABLE OF BDCDATA WITH HEADER LINE,
MESSTAB TYPE TABLE OF BDCMSGCOLL WITH HEADER LINE.
*& Work Area
DATA :WH_CAUFVD TYPE TH_CAUFVD,
W_CAUFVD TYPE T_CAUFVD ,
W_TEXT TYPE TABLE OF TLINE WITH HEADER LINE,
W_HEADER TYPE TABLE OF THEAD WITH HEADER LINE.
Gloable Variable
DATA : V_FILENAME TYPE STRING,
V_MSG TYPE STRING,
V_COUNT(2) TYPE N,
V_VAL(15).
SELECTION-SCREEN BEGIN OF BLOCK A WITH FRAME TITLE TEXT-001.
PARAMETERS: FILENAME LIKE RLGRAP-FILENAME.
SELECTION-SCREEN END OF BLOCK A.
SELECTION-SCREEN BEGIN OF BLOCK B WITH FRAME TITLE TEXT-002.
PARAMETERS P_FRMLIN TYPE I DEFAULT 2. " From Line No
PARAMETERS P_TOLINE TYPE I. " To Line No
SELECTION-SCREEN END OF BLOCK B.
*& At Selection Screen on value-request
AT SELECTION-SCREEN ON VALUE-REQUEST FOR FILENAME.
*For F4 Help for the file.
PERFORM GET_FILE.
*& Start-of-selection
START-OF-SELECTION.
*For transfering the data from flatfile to internal table.
PERFORM UPLOAD_FILE.
*start of recording
DATA L_CAUFVD LIKE W_CAUFVD.
*Read TABLE I_caufvd into l_caufvd index 1.
LOOP AT IH_CAUFVD INTO WH_CAUFVD.
ON CHANGE OF WH_CAUFVD-AUFNR_001.
PERFORM BDC_DYNPRO USING 'SAPLCOKO' '2000'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'CAUFVD-AUFNR'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=LIST'.
PERFORM BDC_FIELD USING 'CAUFVD-AUFNR'
WH_CAUFVD-AUFNR_001.
PERFORM BDC_DYNPRO USING 'SAPLCOVG' '2000'.
*start loop for n items
LOOP AT I_CAUFVD INTO W_CAUFVD
WHERE AUFNR_001 = WH_CAUFVD-AUFNR_001.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=POSI'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'AFVGD-VORNR(01)'.
PERFORM BDC_DYNPRO USING 'SAPLCOVG' '2200'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=ENT1'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'AFVGD-VORNR'.
PERFORM BDC_FIELD USING 'AFVGD-VORNR'
W_CAUFVD-VORNR_002.
PERFORM BDC_DYNPRO USING 'SAPLCOVG' '2000'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=LTXT'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'AFVGD-VORNR(01)'.
PERFORM BDC_FIELD USING 'RC27X-FLG_SEL(01)'
'X'.
PERFORM BDC_DYNPRO USING 'SAPLSTXX' '1100'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'RSTXT-TXLINE(02)'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=TXBA'.
PERFORM BDC_FIELD USING 'RSTXT-TXLINE(02)'
W_CAUFVD-TXLINE_02_004.
PERFORM BDC_DYNPRO USING 'SAPLCOVG' '2000'.
*perform bdc_field using 'BDC_OKCODE'
'=POSI'.
*perform bdc_field using 'BDC_CURSOR'
'AFVGD-VORNR(01)'.
PERFORM BDC_FIELD USING 'RC27X-FLG_SEL(01)'
ENDLOOP.
PERFORM BDC_DYNPRO USING 'SAPLCOVG' '2000'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=BU'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'AFVGD-VORNR(01)'.
PERFORM BDC_FIELD USING 'RC27X-FLG_SEL(01)'
PERFORM BDC_TRANSACTION USING 'CN22'.
ENDON.
WRITE:/ V_MSG.
ENDLOOP.
*& Form GET_FILE
text
--> p1 text
<-- p2 text
FORM GET_FILE .
CALL FUNCTION 'F4_FILENAME'
IMPORTING
FILE_NAME = FILENAME.
ENDFORM. " GET_FILE
*& Form UPLOAD_FILE
text
--> p1 text
<-- p2 text
FORM UPLOAD_FILE .
V_FILENAME = FILENAME.
DATA: LWA_INTERN TYPE ALSMEX_TABLINE,
LIT_INTERN TYPE STANDARD TABLE OF ALSMEX_TABLINE INITIAL SIZE 0.
DATA: IT_RAW TYPE TRUXS_T_TEXT_DATA.
TYPES : BEGIN OF T_RETURN,
ROW TYPE KCD_EX_ROW_N,
COL TYPE KCD_EX_COL_N,
VALUE(1000),
END OF T_RETURN.
DATA : I_RETURN TYPE TABLE OF T_RETURN.
DATA L_ROW TYPE KCD_EX_ROW_N. " Row
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
FILENAME = FILENAME
I_BEGIN_COL = 1
I_BEGIN_ROW = P_FRMLIN
I_END_COL = 3
I_END_ROW = P_TOLINE
TABLES
INTERN = LIT_INTERN "i_record
EXCEPTIONS
INCONSISTENT_PARAMETERS = 1
UPLOAD_OLE = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
WRITE: 'Error in opening the File'.
ELSE.
SORT LIT_INTERN BY ROW ASCENDING
COL ASCENDING.
L_ROW = 1.
For total records
LOOP AT LIT_INTERN INTO LWA_INTERN.
IF L_ROW = LWA_INTERN-ROW.
IF LWA_INTERN-COL = 1.
WH_CAUFVD-AUFNR_001 = LWA_INTERN-VALUE.
ELSEIF LWA_INTERN-COL = 4.
K_RECORD-DOKVR_004 = LWA_INTERN-VALUE.
ENDIF.
AT END OF ROW.
L_ROW = L_ROW + 1.
APPEND WH_CAUFVD TO IH_CAUFVD.
CLEAR WH_CAUFVD.
ENDAT.
ENDIF.
ENDLOOP.
ENDIF.
L_ROW = 1.
*For total records
LOOP AT LIT_INTERN INTO LWA_INTERN.
IF L_ROW = LWA_INTERN-ROW.
IF LWA_INTERN-COL = 1.
W_CAUFVD-AUFNR_001 = LWA_INTERN-VALUE.
ELSEIF LWA_INTERN-COL = 2.
W_CAUFVD-VORNR_002 = LWA_INTERN-VALUE.
ELSEIF LWA_INTERN-COL = 3.
W_CAUFVD-TXLINE_02_004 = LWA_INTERN-VALUE.
ENDIF.
AT END OF ROW.
L_ROW = L_ROW + 1.
APPEND W_CAUFVD TO I_CAUFVD.
CLEAR W_CAUFVD.
ENDAT.
ENDIF.
ENDLOOP.
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
I_FIELD_SEPERATOR =
I_LINE_HEADER = 'X'
I_TAB_RAW_DATA = IT_RAW " WORK TABLE
I_FILENAME = FILENAME
TABLES
I_TAB_CONVERTED_DATA = I_CAUFVD[] "ACTUAL DATA
EXCEPTIONS
CONVERSION_FAILED = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
WRITE: 'Error in opening the File'.
ENDIF.
ENDFORM. " UPLOAD_FILE
*& Form BDC_FIELD
text
-->P_0377 text
-->P_WI_RECORD_REKRS_023 text
FORM BDC_DYNPRO USING PROGRAM
DYNPRO.
CLEAR I_BDCDATA.
I_BDCDATA-PROGRAM = PROGRAM.
I_BDCDATA-DYNPRO = DYNPRO.
I_BDCDATA-DYNBEGIN = 'X'.
APPEND I_BDCDATA.
ENDFORM. " BDC_DYNPRO
*& Form BDC_FIELD
text
-->P_0377 text
-->P_WI_RECORD_REKRS_023 text
FORM BDC_FIELD USING NAME
VALUE.
CLEAR I_BDCDATA.
I_BDCDATA-FNAM = NAME.
I_BDCDATA-FVAL = VALUE.
APPEND I_BDCDATA.
CLEAR I_BDCDATA.
ENDFORM. " BDC_FIELD
*& Form BDC_TRANSACTION
text
-->P_0412 text
FORM BDC_TRANSACTION USING TCODE.
CALL TRANSACTION TCODE USING I_BDCDATA MODE 'N' MESSAGES INTO MESSTAB.
REFRESH I_BDCDATA[].
CLEAR I_BDCDATA.
IF SY-SUBRC <> 0.
DESCRIBE TABLE MESSTAB.
READ TABLE MESSTAB INDEX SY-TFILL.
IF SY-SUBRC = 0.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
ID = SY-MSGID
LANG = '-D'
NO = SY-MSGNO
V1 = SY-MSGV1
V2 = SY-MSGV2
V3 = SY-MSGV3
V4 = SY-MSGV4
IMPORTING
MSG = V_MSG
EXCEPTIONS
NOT_FOUND = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF.
ENDIF.
ENDFORM. " BDC_TRANSACTION
and if iam giving a long text which is a paragraph iam getting an error
"Field RSTXT-TXLINE(2) input value is longer than screen field."
please do needful help as soon as possibe.Hi!
Instead of using a BDC, use FM CREATE_TEXT for creating the long text. With this you can easily create the text using the text id, name, object and language. To get these details, use the editor button (icon - clipboard with a pencil) and in the text Goto-->Header.
Hope this resolves your issue.
Cheers! -
Problem in BDC for Transaction F-02
Hi Friends,
I am struck up in BDC for TransactionF-02.i am unable to load the data of my test data.when i am loading its loading the second record not the first record.
Below is the test data
H,RAWATEB,1
M,11072006,ZE,1000,11072006,20,SAR,,,,,RAWATIB,,SALARIES,1000
D,50,482000,3648.61,Z1,,,1000,1111,,,,,,
D,40,113001,3648.61,Z1,,,1000,,,,,,,
D,17,001011,3000000.00,Z1,,,1000,,,,,,,
D,40,113001,3000000.00,Z1,,,1000,,,,,,,
M,17082004,ZE,1000,11072006,20,SAR,,,,,RAWATIB,,SALARIES,1000
D,50,482000,3202.82,Z1,,,1000,1112,,,,,,
D,40,113001,3202.82,Z1,,,1000,,,,,,,
D,50,482000,2600000.00,Z1,,,1000,1111,,,,,,
D,40,001011,2600000.00,Z1,,,1000,,,,,,,
T,0000000002
<b></b>
the report is below
REPORT ZFGLDR0030 line-count 60
line-size 160
message-id 00.
====================================================================
****************************TABLES**********************************
====================================================================
tables: bkpf.
====================================================================
**************************RECORD LAYOUTS****************************
====================================================================
Data: begin of bdc_tab occurs 200.
include structure bdcdata.
data: end of bdc_tab.
Data: Begin of tmp_tab occurs 200,
fld1(255) type c,
end of tmp_tab.
DATA: BEGIN OF upload_tab OCCURS 200,
fld1(1) type c,
fld2(10) type c,
fld3(10) type c,
fld4(16) type c,
fld5(10) type c,
fld6(2) type c,
fld7(4) type c,
fld8(10) type c,
fld9(10) type c,
fld10(10) type c,
fld11(10) type c,
fld12(12) type c,
fld13(25) type c,
fld14(50) type c,
fld15(4) type c,
fld16(1) type c,
END OF upload_tab.
data : tmp_rec like upload_tab.
DATA: BEGIN OF upload1_tab OCCURS 200,
fld1(1) type c,
fld2(10) type c,
fld3(10) type c,
fld4(16) type c,
fld5(10) type c,
fld6(2) type c,
fld7(4) type c,
fld8(10) type c,
fld9(10) type c,
fld10(10) type c,
fld11(10) type c,
fld12(12) type c,
fld13(25) type c,
fld14(50) type c,
fld15(4) type c,
fld16(1) type c,
END OF upload1_tab.
Data: upload2_tab like tmp_rec occurs 200 with header line.
Data: Del_tab like tmp_rec occurs 200 with header line.
DATA: V_SYTABIX TYPE I,
v_kunnr like knb1-kunnr,
v_brsch like kna1-brsch,
v_datum like sy-datum,
v_tmp(1) type c,
v_flag type i,
v_ccode(10) type c,
v_glcd(10) type c,
v_len type n,
v_rem(50) type c,
v_docno(12) type c,
v_dtype(3) type c,
v_sno(8) type n,
v_upd_flag type i,
v_idx like sy-tabix,
v_budat like bkpf-budat,
v_fld5(10) type c,
v_date(10) type c.
====================================================================
*********************SELECTION-SCREEN******************************
====================================================================
selection-screen: begin of block b1 with frame .
parameters:p_fl_mct like rlgrap-filename
default 'C:\test' obligatory,
p_sesid like apqi-groupid default 'RAWATIB',
p_user like apqi-userid default sy-uname.
selection-screen: end of block b1.
selection-screen: begin of block b2 with frame .
parameters:p_opt1 radiobutton group grp1 default 'X',
p_opt2 radiobutton group grp1,
p_budat like bkpf-budat.
selection-screen: end of block b2.
====================================================================
Validate SELECTION-SCREEN **************************
====================================================================
At Selection-screen.
translate p_fl_mct to upper case.
if p_opt2 = 'X' and p_budat = '00000000'.
message e398(00) with 'Please enter date to use as Posting date'.
endif.
at selection-screen on value-request for p_fl_mct.
data : v_mask(120) type c.
v_mask = ',IT2 files (.),.'.
CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
DEF_FILENAME = ' '
DEF_PATH = ' '
MASK = v_mask
TITLE = 'File Selection for Upload'
IMPORTING
FILENAME = p_fl_mct
RC =
EXCEPTIONS
INV_WINSYS = 1
NO_BATCH = 2
SELECTION_CANCEL = 3
SELECTION_ERROR = 4
OTHERS = 5.
end-of-selection.
====================================================================
*****************************CONSTANTS******************************
====================================================================
====================================================================
*****************************VARIABLES******************************
====================================================================
====================================================================
TOP OF PAGE*******************************
====================================================================
top-of-page.
start-of-selection.
v_upd_flag = 0.
perform initialise_process.
perform bdc_open.
perform process_upload_tab.
perform terminate_process.
end-of-selection.
====================================================================
Form : Initialise_Process *
====================================================================
FORM initialise_process.
Initialises variables *
move : sy-repid to sy-tvar0,
sy-uname to sy-tvar1,
p_sesid to sy-tvar2,
sy-pagno to sy-tvar3.
write: sy-datum to sy-tvar4,
sy-uzeit to sy-tvar5.
Selecting the GL codes to be updated**********************
call function 'WS_UPLOAD'
EXPORTING
FILENAME = p_fl_mct
FILETYPE = 'ASC'
TABLES
data_tab = Tmp_tab
EXCEPTIONS
CONVERSION_ERROR = 1
FILE_OPEN_ERROR = 2
OTHERS = 10.
if sy-subrc <> 0.
message e398(00) with 'Unable to upload data'.
endif.
Validation for Upload file **********************
read table tmp_tab index 1.
split tmp_tab-fld1 at ',' into tmp_rec-fld1
tmp_rec-fld2
tmp_rec-fld3
tmp_rec-fld4
tmp_rec-fld5
tmp_rec-fld6
tmp_rec-fld7
tmp_rec-fld8
tmp_rec-fld9
tmp_rec-fld10
tmp_rec-fld11
tmp_rec-fld12
tmp_rec-fld13
tmp_rec-fld14
tmp_rec-fld15
v_tmp.
if tmp_rec-fld2 <> 'RAWATEB'.
message e398(00) with 'Invliad file format, cannot upload'.
endif.
loop at tmp_tab.
clear upload_tab.
v_tmp = tmp_tab-fld1+0(1).
if v_tmp = 'M' or v_tmp = 'D'.
split tmp_tab-fld1 at ',' into upload_tab-fld1
upload_tab-fld2
upload_tab-fld3
upload_tab-fld4
upload_tab-fld5
upload_tab-fld6
upload_tab-fld7
upload_tab-fld8
upload_tab-fld9
upload_tab-fld10
upload_tab-fld11
upload_tab-fld12
upload_tab-fld13
upload_tab-fld14
upload_tab-fld15
v_tmp.
if upload_tab-fld1 = 'M'.
clear tmp_rec.
move upload_tab to tmp_rec.
else.
clear upload1_tab.
move upload_tab to upload1_tab.
upload1_tab-fld10 = tmp_rec-fld2.
upload1_tab-fld12 = tmp_rec-fld12.
upload1_tab-fld15 = tmp_rec-fld15.
append upload1_tab.
endif.
append upload_tab.
endif.
endloop.
Mark the already uploaded Transaction to skip ***********
Loop at upload_tab.
if upload_tab-fld1 = 'M'.
v_idx = sy-tabix.
move upload_tab-fld24(4) to v_budat0(4).
move upload_tab-fld22(2) to v_budat4(2).
move upload_tab-fld20(2) to v_budat6(2).
Select single * from bkpf where BLART = upload_tab-fld3 and
BUKRS = upload_tab-fld4 and
XBLNR = upload_tab-fld12 and
budat = v_budat.
if sy-subrc = 0.
do 1000 times.
clear del_tab.
move upload_tab to del_tab.
append del_tab.
upload_tab-fld16 = '*'.
modify upload_tab index v_idx.
v_idx = v_idx + 1.
Read table upload_tab index v_idx.
if upload_tab-fld1 = 'M' or sy-subrc <> 0.
exit.
endif.
enddo.
endif.
endif.
endloop.
ENDFORM. "initialise_process
====================================================================
Form : Process_Ord_itab *
====================================================================
FORM process_upload_tab .
v_flag = 0.
loop at upload_tab where fld16 <> '*' .
Performing the Save at the end of Transaction *************
if upload_tab-fld1 = 'M' and v_flag = 1.
perform load_save.
perform bdc_insert.
endif.
Putting the Header information of the document ************
if upload_tab-fld1 = 'M'.
perform load_header.
v_date = v_fld5.
v_rem = upload_tab-fld14.
v_flag = 0.
endif.
Putting the Detail information of the document ************
if upload_tab-fld1 = 'D'.
if upload_tab-fld2 = '40' or upload_tab-fld2 = '50' .
perform Load_next.
v_tmp = v_glcd.
v_len = strlen( upload_tab-fld3 ).
If ( v_tmp = '2' or v_tmp = '4' or v_tmp = '0' ) .
Perform load_ccenter.
elseif v_flag = 1.
perform upload_blank.
endif.
perform load_Detail.
v_flag = 1.
v_glcd = upload_tab-fld3.
v_ccode = upload_tab-fld9.
else.
perform Load_next.
v_tmp = v_glcd.
v_len = strlen( upload_tab-fld3 ).
perform upload_blank.
perform load_Detail_301.
v_flag = 0.
v_glcd = '1'.
endif.
endif.
endloop.
if v_flag = 1.
perform load_save.
endif.
perform bdc_insert.
v_upd_flag = 1.
ENDFORM. "process_upload_tab
====================================================================
Form : BDC_OPEN *
====================================================================
FORM bdc_open.
call function 'BDC_OPEN_GROUP'
EXPORTING
client = sy-mandt
group = p_sesid
user = p_user
keep = 'X'.
ENDFORM. "bdc_open
====================================================================
Form : Fill_BDC_Tab *
====================================================================
FORM fill_bdc_tab using dynbegin
name
value.
if dynbegin = 'X'.
clear bdc_tab.
move: name to bdc_tab-program,
value to bdc_tab-dynpro,
'X' to bdc_tab-dynbegin.
append bdc_tab.
else.
clear bdc_tab.
move: name to bdc_tab-fnam,
value to bdc_tab-fval.
append bdc_tab.
endif.
ENDFORM. "fill_bdc_tab
====================================================================
Form : BDC_INSERT *
====================================================================
FORM bdc_insert .
call function 'BDC_INSERT'
EXPORTING
tcode = 'F-02'
TABLES
dynprotab = bdc_tab.
refresh bdc_tab.
clear bdc_tab.
ENDFORM. "bdc_insert
====================================================================
Form : BDC_CLOSE *
====================================================================
FORM bdc_close.
call function 'BDC_CLOSE_GROUP'.
ENDFORM. "bdc_close
====================================================================
Form : Terminate_Process *
====================================================================
FORM terminate_process.
perform bdc_close.
ENDFORM. "terminate_process
*& Form load_Header
FORM load_Header.
If upload_tab-fld1 = 'M'.
v_fld5 = upload_tab-fld5.
if p_opt2 = 'X'.
move p_budat6(2) to v_fld50(2).
move p_budat4(2) to v_fld52(2).
move p_budat0(4) to v_fld54(4).
endif.
perform fill_bdc_tab using:
'X' 'SAPMF05A' '0100',
' ' 'BDC_CURSOR' 'RF05A-NEWKO',
' ' 'BKPF-BLDAT' upload_tab-fld2,
' ' 'BKPF-BLART' upload_tab-fld3,
' ' 'BKPF-BUKRS' upload_tab-fld4,
' ' 'BKPF-BUDAT' v_fld5,
' ' 'BKPF-WAERS' upload_tab-fld7,
' ' 'BKPF-XBLNR' upload_tab-fld12,
' ' 'BKPF-BKTXT' upload_tab-fld13.
Endif.
ENDFORM. "load_Header
*& Form load_Detail
FORM load_Detail.
perform fill_bdc_tab using:
'X' 'SAPMF05A' '0300',
' ' 'BDC_CURSOR' 'BSEG-WRBTR',
' ' 'BSEG-WRBTR' upload_tab-fld4,
' ' 'BSEG-VALUT' v_date,
' ' 'BSEG-SGTXT' v_rem.
ENDFORM. " LOAD_DATA
*& Form load_Detail
FORM load_Detail_301.
perform fill_bdc_tab using:
'X' 'SAPMF05A' '0301',
' ' 'BDC_CURSOR' 'RF05A-NEWUM',
' ' 'BSEG-WRBTR' upload_tab-fld4,
' ' 'BSEG-VALUT' v_date,
' ' 'BSEG-SGTXT' v_rem.
ENDFORM. " LOAD_DATA
*& Form load_Next
FORM Load_next.
perform fill_bdc_tab using:
' ' 'RF05A-NEWBS' upload_tab-fld2,
' ' 'RF05A-NEWKO' upload_tab-fld3,
' ' 'BDC_OKCODE' '/00'.
ENDFORM. "Load_next
*& Form load_Save
FORM Load_save.
perform fill_bdc_tab using:
'X' 'SAPMF05A' '0300',
' ' 'BDC_OKCODE' '=BU'.
v_tmp = v_glcd.
v_len = strlen( upload_tab-fld3 ).
If ( v_tmp = '2' or v_tmp = '4' or v_tmp = '0' ) .
Perform load_ccenter.
elseif v_flag = 1.
perform upload_blank.
endif.
perform fill_bdc_tab using:
'X' 'SAPMF05A' '0700',
' ' 'BDC_OKCODE' '=BU'.
ENDFORM. "Load_save
*& Form load_CCenter
FORM Load_Ccenter.
perform fill_bdc_tab using:
'X' 'SAPLKACB' '0002',
' ' 'BDC_CURSOR' 'COBL-KOSTL',
' ' 'COBL-KOSTL' '4200-0451',
' ' 'COBL-KOSTL' v_ccode,
' ' 'COBL-KOSTL' '4200-0295',
' ' 'BDC_OKCODE' '/EENTE'.
ENDFORM. "Load_Ccenter
*& Form load_blank
FORM UpLoad_blank.
perform fill_bdc_tab using:
'X' 'SAPLKACB' '0002',
' ' 'BDC_OKCODE' '/EENTE'.
ENDFORM. "UpLoad_blankur code looking ok..
just change it..
call function <b>'WS_UPLOAD'</b>--->to <b>gui_upload</b>
EXPORTING
FILENAME = p_fl_mct
FILETYPE = 'ASC'
TABLES
data_tab = Tmp_tab
EXCEPTIONS
CONVERSION_ERROR = 1
FILE_OPEN_ERROR = 2
OTHERS = 10.
if sy-subrc <> 0.
message e398(00) with 'Unable to upload data'.
endif. -
Download Data From Excel - VBA Code to SAP Using BDC
Hi ,
I am Sudhir Dure, working with Satyam Computers.
I need help on the below query:
I have an excel file which download data from Excel to SAP using RFC function & with the help of VBA interface.
In this VBA code I have used BDC recording of SAP Transaction KE21N to post data into SAP.
Now I am facing problem to find sub screen (tab page screen ) in SAP from VBA code .
How to pass BDC Subscreen details from VBA code to SAP using below code?
BDCTABLE.Rows.Add
BDCTABLE.Cell(J, "PROGRAM") = PROGRAMNAME
BDCTABLE.Cell(J, "DYNPRO") = "0200"
BDCTABLE.Cell(J, "DYNBEGIN") = "X"
BDCTABLE.Cell(J, "FNAM") = "BDC_OKCODE"
BDCTABLE.Cell(J, "FVAL") = "=NEXT"
Thanks,
Sudhir Dure
9972097464can anyone tell me how to get the PurchaseOrder number and item quantity from the Salesorder...? what are the fields here as given below..??
For Each oItem In oSalesOrder.items
wsTemplate.Range(cols(3) & Indexv).Value = oItem.material.material
'wsTemplate.Range(cols(4) & Indexv).Value = ' I need item quantity here ????
wsTemplate.Range(cols(1) & Indexv).Value = sapSoNumber
wsTemplate.Range(cols(2) & Indexv).Value = ' I need purchase order number here>???
Indexv = (Indexv + 1)
Next
reply fast. please .. thanks -
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
Maybe you are looking for
-
Remote monitoring entry in SOLMAN
Hi , I am trying to create Remote monitoring entry in SOLMAN but after I create and save , it says entry is saved in secure area but dos not reflect in system topology. It give me the following message after save : ECD_RZ20_COLLECT_072949Error when
-
CS3 - What Are the Best Export Settings for Animation?
I have edited a project in Premiere Pro CS3. It is animated, and I want to preserve as much of the quality of the animation as I can. What are the best possible settings that I can use to export the video to a .MOV file? A little background info, in
-
How can i move to a new page in smartform?
hi friends i hav a smartform with two pages. the fist page contains the Main window and 3 Secondary windows. in the 1st page i'm displaying some line items and in the main window i gave the command to go to Page 2. the 2nd page contains only one Seco
-
visit the following page in IE10 and IE11, and use your mouse wheel to scroll the page: http://www.oussamaharb.com/ In IE <= 10, Safari, Chrome, and FireFox, the header section of that page stays put when scrolling. However, only in IE11, when you s
-
Can't publish to SharePoint natively: trusted sites issue?
I'm trying to publish an RH 10 project to SharePoint using the Multiscreen_HTML5 layout. In SharePoint (Native), I selected the 2007 version option because 2010 wouldn't work. The publish process goes all the way through until I get "Publishing has b