Identifying Programs using BDC.
Hi Experts,
I have a peculiar requirement. i have a list of programs. I have to develop a logic which will help me identify those programs using BDC (using batch input session or Call transaction). I also have to identify the transactions called using the batch input session or Call transaction.
For example:
1) I have a program using CALL TRANSACTION 'abc' USING BDCDATA
MODE CTUMODE
UPDATE CUPDATE
MESSAGES INTO MESSTAB.
I have to extract the program name and 'abc' in a file.
kindly provide solutions.
Thanks
Edited by: Sadhna Achhra on Dec 22, 2008 7:58 AM
Hi Sadhna,
I just written a small program (with reference to standard progs) that u might use. please see if you can use the following codes and adapt it for your purpose:
logic:
- i have retrieved all includes associated to the program in selection screen
- scan each program where call transaction has been used
- get the transaction being called and display it on screen
PARAMETERS:p_prog TYPE trdir-name.
DATA: BEGIN OF i_int_abap OCCURS 0, " Internal table for storing ABAP
line(256) TYPE c,
END OF i_int_abap.
DATA: BEGIN OF i_int_inc OCCURS 0, " Table to Store Includes Name
include LIKE sy-repid,
END OF i_int_inc.
DATA:v_prog TYPE trdir-name ,
v_tcode TYPE sy-tcode,
v_dummmy TYPE c.
CONSTANTS:c_true TYPE c VALUE 'X'.
CLEAR v_prog.
v_prog = p_prog.
CALL FUNCTION 'RS_GET_ALL_INCLUDES' "This will get all includes related to the program
EXPORTING
program = v_prog
with_inactive_incls = c_true
TABLES
includetab = i_int_inc
EXCEPTIONS
not_existent = 1
no_program = 2
OTHERS = 3.
IF sy-subrc = 0.
CLEAR i_int_inc.
i_int_inc-include = p_prog.
INSERT i_int_inc INDEX 1.
CLEAR i_int_inc.
LOOP AT i_int_inc. " loop at all programs/include and check for call transaction
CLEAR v_prog.
v_prog = i_int_inc-include.
READ REPORT v_prog INTO i_int_abap.
LOOP AT i_int_abap WHERE line(1) <> '*'
AND LINE CS 'CALL TRANSACTION '.
SPLIT i_int_abap-line AT text-001 INTO v_dummmy v_tcode. "text-001 stores '
SPLIT v_tcode AT text-001 INTO v_tcode v_dummmy. "text-001 stores '
WRITE : / 'Call transaction to :' , v_tcode.
ENDLOOP.
REFRESH i_int_abap .
ENDLOOP.
ENDIF.
Regards,
Dev.
Similar Messages
-
How to determine fixed line of table control using BDC program ?
Dear All,
I create program using BDC that contains table control.
Unfortunately the table control line of BDC program will depend on the resolution of our PC setting.
Sometime I have 2 lines, sometime 3 lines (in different PC).
How to determine fixed line of table control?
So it will never be confusing me whether I have 2 or 3 lines.
Thnx - Regards,
(Taufik K.)Hi Taufik,
Check the table CTU_PARAMS and field DEFSIZE for setting fixed line of a table control.
CALL TRANSACTION 'VA01' USING it_bdcdata
OPTIONS FROM OPT
MESSAGES INTO it_mesg.
opt of type ctu_params.
WA_CTU_PARAMS-DISMODE = 'N'. "no screen mode
WA_CTU_PARAMS-UPDMODE = 'S'. "synchronus update
WA_CTU_PARAMS-NOBINPT = 'X'.
WA_CTU_PARAMS-NOBIEND = 'X'.
WA_CTU_PARAMS-DEFSIZE = 'X'. "Default size
Default size will play good role in terms of resoultion. in one system in table control you can see 10rows, but in others system it will show 20 records. it depends on resoultion. but when you set the default size then it will take same (default screen size) in all the systems when you run BDC.
Reward if helps.
Regards,
Senthil
Message was edited by: senthil kumar -
Standard BDC program used for FI
hi all ,
i would like to know the standard BDC program used in FI , like for tcode fb01 or somethings else.
Appreciate for any segguestion.
thanks and regards.hi siddu m
thanks for replay ,
i have anohter question
provided the transaction A was contianed in the first batch file,
and also contained in the second batch file , how the tcode treated as the duplicate posting ?
many thanks -
BDC programming using Batch input Session.
Hello Experts.
I'm an ABAP beginner. I've benn practicing BDC programming using Batch input Session
at the moment.
This is the program that upload Local file which has plural records, and put the records into a Session.
These are the records.
413459,KIM EI HWAN121 ,19810607,MIADONG1234
423459,KIM EI HWAN122 ,19810607,MIADONG1235
433459,KIM EI HWAN123 ,19810607,MIADONG1236
443459,KIM EI HWAN124 ,19810607,MIADONG1237
453459,KIM EI HWAN125 ,19810607,MIADONG1238
463459,KIM EI HWAN126 ,19810607,MIADONG1239
I succeeded making Session.
However, for some reaseon, every record in the Session has got the same, value which is the first record.
Why is this happening? And How can I correct the code below?
REPORT ZBCUSER002_BATCH NO STANDARD PAGE HEADING
LINE-SIZE 255
MESSAGE-ID ZBATCH.
= Types definition ===================================================
TYPES: BEGIN OF TYP_LOCAL, "For Local file upload
RECORD(200) TYPE C,
END OF TYP_LOCAL.
= Internal table definition ==============================================
DATA: BEGIN OF BDC_TAB OCCURS 0. "BDCDATA itab
INCLUDE STRUCTURE BDCDATA.
DATA: END OF BDC_TAB.
DATA: BEGIN OF MESSAGE_BDC OCCURS 0. "Message itab
INCLUDE STRUCTURE BDCMSGCOLL.
DATA: END OF MESSAGE_BDC.
DATA: TBL_LOCAL TYPE STANDARD TABLE OF TYP_LOCAL, "Local file itab
F_TBL TYPE FILETABLE. "FILETABLE fot local
= Structure table definition =========================================
DATA: STR_F_TBL LIKE LINE OF F_TBL, "FILETABLE structure
STR_LOCAL TYPE TYP_LOCAL. "Local file structure
= Variable definition ================================================
DATA: LV_RC TYPE I, "Method parameter
ENUMBER TYPE ZT601-ENUMBER, "Employee number
NAME TYPE ZT601-NAME, "Employee name
BIRTH TYPE ZT601-BIRTH, "Birthday
HOMETOWN TYPE ZT601-HOMETOWN, "Hometown
SYSVAL TYPE SY-SUBRC. "System valuible
= Constants definition ===============================================
CONSTANTS: TBL_NAME(10) TYPE C VALUE 'ZT601'. "Table name ZT601
= Parameters definition ==============================================
PARAMETERS: F_NAME TYPE RLGRAP-FILENAME OBLIGATORY, "File path
EXECMODE(1) TYPE C. "Execute mode
INITIALIZATION
*----- Initialize all valuables, structures and internal tables
CLEAR: LV_RC,
STR_F_TBL,
STR_LOCAL,
ENUMBER,
NAME,
BIRTH,
HOMETOWN.
REFRESH: F_TBL,
TBL_LOCAL.
AT SELECTION-SCREEN
*----- When the button next to Parameter 'F_NAME',
*----- File dialog open.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR F_NAME.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG
EXPORTING
WINDOW_TITLE = 'SELECT FILE'
DEFAULT_FILENAME = '*.TXT'
CHANGING
FILE_TABLE = F_TBL
RC = LV_RC
EXCEPTIONS
FILE_OPEN_DIALOG_FAILED = 1
CNTL_ERROR = 2
OTHERS = 3
*----- system valiable check.
*----- If done properly,
*----- Put the path into the File path parameter
IF SY-SUBRC = 0.
READ TABLE F_TBL INTO STR_F_TBL INDEX 1.
F_NAME = STR_F_TBL.
*----- If not done properly, show message
*----- An error occured while getting file path then end program
ELSE.
MESSAGE E000.
ENDIF.
*----- Execute code can only be A or N.
AT SELECTION-SCREEN ON EXECMODE.
IF EXECMODE <> 'A' AND EXECMODE <> 'N'.
MESSAGE E001.
ENDIF.
START-OF-SELECTION
START-OF-SELECTION.
*----- Upload Local file of file path parameter.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = F_NAME
FILETYPE = 'ASC'
TABLES
DATA_TAB = TBL_LOCAL
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
OTHERS = 6.
*----- System valiable check.
*----- If not done properly, show an error message
*----- An error occured while uploading local file then end program
IF SY-SUBRC <> 0.
MESSAGE E002.
ENDIF.
PERFORM BDC_OPEN.
*----- Loop Internal table
LOOP AT TBL_LOCAL INTO STR_LOCAL.
*----- Spilt the file record and put them into each valiable.
SPLIT STR_LOCAL AT ',' INTO ENUMBER
NAME
BIRTH
HOMETOWN.
*----- Data check Function module
CALL FUNCTION 'DATE_CHECK_PLAUSIBILITY'
EXPORTING
DATE = BIRTH
EXCEPTIONS
PLAUSIBILITY_CHECK_FAILED = 1
OTHERS = 2.
*----- When error occurs while checking date, show an error message.
*----- (&1) is not date
IF SY-SUBRC <> 0.
MESSAGE E003 WITH BIRTH.
ENDIF.
*-- The first screen of SE11
*----- Screen number 0102 of program id SAPMSRD0
PERFORM BDC_DYNPRO USING 'SAPMSRD0' '0102'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'RSRD1-TBMA_VAL'. "Field on Cursor
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=SHOW'. "Display button
PERFORM BDC_FIELD USING 'RSRD1-TBMA'
'X'.
PERFORM BDC_FIELD USING 'RSRD1-TBMA_VAL'
TBL_NAME. "ZT601
*-- Table definition screen
*----- Screen number 2000 of program id SAPLSD02
PERFORM BDC_DYNPRO USING 'SAPLSD02' '2000'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'DD02D-TABCLTEXT'. "Field on Cursor
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=TDED'. "Create entry
PERFORM BDC_FIELD USING 'BDC_SUBSCR'
'SAPLSD02'.
PERFORM BDC_FIELD USING 'BDC_SUBSCR'
'SAPLSED5'.
*-- Data input screen
*----- Screen number 0101 of program /1BCDWB/DBZT601
PERFORM BDC_DYNPRO USING '/1BCDWB/DBZT601' '0101'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'ZT601-CRUSER'. "Field on Cursor
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=SAVE'. "Save
PERFORM BDC_FIELD USING 'ZT601-MANDT'
SY-MANDT. "Client
PERFORM BDC_FIELD USING 'ZT601-ENUMBER'
ENUMBER. "Employee number
PERFORM BDC_FIELD USING 'ZT601-NAME'
NAME. "Employee name
PERFORM BDC_FIELD USING 'ZT601-BIRTH'
BIRTH. "Birthday
PERFORM BDC_FIELD USING 'ZT601-HOMETOWN'
HOMETOWN. "Hometown
PERFORM BDC_FIELD USING 'ZT601-CRDATE'
SY-DATUM. "System date
PERFORM BDC_FIELD USING 'ZT601-CRTIME'
SY-UZEIT. "System time
PERFORM BDC_FIELD USING 'ZT601-CRUSER'
SY-UNAME. "System user
*-- Data input screen (After input)
*----- Screen number 0101 of program /1BCDWB/DBZT601
PERFORM BDC_DYNPRO USING '/1BCDWB/DBZT601' '0101'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'/EBACK'. "Back
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'ZT601-CRUSER'. "Field on Cursor
*-- Table definition screen]
*----- Screen number 2000 of program SAPLSD02
PERFORM BDC_DYNPRO USING 'SAPLSD02' '2000'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'DD02D-TABCLTEXT'. "Field on Cursor
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=WB_BACK'. "Back
*-- The first screen of SE11
*----- Screen number 0102 of program SAPMSRD0
PERFORM BDC_DYNPRO USING 'SAPMSRD0' '0102'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'RSRD1-TBMA_VAL'. "Field on Cursor
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=BACK'.
PERFORM BDC_FIELD USING 'RSRD1-TBMA'
'X'.
PERFORM BDC_FIELD USING 'RSRD1-TBMA_VAL'
TBL_NAME.
PERFORM BDC_INSERT.
ENDLOOP.
PERFORM BDC_CLOSE.
FORM BDC_DYNPRO *
Put Program-Id, Dynpro screen number, Start point
into DBCDATA
--> PROGRAM *
--> DYNPRO *
FORM BDC_DYNPRO USING PROGRAM DYNPRO.
CLEAR BDC_TAB.
BDC_TAB-PROGRAM = PROGRAM.
BDC_TAB-DYNPRO = DYNPRO.
BDC_TAB-DYNBEGIN = 'X'.
APPEND BDC_TAB.
ENDFORM.
FORM BDC_FIELD *
Put Field Name and Value into BDCDATA
--> FNAM *
--> FVAL *
FORM BDC_FIELD USING FNAM FVAL.
CLEAR BDC_TAB.
BDC_TAB-FNAM = FNAM.
BDC_TAB-FVAL = FVAL.
APPEND BDC_TAB.
ENDFORM.
FORM bdc_process *
FORM BDC_OPEN.
CALL FUNCTION 'BDC_OPEN_GROUP'
EXPORTING
CLIENT = SY-MANDT
GROUP = 'Testsession'
KEEP = 'X'
USER = SY-UNAME.
IF SY-SUBRC <> 0.
MESSAGE E006 WITH SY-SUBRC.
ENDIF.
ENDFORM.
FORM bdc_insert *
FORM BDC_INSERT.
CALL FUNCTION 'BDC_INSERT'
EXPORTING
TCODE = 'SE11'
TABLES
DYNPROTAB = BDC_TAB
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.
MESSAGE E007 WITH SY-SUBRC.
ENDIF.
CLEAR: BDC_TAB.
ENDFORM.
FORM bdc_close *
FORM BDC_CLOSE.
CALL FUNCTION 'BDC_CLOSE_GROUP'
EXCEPTIONS
NOT_OPEN = 1
QUEUE_ERROR = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
MESSAGE E008 WITH SY-SUBRC.
ENDIF.
ENDFORM.God I forgot to refresh Internal table after putting record into Session.
Now I'm done.
You guys be careful too. -
Hi,
I am new to HR ABAP . Can anybody send me an end to end sample BDC program using HR ABAP. I have a requirement to develop a program.
Please give the sample file which has the sample data to upload to SAP.
Rgds,
Sofiahi....
to create a program of your own....
goto tcode 'SHDB' and there go for a new recording of the TCODE as required by you...
after recording is complete there is a button to GENERATE a program for that
i am looking for a complete data tranfer example which i have done.... i ll send that to you
regards
this is a sample code for it
THIS IS WRITTEN BY ME,YOU CAN GENERATE PROGRAM DIRECTLY
*" Type declarations...................................................
Type declaration of the structure to hold material information *
TYPES:
BEGIN OF type_s_mat,
name(10) TYPE c, " Material Number
industry TYPE c, " Industry Sector
mtype(10) TYPE c, " Material Type
descr(20) TYPE c, " Material Description
unit(10) TYPE c, " Base Unit of Measure
END OF type_s_mat,
type_s_f2(4096) TYPE c.
*" Data declarations...................................................
Work variables *
DATA:
fs_f1 TYPE type_s_mat, " Field string of TYPE_S_MAT
fs_workarea TYPE bdcdata, " Field string of type BDCDATA
fs_bdc TYPE bdcmsgcoll, " Field string of type bdcmsgcoll
w_msg(72) TYPE c, " Holds message for writing
w_i TYPE i, " Holds value of rc
w_file TYPE filetable, " Holds name of the file
w_var TYPE file_table, " Field string of file_table
w_file1 TYPE string. " Holds the path of the file
Internal table to hold data for the input *
DATA:
t_itab LIKE
STANDARD TABLE
OF fs_workarea,
Internal table to hold data for the messages *
t_mess LIKE
STANDARD TABLE
OF fs_bdc,
t_mat LIKE
STANDARD TABLE
OF fs_f1,
Internal table to hold data for the input *
t_temp TYPE
STANDARD TABLE
OF type_s_f2.
*"Selection screen elements............................................
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.
PARAMETERS: p_file(128) TYPE c.
SELECTION-SCREEN END OF BLOCK b1.
AT SELECTION-SCREEN ON VALUE-REQUEST EVENT *
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CALL METHOD cl_gui_frontend_services=>file_open_dialog
EXPORTING
window_title = 'FILE_OPEN'
default_extension = 'XLS'
CHANGING
file_table = w_file
rc = w_i
EXCEPTIONS
file_open_dialog_failed = 1
cntl_error = 2
error_no_gui = 3
not_supported_by_gui = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF. " IF SY-SUBRC <> 0.
LOOP AT w_file INTO w_var.
p_file = w_var-filename.
ENDLOOP. " LOOP AT W_FILE INTO W_VAR.
ULINE.
START-OF-SELECTION EVENT *
START-OF-SELECTION.
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
i_tab_raw_data = t_temp
i_filename = p_file
TABLES
i_tab_converted_data = t_mat
EXCEPTIONS
conversion_failed = 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. " IF SY-SUBRC EQ 0.
END-OF-SELECTION EVENT *
END-OF-SELECTION.
PERFORM sub_display.
*& Form sub_screen
This subroutine appends the value of screen name and number *
-->PV_screenam This holds screen name *
-->PV_scrnum This holds screen number *
FORM sub_screen USING value(pv_screenam)
value(pv_scrnum).
CLEAR fs_workarea.
fs_workarea-program = pv_screenam.
fs_workarea-dynpro = pv_scrnum.
fs_workarea-dynbegin = 'X'.
APPEND fs_workarea TO t_itab.
ENDFORM. " FORM SUB_SCREEN
*& Form SUB_FIELD_DATA *
This subroutine apppends field name and value of the screen. *
-->PV_FLDNAM This holds field name *
-->PV_FLDVAL This holds Field value *
FORM sub_field_data USING value(pv_fldnam)
value(pv_fldval).
CLEAR fs_workarea.
fs_workarea-fnam = pv_fldnam.
fs_workarea-fval = pv_fldval.
APPEND fs_workarea TO t_itab.
ENDFORM. " FORM SUB_FIELD_DATA
*& Form sub_display *
This subroutine fills the value on screen fields when BDC executes *
There are no interface parameters to be passed to this subroutine. *
FORM sub_display .
LOOP AT t_mat INTO fs_f1.
CLEAR fs_workarea.
CLEAR fs_bdc.
PERFORM sub_screen USING 'SAPLMGMM' '0060'.
PERFORM sub_field_data USING 'RMMG1-MATNR' fs_f1-name.
PERFORM sub_field_data USING 'RMMG1-MBRSH' fs_f1-industry.
PERFORM sub_field_data USING 'RMMG1-MTART' fs_f1-mtype.
PERFORM sub_field_data USING 'BDC_OKCODE' '/00'.
PERFORM sub_screen USING 'SAPLMGMM' '0070'.
PERFORM sub_field_data USING 'MSICHTAUSW-KZSEL(01)' 'X'.
PERFORM sub_field_data USING 'MSICHTAUSW-KZSEL(02)' 'X'.
PERFORM sub_field_data USING 'BDC_OKCODE' '=ENTR'.
PERFORM sub_screen USING 'SAPLMGMM' '4004'.
PERFORM sub_field_data USING 'MAKT-MAKTX' fs_f1-descr.
PERFORM sub_field_data USING 'MARA-MEINS' fs_f1-unit.
PERFORM sub_field_data USING 'BDC_OKCODE' '/00'.
PERFORM sub_screen USING 'SAPLMGMM' '4004'.
PERFORM sub_field_data USING 'BDC_OKCODE' '=BU'.
CALL TRANSACTION 'MM01' USING t_itab MODE 'A' MESSAGES INTO t_mess.
ENDLOOP.
ENDFORM. " SUB_DISPLAY
Edited by: Mohit Kumar on Feb 18, 2009 12:40 PM -
Issue with BDC program used for FBZ5 (Check Print)
Hi all,
I am having one requirement in Check printing. as per that i have made one Z program which will accept multiple Payment documents. I am passing selected accounting documents to BDC routine for Transaction FBZ5. (As in FBZ5 we can take a print for one Payment document not for multiple)
We can have 3 scenarios in FBZ5
1. Fresh Check printing (First time check printing)
2. Old Check (printing for same Check no)
3. New Check (After voiding older check)
Category 1 and 2 are working fine but i am facing problem in category 3.
For Category 3 : BDC Screen flow is like this
A. Tcode FBZ5 Start program: SAPMFCHK Screen: 750 --> Click on 'Print'
B. Program: SAPLSPO2 Screen: 0100 --> Here specify option 'New Check'
C. Program: SAPMFCHK Screen: 0700
- This program belongs to new Tcode FCH7
- Here we have to give Void Reason code
Now issue with Category 3:
While executing BDC in online and background mode my control is terminating at step C mentioned above
Troubleshooting:
I have debugged standard program of FBZ5
1. in Include MFCHKFD0 we can see call to Tcode FCH7 (PERFORM AUFRUF_FCH7.)
2. in form AUFRUF_FCH7 i found code related to BDC
also there one statement is getting triggered --> CALL TRANSACTION 'FCH7' USING BDC MODE 'A'.
So there is a BDC call inside my Z BDC program, so is this a reason why my program is not working for above scenario ?
Or can't we handle above scenario in a way mentioned above?Hi Sandra,
I was trying to upload customer master in fd01 using bdc. The screens were different while recording. So could not perform the upload. Thenone screen was skipped so that the bdc was working fine and the data was uploaded.
This is the flow of the recording.
'SAPMF02D' '0105'.
SAPMF02D' '7105'
SAPMF02D' '0111
SAPMF02D' '0120
SAPMF02D' '0130
SAPMF02D' '0210
SAPMF02D' '0215
SAPMF02D' '0220'
SAPMF02D' '0230'
SAPMF02D' '0610
After the second screen was deleted the bdc worked fine. -
BDC program using call txn for txn cj40
Hi,
I am uploading data using bdc call txn method for txn cj40. In flat file I have 2 header field and 4 line items.So in line items last field is Qty [RK70L-MENGE].This field data is not uploading.Pls tell me where is the problem.
And in txn cj40 first field is project def, So user wants. That field should be blank.
Bcoz it is taking previous value.Pls tell me the suitable code for that.
Thanks & Regards,
Shiv KantSo in line items last field is Qty RK70L-MENGE//
->Use char format in ur flat file for the quantity field.
itab-menge(13) type c.
//And in txn cj40 first field is project def, So user wants. That field should be blank.
Bcoz it is taking previous value.Pls tell me the suitable code for that.
Dont know what u mean by taking previous value .. just check if ur refreshing bdcdata structure after every iteration / before the start of iteration itself in ur loop endloop .
loop ..
refresh i_bdcdata[]. " <----
perform
perform
perform
endloop. -
Data upload for vendor balances using BDC
hi abap experts,
I have a requirement on data uploading using BDC.
For the vendor balances ie. for transaction FBL1N ( I was given a template for vendor balance upload and need to write a BDC program for that ) I need upload the exsisting transaction data to the system. is recording necessary for this?
can u pls help me with step by step process for vendor balance uploading.
Thanks,
Hema.Hi
Please follow the following Steps:
Steps for recording:
Step1: Goto TCODE SHDB
Step2: Click on New Recording
Step3: Give the necessary Details such as TOCDE, Desc, ...
Step4: Do the screen by screen recording.(Please avoid extra screen to appear)
Step5: Save the recording.
Step6. Select the recording and click on Program button on toolbar.
Step7: Give the Program name and click on radio button Transfer from recording.
Step 8: It will open a new session with SE38 and a program with the recoding.
Step 9: then just add the basic code for BDC.
Regards,
Lokesh -
I want in LSMW SAME CODING. THIS IS USING BDC CALL TRANSACTION
REPORT ZXX_BDC_PRA NO STANDARD PAGE HEADING LINE-COUNT 20
LINE-SIZE 150 .
Program Name :ZXX_BDC_PRA *
Object Id : *
Develper Name : praveen *
Start Date : 25.06.07 *
Description : uploading flat file to sap system *
*--structure for Data Uploading.
DATA: BEGIN OF IT_STR ,
VKORG LIKE RF02D-VKORG,
VTWEG LIKE RF02D-VTWEG,
SPART LIKE RF02D-SPART,
KTOKD LIKE RF02D-KTOKD,
NAME1 LIKE KNA1-NAME1,
SORTL LIKE KNA1-SORTL,
ORT01 LIKE KNA1-ORT01,
PSTLZ LIKE KNA1-PSTLZ,
LAND1 LIKE KNA1-LAND1,
SPRAS LIKE KNA1-SPRAS,
END OF IT_STR.
*--Internal Table for Data Uploading.
DATA: ITAB LIKE IT_STR OCCURS 0.
*--Internal Table to sucessfull Records.
DATA: ITAB1 LIKE IT_STR OCCURS 0.
*--Internal Table to Store Error Records.
DATA: ITAB2 LIKE STANDARD TABLE OF IT_STR WITH HEADER LINE.
*--Internal Table for Storing the BDC data.
DATA: BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE.
*--Internal Table for storing the messages.
DATA: MESSTAB LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.
DATA: COUNT TYPE I VALUE 1,
S VALUE 0, E VALUE 0.
Selection screen *
SELECTION-SCREEN BEGIN OF BLOCK b1
WITH FRAME TITLE TEXT-001.
PARAMETERS: P_FILE TYPE IBIPPARMS-PATH.
SELECTION-SCREEN END OF BLOCK B1.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
*functionality to use drill down list
CALL FUNCTION 'F4_FILENAME'
EXPORTING
PROGRAM_NAME = SYST-CPROG
DYNPRO_NUMBER = SYST-DYNNR
IMPORTING
FILE_NAME = P_FILE.
Start-of-selection *
START-OF-SELECTION.
DATA FILENAME TYPE STRING.
FILENAME = P_FILE.
*-- Form to upload flatfile data into the internal table.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = FILENAME
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X'
TABLES
DATA_TAB = ITAB
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.
*--Generating the BDC table for the fields of the internal table.
LOOP AT ITAB INTO IT_STR.
PERFORM BDC_DYNPRO USING 'SAPMF02D' '0107'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'RF02D-KTOKD'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'/00'.
PERFORM BDC_FIELD USING 'RF02D-VKORG'
IT_STR-VKORG.
PERFORM BDC_FIELD USING 'RF02D-VTWEG'
IT_STR-VTWEG.
PERFORM BDC_FIELD USING 'RF02D-SPART'
IT_STR-SPART.
PERFORM BDC_FIELD USING 'RF02D-KTOKD'
IT_STR-KTOKD.
PERFORM BDC_DYNPRO USING 'SAPMF02D' '0110'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'KNA1-SPRAS'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'/00'.
PERFORM BDC_FIELD USING 'KNA1-NAME1'
IT_STR-NAME1.
PERFORM BDC_FIELD USING 'KNA1-SORTL'
IT_STR-SORTL.
PERFORM BDC_FIELD USING 'KNA1-ORT01'
IT_STR-ORT01.
PERFORM BDC_FIELD USING 'KNA1-PSTLZ'
IT_STR-PSTLZ.
PERFORM BDC_FIELD USING 'KNA1-LAND1'
IT_STR-LAND1.
PERFORM BDC_FIELD USING 'KNA1-SPRAS'
IT_STR-SPRAS.
PERFORM BDC_DYNPRO USING 'SAPMF02D' '0120'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'KNA1-TXJCD'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'/00'.
PERFORM BDC_DYNPRO USING 'SAPMF02D' '0125'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'KNA1-NIELS'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'/00'.
PERFORM BDC_DYNPRO USING 'SAPMF02D' '0360'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'KNVK-NAMEV(01)'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=ENTR'.
PERFORM BDC_DYNPRO USING 'SAPMF02D' '0310'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'KNVV-BEGRU'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'/00'.
PERFORM BDC_DYNPRO USING 'SAPMF02D' '0324'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'KNVP-PARVW(01)'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=ENTR'.
*--Calling the transaction 'Vd01'.
CALL TRANSACTION 'VD01' USING BDCDATA MODE 'N' UPDATE 'S'
MESSAGES INTO MESSTAB.
PERFORM MESSAGES.
REFRESH : BDCDATA, MESSTAB.
ENDLOOP.
END-OF-SELECTION.
*--Populating the Success records internal table.
IF ITAB1[] IS NOT INITIAL.
format color 5.
WRITE: /'SUCCESSFUL RECORDS'.
format color off.
LOOP AT ITAB1 INTO IT_STR.
WRITE:/ IT_STR-VKORG,IT_STR-VTWEG,
IT_STR-SPART,IT_STR-KTOKD,
IT_STR-NAME1,IT_STR-SORTL,
IT_STR-ORT01,
IT_STR-PSTLZ,
IT_STR-LAND1,
IT_STR-SPRAS.
S = S + 1.
ENDLOOP.
REFRESH : ITAB1.
WRITE:/ 'TOTAL RECORDS',S.
ENDIF.
*--Populating the error records internal table.
IF ITAB2[] IS NOT INITIAL.
FORMAT COLOR 3.
WRITE :/ 'ERRORS RECORDS ARE'.
FORMAT COLOR OFF.
LOOP AT ITAB2.
WRITE:/ ITAB2-VKORG,
ITAB2-VTWEG,
ITAB2-SPART,ITAB2-KTOKD,
ITAB2-NAME1,ITAB2-SORTL,
ITAB2-ORT01,
ITAB2-PSTLZ,
ITAB2-LAND1,
ITAB2-SPRAS.
E = E + 1.
ENDLOOP.
REFRESH : ITAB2.
WRITE: / 'TOTAL RECORDS',E.
REFRESH : ITAB2.
ENDIF.
End of Selection *
END-OF-SELECTION.
TOP-OF-PAGE *
TOP-OF-PAGE.
WRITE:/ SY-ULINE.
WRITE:/10 'REPORT ID',21 SY-REPID,35 'USERNAME',46 SY-UNAME,
60 'SYSTEM DATE',70 SY-DATUM,80 'SYSTEM TIME',90 SY-UZEIT,
100 'PAGE NO',108 SY-PAGNO.
WRITE:/ SY-ULINE.
FOrm to Populate the BDC table.
Start new screen *
FORM BDC_DYNPRO USING PROGRAM DYNPRO.
CLEAR BDCDATA.
BDCDATA-PROGRAM = PROGRAM.
BDCDATA-DYNPRO = DYNPRO.
BDCDATA-DYNBEGIN = 'X'.
APPEND BDCDATA.
ENDFORM. "BDC_DYNPRO
Insert field *
FORM BDC_FIELD USING FNAM FVAL.
IF FVAL <> SPACE.
CLEAR BDCDATA.
BDCDATA-FNAM = FNAM.
BDCDATA-FVAL = FVAL.
APPEND BDCDATA.
ENDIF.
ENDFORM. "BDC_FIELD
*& Form messages
FORM MESSAGES .
LOOP AT MESSTAB.
IF MESSTAB-MSGTYP = 'I'.
WRITE : / MESSTAB-MSGV1.
ELSEIF
MESSTAB-MSGTYP = 'S'.
INSERT LINES OF ITAB FROM COUNT TO COUNT INTO TABLE ITAB1 .
COUNT = COUNT + 1.
WRITE : / MESSTAB-MSGV1.
ELSEIF
MESSTAB-MSGTYP = 'E'.
INSERT LINES OF ITAB FROM COUNT TO COUNT INTO TABLE ITAB2.
COUNT = COUNT + 1.
WRITE : / MESSTAB-MSGV1.
ENDIF.
ENDLOOP.
ENDFORM. " messagesHi
Go through the doc and do the same using LSMW
BDC is the way to transfer data by writing a batch input program which can use either session or call transaction method.
LSMW used to transfer data without/less code.
What type of data we transfer using LSMW?
LSMW is best suited for transferring master data.
Actually BDC and LSMW are not comparable at all.
for example LSMW itself can use BDC as a way of mass data transfer.
BDC is a mass data transfer technique via screen logic of existing SAP Data entry transactions. It behaves as if you are manually making thousand of entires into sap system as a background job. And that is probably the reason why BAPI's are preffered over BDC's.
On the other hand LSMW is a tool to facilitate DATA migration from other legacy systems ... It contains step by step procedure for data migration.
Like Managing Data Migration Projects , Creating Source Structures , Mapping Source structures wid Target structures , etc etc
LSMW internally might well be using the following techniqes for data transfer..
1. IDOX
2. Direct Input / BDC
4. BAPI's
LSMW is an encapsulated data transfer tool. It can provide the same functionality as BDC infact much more but when coming to techinical perspective most the parameters are encapulated. To listout some of the differences :
LSMW is basicaly designed for a fuctional consultant who do not do much coding but need to explore the fuctionality while BDC is designed for a technical consultant.
LSMW offers different techinque for migrating data: Direct input ,BAPI,Idoc,Batch input recording. While bdc basically uses recording.
LSMW mapping is done by SAP while in BDC we have to do it explicitly .
LSMW is basically for standard SAP application while bdc basically for customized application.
Coding can be done flexibly in BDC when compared to LSMW
1. Maintain Attributes:
Here you have to choose the second option and you can do the recording how this should work. Then assign the same to the Batch Input Recording name.
2. Maintain Source structure:
Create a structure name
3. Maintain Source field:
In this you have to create a structure same as that of the input file
eg: name
age
4. Maintain structure relations:
This will link the structure to the input file.
5. Maintain field mapping and conversion rules:
Here is the place where you can do coding, depending upon the code you have written or assignment you have done the values will get picked up from the file and get processed.
6. Maintain field mapping and conversion rules:
If you have any fixed values you can define here.
7. Specify files:
Specify the input file path and type.
8. Assign files:
This will assign ur file to the Input file
9. Read Data:
This will read ur data from teh file.
10. Dispaly Read Data:
You can see the uploaded data
11. Convert Data
This will convert the data to the corresponding format for processing
12. Display Converted data:
13. Create batch input session
Here this will create a batch input session for processing
14. Run Batch Input session:
By clicking on the session and process the same you can do teh needfu.
http://www.sapbrain.com/TOOLS/LSMW/SAP_LSMW_steps_introduction.html
http://esnips.com/doc/8e732760-5548-44cc-a0bb-5982c9424f17/lsmw_sp.ppt
http://esnips.com/doc/f55fef40-fb82-4e89-9000-88316699c323/Data-Transfer-Using-LSMW.zip
http://esnips.com/doc/1cd73c19-4263-42a4-9d6f-ac5487b0ebcb/LSMW-with-Idocs.ppt
http://esnips.com/doc/ef04c89f-f3a2-473c-beee-6db5bb3dbb0e/LSMW-with-BAPI.ppt
http://esnips.com/doc/7582d072-6663-4388-803b-4b2b94d7f85e/LSMW.pdf
for Long texts Upload
Please take a look at this..
http://help.sap.com/saphelp_erp2005/helpdata/en/e1/c6d30210e6cf4eac7b054a73f8fb1d/frameset.htm
Reward points for useful Answers
Regards
Anji -
How to display the output screen when I use bdc.
hey expert,
I want to display the output screen when i use bdc without using mode 'A'.
thank you.Hi,
You can go for mode 'E'.. it will display the output screen directly and if there is any error in the transaction you would get that particular screen and you can correct and continue after which you will get the final screen if anything goes fine...
check this sample code....
I had a program if you execute below program it automatically creates a new zprogram.
REPORT zprogram_create_recording.
PARAMETER:
p_prog TYPE sy-repid OBLIGATORY,
p_shtxt TYPE repti OBLIGATORY,
p_pack TYPE devclass DEFAULT '$tmp'.
DATA:
t_bdcdata LIKE
STANDARD TABLE
OF bdcdata.
DATA:
wa_bdcdata LIKE LINE OF t_bdcdata.
REFRESH t_bdcdata.
CLEAR wa_bdcdata.
wa_bdcdata-program = 'SAPLWBABAP'.
wa_bdcdata-dynpro = '0100'.
wa_bdcdata-dynbegin = 'X'.
wa_bdcdata-fnam = 'RS38M-PROGRAMM'.
wa_bdcdata-fval = p_prog.
APPEND wa_bdcdata TO t_bdcdata.
CLEAR wa_bdcdata.
wa_bdcdata-fnam = 'BDC_OKCODE'.
wa_bdcdata-fval = 'NEW'.
APPEND wa_bdcdata TO t_bdcdata.
CLEAR wa_bdcdata.
wa_bdcdata-program = 'SAPLSEDTATTR'.
wa_bdcdata-dynpro = '0200'.
wa_bdcdata-dynbegin = 'X'.
wa_bdcdata-fnam = 'RS38M-REPTI'.
wa_bdcdata-fval = p_shtxt.
APPEND wa_bdcdata TO t_bdcdata.
CLEAR wa_bdcdata.
wa_bdcdata-fnam = 'TRDIR-SUBC'.
wa_bdcdata-fval = '1'.
APPEND wa_bdcdata TO t_bdcdata.
CLEAR wa_bdcdata.
wa_bdcdata-fnam = 'BDC_OKCODE'.
wa_bdcdata-fval = 'CONT'.
APPEND wa_bdcdata TO t_bdcdata.
IF p_pack EQ '$TMP'.
*local object
CLEAR wa_bdcdata.
wa_bdcdata-program = 'SAPLSTRD'.
wa_bdcdata-dynpro = '0100'.
wa_bdcdata-dynbegin = 'X'.
wa_bdcdata-fnam = 'KO007-L_DEVCLASS'.
wa_bdcdata-fval = ' '.
APPEND wa_bdcdata TO t_bdcdata.
CLEAR wa_bdcdata.
wa_bdcdata-fnam = 'BDC_OKCODE'.
wa_bdcdata-fval = 'TEMP'.
APPEND wa_bdcdata TO t_bdcdata.
ELSE.
*package assignment with request
CLEAR wa_bdcdata.
wa_bdcdata-program = 'SAPLSTRD'.
wa_bdcdata-dynpro = '0100'.
wa_bdcdata-dynbegin = 'X'.
wa_bdcdata-fnam = 'KO007-L_DEVCLASS'.
wa_bdcdata-fval = p_pack.
APPEND wa_bdcdata TO t_bdcdata.
CLEAR wa_bdcdata.
wa_bdcdata-fnam = 'BDC_OKCODE'.
wa_bdcdata-fval = 'ADD'.
APPEND wa_bdcdata TO t_bdcdata.
CLEAR wa_bdcdata.
wa_bdcdata-program = 'SAPLSTRD'.
wa_bdcdata-dynpro = '0300'.
wa_bdcdata-dynbegin = 'X'.
wa_bdcdata-fnam = 'KO008-TRKORR'.
wa_bdcdata-fval = ' '.
APPEND wa_bdcdata TO t_bdcdata.
CLEAR wa_bdcdata.
wa_bdcdata-fnam = 'KO008-AS4TEXT'.
wa_bdcdata-fval = ' '.
APPEND wa_bdcdata TO t_bdcdata.
CLEAR wa_bdcdata.
wa_bdcdata-fnam = 'BDC_OKCODE'.
wa_bdcdata-fval = 'LOCK'.
APPEND wa_bdcdata TO t_bdcdata.
ENDIF. " IF P_PACK EQ '$TMP'
CALL TRANSACTION 'SE38' USING t_bdcdata MODE 'E'.
Hope this would help you..
Regards
Narin Nandivada -
Capturing EPC error List into a local file using BDC
Can anyone let me know the Code for downloading the EPC check Results into a local File using BDC...[<b></b>
You can use the function module
EXTENDED_PROGRAM_CHECK to get the errors and warnigs of a epc for a program.
then you can download that internal table information using GUI_DOWNLOAD fm.
Regards,
Ravi -
Call transaction using bdc tab and also skip first screen??
Hi,
Please help.
I want to call transaction PA30 fill it with values which are determined only at runtime and then skip first screen.
The screen doesn't have parameter fields so i cannot use 'set parameter id'.
I also cannot create a transaction with parameters as I only have these at runtime.
Anyone done anything like this???hi,
you might be populateing the itab bdc_tab with the corresponding values fronm the recording.
while doing the recording go until to the screen wher u want to finsih.
and populate the bdc_tab wit the ok code,screen number and the value.
this will do.
for eg see the code below.
METHOD analyze_log.
DATA : wrk_extid TYPE balhdr-extnumber.
DATA : wrk_date(10) TYPE c.
DATA : it_rspar TYPE TABLE OF rsparams .
DATA : wa_rspar TYPE rsparams.
DATA: it_bdcdata TYPE STANDARD TABLE OF bdcdata,
wa_bdcdata TYPE bdcdata.
DATA: params TYPE ctu_params.
CONSTANTS : object TYPE balhdr-object VALUE 'ZKIV_LOG'.
IF wa_kopf-vertr_nr IS NOT INITIAL.
CONCATENATE wa_kopf-vertr_nr '/' wa_kopf-nachtr_nr INTO wrk_extid.
wrk_date = '01.09.2006'.
SET PARAMETER ID 'BALOBJ' FIELD object .
SET PARAMETER ID 'BALEXT' FIELD wrk_extid.
wa_rspar-selname = 'ALDATE'.
wa_rspar-sign = 'I'.
wa_rspar-kind = 'P'.
wa_rspar-option = 'EQ'.
wa_rspar-low = wrk_date.
APPEND wa_rspar TO it_rspar.
ELSE.
CLEAR wrk_extid.
SET PARAMETER ID 'BALEXT' FIELD wrk_extid.
ENDIF.
Update BDC tab
--Call SLG1 using BDC--&
params-dismode = 'E'. "Show errors only
CLEAR wa_bdcdata.
wa_bdcdata-program = 'SAPLSLG3'.
wa_bdcdata-dynpro = '0100'.
wa_bdcdata-dynbegin = 'X'.
APPEND wa_bdcdata TO it_bdcdata.
CLEAR wa_bdcdata.
wa_bdcdata-fnam = 'BDC_CURSOR'.
wa_bdcdata-fval = 'BALHDR-ALDATE'.
APPEND wa_bdcdata TO it_bdcdata.
CLEAR wa_bdcdata.
wa_bdcdata-fnam = 'BALHDR-ALDATE'.
wa_bdcdata-fval = wrk_date.
APPEND wa_bdcdata TO it_bdcdata.
CLEAR wa_bdcdata.
wa_bdcdata-fnam = 'BDC_OKCODE'.
wa_bdcdata-fval = '=SELE'.
APPEND wa_bdcdata TO it_bdcdata.
CLEAR wa_bdcdata.
wa_bdcdata-program = 'SAPLSLG3'.
wa_bdcdata-dynpro = '0100'.
wa_bdcdata-dynbegin = 'X'.
APPEND wa_bdcdata TO it_bdcdata.
CLEAR wa_bdcdata.
wa_bdcdata-fnam = 'BDC_OKCODE'.
wa_bdcdata-fval = '=&F03'.
APPEND wa_bdcdata TO it_bdcdata.
CLEAR wa_bdcdata.
wa_bdcdata-fnam = 'BDC_SUBSCR'.
wa_bdcdata-fval = 'SAPLSBAL_DISPLAY 0101SUBSCREEN'.
APPEND wa_bdcdata TO it_bdcdata.
CALL TRANSACTION 'SLG1' USING it_bdcdata OPTIONS FROM params.
--End of BDC--&
ENDMETHOD.
here wat i m doing is that i dont want the subscreen 101 to be displayed..
Message was edited by:
Sandeep S -
Creation of po with mutiple line items using BDC
Hi Gurus,
Can any body hav notes for creating po's using BDC with multiple line items in transaction ME21. I hav created po for single line item but if i tried to create multiple line items, it ll create multiple po's...
thanks in advance
arunSee the Below Logic for me22 and it is also same for me21
report zpochange.
data : i_error like bdcmsgcoll occurs 0 with header line.
data : i_bdcdata like bdcdata occurs 0 with header line.
tables : ekko, ekpo.
data :c1(10) value 'ME22',
c2(1) value ',',c3(10).
data : var1(20). " LIKE EKKO-EBELN.
data : var2 like ekko-ebeln.
data : begin of i_ekko occurs 0,
header(2),
ebeln like ekko-ebeln,
end of i_ekko.
data : begin of i_ekpo occurs 0,
item(2),
ebeln like ekpo-ebeln,
ebelp like ekpo-ebelp,
menge(10), " LIKE EKPO-MENGE,
end of i_ekpo.
data : v like ekpo-ebelp.
data: begin of itab occurs 0,
text(300),
end of itab.
parameters: p_file like ibipparms-path.
*PARAMETERS: PONUMBER LIKE EKPO-EBELN.
at selection-screen on value-request for p_file.
call function 'F4_FILENAME'
exporting
program_name = syst-cprog
dynpro_number = syst-dynnr
FIELD_NAME = ' '
importing
file_name = p_file
start-of-selection.
*SELECT EBELN FROM EKKO INTO TABLE I_EKKO WHERE EBELN = PONUMBER.
SELECT EBELN EBELP MENGE FROM EKPO INTO TABLE I_EKPO WHERE EBELN
*= PONUMBER.
perform get_data.
*LOOP AT ITAB.
WRITE :/ ITAB.
ENDLOOP.
loop at itab.
var1 = itab-text+0(1).
if var1 = 'H'.
*I_EKKO-EBELN = ITAB-TEXT.
split itab at c2 into i_ekko-header
i_ekko-ebeln.
SPLIT ITAB AT ',' INTO I_EKKO-EBELN.
" I_EKPO-EBELP
" I_EKPO-MENGE
" var1.
append i_ekko.
else.
split itab at c2 into i_ekpo-item
i_ekpo-ebeln
i_ekpo-ebelp
i_ekpo-menge.
append i_ekpo.
endif.
*var2 = i_ekpo-ebeln.
MOVE VAR1 TO I_EKPO-EBELN.
MOVE VAR1 TO I_EKKO-EBELN.
APPEND: I_EKPO.
*if not var1 is initial.
split var1 at ',' into i_ekpo-ebelp
i_ekpo-menge.
i_ekpo-ebeln = var2.
append i_ekpo.
*endif.
endloop.
loop at i_ekpo.
write :/ i_ekpo.
endloop.
loop at i_ekko.
perform fill_data. " TABLES I_EKPO.
endloop.
LOOP AT I_EKPO.
WRITE :/ I_EKPO.
ENDLOOP.
*& Form GET_DATA
text
--> p1 text
<-- p2 text
*LOOP AT I_ERROR.
WRITE :/ I_ERROR.
ENDLOOP.
form get_data.
call function 'WS_UPLOAD'
exporting
codepage = ' '
filename = p_file
filetype = 'ASC'
headlen = ' '
line_exit = ' '
trunclen = ' '
user_form = ' '
user_prog = ' '
dat_d_format = ' '
IMPORTING
FILELENGTH =
tables
data_tab = itab
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.
endif.
endform. " GET_DATA
*& Form FILL_DATA
text
-->P_I_EKPO text
form fill_data. " tables i_ekpo .
perform bdcscreen using 'SAPMM06E' '0105'.
perform bdcfield using 'RM06E-BSTNR' i_ekko-ebeln.
perform bdcfield using 'BDC_OKCODE' '/00'.
loop at i_ekpo where ebeln = i_ekko-ebeln.
V = I_EKPO-EBELP.
perform bdcscreen using 'SAPMM06E' 0120.
perform bdcfield using 'BDC_CURSOR' 'RM06E-EBELP'.
perform bdcfield using 'RM06E-EBELP' i_ekpo-ebelp.
perform bdcfield using 'BDC_OKCODE' '/00'.
perform bdcscreen using 'SAPMM06E' 0120.
perform bdcfield using 'BDC_CURSOR' 'EKPO-MENGE(01)'.
perform bdcfield using 'RM06E-EBELP' i_ekpo-ebelp.
perform bdcfield using 'EKPO-MENGE(01)' i_ekpo-menge.
perform bdcfield using 'BDC_OKCODE' '/00'.
*PERFORM BDCSCREEN USING 'SAPMM06E' 0120.
*PERFORM BDCFIELD USING 'BDC_CURSOR' 'RMO6E-EBELP'.
*CLEAR V.
endloop.
perform bdcfield using 'BDC_OKCODE' '=BU'.
call transaction c1 using i_bdcdata mode 'A'
messages into i_error.
refresh i_bdcdata.
endform. " FILL_DATA
*& Form BDCSCREEN
text
-->P_0140 text
-->P_0120 text
form bdcscreen using p_program p_screen.
i_bdcdata-program = p_program.
i_bdcdata-dynpro = p_screen.
i_bdcdata-dynbegin = 'X'.
append i_bdcdata.
clear i_bdcdata.
endform. " BDCSCREEN
*& Form BDCFIELD
text
-->P_0145 text
-->P_I_EKPO_EBELN text
form bdcfield using fnam fval.
i_bdcdata-fnam = fnam.
i_bdcdata-fval = fval.
append i_bdcdata.
clear i_bdcdata.
endform. " BDCFIELD
Reward Points if it is helpful
Thanks
Seshu -
Creation of PO using BDC with ME21N - Urgent
Hi All,
My requirement is to create a Purchase Order using BDC. I'm using ME21N for BDC. I did recording and using that recording I wrote a program for BDC. BDC table is populated correctly, but while calling ME21N using call transaction, program is cuming back to the selection screen, without creating PO. And sy-subrc value after call transaction is '0'. Please let me know the problem.
Thanks in Advance.
Siva Sankar.Hi,
Put a break point after the call transaction statement(i.e, put break point on sy-subrc check)
and then check the message table.
if call transaction is suceessfull u will find a success messages in the I_messages table.
Regards,
Sriram -
Creating Sales order texts while using BDC session method is not working
Hi All,
I have an existing program which creates sales order using BDC session method.( Actual program uses BAPI to create sales order and in case if any error occurs during creation of sales order BDC session is generated so that user can process it later and i am facing issues in this part of code where it uses BDC)
I wanted to modify this BDC sesion to update the sales order text also. I tried recording VA01 for creationg sales order text unfortunatly it is not capturing the data i am entering in the text fields.
Please suggest if there is any way to create sales order using BDC.
Regards
SheebaHi Madhu,
'=TP_CREATE' is the OK code i am getting for creating TEXTS. But the text entered are not captured in BDC.
Part of BDC program generated for cretaing sales order texts.
perform bdc_dynpro using 'SAPMV45A' '4003'.
perform bdc_field using 'BDC_OKCODE'
'=%_GC 128 22'.
perform bdc_field using 'LV70T-SPRAS'
'EN'.
perform bdc_dynpro using 'SAPMV45A' '4003'.
perform bdc_field using 'BDC_OKCODE'
'=TP_CREATE'.
perform bdc_field using 'LV70T-SPRAS'
'EN'.
perform bdc_dynpro using 'SAPMV45A' '4003'.
perform bdc_field using 'BDC_OKCODE'
'=%_GC 128 22'.
perform bdc_field using 'LV70T-SPRAS'
'EN'.
perform bdc_dynpro using 'SAPMV45A' '4003'.
perform bdc_field using 'BDC_OKCODE'
'=TP_CREATE'.
perform bdc_field using 'LV70T-SPRAS'
'EN'.
perform bdc_dynpro using 'SAPMV45A' '4003'.
perform bdc_field using 'BDC_OKCODE'
'/EBACK'.
perform bdc_field using 'LV70T-SPRAS'
'EN'.
perform bdc_dynpro using 'SAPMV45A' '4001'.
perform bdc_field using 'BDC_OKCODE'
'=SICH'.
Regards,
Sheeba
Maybe you are looking for
-
Web Photo Album 2.1 - putting it in page
Hi, I'm on DW MX and haven't used it in a while. I installed the extension web photo album 2.1 and I have a page onto which I want to put a photo gallery. So I have the page created and my cursor placed and I chose 'Command/Create Web Album2.1" and I
-
Pa allocation structure for pm orders
hi fico experts, can any one tell us how to configure the pa allocation structure for pm orders for revenues billing thru dip profile use for service orders. pl help thanx in advance regards srihari
-
Difference between drag events in Flex vs. Air?
I have a Canvas with a dragEnter and a dragDrop event. On top of the canvas I have 2 buttons. button1 initiates a doDrag event. button2 also has a dragEnter and a dragDrop event, but also a dragExit event. Both the canvas' and the button2's dragEnter
-
Hi , I am printing a Custom Adobe Form(ZPTRV_EXPENSE_FORM), which is a copy of standard form(PTRV_EXPENSE_FORM), through PR05. The problem here is in the subform for additional trip information, where the comments entered by the user are getting disp
-
Apply Template to Folder using API
Hi, Does anyone know how to apply a template to a folder withing OracleAS Portal 10.1.4. I have created pages/folders uploaded documents and associated them with pages, however I am unable to find how to apply a template to a folder. Is adding templa