Handling popups in bdc recording
Hi,
I am doing bdc recording for a transaction, and there is a popup screen to be handled by the user, but when i am doing recording it is not recording the popup menus. can you please tel me how i can handle popups in BDC recording.
It is very urgent.
Thank you.
Hi Ameen,
Award points if useful...
Step by Step approach to ceate simple BDC session program using reusable template.
This step by step approach can be used to create a Simple BDC program i.e for a transaction which does not have any table control / looping at screen table. The same can also be enhanced to develop a program for transactions involving table controls .
1. Create a new program as executable program using SE38 transaction code.
2. Copy the following template code into your program .
---- Start of Template -
REPORT NO STANDARD PAGE HEADING LINE-SIZE 200 LINE-COUNT 300.
*-- DATA DECLARATION--
*---Types
DATA : BEGIN OF t_upload,
FIELD1(10),
FIELD2(2),
FIELD3(18),
FIELD4(35),
END OF t_upload.
*--- Tables
DATA : BEGIN OF i_bdcdata OCCURS 0."to hold the transaction record
INCLUDE STRUCTURE bdcdata.
DATA: END OF i_bdcdata.
DATA: i_upload LIKE STANDARD TABLE OF t_upload," to hold file data.
i_upload1 LIKE STANDARD TABLE OF t_upload." to hold file data.
*--- Work Areas
DATA: wa_upload2 LIKE t_upload,
wa_upload LIKE t_upload,
wa_upload1 LIKE t_upload.
*--- Variables
DATA: v_count1(4) TYPE n,
v_error TYPE c,
v_session(12),
v_field(21) TYPE c,
v_message(60) type 'C'.
*--Constants
DATA: c_open TYPE c VALUE '(',
c_close TYPE c VALUE ')',
c_x TYPE c VALUE 'X'.
*---Initialisation
initialization.
refresh : i_upload , i_upload1 ,i_bdcdata.
-------Selection Screen Design -
*Selection screen for input of upload file address
SELECTION-SCREEN SKIP 2.
SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME.
PARAMETERS : p_file LIKE rlgrap-filename OBLIGATORY.
SELECTION-SCREEN END OF BLOCK blk1.
---AT SELECTION SCREEN -
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
*--For popup to select file.
PERFORM give_help.
-----START OF SELECTION -
START-OF-SELECTION.
*--Data upload using WS_Upload.
PERFORM get_data.
*-- OPEN SESSION
PERFORM open_group.
*--Insert transactions using BDCDATA table in the session.
PERFORM do_transaction .
*-- Close the session.
PERFORM close_group.
END-OF-SELECTION.
*& Form f_get_data
For data upload from external file.
FORM get_data.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
filename = p_file
filetype = 'DAT'
TABLES
data_tab = i_upload
EXCEPTIONS
conversion_error = 1
file_open_error = 2
file_read_error = 3
invalid_type = 4
no_batch = 5
unknown_error = 6
invalid_table_width = 7
gui_refuse_filetransfer = 8
customer_error = 9
OTHERS = 10.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
DELETE I_UPLOAD INDEX 1.
ENDIF.
ENDFORM. " f_get_data
*& Form F_open_group
To open session in session management.
FORM open_group.
v_session = 'TCODE'.
CALL FUNCTION 'BDC_OPEN_GROUP'
EXPORTING
client = sy-mandt
group = v_session
user = sy-uname
keep = 'X'.
ENDFORM. " F_open_group
*& Form f_do_transaction
Insert transactions in session after passing values to BDCDATA
FORM do_transaction.
LOOP AT i_upload INTO wa_upload .
*---- insert your generated codes from recording at SHDB here
*----- insertion ends
perform bdc_transaction using 'TCODE'.
REFRESH : I_BDCDATA.
CLEAR : WA_UPLOAD.
ENDIF.
ENDLOOP.
ENDFORM. " f_do_transaction
*& Form bdc_dynpro
For appending screen details to BDCDATA
FORM bdc_dynpro USING program dynpro.
CLEAR i_bdcdata.
i_bdcdata-program = program.
i_bdcdata-dynpro = dynpro.
i_bdcdata-dynbegin = 'X'.
APPEND i_bdcdata.
CLEAR i_bdcdata.
ENDFORM. "bdc_dynpro
*& Form bdc_field
For appending field details to bdcdata table
FORM bdc_field USING fnam fval.
CLEAR i_bdcdata.
i_bdcdata-fnam = fnam.
i_bdcdata-fval = fval.
APPEND i_bdcdata.
CLEAR i_bdcdata.
ENDFORM. " bdc_field
*& Form bdc_transaction
For inserting Transaction in the session
FORM bdc_transaction USING tcode.
CALL FUNCTION 'BDC_INSERT'
EXPORTING
tcode = tcode
TABLES
dynprotab = i_bdcdata.
ENDFORM. " bdc_transaction
*& Form F_close_group
For closing the session created in Session manager SM35
FORM close_group.
CALL FUNCTION 'BDC_CLOSE_GROUP'.
concatenate 'Session ' v_session 'successfully created' into v_field.
MESSAGE v_field type 'I'..
CALL TRANSACTION 'SM35'.
ENDFORM. "f_close_group
*& Form f_give_help
For user help to select file
FORM give_help.
CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
mask = ',.,..'
mode = 'O'
IMPORTING
filename = p_file
EXCEPTIONS
inv_winsys = 1
no_batch = 2
selection_cancel = 3
selection_error = 4
OTHERS = 5.
IF sy-subrc <> 0 AND NOT sy-msgty IS INITIAL.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. " f_give_help
---- End of Template -
3.Go to the transaction SHDB in another session ( you can also give TCODE - OSHDB in transaction code window and hit enter ).
4.Create you transaction recording in SHDB . Ensure your transaction recording takes care of input values to all the
fields to which you intend to pass values in the BDC.
5.Once your recording is done correctly create the program from recording in the SHDB transction . You will find the button to create program in SHDB . Choose the option of creating from file when you proceed through the subsequent steps.
6. Define data type t_upload and structure wa_upload in the template program with fields of structure 'RECORD' from the program generated using SHDB recording ( replace the field1, field2 and so on as per your requirement). For your understanding you can remove the suffixes to the
field name but keep the field size unchanged.
7.Copy the coding existing between 'do' and 'enddo' statement from the generated program . Insert the copied code between the loop and endloop code of form 'Do_transaction '. Replace fields of structure 'RECORD' with respective fields of structure wa_upload.Insert constant values wherever possible in transaction recording.You can also handle customised data conversions here.
8.Replace 'TCODE' in the template program with the transaction code you intend to process in this BDC.
9.Please carry out further syntax check and resolve the related issues.
This program will provide for input help to select upload file from local machine. The file needs to be in Tab delimited format and is assumed to have first row as column headers .
On successful creation of session you will be prompted with a Information popup giving the name of session ,and will take you to the SM35 transaction to process your session.
Similar Messages
-
hi,
how to handle popups in bdc.
it is very urgent.
thanks in advance...bdc.
some time bdc ok_code can't set for popup.
so Manually set.
screen no.
bdc_ok code..
else.
check backgrounf sucessful run or not.
after set bdc ok_code. -
Hi,
How to handle the pop ups in BDC??
Thanks & Regards,
Abhishek SarkarHi,
I am not sure whether popup works in BDC.
Can u please confirm it or can u give me some sample code??
Thanks & Regards -
Hi guys,
I am doing a bdc recording for transaction co02. when i got to CO02 transaction and give the order no and press enter.Then in the next screen if u go to menu Function-->Read pp master data, then a small pop-up screen will come.In that screen for the field prod version i m giving the data programtically(what ever i gave programtically it is displaying in that field).For example i gave the production version 2 for the production order z1.If the order Z1 doesn't have a production version 2 it is throwing a popup error message and it is not continuing any further.The next order is not exectued.It is stopping at the order Z1.If the order z1 has prod version 2 then it will accept and will continue to the next production order.
I hope u understand my requirement.Everywhere i m passing the correct data to the required fields.I want to handle the popup error message programatically.
Thanks
dp.Hi,
Here you have to know the message type, class, and number, for the wrong production version.
With the help of these values write and if condition to skip the pop up screen.
Or do that production version checking manually for the given input before populating the values into the transaction.
Try this and reply me if there is any queries -
Bdc recording for trancastion ME01
Hi,
Can u help me in BDC recording for transaction 'ME01' .
I have no idea for transaction 'ME01' & here i like to know how to handle table ctr during bdc recording?
give sample code if possible.
ThanksSee the sample attached code for ME51 using table control.
similarly record the same for ME01 and copy the TC logic from this.
REPORT zmm_pr_upload_mat
NO STANDARD PAGE HEADING
LINE-SIZE 255.
Standard Include for Selection Screen
INCLUDE bdcrecx1.
Internal Table for Upload Data
DATA: BEGIN OF i_pr OCCURS 0,
Header Screen
sno(3), " SNo
bsart(004), " PR Type
epstp(001), " Item Category
knttp(001), " Account Assignment
eeind(010), " Delivery Date
lpein(001), " Category of Del Date
werks(004), " Plant
lgort(004), " Storage Location
ekgrp(003), " Purchasing Group
matkl(009), " Material Group
bednr(010), " Tracking No
afnam(012), " Requisitioner
Item Details
matnr(018), " Material No
menge(017), " Quantity
badat(010),
frgdt(010),
preis(014), " Valuation Price
waers(005), " Currency
peinh(005),
wepos(001),
repos(001),
sakto(010), " GL Account
kostl(010), " Cost Center
bnfpo(005),
END OF i_pr.
Internal Table for header Data
DATA: BEGIN OF it_header OCCURS 0,
sno(3), " SNo
bsart(004), " PR Type
epstp(001), " Item Category
knttp(001), " Account Assignment
eeind(010), " Delivery Date
werks(004), " Plant
lgort(004), " Storage Location
ekgrp(003), " Purchasing Group
matkl(009), " Material Group
bednr(010), " Tracking No
afnam(012), " Requisitioner
END OF it_header.
Internal Table for Item Data
DATA: BEGIN OF it_item OCCURS 0,
sno(3), " SNo
matnr(018), " Material No
menge(017), " Quantity
preis(014), " Valuation Price
sakto(010), " GL Account
kostl(010), " Cost Center
END OF it_item.
Data Variables & Constants
CONSTANTS : c_x VALUE 'X'. " Flag
DATA : v_l(2), " Counter
v_rowno(5), " Row No
v_2(2), " Counter
v_rows LIKE sy-srows, " Rows in TC
v_field(45). " String
Parameters
PARAMETERS: p_file LIKE ibipparms-path. " Filename
At selection-screen on Value Request for file Name
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
Get the F4 Values for the File
CALL FUNCTION 'F4_FILENAME'
EXPORTING
program_name = syst-cprog
dynpro_number = syst-dynnr
IMPORTING
file_name = p_file.
Start of Selection
START-OF-SELECTION.
Open the BDC Session
PERFORM open_group.
Upload the File into internal Table
CALL FUNCTION 'UPLOAD'
EXPORTING
filename = p_file
filetype = 'DAT'
TABLES
data_tab = i_pr
EXCEPTIONS
conversion_error = 1
invalid_table_width = 2
invalid_type = 3
no_batch = 4
unknown_error = 5
gui_refuse_filetransfer = 6
OTHERS = 7.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
SORT i_pr BY sno.
LOOP AT i_pr.
MOVE-CORRESPONDING i_pr TO it_item.
APPEND it_item.
CLEAR it_item.
AT END OF sno.
READ TABLE i_pr INDEX sy-tabix.
MOVE-CORRESPONDING i_pr TO it_header.
APPEND it_header.
CLEAR it_header.
ENDAT.
ENDLOOP.
SORT it_header BY sno.
SORT it_item BY sno.
v_rows = sy-srows - 6.
Upload the Data from Internal Table
LOOP AT it_header.
Header Data
PERFORM bdc_dynpro USING 'SAPMM06B' '0100'.
PERFORM bdc_field USING 'BDC_CURSOR'
'EBAN-BEDNR'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'EBAN-BSART'
it_header-bsart.
PERFORM bdc_field USING 'RM06B-EPSTP'
it_header-epstp.
PERFORM bdc_field USING 'EBAN-KNTTP'
it_header-knttp.
PERFORM bdc_field USING 'RM06B-EEIND'
it_header-eeind.
PERFORM bdc_field USING 'RM06B-LPEIN'
it_header-lpein.
PERFORM bdc_field USING 'EBAN-WERKS'
it_header-werks.
PERFORM bdc_field USING 'EBAN-LGORT'
it_header-lgort.
PERFORM bdc_field USING 'EBAN-EKGRP'
it_header-ekgrp.
PERFORM bdc_field USING 'EBAN-MATKL'
it_header-matkl.
PERFORM bdc_field USING 'EBAN-BEDNR'
it_header-bednr.
PERFORM bdc_field USING 'EBAN-AFNAM'
it_header-afnam.
Item Details
v_l = 0.
To add no. of rows
v_2 = 0 .
As the screen is showing 13 rows defaulted to 130
v_rowno = 130 .
LOOP AT it_item WHERE sno = it_header-sno.
v_l = v_l + 1.
IF v_l = 14 .
IF v_2 = 12 .
v_2 = 12 .
v_l = 2 .
From second time onwards it is displaying 12 rows only
v_rowno = v_rowno + 120 .
PERFORM bdc_dynpro USING 'SAPMM06B' '0106'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RM06B-BNFPO'.
PERFORM bdc_field USING 'RM06B-BNFPO'
v_rowno.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
ELSE.
V_2 initialized to 12 for second screen purpose
v_2 = 12 .
v_l = 2 .
PERFORM bdc_dynpro USING 'SAPMM06B' '0106'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RM06B-BNFPO'.
PERFORM bdc_field USING 'RM06B-BNFPO'
v_rowno .
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
ENDIF.
ENDIF.
PERFORM bdc_dynpro USING 'SAPMM06B' '0106'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
CLEAR v_field.
CONCATENATE 'EBAN-MATNR(' v_l ')' INTO v_field.
PERFORM bdc_field USING v_field it_item-matnr.
CLEAR v_field.
CONCATENATE 'EBAN-MENGE(' v_l ')' INTO v_field.
PERFORM bdc_field USING v_field it_item-menge.
PERFORM bdc_dynpro USING 'SAPMM06B' '0102'.
PERFORM bdc_field USING 'BDC_CURSOR'
'EBAN-PREIS'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'EBAN-PREIS'
it_item-preis.
PERFORM bdc_dynpro USING 'SAPMM06B' '0505'.
PERFORM bdc_field USING 'BDC_CURSOR'
'EBKN-SAKTO'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=ENTE'.
PERFORM bdc_field USING 'EBKN-SAKTO'
it_item-sakto.
Cost Center
PERFORM bdc_dynpro USING 'SAPLKACB' '0002'.
PERFORM bdc_field USING 'BDC_CURSOR'
'COBL-KOSTL'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=ENTE'.
PERFORM bdc_field USING 'COBL-KOSTL'
it_item-kostl.
PERFORM bdc_field USING 'BDC_OKCODE'
'=ENTE'.
ENDLOOP.
PERFORM bdc_dynpro USING 'SAPMM06B' '0106'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RM06B-BNFPO'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=BU'.
Call The Transaction
PERFORM bdc_transaction USING 'ME51'.
ENDLOOP.
Close the BDC Session
PERFORM close_group.
reward if useful
Regards
Vasu -
Bdc recording of screen having table control
hi all,
how to trap scroll in bdc recording of table control.
regards deepakHi..,
<b>I found this program in one of the BDC links !! Hope this helps u !!</b>
Following is a sample code of handling table control in BDC.
REPORT Y730_BDC5 .
*HANDLING TABLE CONTROL IN BDC
DATA : BEGIN OF IT_DUMMY OCCURS 0,
DUMMY(100) TYPE C,
END OF IT_DUMMY.
DATA : BEGIN OF IT_XK01 OCCURS 0,
LIFNR(10) TYPE C,
BUKRS(4) TYPE C,
EKORG(4) TYPE C,
KTOKK(4) TYPE C,
NAME1(30) TYPE C,
SORTL(10) TYPE C,
LAND1(3) TYPE C,
SPRAS(2) TYPE C,
AKONT(6) TYPE C,
FDGRV(2) TYPE C,
WAERS(3) TYPE C,
END OF IT_XK01,
BEGIN OF IT_BANK OCCURS 0,
BANKS(3) TYPE C,
BANKL(10) TYPE C,
BANKN(10) TYPE C,
KOINH(30) TYPE C,
LIFNR(10) TYPE C,
END OF IT_BANK.
DATA : IT_BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE,
IT_BDCMSGCOLL LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
FILENAME = 'C:\VENDOR.TXT'
FILETYPE = 'ASC'
TABLES
DATA_TAB = IT_DUMMY.
LOOP AT IT_DUMMY.
IF IT_DUMMY-DUMMY+0(2) = '11'.
IT_XK01-LIFNR = IT_DUMMY-DUMMY+2(10).
IT_XK01-BUKRS = IT_DUMMY-DUMMY+12(4).
IT_XK01-EKORG = IT_DUMMY-DUMMY+16(4).
IT_XK01-KTOKK = IT_DUMMY-DUMMY+20(4).
IT_XK01-NAME1 = IT_DUMMY-DUMMY+24(30).
IT_XK01-SORTL = IT_DUMMY-DUMMY+54(10).
IT_XK01-LAND1 = IT_DUMMY-DUMMY+64(3).
IT_XK01-SPRAS = IT_DUMMY-DUMMY+67(2).
IT_XK01-AKONT = IT_DUMMY-DUMMY+69(6).
IT_XK01-FDGRV = IT_DUMMY-DUMMY+75(2).
IT_XK01-WAERS = IT_DUMMY-DUMMY+77(3).
APPEND IT_XK01.
ELSE.
IT_BANK-BANKS = IT_DUMMY-DUMMY+2(3).
IT_BANK-BANKL = IT_DUMMY-DUMMY+5(10).
IT_BANK-BANKN = IT_DUMMY-DUMMY+15(10).
IT_BANK-KOINH = IT_DUMMY-DUMMY+25(30).
IT_BANK-LIFNR = IT_DUMMY-DUMMY+55(10).
APPEND IT_BANK.
ENDIF.
ENDLOOP.
LOOP AT IT_XK01.
REFRESH IT_BDCDATA.
perform bdc_dynpro using 'SAPMF02K' '0100'.
perform bdc_field using 'BDC_CURSOR'
'RF02K-REF_LIFNR'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'RF02K-LIFNR'
IT_XK01-LIFNR.
perform bdc_field using 'RF02K-BUKRS'
IT_XK01-BUKRS.
perform bdc_field using 'RF02K-EKORG'
IT_XK01-EKORG.
perform bdc_field using 'RF02K-KTOKK'
IT_XK01-KTOKK.
perform bdc_dynpro using 'SAPMF02K' '0110'.
perform bdc_field using 'BDC_CURSOR'
'LFA1-TELX1'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'LFA1-NAME1'
IT_XK01-NAME1.
perform bdc_field using 'LFA1-SORTL'
IT_XK01-SORTL.
perform bdc_field using 'LFA1-LAND1'
IT_XK01-LAND1.
perform bdc_field using 'LFA1-SPRAS'
IT_XK01-SPRAS.
perform bdc_dynpro using 'SAPMF02K' '0120'.
perform bdc_field using 'BDC_CURSOR'
'LFA1-KUNNR'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_dynpro using 'SAPMF02K' '0130'.
perform bdc_field using 'BDC_CURSOR'
'LFBK-KOINH(02)'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
DATA : FNAM(20) TYPE C,
IDX TYPE C.
MOVE 1 TO IDX.
LOOP AT IT_BANK WHERE LIFNR = IT_XK01-LIFNR.
CONCATENATE 'LFBK-BANKS(' IDX ')' INTO FNAM.
perform bdc_field using FNAM
IT_BANK-BANKS.
CONCATENATE 'LFBK-BANKL(' IDX ')' INTO FNAM.
perform bdc_field using FNAM
IT_BANK-BANKL.
CONCATENATE 'LFBK-BANKN(' IDX ')' INTO FNAM.
perform bdc_field using FNAM
IT_BANK-BANKN.
CONCATENATE 'LFBK-KOINH(' IDX ')' INTO FNAM.
perform bdc_field using FNAM
IT_BANK-KOINH.
IDX = IDX + 1.
ENDLOOP.
perform bdc_dynpro using 'SAPMF02K' '0130'.
perform bdc_field using 'BDC_CURSOR'
'LFBK-BANKS(01)'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_dynpro using 'SAPMF02K' '0210'.
perform bdc_field using 'BDC_CURSOR'
'LFB1-FDGRV'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'LFB1-AKONT'
IT_XK01-AKONT.
perform bdc_field using 'LFB1-FDGRV'
IT_XK01-FDGRV.
perform bdc_dynpro using 'SAPMF02K' '0215'.
perform bdc_field using 'BDC_CURSOR'
'LFB1-ZTERM'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_dynpro using 'SAPMF02K' '0220'.
perform bdc_field using 'BDC_CURSOR'
'LFB5-MAHNA'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_dynpro using 'SAPMF02K' '0310'.
perform bdc_field using 'BDC_CURSOR'
'LFM1-WAERS'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'LFM1-WAERS'
IT_XK01-WAERS.
perform bdc_dynpro using 'SAPMF02K' '0320'.
perform bdc_field using 'BDC_CURSOR'
'WYT3-PARVW(01)'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_dynpro using 'SAPLSPO1' '0300'.
perform bdc_field using 'BDC_OKCODE'
'=YES'.
CALL TRANSACTION 'XK01' USING IT_BDCDATA
MODE 'A'
UPDATE 'S'
MESSAGES INTO IT_BDCMSGCOLL.
ENDLOOP.
FORM BDC_DYNPRO USING PROG SCR.
CLEAR IT_BDCDATA.
IT_BDCDATA-PROGRAM = PROG.
IT_BDCDATA-DYNPRO = SCR.
IT_BDCDATA-DYNBEGIN = 'X'.
APPEND IT_BDCDATA.
ENDFORM.
FORM BDC_FIELD USING FNAM FVAL.
CLEAR IT_BDCDATA.
IT_BDCDATA-FNAM = FNAM.
IT_BDCDATA-FVAL = FVAL.
APPEND IT_BDCDATA.
ENDFORM.
regards,
sai ramesh -
BDC Recording for uploading data into Fi01
HI,
I need to upload date from a file into SAP Fi01 transaction
i used a sample program and added my bdc recording to it as per instrucrion
there is a error while uploading.
i believe it is at the place i am pointing in bold. it is at read dataset. could you advice me how to solve it.
CODE:
REPORT Z_BANK_DIRECTORY
NO STANDARD PAGE HEADING
LINE-SIZE 200
LINE-COUNT 300.
*-- DATA DECLARATION--
*---Types
DATA : BEGIN OF t_upload,
data element: BANKS
BANKS_001(003),
data element: BANKK
BANKL_002(015),
data element: BANKA
BANKA_003(060),
data element: REGIO
PROVZ_004(003),
data element: STRAS_GP
STRAS_005(035),
data element: ORT01_GP
ORT01_006(035),
data element: BRNCH
BRNCH_007(040),
data element: SWIFT
SWIFT_008(011),
data element: BGRUP
BGRUP_009(002),
data element: AD_TITLETX
TITLE_MEDI_010(030),
data element: AD_NAME1
NAME1_011(040),
data element: AD_STRSPP1
STR_SUPPL1_012(040),
data element: AD_STRSPP2
STR_SUPPL2_013(040),
data element: AD_STREET
STREET_014(060),
data element: AD_CITY2
CITY2_015(040),
data element: AD_CITY3
HOME_CITY_016(040),
data element: AD_PSTCD1
POST_CODE1_017(010),
data element: LAND1
COUNTRY_018(003),
data element: AD_POBX
PO_BOX_019(010),
data element: AD_PSTCD2
POST_CODE2_020(010),
data element: SPRAS
LANGU_021(002),
data element: AD_TLNMBR1
TEL_NUMBER_022(030),
data element: AD_MBNMBR1
MOB_NUMBER_023(030),
data element: AD_FXNMBR1
FAX_NUMBER_024(030),
data element: AD_SMTPADR
SMTP_ADDR_025(132),
data element: BANKA
BANKA_026(060),
data element: REGIO
PROVZ_027(003),
data element: STRAS_GP
STRAS_028(035),
data element: ORT01_GP
ORT01_029(035),
data element: BRNCH
BRNCH_030(040),
data element: SWIFT
SWIFT_031(011),
data element: BGRUP
BGRUP_032(002),
END OF t_upload.
*--- Tables
DATA : BEGIN OF i_bdcdata OCCURS 0."to hold the transaction t_upload
INCLUDE STRUCTURE bdcdata.
DATA: END OF i_bdcdata.
DATA: i_upload LIKE STANDARD TABLE OF t_upload," to hold file data.
i_upload1 LIKE STANDARD TABLE OF t_upload." to hold file data.
*--- Work Areas
DATA: wa_upload2 LIKE t_upload,
wa_upload LIKE t_upload,
wa_upload1 LIKE t_upload.
*--- Variables
DATA: v_count1(4) TYPE n,
v_error TYPE c,
v_session(12),
v_field(21) TYPE c,
v_message(60) type C.
*--Constants
DATA: c_open TYPE c VALUE '(',
c_close TYPE c VALUE ')',
c_x TYPE c VALUE 'X'.
*---Initialisation
initialization.
refresh : i_upload , i_upload1 ,i_bdcdata.
-------Selection Screen Design -
*Selection screen for input of upload file address
SELECTION-SCREEN SKIP 2.
SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME.
PARAMETERS : p_file LIKE rlgrap-filename OBLIGATORY.
SELECTION-SCREEN END OF BLOCK blk1.
---AT SELECTION SCREEN -
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
*--For popup to select file.
PERFORM give_help.
-----START OF SELECTION -
START-OF-SELECTION.
*--Data upload using WS_Upload.
PERFORM get_data.
*-- OPEN SESSION
PERFORM open_group.
*--Insert transactions using BDCDATA table in the session.
PERFORM do_transaction .
*-- Close the session.
PERFORM close_group.
END-OF-SELECTION.
*& Form f_get_data
For data upload from external file.
FORM get_data.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
filename = p_file
filetype = 'DAT'
TABLES
data_tab = i_upload
EXCEPTIONS
conversion_error = 1
file_open_error = 2
file_read_error = 3
invalid_type = 4
no_batch = 5
unknown_error = 6
invalid_table_width = 7
gui_refuse_filetransfer = 8
customer_error = 9
OTHERS = 10.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
DELETE I_UPLOAD INDEX 1.
ENDIF.
ENDFORM. " f_get_data
*& Form F_open_group
To open session in session management.
FORM open_group.
v_session = 'FI01'.
CALL FUNCTION 'BDC_OPEN_GROUP'
EXPORTING
client = sy-mandt
group = v_session
user = sy-uname
keep = 'X'.
ENDFORM. " F_open_group
*& Form f_do_transaction
Insert transactions in session after passing values to BDCDATA
FORM do_transaction.
LOOP AT i_upload INTO wa_upload .
*---- insert your generated codes from recording at SHDB here
read dataset <b>wa_upload</b> into t_upload.
if sy-subrc <> 0. exit. endif.
perform bdc_dynpro using 'SAPMF02B' '0100'.
perform bdc_field using 'BDC_CURSOR'
'BNKA-BANKL'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BNKA-BANKS'
t_upload-BANKS_001.
perform bdc_field using 'BNKA-BANKL'
t_upload-BANKL_002.
perform bdc_dynpro using 'SAPMF02B' '0110'.
perform bdc_field using 'BDC_CURSOR'
'BNKA-BGRUP'.
perform bdc_field using 'BDC_OKCODE'
'=ADDR'.
perform bdc_field using 'BNKA-BANKA'
t_upload-BANKA_003.
perform bdc_field using 'BNKA-PROVZ'
t_upload-PROVZ_004.
perform bdc_field using 'BNKA-STRAS'
t_upload-STRAS_005.
perform bdc_field using 'BNKA-ORT01'
t_upload-ORT01_006.
perform bdc_field using 'BNKA-BRNCH'
t_upload-BRNCH_007.
perform bdc_field using 'BNKA-SWIFT'
t_upload-SWIFT_008.
perform bdc_field using 'BNKA-BGRUP'
t_upload-BGRUP_009.
perform bdc_dynpro using 'SAPLSZA1' '0201'.
perform bdc_field using 'BDC_CURSOR'
'SZA1_D0100-SMTP_ADDR'.
perform bdc_field using 'BDC_OKCODE'
'=CONT'.
perform bdc_field using 'SZA1_D0100-TITLE_MEDI'
t_upload-TITLE_MEDI_010.
perform bdc_field using 'ADDR1_DATA-NAME1'
t_upload-NAME1_011.
perform bdc_field using 'ADDR1_DATA-STR_SUPPL1'
t_upload-STR_SUPPL1_012.
perform bdc_field using 'ADDR1_DATA-STR_SUPPL2'
t_upload-STR_SUPPL2_013.
perform bdc_field using 'ADDR1_DATA-STREET'
t_upload-STREET_014.
perform bdc_field using 'ADDR1_DATA-CITY2'
t_upload-CITY2_015.
perform bdc_field using 'ADDR1_DATA-HOME_CITY'
t_upload-HOME_CITY_016.
perform bdc_field using 'ADDR1_DATA-POST_CODE1'
t_upload-POST_CODE1_017.
perform bdc_field using 'ADDR1_DATA-COUNTRY'
t_upload-COUNTRY_018.
perform bdc_field using 'ADDR1_DATA-PO_BOX'
t_upload-PO_BOX_019.
perform bdc_field using 'ADDR1_DATA-POST_CODE2'
t_upload-POST_CODE2_020.
perform bdc_field using 'ADDR1_DATA-LANGU'
t_upload-LANGU_021.
perform bdc_field using 'SZA1_D0100-TEL_NUMBER'
t_upload-TEL_NUMBER_022.
perform bdc_field using 'SZA1_D0100-MOB_NUMBER'
t_upload-MOB_NUMBER_023.
perform bdc_field using 'SZA1_D0100-FAX_NUMBER'
t_upload-FAX_NUMBER_024.
perform bdc_field using 'SZA1_D0100-SMTP_ADDR'
t_upload-SMTP_ADDR_025.
perform bdc_dynpro using 'SAPMF02B' '0110'.
perform bdc_field using 'BDC_CURSOR'
'BNKA-BANKA'.
perform bdc_field using 'BDC_OKCODE'
'=UPDA'.
perform bdc_field using 'BNKA-BANKA'
t_upload-BANKA_026.
perform bdc_field using 'BNKA-PROVZ'
t_upload-PROVZ_027.
perform bdc_field using 'BNKA-STRAS'
t_upload-STRAS_028.
perform bdc_field using 'BNKA-ORT01'
t_upload-ORT01_029.
perform bdc_field using 'BNKA-BRNCH'
t_upload-BRNCH_030.
perform bdc_field using 'BNKA-SWIFT'
t_upload-SWIFT_031.
perform bdc_field using 'BNKA-BGRUP'
t_upload-BGRUP_032.
*----- insertion ends
perform bdc_transaction using 'FI01'.
REFRESH : I_BDCDATA.
CLEAR : WA_UPLOAD.
ENDIF.
ENDLOOP.
ENDFORM. " f_do_transaction
*& Form bdc_dynpro
For appending screen details to BDCDATA
FORM bdc_dynpro USING program dynpro.
CLEAR i_bdcdata.
i_bdcdata-program = program.
i_bdcdata-dynpro = dynpro.
i_bdcdata-dynbegin = 'X'.
APPEND i_bdcdata.
CLEAR i_bdcdata.
ENDFORM. "bdc_dynpro
*& Form bdc_field
For appending field details to bdcdata table
FORM bdc_field USING fnam fval.
CLEAR i_bdcdata.
i_bdcdata-fnam = fnam.
i_bdcdata-fval = fval.
APPEND i_bdcdata.
CLEAR i_bdcdata.
ENDFORM. " bdc_field
*& Form bdc_transaction
For inserting Transaction in the session
FORM bdc_transaction USING tcode.
CALL FUNCTION 'BDC_INSERT'
EXPORTING
tcode = 'FI01'
TABLES
dynprotab = i_bdcdata.
ENDFORM. " bdc_transaction
*& Form F_close_group
For closing the session created in Session manager SM35
FORM close_group.
CALL FUNCTION 'BDC_CLOSE_GROUP'.
concatenate 'Session ' v_session 'successfully created' into v_field.
MESSAGE v_field type 'I'..
CALL TRANSACTION 'SM35'.
ENDFORM. "f_close_group
*& Form f_give_help
For user help to select file
FORM give_help.
CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
mask = ',.,..'
mode = 'O'
IMPORTING
filename = p_file
EXCEPTIONS
inv_winsys = 1
no_batch = 2
selection_cancel = 3
selection_error = 4
OTHERS = 5.
IF sy-subrc <> 0 AND NOT sy-msgty IS INITIAL.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. " f_give_help
---- End of Template -Actually, there is no need for the dataset statemant at all. Comment that out, and add a line that moves the data from wa_upload to t_upload, or you could change the rest of the references to point to wa_upload and forget about t_upload. Your choice.
LOOP AT i_upload INTO wa_upload .
*---- insert your generated codes from recording at SHDB here
*read dataset wa_upload into t_upload.
*f sy-subrc <> 0. exit. endif.
t_upload = wa_upload.
Regards,
RIch Heilman -
BDC Recording for creating a new Transport request
Hi folks,
I have done BDC to update a view. It has to update the values in view and create a new request at run time. Its working fine in foreground. But when it comes to back ground, it shows error, saying no batch input data for that screen. Here i am cliking 'create new request' icon to create new request and system will generate a request at runtime. So it might be showign that error. Could any body suggest me how to handle this error. How to create a new request in BDC recording at ruen time....Thanks in advance..
Shyam.Hi Shyam,
Please check the recording. I think you have missed some thing while recording.
Best regards,
raam -
How to capture F4 help during bdc recording
Hello All,
I need one help to solve one of the requrimkents..
In transaction Co02, user have to add the compoenents manually..but before user adds the components manually, i need to call the transaction co02, then i have do F4 help and fill the data for the user and then user will handle it manually...
So till F4 help and filling the data in F4 help, i need to do through my program using bdc...when i try to do, F4 help is not captured in my recording..
So please help me how to capture F4 help during BDC recording.
Thanks in advance
SangeethaHI Sangeetha,
I have one question for you!!!!
Capturing F4 help in BDC recording is secondary thing. First, If you want the user to select the value from the F4 help, then in that case user will have to run the BDC program in the foreground mode which is not possible and time consuming if your file is having more records (say >100). Then in that case will you prompt the user every time for selecting the component values, as many records there will be in the file to be uploaded??? I think it is not a way of handling or capturing the component values. I would prefer that pass the component values in the file which has to be uploaded.
Please let me know if you still have some doubts on the same.
Thanks
VJ -
How to handle tabstrips in BDC
Hi All,
Can anyone please let me know how to handle Tabstrips in BDC (Here Subscreen comes into picture).
Please give me advice on this any one, it is very urgent, please help me.
Many Thanks in Advance for u r Answer
NarenJust use ABAPDOCU Transaction and see the complex screen menu,there you will find out example program for Tab strips.
for bdc point of view you need to do recording propery and copy the code .
only changes you need to do get the data from file to internal table.
use loop ur internal table ,withinin internal table paste ur code(screens,program name) and it should work.
Reward Points if it is useful
Thanks
Seshu -
hi all,
how to block popups in bdc.?
thanks.Hi
popups which are coming is for u to guidee u that wat exactlt you hv recorded
still if u want to change anything or any screen processing
you can change in program...
anf run the BDCin backgroud
it uploads the data and want gives any screen...
HTH
<REMOVED BY MODERATOR>
regrds
rajan
Edited by: Alvaro Tejada Galindo on Apr 10, 2008 4:48 PM -
could anyone help me out in knowing the BDC recording steps in detail for co11n.
regards
rayHi,
Steps used in Recording
1) Start by going to SHDB transaction. There, on top left corner, you will see the "New Recording" button.
2) After clicking on the new recording button, you will be presented with a screen to specify the name of this recording, AND, the transaction which you want to record. Fill these up, and click on "Start Recording" button.
3) Handle the transaction just like normal. However, you should know that all that you do in the transaction are captured.
4) Once you finish the transaction, the screen will return to SHDB transaction. You will see a number of instructions. This is not of much interest to us at this point. Just save this recording by clicking on the "Save" icon at the top.
5) Once saved, click on the "Back" button to display a list of recordings. By default, the recording you just did will be the only one shown on the screen.
6) Select this row, and then, click on "Generate Program" from the top middle tool bar.
7) Select the program type as executable, and fill up other attributes, like short description..etc.
8) When asked for a package, for now, select the local object.
Usually, what you will be doing, is to use this code that is generated as a skeleton, and the data will be got dynamically.
regards ,
Stephen.
Reward if it is useful. -
Hi,
How to handle errors in bdc call transaction method.
what is the steps to download errors from bdcmsgcoll into flat file in call transaction method
udayHi friend,
Here is a beautiful example which explains how to trap erroreneous records ..if help full then please give me max reward point.
REPORT zgopi_report
NO STANDARD PAGE HEADING
LINE-SIZE 255
MESSAGE-ID ZRASH.
Internal Table Declarations *
*--Internal Table for Data Uploading.
DATA : BEGIN OF IT_FFCUST OCCURS 0,
KUNNR(10),
BUKRS(4),
KTOKD(4),
ANRED(15),
NAME1(35),
SORTL(10),
STRAS(35),
ORT01(35),
PSTLZ(10),
LAND1(3),
SPRAS(2),
AKONT(10),
END OF IT_FFCUST.
*--Internal Table to Store Error Records.
DATA : BEGIN OF IT_ERRCUST OCCURS 0,
KUNNR(10),
EMSG(255),
END OF IT_ERRCUST.
*--Internal Table to Store Successful Records.
DATA : BEGIN OF IT_SUCCUST OCCURS 0,
KUNNR(10),
SMSG(255),
END OF IT_SUCCUST.
*--Internal Table for Storing the BDC data.
DATA : IT_CUSTBDC LIKE BDCDATA OCCURS 0 WITH HEADER LINE.
*--Internal Table for storing the messages.
DATA : IT_CUSTMSG LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.
DATA : V_FLAG1(1) VALUE ' ',
"Flag used for opening session.
V_TLINES LIKE SY-TABIX,
"For storing total records processed.
V_ELINES LIKE SY-TABIX,
"For storing the no of error records.
V_SLINES LIKE SY-TABIX.
"For storing the no of success records.
Selection screen *
SELECTION-SCREEN BEGIN OF BLOCK B1.
PARAMETERS : V_FNAME LIKE RLGRAP-FILENAME,
V_SESNAM LIKE RLGRAP-FILENAME.
SELECTION-SCREEN END OF BLOCK B1.
Start-of-selection *
START-OF-SELECTION.
*-- Form to upload flatfile data into the internal table.
PERFORM FORM_UPLOADFF.
TOP-OF-PAGE *
TOP-OF-PAGE.
WRITE:/ 'Details of the error and success records for the transaction'
ULINE.
SKIP.
End of Selection *
END-OF-SELECTION.
*-- Form to Generate a BDC from the Uploaded Internal table
PERFORM FORM_BDCGENERATE.
*--To write the totals and the session name.
PERFORM FORM_WRITEOP.
*& Form form_uploadff
Form to upload flatfile data into the internal table.
FORM FORM_UPLOADFF .
*--Variable to change the type of the parameter file name.
DATA : LV_FILE TYPE STRING.
LV_FILE = V_FNAME.
*--Function to upload the flat file to the internal table.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = LV_FILE
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X'
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
IMPORTING
FILELENGTH =
HEADER =
TABLES
DATA_TAB = IT_FFCUST
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
NO_AUTHORITY = 6
UNKNOWN_ERROR = 7
BAD_DATA_FORMAT = 8
HEADER_NOT_ALLOWED = 9
SEPARATOR_NOT_ALLOWED = 10
HEADER_TOO_LONG = 11
UNKNOWN_DP_ERROR = 12
ACCESS_DENIED = 13
DP_OUT_OF_MEMORY = 14
DISK_FULL = 15
DP_TIMEOUT = 16
OTHERS = 17
IF SY-SUBRC = 0.
*--Deleting the headings from the internal table.
DELETE IT_FFCUST INDEX 1.
*--Getting the total number of records uploaded.
DESCRIBE TABLE IT_FFCUST LINES V_TLINES.
ENDIF.
ENDFORM. " form_uploadff
*& Form Form_bdcgenerate
Form to Generate a BDC from the Uploaded Internal table
FORM FORM_BDCGENERATE .
*--Generating the BDC table for the fields of the internal table.
LOOP AT IT_FFCUST.
PERFORM POPULATEBDC USING :
'X' 'SAPMF02D' '0105',
' ' 'BDC_OKCODE' '/00' ,
' ' 'RF02D-KUNNR' IT_FFCUST-KUNNR,
' ' 'RF02D-BUKRS' IT_FFCUST-BUKRS,
' ' 'RF02D-KTOKD' IT_FFCUST-KTOKD,
'X' 'SAPMF02D' '0110' ,
' ' 'BDC_OKCODE' '/00',
' ' 'KNA1-ANRED' IT_FFCUST-ANRED,
' ' 'KNA1-NAME1' IT_FFCUST-NAME1,
' ' 'KNA1-SORTL' IT_FFCUST-SORTL,
' ' 'KNA1-STRAS' IT_FFCUST-STRAS,
' ' 'KNA1-ORT01' IT_FFCUST-ORT01,
' ' 'KNA1-PSTLZ' IT_FFCUST-PSTLZ,
' ' 'KNA1-LAND1' IT_FFCUST-LAND1,
' ' 'KNA1-SPRAS' IT_FFCUST-SPRAS,
'X' 'SAPMFO2D' '0120',
' ' 'BDC_OKCODE' '/00',
'X' 'SAPMF02D' '0125',
' ' 'BDC_OKCODE' '/00',
'X' 'SAPMF02D' '0130',
' ' 'BDC_OKCODE' '=ENTR',
'X' 'SAPMF02D' '0340',
' ' 'BDC_OKCODE' '=ENTR',
'X' 'SAPMF02D' '0360',
' ' 'BDC_OKCODE' '=ENTR',
'X' 'SAPMF02D' '0210',
' ' 'KNB1-AKONT' IT_FFCUST-AKONT,
' ' 'BDC_OKCODE' '/00',
'X' 'SAPMF02D' '0215',
' ' 'BDC_OKCODE' '/00',
'X' 'SAPMF02D' '0220',
' ' 'BDC_OKCODE' '/00',
'X' 'SAPMF02D' '0230',
' ' 'BDC_OKCODE' '=UPDA'.
*--Calling the transaction 'fd01'.
CALL TRANSACTION 'FD01' USING IT_CUSTBDC MODE 'N' UPDATE 'S'
MESSAGES INTO IT_CUSTMSG.
IF SY-SUBRC <> 0.
*--Populating the error records internal table.
IT_ERRCUST-KUNNR = IT_FFCUST-KUNNR.
APPEND IT_ERRCUST.
CLEAR IT_ERRCUST.
*--Opening a session if there is an error record.
IF V_FLAG1 = ' '.
PERFORM FORM_OPENSESSION.
V_FLAG1 = 'X'.
ENDIF.
*--Inserting the error records into already open session.
IF V_FLAG1 = 'X'.
PERFORM FORM_INSERT.
ENDIF.
*--Populating the Success records internal table.
ELSE.
IT_SUCCUST-KUNNR = IT_FFCUST-KUNNR.
APPEND IT_SUCCUST.
CLEAR IT_SUCCUST.
ENDIF.
*--Displaying the messages.
IF NOT IT_CUSTMSG[] IS INITIAL.
PERFORM FORM_FORMATMSG.
ENDIF.
*--Clearing the message and bdc tables.
CLEAR : IT_CUSTBDC[],IT_CUSTMSG[].
ENDLOOP.
*--Getting the total no of error records.
DESCRIBE TABLE IT_ERRCUST LINES V_ELINES.
*--Getting the total no of successful records.
DESCRIBE TABLE IT_SUCCUST LINES V_SLINES.
*--Closing the session only if it is open.
IF V_FLAG1 = 'X'.
PERFORM FORM_CLOSESESS.
ENDIF.
ENDFORM. " Form_bdcgenerate
*& Form populatebdc
FOrm to Populate the BDC table.
FORM POPULATEBDC USING VALUE(P_0178)
VALUE(P_0179)
VALUE(P_0180).
IF P_0178 = 'X'.
IT_CUSTBDC-PROGRAM = P_0179.
IT_CUSTBDC-DYNPRO = P_0180.
IT_CUSTBDC-DYNBEGIN = 'X'.
ELSE.
IT_CUSTBDC-FNAM = P_0179.
IT_CUSTBDC-FVAL = P_0180.
ENDIF.
APPEND IT_CUSTBDC.
CLEAR IT_CUSTBDC.
ENDFORM. " populatebdc
*& Form FORM_OPENSESSION
Form to Open a session.
FORM FORM_OPENSESSION .
*--Variable to convert the given session name into reqd type.
DATA : LV_SESNAM(12).
LV_SESNAM = V_SESNAM.
*--Opening a session.
CALL FUNCTION 'BDC_OPEN_GROUP'
EXPORTING
CLIENT = SY-MANDT
GROUP = LV_SESNAM
HOLDDATE = '20040805'
KEEP = 'X'
USER = SY-UNAME
PROG = SY-CPROG
IMPORTING
QID =
EXCEPTIONS
CLIENT_INVALID = 1
DESTINATION_INVALID = 2
GROUP_INVALID = 3
GROUP_IS_LOCKED = 4
HOLDDATE_INVALID = 5
INTERNAL_ERROR = 6
QUEUE_ERROR = 7
RUNNING = 8
SYSTEM_LOCK_ERROR = 9
USER_INVALID = 10
OTHERS = 11
IF SY-SUBRC <> 0.
WRITE :/ 'Session not open'.
ENDIF.
ENDFORM. " FORM_OPENSESSION
*& Form FORM_INSERT
fORM TO INSERT ERROR RECOED INTO A SESSION.
FORM FORM_INSERT .
*--Inserting the record into session.
CALL FUNCTION 'BDC_INSERT'
EXPORTING
TCODE = 'FD01'
POST_LOCAL = NOVBLOCAL
PRINTING = NOPRINT
SIMUBATCH = ' '
CTUPARAMS = ' '
TABLES
DYNPROTAB = IT_CUSTBDC
EXCEPTIONS
INTERNAL_ERROR = 1
NOT_OPEN = 2
QUEUE_ERROR = 3
TCODE_INVALID = 4
PRINTING_INVALID = 5
POSTING_INVALID = 6
OTHERS = 7
IF SY-SUBRC <> 0.
WRITE :/ 'Unable to insert the record'.
ENDIF.
ENDFORM. " FORM_INSERT
*& Form FORM_CLOSESESS
Form to Close the Open Session.
FORM FORM_CLOSESESS .
CALL FUNCTION 'BDC_CLOSE_GROUP'
EXCEPTIONS
NOT_OPEN = 1
QUEUE_ERROR = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
ENDIF.
ENDFORM. " FORM_CLOSESESS
*& Form FORM_FORMATMSG
Form to format messages.
FORM FORM_FORMATMSG .
*--Var to store the formatted msg.
DATA : LV_MSG(255).
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
ID = SY-MSGID
LANG = SY-LANGU
NO = SY-MSGNO
V1 = SY-MSGV1
V2 = SY-MSGV2
V3 = SY-MSGV3
V4 = SY-MSGV4
IMPORTING
MSG = LV_MSG
EXCEPTIONS
NOT_FOUND = 1
OTHERS = 2.
IF SY-SUBRC = 0.
WRITE :/ LV_MSG.
ENDIF.
ULINE.
ENDFORM. " FORM_FORMATMSG
*& Form form_writeop
To write the totals and the session name.
FORM FORM_WRITEOP .
WRITE :/ 'Total Records Uploaded :',V_TLINES,
/ 'No of Error Records :',V_ELINES,
/ 'No of Success Records :',V_SLINES,
/ 'Name of the Session :',V_SESNAM.
ULINE.
ENDFORM. " form_writeop -
Hi I am having a problem in BDC Recording. My requirement is that when I input data in transaction fb02 to block the invoices, It shows a list of invoices. Now i need to double click that item(line) in which PK = 06 at runtime during bdc recording. During BDC recording it takes the line number on which we have clicked which is constant but i want it dynamic that if item 1 is having PK=6, that line should be double clicked and if item 3 is having PK=6, the third item should be double clicked to open another screen. Kindly help me... Thanks in advance.
Hi Ravi,
While writing your code that is in your code you know which line number is having the PK = 06, then you can use the same line number and add the code for double click after that.
Regards,
Atish -
hi gurus,
i am trying to do a material master creation using BDC recording,
i am new i dont know how to modify the code,
the following is the code, please let me know how to make changes.
report ZTEST95
no standard page heading line-size 255.
include bdcrecx1.
parameters: dataset(132) lower case default
'C:\Documents and Settings\Deskt'
& 'op\test95.txt'.
DO NOT CHANGE - the generated data section - DO NOT CHANGE ***
If it is nessesary to change the data section use the rules:
1.) Each definition of a field exists of two lines
2.) The first line shows exactly the comment
'* data element: ' followed with the data element
which describes the field.
If you don't have a data element use the
comment without a data element name
3.) The second line shows the fieldname of the
structure, the fieldname must consist of
a fieldname and optional the character '_' and
three numbers and the field length in brackets
4.) Each field must be type C.
Generated data section with specific formatting - DO NOT CHANGE ***
data: begin of record,
data element: MATNR
MATNR_001(040),
data element: MBRSH
MBRSH_002(001),
data element: MTART
MTART_003(004),
data element: REF_MATNR
MATNR_004(040),
data element: XFELD
KZSEL_01_005(001),
data element: MAKTX
MAKTX_006(040),
data element: MEINS
MEINS_007(003),
data element: MATKL
MATKL_008(009),
data element: SPART
SPART_009(002),
data element: MTPOS_MARA
MTPOS_MARA_010(004),
data element: BRGEW
BRGEW_011(017),
data element: GEWEI
GEWEI_012(003),
data element: NTGEW
NTGEW_013(017),
end of record.
End generated data section ***
start-of-selection.
perform open_dataset using dataset.
perform open_group.
do.
read dataset dataset into record.
if sy-subrc <> 0. exit. endif.
perform bdc_dynpro using 'SAPLMGMM' '0060'.
perform bdc_field using 'BDC_CURSOR'
'RMMG1-MATNR'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_field using 'RMMG1-MATNR'
record-MATNR_001.
perform bdc_field using 'RMMG1-MBRSH'
record-MBRSH_002.
perform bdc_field using 'RMMG1-MTART'
record-MTART_003.
perform bdc_field using 'RMMG1_REF-MATNR'
record-MATNR_004.
perform bdc_dynpro using 'SAPLMGMM' '0070'.
perform bdc_field using 'BDC_CURSOR'
'MSICHTAUSW-DYTXT(01)'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_field using 'MSICHTAUSW-KZSEL(01)'
record-KZSEL_01_005.
perform bdc_dynpro using 'SAPLMGMM' '4004'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'MAKT-MAKTX'
record-MAKTX_006.
perform bdc_field using 'MARA-MEINS'
record-MEINS_007.
perform bdc_field using 'MARA-MATKL'
record-MATKL_008.
perform bdc_field using 'MARA-SPART'
record-SPART_009.
perform bdc_field using 'MARA-MTPOS_MARA'
record-MTPOS_MARA_010.
perform bdc_field using 'BDC_CURSOR'
'MARA-BRGEW'.
perform bdc_field using 'MARA-BRGEW'
record-BRGEW_011.
perform bdc_field using 'MARA-GEWEI'
record-GEWEI_012.
perform bdc_field using 'MARA-NTGEW'
record-NTGEW_013.
perform bdc_dynpro using 'SAPLSPO1' '0300'.
perform bdc_field using 'BDC_OKCODE'
'=YES'.
perform bdc_transaction using 'MM01'.
enddo.
perform close_group.
perform close_dataset using dataset.
thanks.Hi,
It is better if the Material Master creation step is done by LSMW - Direct Input method with the following object:
Object 0020 Material master
Method 0000
Program name RMDATIND
Program type D Direct input
Check the program documentation for more details.
For a sample data file generation ( Sequential file ), check the program RMDATGEN
If the reqmt., is for a repetetive loading of Material Master you could schedule / execute the LSMW by following program: /SAPDMC/SAP_LSMW_INTERFACE.
Hope this helps.
Best Regards, Murugesh
Maybe you are looking for
-
No boot option after Windows 7 install on Mac Pro
Hi, I have problem and it is very frustrating. My configuration Mac Pro 1.1 2x2.66 RAM 5 GB HDs Bay1 500GB (have a Mac OSx 10.6) Bay2 250GB (install Windows 7 Ultimate 64bit) Bay3 250GB (in raid Mac OSX 10.6.6) primary system Bay4 250GB (in raid Mac
-
How do i change the cover color?
can i change the color of the cover or the material? how? thanks
-
How can I merge several docs in Pages into 1 pdf doc.?
I have created several pages in Pages that will become one report. I have sent each page in an email as a pdf, as well as shared in iworks.com. How do I merge all the pages into one pdf?
-
Hi, I am new to BADI. I am working on SAP Auto-Id infrastructure 4.0 (used in RFID projects) there is a Custom BADI which is implemented in one SAP AII system. I need to copy this to other SAP AII system. How to create a Transport Request for Custom
-
Hi, System is allowing to issue more qty then reservation. How to stop that? eg. Reservation qty is 5 & Issue qty is 7. Thanks in advance Samir Bhatt,