In BDC report ..
In BDC report ..what is meaning for ok_code value equal to /00 , =BS and =BU.
Thanking u in adv.
Sangeeta.
Hi Sangeeta,
In BDC report, OK_CODE stores the action/user commnd while recodring transaction.
/00 : ok_code for 'ENTER'.
Execute a bdc in foreground mode you can see the ok_code as per your action/user command.
at the time of recording, when we perform any action like click/enter /select the value of that particular action get stoed in ok_code field.
Regards,
Hemant
Similar Messages
-
Scheduling custom BDC report as a job....
Hi,
I want to generate a background Job for a custom BDC ABAP report.
I am going to transaction SM36, entering name of Job -> Job class as 'C' -> enter.
But after I provide name of the program, it also has a field called variant. What do I enter there ?
Is it that I need to create some varaiant for my BDC report ? How do I do that ?
Also how do I schedule this job which I created ?
Regards.Hi Rajesh,
I assume that you have a variant for your program.
Follow these steps.
1) Goto SM36
2)Enter Job Name and Job Class. Then Save it. (Goto Job-->Save(Ctrl + S) in Menu bar).
3) You will get a popup.
In program values enter ABAP program and Variant name.
Save it.
4) Now goto SM37.
Job status all selected.
Execute.
5)You will find your Job created. <b>Check it</b>.
6)Press CtrlShiftF10 (Release Job)
Immediate. Save again.
Done..
Regards,
<b>AS</b>. -
BDC Report to Roll Forward Negative Statutory Leave Entitlement
Hi experts,
Please let me know any standard program is there for this requirement: BDC Report to Roll Forward Negative Statutory Leave Entitlement.
Tel me how to solve this requirement.....
Thanks,
Brahmathanks experts
-
How to call a SM35 transaction and run in BDC report.
Hi Experts,
I knew that how to call a transaction but here, I've to call the SM35 transaction ,which have my BRS BDC recording, to run my session.
Pls help me how to call the transaction and run/process the first session tab in the table control of SM35 window.
thanks & regards
sankar.Hi,
Look up this example..here v have recorded one transaction & running it throough BDC report programming.
report ZBDC_16JUL2008
no standard page heading line-size 255.
include bdcrecx1.
DATA : BEGIN OF it_tab OCCURS 0,
LIFNR(016),
BUKRS(004),
KTOKK(004),
NAME1(035),
SORTL(010),
STRAS(035),
PFACH(010),
ORT01(035),
LAND1(003),
REGIO(003),
SPRAS(002),
TELF1(016),
AKONT(010),
FDGRV(010),
END OF it_tab.
start-of-selection.
CALL FUNCTION 'UPLOAD'
EXPORTING
CODEPAGE = ' '
FILENAME = 'D:\'
FILETYPE = 'ASC'
ITEM = ' '
FILEMASK_MASK = ' '
FILEMASK_TEXT = ' '
FILETYPE_NO_CHANGE = ' '
FILEMASK_ALL = ' '
FILETYPE_NO_SHOW = ' '
LINE_EXIT = ' '
USER_FORM = ' '
USER_PROG = ' '
SILENT = 'S'
IMPORTING
FILESIZE =
CANCEL =
ACT_FILENAME =
ACT_FILETYPE =
TABLES
data_tab = it_tab
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.
perform open_group.
LOOP at it_tab.
perform bdc_dynpro using 'SAPMF02K' '0105'.
perform bdc_field using 'BDC_CURSOR'
'RF02K-KTOKK'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'RF02K-LIFNR'
it_tab-LIFNR.
perform bdc_field using 'RF02K-BUKRS'
it_tab-BUKRS.
perform bdc_field using 'RF02K-KTOKK'
it_tab-KTOKK.
perform bdc_dynpro using 'SAPMF02K' '0110'.
perform bdc_field using 'BDC_CURSOR'
'LFA1-TELF1'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'LFA1-NAME1'
it_tab-NAME1.
perform bdc_field using 'LFA1-SORTL'
it_tab-SORTL.
perform bdc_field using 'LFA1-STRAS'
it_tab-STRAS.
perform bdc_field using 'LFA1-PFACH'
it_tab-PFACH.
perform bdc_field using 'LFA1-ORT01'
it_tab-ORT01.
perform bdc_field using 'LFA1-LAND1'
it_tab-LAND1.
perform bdc_field using 'LFA1-REGIO'
it_tab-REGIO.
perform bdc_field using 'LFA1-SPRAS'
it_tab-SPRAS.
perform bdc_field using 'LFA1-TELF1'
it_tab-TELF1.
perform bdc_dynpro using 'SAPMF02K' '0120'.
perform bdc_field using 'BDC_CURSOR'
'LFA1-VBUND'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
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'
'=UPDA'.
perform bdc_field using 'LFB1-AKONT'
it_tab-AKONT.
perform bdc_transaction using 'FK01'.
ENDLOOP.
perform close_group. -
Need example BDC reports in HR ABAP
hi all,
I need example BDC reports in HR-ABAP .both download and upload reports..
I was tried but I'm not getting it , so please, any one send sample reports .
Rewarded for helpful answers.Hi,
Check these links
BDC for infotype 0008
https://www.sdn.sap.com/irj/sdn/wiki?path=/display/erphcm/employee%2bphoto%2bupload
Search using "bdc" in this forum you will get lot of examples -
*Hi all,*
*i m writing a BDC report for creating sales order using VA01 tcode...i have four fields in a upload file..the file will contain something like this...*
*soldto shipto matnr quantity*
*880 770 112 4*
*881 771 113 5*
*881 771 114 6*
*882 772 115 7*
*882 772 116 8*
*883 773 117 7*
*883 773 118 7*
*883 773 119 7*
*from above file i need to write the code based on soldto and shipto fields...A separate Sales Order will be created for each combination of Sold-To & Ship-To parties. A Sold-To party may have several Ship-To parties assigned to it. Lines having same combination of SoldTo u2013 ShipTo parties should be added to one Sales Order. A separate Sales Order will be created if a line has different Ship-To party even if the Sold-To remains same*
*based on above logic i wrote below code..but some how..its not working..pls hlp*
LOOP AT i_input_bdc." INTO wa_input_bdc.
on change of i_input_bdc-shipto.
on change of i_input_bdc-soldto.
{code for perform statements}
PERFORM insert_bdc USING 'VA01'.
CLEAR wa_input_bdc.
REFRESH i_bdcdata.
endon.
endon.
ENDLOOP.
Onchange of is not working......pls hlpHI,
The field order in internal table should be ..
soldto
shipto
matnr
quantity
Check this code..
SORT ITAB BY SOLDto Shipto.
LOOP AT i_input_bdc." INTO wa_input_bdc.
AT END of i_input_bdc-shipto.
{code for perform statements}
PERFORM insert_bdc USING 'VA01'.
CLEAR wa_input_bdc.
REFRESH i_bdcdata.
endat.
ENDLOOP.
Use AT END of Event -
Error in bdc report program .
Hello Experts ,
I was doing the BDC demo program as explained in tutorial ,
http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/309cb157-738d-2910-7691-b74c4ddba3c7&overridelayout=true
but when i run the pgm i get runtime error as
shrt text
type conflict occur when calling fuction module .
Function module was called incorrectely .
here i am pasting the report pgm for bdc ,
<< See below >>
Can anybody suggest how to solve this problem ,
Thks ,
Rushi
Edited by: RUSHI123 on Nov 4, 2009 1:20 PM
Edited by: RUSHI123 on Nov 4, 2009 1:21 PM
Edited by: Rob Burbank on Nov 4, 2009 9:49 AMreport Z98
no standard page heading line-size 255.
include bdcrecx1.
DATA : BEGIN OF ITAB OCCURS 0 ,
ID(4) TYPE C ,
NAME(20) TYPE C ,
END OF ITAB .
start-of-selection.
CALL FUNCTION 'UPLOAD'
EXPORTING
* CODEPAGE = ' '
FILENAME = 'C:\'
FILETYPE = 'ASC '
* ITEM = ' '
* FILEMASK_MASK = ' '
* FILEMASK_TEXT = ' '
* FILETYPE_NO_CHANGE = ' '
* FILEMASK_ALL = ' '
* FILETYPE_NO_SHOW = ' '
* LINE_EXIT = ' '
* USER_FORM = ' '
* USER_PROG = ' '
* SILENT = 'S'
* IMPORTING
* FILESIZE =
* CANCEL =
* ACT_FILENAME =
* ACT_FILETYPE =
TABLES
DATA_TAB = ITAB
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.
WRITE :/ SY-SUBRC .
ENDIF.
perform open_group.
LOOP AT ITAB .
perform bdc_dynpro using 'ZTRNSBDCDEMO' '1000'.
perform bdc_field using 'BDC_CURSOR'
'NAME'.
perform bdc_field using 'BDC_OKCODE'
'=SPOS'.
perform bdc_field using 'ID'
ITAB-ID . "... ' 3'.
perform bdc_field using 'NAME'
ITAB-NAME . " ...'MIRAJ'.
perform bdc_dynpro using 'SAPLSVAR' '0281'.
perform bdc_field using 'BDC_OKCODE'
'=BACKLIST'.
perform bdc_dynpro using 'ZTRNSBDCDEMO' '1000'.
perform bdc_field using 'BDC_OKCODE'
'/EE'.
perform bdc_field using 'BDC_CURSOR'
'NAME'.
perform bdc_transaction using 'Z98DEMO'.
ENDLOOP .
And please use code tags
Edited by: RUSHI123 on Nov 4, 2009 1:41 PM
Edited by: RUSHI123 on Nov 4, 2009 1:44 PM
Edited by: Rob Burbank on Nov 4, 2009 9:49 AM -
can any body help me to do one bdc for
BOM master?? i m doing this first time so i need some input
thanks well in advance.
points ll be rewarded...
Message was edited by:
soumya shekharhi
good
When you try to create, you would find a pushbutton 'INSERT NEW LINES' or something simialr to enter your data in the next line. Say you're entering the Material inthe first row, its field position would be MARA-MATNR(01). Now when you click the Insert Pushbitton the cursor always is at positon 2. so you have to loop the remaining data to enter in MARA-MATNR(02). Yougenereally set a counter and pass that counter value (in this case the counter value is 2 always)
The other case when you don't have a push button to Insert. Enter all the rows and then do a Page down. Now your cursor would sit back at position 2 again. Say if there are 20 rows in the first screen. You would keep incrementing the counter and then when it is 21 you do a pagedown and then reset the counter to 2. You loop the pagedown and in it you loop the counter.
I have attached a BDC where I use the second case (no push button). Do a recording and then you would know all the answers by yourself.
*& REPORT ZPP0122 *
*& Module : PP |
*& Application : The program loads the Material Assignment of Routings |
*& |
REPORT zpp0122 NO STANDARD PAGE HEADING
MESSAGE-ID z0
LINE-SIZE 132
LINE-COUNT 65(2).
Internal Tables *
*Internal table for the Routing fields.
DATA: BEGIN OF i_rout OCCURS 0,
plnnr(8),
plnal(2),
matnr(18),
werks(4),
END OF i_rout.
DATA:
g_my_rec_in LIKE i_rout.
Declare internal table for Call Transaction and BDC Session
DATA: i_bdc_table LIKE bdcdata OCCURS 0 WITH HEADER LINE.
Global Variables *
DATA: g_counter(2) TYPE n,
g_field_name(18) TYPE c,
zc_yes TYPE syftype VALUE 'X'.
Selection Screen *
SELECTION-SCREEN BEGIN OF BLOCK a WITH FRAME TITLE text-001.
PARAMETERS: p_fname1 TYPE localfile .
SELECTION-SCREEN SKIP 1.
SELECTION-SCREEN BEGIN OF BLOCK b WITH FRAME TITLE text-002.
PARAMETERS: p_rloc1 AS CHECKBOX DEFAULT 'X'.
SELECTION-SCREEN BEGIN OF BLOCK c WITH FRAME TITLE text-005.
PARAMETERS p_group(12) OBLIGATORY DEFAULT 'ZROUTING'.
SELECTION-SCREEN END OF BLOCK c.
SELECTION-SCREEN END OF BLOCK b.
SELECTION-SCREEN END OF BLOCK a.
**WRITE the report header
TOP-OF-PAGE.
INCLUDE zheading.
Start of selection *
START-OF-SELECTION.
Load Input file
PERFORM f_load_input_file.
Create BDC records.
PERFORM create_bdc_records .
*& Form Create_BDC_records
perform the BDC for the records in the internal table
FORM create_bdc_records .
IF NOT i_rout[] IS INITIAL.
Open BDC session
PERFORM open_bdc_session.
LOOP AT i_rout.
g_my_rec_in = i_rout.
AT NEW plnnr.
CLEAR i_bdc_table[].
PERFORM insert_screen_header.
ENDAT.
CONCATENATE 'MAPL-PLNAL(' g_counter ')' INTO g_field_name.
PERFORM bdc_field USING g_field_name i_rout-plnal.
CONCATENATE 'MAPL-MATNR(' g_counter ')' INTO g_field_name.
PERFORM bdc_field USING g_field_name i_rout-matnr.
CONCATENATE 'MAPL-WERKS(' g_counter ')' INTO g_field_name.
PERFORM bdc_field USING g_field_name i_rout-werks.
PERFORM bdc_field USING 'BDC_OKCODE' '/00'.
g_counter = g_counter + 1.
Page Down for further entries
IF g_counter = 19.
PERFORM bdc_field USING 'BDC_OKCODE' '=P+'.
PERFORM bdc_dynpro USING 'SAPLCZDI' '1010'.
g_counter = 2.
ENDIF.
AT END OF plnnr.
PERFORM bdc_field USING 'BDC_OKCODE' '=BACK'.
PERFORM bdc_dynpro USING 'SAPLCPDI' '1200'.
PERFORM bdc_field USING 'BDC_OKCODE' '=BU'.
PERFORM insert_bdc_new.
ENDAT.
ENDLOOP.
CLEAR i_rout[].
PERFORM close_bdc_session.
Release the BDC sessions created
PERFORM release_bdc.
ENDIF.
ENDFORM. " open_group
*& Form bdc_dynpro_start
Call the screen for the input of fields
-->P_G_PROGRAM_1
-->P_G_SCREEN
FORM bdc_dynpro USING p_g_program_1
p_g_screen.
CLEAR i_bdc_table.
i_bdc_table-program = p_g_program_1.
i_bdc_table-dynpro = p_g_screen.
i_bdc_table-dynbegin = 'X'.
APPEND i_bdc_table.
ENDFORM. " bdc_dynpro_start
*& Form bdc_field
Insert field *
FORM bdc_field USING f_name f_value.
IF f_value <> space.
CLEAR i_bdc_table.
i_bdc_table-fnam = f_name.
i_bdc_table-fval = f_value.
APPEND i_bdc_table.
ENDIF.
ENDFORM. "bdc_insert_field
*& Form open_bdc_session
Create the BDC session
FORM open_bdc_session .
Open BDC session and creat and update condition records
CALL FUNCTION 'BDC_OPEN_GROUP'
EXPORTING
client = sy-mandt
DEST = FILLER8
group = p_group
HOLDDATE = FILLER8
keep = 'X'
user = sy-uname
RECORD = FILLER1
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.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. " create_bdc_session
*& Form insert_screen_header
Header Data inserted
FORM insert_screen_header .
g_counter = 1.
First screen
PERFORM bdc_dynpro USING 'SAPLCPDI' '1010'.
PERFORM bdc_field USING 'BDC_CURSOR' 'RC271-PLNNR'.
PERFORM bdc_field USING 'BDC_OKCODE' '=ALUE'.
PERFORM bdc_field USING 'RC271-PLNNR' g_my_rec_in-plnnr.
PERFORM bdc_field USING 'RC27M-MATNR' ' '.
PERFORM bdc_field USING 'RC27M-WERKS' ' '.
PERFORM bdc_field USING 'RC271-PLNAL' ' '.
*next screen
PERFORM bdc_dynpro USING 'SAPLCPDI' '1200'.
PERFORM bdc_field USING 'BDC_OKCODE' '=MTUE'.
*next screen
PERFORM bdc_dynpro USING 'SAPLCZDI' '1010'.
ENDFORM. " insert_screen_header
*& Form insert_bdc
Insert the BDC for the transaction
FORM insert_bdc_new .
CALL FUNCTION 'BDC_INSERT'
EXPORTING
tcode = 'CA02'
POST_LOCAL = NOVBLOCAL
PRINTING = NOPRINT
SIMUBATCH = ' '
CTUPARAMS = ' '
TABLES
dynprotab = i_bdc_table
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 ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
CLEAR i_bdc_table[].
ENDFORM. " insert_bdc
*& Form close_bdc_session
Close the session
FORM close_bdc_session .
CALL FUNCTION 'BDC_CLOSE_GROUP'
EXCEPTIONS
not_open = 1
queue_error = 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.
ENDFORM. " close_bdc_session
*& Form f_load_input_file
Load the data file
FORM f_load_input_file.
The data file is from Presentation server
IF p_rloc1 = zc_yes.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
filename = p_fname1
filetype = 'DAT'
TABLES
data_tab = i_rout
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.
EXIT.
ENDIF.
ENDIF.
ENDFORM. " f_load_input_file
*& Form release_bdc
Release BDC session
FORM release_bdc.
SUBMIT rsbdcsub WITH mappe EQ p_group
WITH von EQ sy-datum
WITH bis EQ sy-datum
WITH fehler EQ '.'
EXPORTING LIST TO MEMORY
AND RETURN.
ENDFORM.
reward point if helpful.
thanks
mrutyun^ -
Hi
experts can u please help me.my problem is i want to know that how to read the value against a particular field by read statement .like i want to read emo_amend against order no.(both r in same table ymt_mill_order.Hi,
please check out the link below it might help you
http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb35f8358411d1829f0000e829fbfe/content.htm
http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3605358411d1829f0000e829fbfe/content.htm
**********please reward points if the information is helpful to you***************** -
Report with BDC not displaying success message when run in Background
I am running a BDC report in Background mode.The below statement is not capturing the Success message when a document is posted.But when I am running the same in ForeGround mode it is capturing and is displayed in the output.Can anyone please help me in understanding why this is happening and how can I resolve this.
CALL TRANSACTION 'MB1C' USING bdcdata MODE mode UPDATE 'S'
MESSAGES INTO messtab.Hi Madhu,
I think your BDC didnt generated any document when you run it in 'N' screen mode.
Debug your program when you run it in background
Goto Tcode :SM37
Select the job ( march checkbox )
==> in command prompt enter 'JDBG'
==> Then you can start reexecting the job .
You can check the sucess messages accordingly in debug mode
Also add a read statement on messtab for msgtype = 'S'.
Thanks
Bhanu -
How to supress a warning message in BDC for ME11 Tcode
Hi Expert,
I am doing a BDC report for ME11 Tcode and some of warning is ignorable for this transaction code,how can we suppress these warning through BDC program, is it possible or will have to make some changes changes in TCODE(ME11) itself.hi,
if the warning message coming in a pop-up window then it can be supressed in the following way.
1. comment the lines of the code of bdc recording of that pop-up screen along with the perform of bdc ok code '=ENTE".
2. use the structure ctu_params and fill the correspondings fiels, particularly the field nobinpt = 'X' and then use this structure in the call transcation statement as
call transcation 'ME11'
using bdcdata
options from opt ( structure of ctu_params )
3. At the time of recording use the option of check box " no batch input session ".
regards,
Alok -
How to create spool when running a report in background
hi folks,
i am running a bdc report in bkgrnd... and i want all the success and eror messages to be displayed in a spool... plz explain with example as to how this can be achieved .Hello Nishant,
You could use this sample code to create the spool.
DATA : X_NAME LIKE TSP03D-NAME,
X_DEST LIKE TSP03D-PADEST VALUE 'LOCL',
X_ROWS LIKE SXPCKLSTI1-BODY_NUM VALUE 0,
X_STARTROW LIKE SXPCKLSTI1-BODY_START VALUE 1,
X_PAGES LIKE RSPOTYPE-PAGES VALUE 1,
X_PAGES_1 TYPE P DECIMALS 2,
X_RQTITLE LIKE SXPCKLSTI1-OBJ_DESCR,
X_RQCOPIES TYPE I VALUE 1,
X_RQOWNER LIKE TRDYSE01CM-USERNAME,
X_IMMEDIATE LIKE PRI_PARAMS-PRIMM VALUE ' ',
X_RQID LIKE TSP01-RQIDENT,
I_CONTENTS LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE.
X_PAGES = 1.
X_RQOWNER = SY-UNAME.
X_DEST = 'LOCL'.
X_STARTROW = 1.
X_RQCOPIES = 1.
X_IMMEDIATE = ' ' .
I_CONTENTS-LINE = 'I Got your Childhood PHOTO'.
APPEND I_CONTENTS.
CALL FUNCTION 'RSPO_SX_OUTPUT_TEXTDATA'
EXPORTING
name = x_name
DEST = X_DEST
ROWS = X_ROWS
STARTROW = X_STARTROW
PAGES = X_PAGES
RQTITLE = X_RQTITLE
RQCOPIES = X_RQCOPIES
RQOWNER = X_RQOWNER
IMMEDIATELY = X_IMMEDIATE
IMPORTING
RQID = X_RQID
TABLES
<b> TEXT_DATA = I_CONTENTS</b> <b>Your Message Table</b>
EXCEPTIONS
NAME_MISSING = 1
NAME_TWICE = 2
NOT_FOUND = 3
ILLEGAL_LAYOUT = 4
INTERNAL_ERROR = 5
SIZE_MISMATCH = 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.
ENDIF.
WRITE: X_RQID
If useful reward.
Vasanth -
BDC for FF67 not displaying the line itmes of second page
Hi all,
I am using the Z BDC report Manual Bank Statement Upload (FF67). The BDC is as mentioned below :
We are using start variant in the BDC.
The report is working fine but the issue is that suppose if their are 45 line items and on one page we can have only 30 line items . Then only 30 line items are been displayed . It is not taking the line items which have come on the second page. Please advsie . Below is the code of the BDC.
REPORT zfi_bank_recon.
TABLES : febko.
DATA: bdcdata LIKE bdcdata OCCURS 0 WITH HEADER LINE.
DATA : i_messtab LIKE bdcmsgcoll OCCURS 0 WITH HEADER LINE.
DATA : BEGIN OF itab OCCURS 0,
vgman TYPE febmka-vgman,
valut TYPE char10, "febep-valut,
kwbtr TYPE char17, "febmka-kwbtr,
chect_kf TYPE febmkk-chect_kf,
sgtxt_kf TYPE febmkk-sgtxt_kf,
count(6) TYPE n,
END OF itab.
DATA : BEGIN OF error OCCURS 0,
msg TYPE string,
END OF error.
DATA :flag,
update VALUE 'A',
mode VALUE 'N'.
DATA : aznum1 TYPE aznum,
lv_esbtr TYPE febko-esbtr,
lv_esvoz TYPE febko-esvoz,
lv_opening TYPE char17, "febmka-kwbtr,
lv_closing TYPE char17. "febmka-kwbtr.
*& Selection screen
SELECTION-SCREEN : BEGIN OF BLOCK blk WITH FRAME TITLE text.
PARAMETERS : bukrs LIKE febmka-bukrs OBLIGATORY,
hbkid LIKE febmka-hbkid OBLIGATORY,
hktid LIKE febmka-hktid OBLIGATORY,
azdat LIKE febmka-azdat OBLIGATORY,
aznum LIKE febmka-aznum OBLIGATORY,
budtm LIKE febmka-budtm OBLIGATORY DEFAULT sy-datum.
SELECTION-SCREEN : END OF BLOCK blk.
SELECTION-SCREEN : BEGIN OF BLOCK blk1 WITH FRAME TITLE text1.
PARAMETERS: p_file LIKE rlgrap-filename OBLIGATORY.
SELECTION-SCREEN : END OF BLOCK blk1.
AT SELECTION-SCREEN.
SELECT SINGLE * FROM febko INTO febko
WHERE bukrs = bukrs AND hbkid = hbkid AND
hktid = hktid AND aznum = aznum
AND budtm = budtm
AND azdat = azdat.
IF sy-subrc EQ 0.
MESSAGE e038(000) WITH 'Statement' aznum 'already uploaded; No further processing done'.
ENDIF.
At Selection Screen Event
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CALL FUNCTION 'F4_FILENAME'
IMPORTING
file_name = p_file.
*& Start of Selection
START-OF-SELECTION.
CLEAR : flag.
PERFORM data_upload.
PERFORM check_data.
IF itab[] IS NOT INITIAL AND flag IS INITIAL..
PERFORM open_group.
REFRESH bdcdata.
PERFORM bdcdata. " USING LV_OPENING LV_CLOSING.
PERFORM bdc_insert.
PERFORM close_group.
ENDIF.
*& Form check_data
FORM check_data.
LOOP AT itab.
DATA : int(6) TYPE n.
CLEAR : int.
int = sy-tabix.
IF itab-vgman IS INITIAL.
CONCATENATE 'Transaction type should not be blank : Record no' int INTO error-msg SEPARATED BY space.
APPEND error.
CLEAR : error.
ENDIF.
IF itab-valut IS INITIAL.
CONCATENATE 'Value Date should not be blank : Record no' int INTO error-msg SEPARATED BY space.
APPEND error.
CLEAR : error.
ENDIF.
IF itab-kwbtr IS INITIAL.
CONCATENATE 'Amount should not be blank : Record no' int INTO error-msg SEPARATED BY space.
APPEND error.
CLEAR : error.
ENDIF.
IF itab-chect_kf IS INITIAL.
CONCATENATE 'Bank Reference should not be blank : Record no' int INTO error-msg SEPARATED BY space.
APPEND error.
CLEAR : error.
ENDIF.
IF itab-vgman NE 'DLF1'
AND itab-vgman NE 'DLF2'.
CONCATENATE 'A Transaction type is not used : Record no' int INTO error-msg SEPARATED BY space.
APPEND error.
CLEAR : error.
ENDIF.
IF itab-vgman EQ 'DLF1'
AND itab-kwbtr LE 0.
CONCATENATE 'As per Transaction type, the Amount should be Positive : Record no' int INTO error-msg SEPARATED BY space.
APPEND error.
CLEAR : error.
ENDIF.
IF itab-vgman EQ 'DLF2'
AND itab-kwbtr GE 0.
CONCATENATE 'As per Transaction type, the Amount should be Negative : Record no' int INTO error-msg SEPARATED BY space.
APPEND error.
CLEAR : error.
ENDIF.
ENDLOOP.
IF error[] IS NOT INITIAL.
WRITE : / 'Error found in upload file'.
SKIP 2 .
LOOP AT error.
WRITE : / error-msg.
ENDLOOP.
flag = 'X'.
ENDIF.
CLEAR : lv_esbtr, lv_esvoz, aznum1, lv_opening, lv_closing.
IF flag IS INITIAL.
SELECT MAX( DISTINCT aznum ) FROM febko INTO aznum1
WHERE bukrs = bukrs AND hbkid = hbkid AND hktid = hktid.
IF sy-subrc = 0.
SELECT SINGLE esbtr esvoz FROM febko INTO (lv_esbtr,lv_esvoz)
WHERE bukrs = bukrs AND hbkid = hbkid AND hktid = hktid AND aznum = aznum1 .
IF lv_esvoz = 'S'.
lv_opening = lv_esbtr * -1.
ELSE.
lv_opening = lv_esbtr.
ENDIF.
lv_closing = lv_opening.
ENDIF.
LOOP AT itab.
lv_closing = lv_closing + itab-kwbtr.
DATA : lv_count(6) TYPE n.
lv_count = lv_count + 1.
MOVE lv_count TO itab-count .
MODIFY itab FROM itab.
CLEAR : itab.
ENDLOOP.
ENDIF.
ENDFORM. "check_data
*& Form data_upload
FORM data_upload.
DATA: loc_filename TYPE string.
loc_filename = p_file.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = loc_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.
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. "data_upload
*& Form bdcdata
FORM bdcdata. " USING lv_opening TYPE febko-ssbtr
" lv_closing TYPE febko-esbtr.
DATA : day(2),
month(2),
year(4),
date(10).
year = azdat+0(4).
month = azdat+4(2).
day = azdat+6(2).
CONCATENATE day month year INTO date.
CONDENSE : date.
Comment
PERFORM bdc_dynpro USING 'SAPMF40K' '0101'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/EVORG'.
PERFORM bdc_field USING 'BDC_CURSOR'
'FEBMKA-AZDAT'.
PERFORM bdc_dynpro USING 'SAPMF40K' '0110'.
PERFORM bdc_field USING 'BDC_CURSOR'
'FEBMKA-VARI_START'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=ENTE'.
PERFORM bdc_field USING 'FEBMKA-KONT_INT'
'X'.
PERFORM bdc_field USING 'FEBMKA-FDIS_SEL'
'X'.
PERFORM bdc_field USING 'FEBMKA-VARI_START'
'Z0001'.
PERFORM bdc_field USING 'FEBMKA-DEBI_MID'
'D'.
PERFORM bdc_field USING 'FEBMKA-KRED_MID'
'K'.
PERFORM bdc_field USING 'FEBMKA-WVAR_ART'
'4'.
PERFORM bdc_field USING 'FEBMKA-BUCH_VAL'
'X'.
PERFORM bdc_dynpro USING 'SAPMF40K' '0101'.
PERFORM bdc_field USING 'BDC_CURSOR'
'FEBMKA-ESALD'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'FEBMKA-BUKRS'
bukrs.
PERFORM bdc_field USING 'FEBMKA-HBKID'
hbkid.
PERFORM bdc_field USING 'FEBMKA-HKTID'
hktid.
PERFORM bdc_field USING 'FEBMKA-AZNUM'
aznum.
PERFORM bdc_field USING 'FEBMKA-AZDAT'
date.
PERFORM bdc_field USING 'FEBMKA-SSALD'
lv_opening.
PERFORM bdc_field USING 'FEBMKA-ESALD'
lv_closing.
PERFORM bdc_dynpro USING 'SAPMF40K' '8000'.
PERFORM bdc_field USING 'BDC_CURSOR'
'FEBMKK-SGTXT_KF(01)'.
SORT itab DESCENDING BY count.
LOOP AT itab.
PERFORM bdc_field USING 'BDC_OKCODE'
'=SICH'.
PERFORM bdc_field USING 'FEBMKA-VGMAN(01)'
itab-vgman.
PERFORM bdc_field USING 'FEBEP-VALUT(01)'
itab-valut.
PERFORM bdc_field USING 'FEBMKA-KWBTR(01)'
itab-kwbtr.
PERFORM bdc_field USING 'FEBMKK-CHECT_KF(01)'
itab-chect_kf.
PERFORM bdc_field USING 'FEBMKK-SGTXT_KF(01)'
itab-sgtxt_kf.
PERFORM bdc_dynpro USING 'SAPMF40K' '8000'.
PERFORM bdc_field USING 'BDC_CURSOR'
'FEBMKK-SGTXT_KF(01)'.
ENDLOOP.
PERFORM bdc_dynpro USING 'SAPMF40K' '8000'.
PERFORM bdc_field USING 'BDC_CURSOR'
'FEBMKA-KWBTR(01)'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=SICH'.
PERFORM bdc_dynpro USING 'SAPMF40K' '0101'.
PERFORM bdc_field USING 'BDC_CURSOR'
'FEBMKA-BUKRS'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=BACK'.
PERFORM bdc_dynpro USING 'SAPLSPO1' '0100'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=NO'.
ENDFORM. "bdcdata
*& Form OPEN_GROUP
FORM open_group .
CALL FUNCTION 'BDC_OPEN_GROUP'
EXPORTING
client = sy-mandt
group = 'BANK_STAT'
user = sy-uname.
keep = 'X'.
ENDFORM. " OPEN_GROUP
*& Form CLOSE_GROUP
FORM close_group .
CALL FUNCTION 'BDC_CLOSE_GROUP'.
CALL TRANSACTION 'SM35'.
ENDFORM. " CLOSE_GROUP
*& Form bdc_insert
FORM bdc_insert.
CALL FUNCTION 'BDC_INSERT'
EXPORTING
tcode = 'FF67'
TABLES
dynprotab = bdcdata.
ENDFORM. " bdc_insert
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.
CLEAR bdcdata.
bdcdata-fnam = fnam.
bdcdata-fval = fval.
APPEND bdcdata.
ENDFORM. "BDC_FIELDHi,
Use:
If line item = 30.
OKCODE = 'P++'. --->For next page after every 30 line items.
endif.
Or:(Sumilate in BDC)
1 . New line. -
>Get the Fcode/Sy-ucomm value of New line(Icon on menu bar)
2.Enter Line Item.
Follow this after every line item.
Hope this resolves the issue.
Regards,
Gurpreet -
What is the exact way of doing BDC ?????
I know when the input is minimal we have to use CALL TRANSACTION method in BDC and when we have batch of input files we have to use BDC Recording.
My question is what is the exact way of doing BDC.
Could any one please tell me the exact way of doing BDC Recording Process.
I appreciate your help.
Thanks for your Time.
Shiv.Hello Sivaramu,
Call transcation can handle only one Trasaction(Tcode).
Session method can handle multiple transcations.
Before getting started with the Recording process...we have to know the transcation code. We do recording to record the screen number, screen values, Button values(OK codes) ...etc
For example...while recording we create a record using some t-code (Say MM01) ...Now, we will create a materail master record using the Recording process.
Let us see the process of recoding a single record with MM01 using SHDB(A tool used to record the details of T-code)
Go through these steps for recording by using SHDB.
How to use recording :
Go to SHDB
--> Click on New Recording
--> Provide any name in Recording , For ex: Z_CHAITU
--> Provide the Transaction name as MM01
--> Select the update mode as Synchrounous or Asynchrounus method
--> Click on Start Recording button.
--> It will display MM01 screen .type the appropriate
information in it.
--> Type the Material no as : 4567E (Any no, But there should b 1 Character in it)
--> Type Checmical Industry in INDUSTRY SECTOR
--> Type COUPONS in MATERIAL TYPE
--> Now click on Select Views button.
--> Select BASIC DATA 1
--> Click on Ok button
--> Under Basic data tab under Material, it will display the Material number.
--> Type the short description and Provide EA as Base Unit Of Measure
--> CLICK ON BACK AND IT WILL ASK U TO SAVE THE DATA, CLICK ON YES
--> Again click on Back, it will ask if u wish to save the changes to record entries.
-> Click on Yes
--> Now, u will be in Initial screen
--> Select the record and Click on Program button
--> Now, provide any program name
--> Now, select Transfer from recording
--> Click on Tick mark
--> Give some short description
--> Type as Executable
--> Click on Source Code button
--> Automatically the code will appear in SE 38 program.
U can try these steps with any T-code by knowing the Mandatory fields in it.
---> *Now by following all the above steps ur done with the recording process to create a single record in MAterail master (MM01). Now, we use the same recording process and put this recording under Loop in report program.*
So that, it will follow the same steps automatically to create materail master records from the flat file. If you have 10 records in flat file(Note pad) then it will do the same process for 10 times to upload 10 records from the flat file using the recoding process that we have done by using the SHDB
If you want then i will provide you with the sample program to upload the data for MK01 using Call transcation and Session method.
Call transcation method for MK01:
U can try these steps with any T-code by knowing the Mandatory fields in it.
& TITLE : BDC FOR MK01
*& DESCR : UPLOAD THE DATA THROUGH FLAT FILE
*& TRANSPORT : DOLK901203
*& VERSION : V1
*& DATE : 17th , JAN , 2008
report Z24_BDC_MK01
no standard page heading line-size 255.
*& DECLARATIONS OF STRUCTURE FOR MK01
TYPES : BEGIN OF TY_MK01 ,
KTOKK TYPE RF02K-KTOKK ,
NAME1 TYPE LFA1-NAME1 ,
SORTL TYPE LFA1-SORTL ,
PSTLZ TYPE LFA1-PSTLZ ,
LAND1 TYPE LFA1-LAND1 ,
END OF TY_MK01 .
*& DECLARATION OF INTERNAL TABLE
DATA : T_MK01 TYPE STANDARD TABLE OF TY_MK01 INITIAL SIZE 0 ,
T_BDCDATA TYPE STANDARD TABLE OF BDCDATA INITIAL SIZE 0 ,
T_BDCMSGCOLL TYPE STANDARD TABLE OF BDCMSGCOLL INITIAL SIZE 0 ,
T_ERROR TYPE STANDARD TABLE OF TY_MK01 INITIAL SIZE 0 ,
*& DECLARATION OF WORK AREA
W_MK01 TYPE TY_MK01 ,
W_BDCDATA TYPE BDCDATA ,
W_BDCMSGCOLL TYPE BDCMSGCOLL .
*& DECLARATION OF SELECTION SCREEN
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME .
PARAMETERS : P_FILE TYPE FILENAME .
SELECTION-SCREEN END OF BLOCK B1 .
*& DECLARATION OF START-OF-SELECTION
START-OF-SELECTION .
PERFORM SUB_UPLOAD_DATA .
PERFORM SUB_POPULATE_BDC .
PERFORM SUB_ERROR_REC .
*include bdcrecx1.
*& Form SUB_UPLOAD_DATA
text
form SUB_UPLOAD_DATA .
DATA : L_FILE TYPE STRING .
L_FILE = P_FILE .
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = L_FILE
HAS_FIELD_SEPARATOR = 'X'
tables
data_tab = T_MK01 .
endform. " SUB_UPLOAD_DATA
*& Form SUB_POPULATE_BDC
text
form SUB_POPULATE_BDC .
LOOP AT T_MK01 INTO W_MK01 .
DATA : L_MSG TYPE STRING .
REFRESH T_BDCDATA .
perform bdc_dynpro using 'SAPMF02K' '0107'.
perform bdc_field using 'BDC_CURSOR'
'RF02K-KTOKK'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'RF02K-KTOKK'
W_MK01-KTOKK.
perform bdc_dynpro using 'SAPMF02K' '0110'.
perform bdc_field using 'BDC_CURSOR'
'LFA1-LAND1'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'LFA1-NAME1'
W_MK01-NAME1.
perform bdc_field using 'LFA1-SORTL'
W_MK01-SORTL.
perform bdc_field using 'LFA1-PSTLZ'
W_MK01-PSTLZ.
perform bdc_field using 'LFA1-LAND1'
W_MK01-LAND1.
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'
'RF02K-LIFNR'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_dynpro using 'SAPLSPO1' '0300'.
perform bdc_field using 'BDC_OKCODE'
'=YES'.
CALL TRANSACTION 'MK01' USING T_BDCDATA MODE 'N' MESSAGES INTO T_BDCMSGCOLL .
IF SY-SUBRC <> 0 .
APPEND W_MK01 TO T_ERROR .
ENDIF .
CLEAR W_BDCMSGCOLL .
READ TABLE T_BDCMSGCOLL INTO W_BDCMSGCOLL INDEX 1 .
CLEAR L_MSG .
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
ID = W_BDCMSGCOLL-MSGID
LANG = SY-LANGU
NO = W_BDCMSGCOLL-MSGNR
V1 = W_BDCMSGCOLL-MSGV1
V2 = W_BDCMSGCOLL-MSGV2
V3 = W_BDCMSGCOLL-MSGV3
V4 = W_BDCMSGCOLL-MSGV4
IMPORTING
MSG = L_MSG
EXCEPTIONS
NOT_FOUND = 1
OTHERS = 2
IF sy-subrc = 0.
WRITE : / 'MESSAGE FOR ' , W_MK01-KTOKK ,'-------' , L_MSG .
ENDIF.
ENDLOOP .
endform. " SUB_POPULATE_BDC
Start new screen *
FORM BDC_DYNPRO USING PROGRAM DYNPRO.
CLEAR W_BDCDATA.
W_BDCDATA-PROGRAM = PROGRAM.
W_BDCDATA-DYNPRO = DYNPRO.
W_BDCDATA-DYNBEGIN = 'X'.
APPEND W_BDCDATA TO T_BDCDATA .
ENDFORM.
Insert field *
FORM BDC_FIELD USING FNAM FVAL.
CLEAR W_BDCDATA.
W_BDCDATA-FNAM = FNAM.
W_BDCDATA-FVAL = FVAL.
APPEND W_BDCDATA TO T_BDCDATA .
ENDFORM.
*& Form SUB_ERROR_REC
text
--> p1 text
<-- p2 text
form SUB_ERROR_REC .
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = 'C:/ERRORS OF MK01.TXT'
WRITE_FIELD_SEPARATOR = 'X'
tables
data_tab = T_ERROR .
endform. " SUB_ERROR_REC
Session Method for MK01:
*& PURPOSE : This BDC report is used to upload all the vendor master
*& data in to SAP using SESSION METHOD with handling the errors
report Y035_SESSION_METHOD
no standard page heading line-size 255.
*& Structure declaration
*Structure Declaration for source internal table
TYPES : BEGIN OF TY_UPLOAD,
LIFNR TYPE RF02K-LIFNR,
EKORG TYPE RF02K-EKORG,
KTOKK TYPE RF02K-KTOKK,
NAME1 TYPE LFA1-NAME1,
SORTL TYPE LFA1-SORTL,
LAND1 TYPE LFA1-LAND1,
SPRAS TYPE LFA1-SPRAS,
WAERS TYPE LFM1-WAERS,
END OF TY_UPLOAD.
*& Internal Table declaration
*Internal Table Declaration for source table
DATA : T_UPLOAD TYPE STANDARD TABLE OF TY_UPLOAD INITIAL SIZE 0,
*Internal Table Declaration for bdcdata
T_BDCDATA TYPE STANDARD TABLE OF BDCDATA INITIAL SIZE 0,
*Internal table declaration for BDCMSGCOLL (To handle the errors)
T_BDCMSG TYPE STANDARD TABLE OF BDCMSGCOLL,
*Internal table declaration for reprocess the errors
T_ERRORS TYPE STANDARD TABLE OF TY_UPLOAD INITIAL SIZE 0,
*& Workarea declaration
*Work area delaration for source table
W_UPLOAD TYPE TY_UPLOAD,
*Work area delaration for bdcdata
W_BDCDATA TYPE BDCDATA,
*Work area delaration for BDCMSGCOLL
W_BDCMSG TYPE BDCMSGCOLL.
*& Selection screen declaration
*Selection Screen declaration
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME.
PARAMETERS : P_FLNAME TYPE FILENAME.
SELECTION-SCREEN END OF BLOCK B1.
*& Start of selection declaration
*Start of selection declaration
START-OF-SELECTION.
*Upload the data
PERFORM SUB_UPLOAD_DATA.
*Populate the BDC data
PERFORM SUB_POPULATE_BDC.
*Process the error records
PERFORM SUB_ERROR_RECORD.
*include bdcrecx1.
*& Form SUB_UPLOAD_DATA
This subroutine is used to upload the data
FORM SUB_UPLOAD_DATA .
DATA : L_FLNAME TYPE STRING.
L_FLNAME = P_FLNAME.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = L_FLNAME
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X'
TABLES
DATA_TAB = T_UPLOAD.
ENDFORM. " SUB_UPLOAD_DATA
*& Form SUB_POPULATE_BDC
This subroutine is used to populate the BDC data
FORM SUB_POPULATE_BDC .
DATA : L_MSG TYPE STRING.
*To oper a sesion in SE35
CALL FUNCTION 'BDC_OPEN_GROUP'
EXPORTING
CLIENT = SY-MANDT
GROUP = 'MAMA_SESSION'
USER = SY-UNAME
KEEP = 'X'
HOLDDATE = '20080129'
PROG = SY-CPROG.
LOOP AT T_UPLOAD INTO W_UPLOAD.
REFRESH T_BDCDATA.
perform bdc_dynpro using 'SAPMF02K' '0107'.
perform bdc_field using 'BDC_CURSOR' 'RF02K-KTOKK'.
perform bdc_field using 'BDC_OKCODE' '/00'.
perform bdc_field using 'RF02K-LIFNR' W_UPLOAD-LIFNR.
perform bdc_field using 'RF02K-EKORG' W_UPLOAD-EKORG.
perform bdc_field using 'RF02K-KTOKK' W_UPLOAD-KTOKK.
perform bdc_dynpro using 'SAPMF02K' '0110'.
perform bdc_field using 'BDC_CURSOR' 'LFA1-SPRAS'.
perform bdc_field using 'BDC_OKCODE' '/00'.
perform bdc_field using 'LFA1-NAME1' W_UPLOAD-NAME1.
perform bdc_field using 'LFA1-SORTL' W_UPLOAD-SORTL.
perform bdc_field using 'LFA1-LAND1' W_UPLOAD-LAND1.
perform bdc_field using 'LFA1-SPRAS' W_UPLOAD-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' '0310'.
perform bdc_field using 'BDC_CURSOR' 'LFM1-WAERS'.
perform bdc_field using 'BDC_OKCODE' '/00'.
perform bdc_field using 'LFM1-WAERS' W_UPLOAD-WAERS.
perform bdc_dynpro using 'SAPMF02K' '0320'.
perform bdc_field using 'BDC_CURSOR' 'RF02K-LIFNR'.
perform bdc_field using 'BDC_OKCODE' '=ENTR'.
perform bdc_dynpro using 'SAPLSPO1' '0300'.
perform bdc_field using 'BDC_OKCODE' '=YES'.
*Transfer data to the session
CALL FUNCTION 'BDC_INSERT'
EXPORTING
TCODE = 'MK01'
TABLES
dynprotab = T_BDCDATA.
ENDLOOP.
*To close the session
CALL FUNCTION 'BDC_CLOSE_GROUP'.
ENDFORM. " SUB_POPULATE_BDC
Start new screen *
FORM BDC_DYNPRO USING PROGRAM DYNPRO.
CLEAR W_BDCDATA.
W_BDCDATA-PROGRAM = PROGRAM.
W_BDCDATA-DYNPRO = DYNPRO.
W_BDCDATA-DYNBEGIN = 'X'.
APPEND W_BDCDATA TO T_BDCDATA.
ENDFORM.
Insert field *
FORM BDC_FIELD USING FNAM FVAL.
CLEAR W_BDCDATA.
W_BDCDATA-FNAM = FNAM.
W_BDCDATA-FVAL = FVAL.
APPEND W_BDCDATA TO T_BDCDATA.
ENDFORM.
*& Form SUB_ERROR_RECORD
This subroutine is used to process the error records
in to a file T_ERRORS
FORM SUB_ERROR_RECORD .
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = 'C:\MAMA_ERRORS.TXT'
WRITE_FIELD_SEPARATOR = 'X'
TABLES
DATA_TAB = T_ERRORS.
ENDFORM. " SUB_ERROR_RECORD
Hope the Explonation and information I had provided will resolve your issue.
Reward points if information is very Helpful.
Have a great day!
Regards,
Krishna Chaitanya
Edited by: Krishna Chaitanya on Apr 7, 2008 4:59 AM -
PURCHASE ORDER UPLOAD THRU BDC
HOW MANY FLAT FILES 'LL U UPLOAD FOR PURCHASE ORDER IN BDC ND BAPI. i.e., WILL U GIVE SEPERATE FILE FOR HEADER DATA AND ITEM DATA OR A SINGLE FILE FOR BOTH. GIVE ME SOME SAMPLE CODES.
Refer the sample program in BDC:
*& Report ZTRAINEE15_BDC *
REPORT ztrainee15_bdc
NO STANDARD PAGE HEADING LINE-SIZE 255.
DATA : BEGIN OF itab OCCURS 10,
orderno LIKE vbak-vbeln,
itemno LIKE vbap-posnr,
reason LIKE vbap-abgru,
END OF itab.
DATA : BEGIN OF it_bdc OCCURS 10.
INCLUDE STRUCTURE bdcdata.
DATA : END OF it_bdc.
DATA : filename TYPE string.
DATA: it_bdcmsgcall type standard table of BDCMSGCOLL WITH HEADER LINE.
*DATA: it_bdcdata type standard table of BDCDATA WITH HEADER LINE.
SELECTION SCREEN
SELECTION-SCREEN BEGIN OF BLOCK b1.
PARAMETER: p_file TYPE rlgrap-filename,
rjct_itm RADIOBUTTON GROUP g1,
add_item RADIOBUTTON GROUP g1.
SELECTION-SCREEN END OF BLOCK b1.
GUI FOR PATH FILE
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.
UPLOADING FILE
START-OF-SELECTION.
filename = p_file.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = filename
filetype = 'ASC'
HAS_FIELD_SEPARATOR = ' '
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
IMPORTING
FILELENGTH =
HEADER =
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
IF sy-subrc 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
*AT SELECTION-SCREEN ON RADIOBUTTON GROUP g1.
CASE 'rjct_itm'.
WHEN 'X'.
PASSING DATA
program name, screen no.
LOOP AT itab.
clear: it_bdc, it_bdc[].
PERFORM bdc_dynpro USING 'SAPMV45A' '102' 'X'.
PERFORM bdc_field USING 'BDC_CURSOR' 'VBAK-VBELN'.
PERFORM bdc_field USING 'BDC_OKCODE' '=SUCH'.
PERFORM bdc_field USING 'VBAK-VBELN' itab-orderno.
PERFORM bdc_dynpro USING 'SAPMV45A' '4001' 'X'.
PERFORM bdc_field USING 'BDC_CURSOR' 'VBAP-POSNR'.
PERFORM bdc_field USING 'BDC_OKCODE' '=ITEM'.
PERFORM bdc_field USING 'VBAP-POSNR' itab-itemno.
PERFORM bdc_dynpro USING 'SAPMV45A' '4003' 'X'.
PERFORM bdc_field USING 'BDC_CURSOR' 'VBAP-ABGRU'.
PERFORM bdc_field USING 'BDC_OKCODE' '=SICH'.
PERFORM bdc_field USING 'VBAP-ABGRU' itab-reason.
CALLING TRANSACTION
CALL TRANSACTION 'VA02' USING it_bdc MODE 'A' MESSAGES INTO
it_bdcmsgcall.
ENDLOOP.
LOOP AT it_bdc.
WRITE: / it_bdc-program,
it_bdc-dynpro,
it_bdc-dynbegin,
it_bdc-fnam,
it_bdc-fval.
ENDLOOP.
*ENDCASE.
*& Form bdc_dynpro
text
-->P_0198 text
-->P_0199 text
-->P_0200 text
FORM bdc_dynpro USING p_program
p_dynpro
p_flag.
it_bdc-program = p_program.
it_bdc-dynpro = p_dynpro.
it_bdc-dynbegin = p_flag.
APPEND it_bdc.
CLEAR it_bdc.
ENDFORM. " bdc_dynpro
*& Form bdc_field
text
-->P_0230 text
-->P_0231 text
FORM bdc_field USING p_fnam
p_fval.
it_bdc-fnam = p_fnam.
it_bdc-fval = p_fval.
APPEND it_bdc.
CLEAR it_bdc.
ENDFORM. " bdc_field
Maybe you are looking for
-
Same sequence value for multiple targets
Hello In my mapping, I have 4 target tables. The primary key of the first table is filled by a sequence. Now I should use the same value to fill in the 3 other tables. I was trying to use the sequence in the joiner and in the splitter but when I vali
-
About 2 weeks ago my iPod told me that something (I forget what now) was corrupt and my iPod had to be restored to factory settings, so I did that. Before I had a chance to resync my iPod, my harddrive in my MacBook Pro crashed and had to be replace
-
I want to hook up an outdoor powered speaker to an airport express. How do I do this? Which airport express thingee do I need? I want to plug in the airport express thingee inside and connect to speakers outside. Is there a length limit to the mi
-
CRM Functionality The CRM solution I'm working on, needs to offer a full and follow up control over customer requests. It needs to have control of, Global response time, One or multiple responsible persons involved to attend it, Different phases a
-
Hello! I have an Mac Mini with an Intel core solo and 512 mb RAM. I also have a 1.83 GHz MacBook Pro with 512 mb of RAM. Both are connected to the Internet via AirPort Extreme. The mini works great, but it appears that the reception on the mini is wo