Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

BDC IN F-02

Former Member
0 Kudos

Hi

experts can anybody send me the BDC Code for F-02.

i am giving you the field names bellow.

BKPF-BLDAT.

BKPF-BLART.

BKPF-BUKRS.

BKPF-BUDAT.

BKPF-MONAT.

BKPF-WAERS.

BSEG-WRBTR.

BSEG-GSBER.

BSEG-ZFBDT.

RF05A-NEWBS.

RF05A-NEWKO.

BSEG-WRBTR.

BSEG-GSBER.

BSEG-ZFBDT.

BSEG-SGTXT.

RF05A-NEWBS.

RF05A-NEWKO.

BSEG-WRBTR.

COBL-GSBER.

COBL-KOSTL.

BSEG-WRBTR.

COBL-GSBER.

COBL-KOSTL.

BSEG-WRBTR.

BSEG-SGTXT.

COBL-GSBER.

COBL-KOSTL.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

O man BDC upload of F-02,those memories.I once did a BDC upload of this tcode and man it was annoying.

I will recommend you not to write BDC for F-02 because the screen keeps on changing with every posting key.

I was faced with the BDC for this again and this time I used LSMW.I hope you have some knowledge on LSMW.I still have the exported LSMW program.I have mailed you the exported file to you.

You just need to import it and run it.

Please reward if helpful.

Message was edited by:

Babar Haroon

13 REPLIES 13

Former Member
0 Kudos

Hi Praktik,

try SHBD with F-02.

Regards, Dieter

former_member1109645
Participant
0 Kudos

hi,

Chk this code, its for BDC that i have done for F-02,

REPORT ZFIB_F_02 NO STANDARD PAGE HEADING LINE-SIZE 255.

DATA : LV_FILENAME TYPE RLGRAP-FILENAME,

LT_FILE_NAME TYPE FILETABLE,

WA_FILE_NAME TYPE FILE_TABLE,

LV_RC TYPE I.

DATA : TRANBDC TYPE ALSMEX_TABLINE OCCURS 0 WITH HEADER LINE.

DATA : BEGIN OF BDC_TAB OCCURS 0,

BLDAT(10), "LIKE BKPF-BLDAT, "DOCUMENT DATE

BLART LIKE BKPF-BLART, "DOCUMENT TYPE

BUKRS LIKE BKPF-BUKRS, "COMPANY CODE

MONAT LIKE BKPF-MONAT, "FISCAL PERIOD

WAERS LIKE BKPF-WAERS, "CURRENCY

XBLNR LIKE BKPF-XBLNR, "REFERENCE DOCUMENT NUMBER

BKTXT LIKE BKPF-BKTXT, "DOCUMENT HEADER TEXT.

NEWBS LIKE RF05A-NEWBS, "POSTING KEY

NEWKO LIKE RF05A-NEWKO, "ACCOUNT

WRBTR(16), "BSEG-WRBTR, "AMOUNT

ZUONR LIKE BSEG-ZUONR, "ASSIGNMENT NUMBER

SGTXT LIKE BSEG-SGTXT, "TEXT

END OF BDC_TAB.

DATA : BEGIN OF BDCTAB OCCURS 0.

INCLUDE STRUCTURE BDCDATA.

DATA : END OF BDCTAB.

*****************/ FOR MESSAGES

DATA : IT_T100 LIKE T100 OCCURS 0 WITH HEADER LINE.

DATA : BEGIN OF IMSG OCCURS 0.

INCLUDE STRUCTURE BDCMSGCOLL.

DATA : END OF IMSG .

DATA : U_MODE(1).

DATA : L_MSTRING(480).

****************/ SELECTION SCREEN BLOCKS.

******SELECTION SCREEN*********

SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.

PARAMETER : FILENAME(200) TYPE C OBLIGATORY,

BGIN_COL TYPE I DEFAULT '1' OBLIGATORY,

BGIN_ROW TYPE I DEFAULT '1' OBLIGATORY,

END_COL TYPE I OBLIGATORY,

END_ROW TYPE I OBLIGATORY.

SELECTION-SCREEN END OF BLOCK B1 .

SELECTION-SCREEN : BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-002.

PARAMETERS : P_FIRST RADIOBUTTON GROUP RB,

P_SECOND RADIOBUTTON GROUP RB DEFAULT 'X',

P_THIRD RADIOBUTTON GROUP RB.

SELECTION-SCREEN : END OF BLOCK B2.

************TO GET FILENAME*******************************

AT SELECTION-SCREEN ON VALUE-REQUEST FOR FILENAME.

PERFORM GET_FILENAME.

***********TO UPLOAD DATA TO INTERNAL TABLE FROM EXCEL FILE**

START-OF-SELECTION.

PERFORM FILE_UPLOAD.

************TO GET MODE OF SCREEN DISPLAY*****************

PERFORM SCREEN_FLAG.

***************/ TO UPLOAD DATA IN BDCDATA TABLE.

PERFORM BDC_TRANSACTION.

&----


*& Form GET_FILENAME

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM GET_FILENAME .

CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG

EXPORTING

INITIAL_DIRECTORY = 'C:\'

CHANGING

FILE_TABLE = LT_FILE_NAME

RC = LV_RC

EXCEPTIONS

FILE_OPEN_DIALOG_FAILED = 1

CNTL_ERROR = 2

ERROR_NO_GUI = 3.

READ TABLE LT_FILE_NAME INTO WA_FILE_NAME INDEX 1.

FILENAME = WA_FILE_NAME.

ENDFORM. " GET_FILENAME

&----


*& Form FILE_UPLOAD

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM FILE_UPLOAD .

LV_FILENAME = FILENAME.

CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'

EXPORTING

FILENAME = LV_FILENAME

I_BEGIN_COL = BGIN_COL

I_BEGIN_ROW = BGIN_ROW

I_END_COL = END_COL

I_END_ROW = END_ROW

TABLES

INTERN = TRANBDC

EXCEPTIONS

INCONSISTENT_PARAMETERS = 1

UPLOAD_OLE = 2

OTHERS = 3.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

READ TABLE TRANBDC INDEX 1.

IF SY-SUBRC IS INITIAL.

LOOP AT TRANBDC.

IF TRANBDC-COL EQ '1'.

MOVE TRANBDC-VALUE TO BDC_TAB-BLDAT.

ELSEIF TRANBDC-COL EQ '2'.

MOVE TRANBDC-VALUE TO BDC_TAB-BLART.

ELSEIF TRANBDC-COL EQ '3'.

MOVE TRANBDC-VALUE TO BDC_TAB-BUKRS.

ELSEIF TRANBDC-COL EQ '4'.

MOVE TRANBDC-VALUE TO BDC_TAB-MONAT.

ELSEIF TRANBDC-COL EQ '5'.

MOVE TRANBDC-VALUE TO BDC_TAB-WAERS.

ELSEIF TRANBDC-COL EQ '6'.

MOVE TRANBDC-VALUE TO BDC_TAB-XBLNR.

ELSEIF TRANBDC-COL EQ '7'.

MOVE TRANBDC-VALUE TO BDC_TAB-BKTXT.

ELSEIF TRANBDC-COL EQ '8'.

MOVE TRANBDC-VALUE TO BDC_TAB-NEWBS.

ELSEIF TRANBDC-COL EQ '9'.

MOVE TRANBDC-VALUE TO BDC_TAB-NEWKO.

ELSEIF TRANBDC-COL EQ '10'.

MOVE TRANBDC-VALUE TO BDC_TAB-WRBTR.

ELSEIF TRANBDC-COL EQ '11'.

MOVE TRANBDC-VALUE TO BDC_TAB-ZUONR.

ELSEIF TRANBDC-COL EQ '12'.

MOVE TRANBDC-VALUE TO BDC_TAB-SGTXT.

IF SY-SUBRC IS INITIAL.

APPEND BDC_TAB.

CLEAR BDC_TAB.

ENDIF.

ENDIF.

CLEAR TRANBDC.

ENDLOOP.

ENDIF.

ENDFORM. " FILE_UPLOAD

&----


*& Form SCREEN_FLAG

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM SCREEN_FLAG .

IF P_FIRST = 'X'.

U_MODE = 'A'.

ENDIF.

IF P_SECOND = 'X'.

U_MODE = 'N'.

ENDIF.

IF P_THIRD = 'X'.

U_MODE = 'E'.

ENDIF.

ENDFORM. " SCREEN_FLAG

&----


*& Form BDC_TRANSACTION

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM BDC_TRANSACTION .

LOOP AT BDC_TAB.

IF NOT BDC_TAB-BLDAT IS INITIAL.

PERFORM BDC_SCREEN USING : 'X' 'SAPMF05A' '0100',

' ' 'BDC_OKCODE' '/00' ,

' ' 'BKPF-BLDAT' BDC_TAB-BLDAT,

' ' 'BKPF-BLART' BDC_TAB-BLART,

' ' 'BKPF-BUKRS' BDC_TAB-BUKRS,

' ' 'BKPF-MONAT' BDC_TAB-MONAT,

' ' 'BKPF-WAERS' BDC_TAB-WAERS,

' ' 'BKPF-XBLNR' BDC_TAB-XBLNR,

' ' 'BKPF-BKTXT' BDC_TAB-BKTXT,

' ' 'RF05A-NEWBS' BDC_TAB-NEWBS,

' ' 'RF05A-NEWKO' BDC_TAB-NEWKO.

PERFORM BDC_SCREEN USING : 'X' 'SAPMF05A' '0300',

' ' 'BSEG-WRBTR' BDC_TAB-WRBTR,

' ' 'BSEG-ZUONR' BDC_TAB-ZUONR,

' ' 'BSEG-SGTXT' BDC_TAB-SGTXT,

' ' 'BDC_OKCODE' '/00' ,

' ' 'BDC_OKCODE' '/00',

' ' 'DKACB-FMORE' ' '.

ENDIF.

IF BDC_TAB-BLDAT IS INITIAL.

PERFORM BDC_SCREEN USING : 'X' 'SAPMF05A' '0300',

' ' 'BDC_OKCODE' '/00' ,

' ' 'RF05A-NEWBS' BDC_TAB-NEWBS,

' ' 'RF05A-NEWKO' BDC_TAB-NEWKO,

' ' 'BDC_OKCODE' '/00',

' ' 'DKACB-FMORE' ' '.

PERFORM BDC_SCREEN USING : 'X' 'SAPMF05A' '0300',

' ' 'BDC_OKCODE' '/00' ,

' ' 'BSEG-WRBTR' BDC_TAB-WRBTR,

' ' 'BSEG-ZUONR' BDC_TAB-ZUONR,

' ' 'BSEG-SGTXT' BDC_TAB-SGTXT,

' ' 'DKACB-FMORE' ' ' .

ENDIF.

IF BDC_TAB-NEWBS = '50'.

PERFORM BDC_SCREEN USING : ' ' 'BDC_OKCODE' '=BU' .

REFRESH IMSG.

CALL TRANSACTION 'F-02' USING BDCTAB MODE U_MODE UPDATE 'S' MESSAGES INTO IMSG.

PERFORM ALL_MESSAGES.

REFRESH BDCTAB.

CLEAR BDCTAB.

ENDIF.

ENDLOOP.

ENDFORM. " BDC_TRANSACTION

&----


*& Form BDC_SCREEN

&----


  • text

----


  • -->P_0442 text

  • -->P_0443 text

  • -->P_0444 text

----


FORM BDC_SCREEN USING DYNBEGIN NAME VALUE.

CLEAR BDCTAB.

IF DYNBEGIN = 'X'.

MOVE: NAME TO BDCTAB-PROGRAM,

VALUE TO BDCTAB-DYNPRO ,

'X' TO BDCTAB-DYNBEGIN.

ELSE.

MOVE: NAME TO BDCTAB-FNAM,

VALUE TO BDCTAB-FVAL.

ENDIF.

APPEND BDCTAB.

ENDFORM. " BDC_SCREEN

&----


*& Form ALL_MESSAGES

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM ALL_MESSAGES .

LOOP AT IMSG.

SELECT SINGLE * FROM T100 INTO IT_T100

WHERE SPRSL = IMSG-MSGSPRA

AND ARBGB = IMSG-MSGID

AND MSGNR = IMSG-MSGNR.

IF SY-SUBRC IS INITIAL.

L_MSTRING = IT_T100-TEXT.

IF L_MSTRING CS '&1'.

REPLACE '&1' WITH IMSG-MSGV1 INTO L_MSTRING.

REPLACE '&2' WITH IMSG-MSGV2 INTO L_MSTRING.

REPLACE '&3' WITH IMSG-MSGV3 INTO L_MSTRING.

REPLACE '&4' WITH IMSG-MSGV4 INTO L_MSTRING.

ELSE.

REPLACE '&' WITH IMSG-MSGV1 INTO L_MSTRING.

REPLACE '&' WITH IMSG-MSGV2 INTO L_MSTRING.

REPLACE '&' WITH IMSG-MSGV3 INTO L_MSTRING.

REPLACE '&' WITH IMSG-MSGV4 INTO L_MSTRING.

ENDIF.

CONDENSE L_MSTRING.

IF IMSG-MSGTYP NE 'W'.

WRITE : /5 IMSG-MSGTYP, L_MSTRING.

ENDIF.

ELSE.

WRITE : /5 IMSG.

ENDIF.

ENDLOOP.

copy paste it ll work,

i ll send u the excel file reg this to ur email

Reward if helpful

Former Member
0 Kudos

Hi,

First record the bdc program using t-code: SHDB, then go through the following link for writing code:

http://www.sap-img.com/bdc.htm

Regards,

Bhaskar

former_member1109645
Participant
0 Kudos

This message was moderated.

0 Kudos

This message was moderated.

Former Member
0 Kudos

hi ,

copy the code and add the what ever the left fields from your table fields.

REPORT ZBDC_F02_NEWCOMPANYCODE no standard page heading line-size 255.

.

include bdcrecx1.

PARAMETER : FILE LIKE RLGRAP-FILENAME DEFAULT 'C:\'.

DATA : FILE1 TYPE STRING. "+

DATA: BEGIN OF RECORD OCCURS 0,

    • Header Data

BUKRS TYPE T001-BUKRS, "Comp code

BLDAT(10), "Doc Date

BLART LIKE BKPF-BLART, "Doc Type

BUDAT(10), "Posting Date

MONAT LIKE BKPF-MONAT, "Period

WAERS LIKE BKPF-WAERS, "Currency

KURSF(6), " LIKE BKPF-KURSF, "Rate

XBLNR LIKE BKPF-XBLNR, "Reference

HBKTXT LIKE BKPF-BKTXT, "Header Text

    • Item Data

NEWBS LIKE RF05A-NEWBS, "Posting Key

SET LIKE RF05A-NEWBS, "Key

NEWKO LIKE RF05A-NEWKO, "GL Account

WRBTR(13), " LIKE BSEG-WRBTR, "Amount

NEWUM LIKE RF05A-NEWUM, "Special G/L

GSBER LIKE COBL-GSBER, "Business Area

*added by girish on 09/03/2006

AUFNR LIKE COBL-AUFNR , "Order No

*end of addition on 09/03/2006

  • ZFBDT1 like bseg-zfbdt ,"due date

KOSTL LIKE COBL-KOSTL, "Cost Center

PS_POSID LIKE COBL-PS_POSID, "WBS Element

NPLNR LIKE COBL-NPLNR, "Network no

VORNR LIKE COBL-VORNR, "Activity

ISGTXT LIKE BSEG-SGTXT, "Item Text

ZUONR LIKE BSEG-ZUONR, "Assignment

ZFBDT(10), "Baseline date based on account

SRNO TYPE I, "Serial No

END OF RECORD.

DATA: WA LIKE RECORD,

WA_ITEM LIKE RECORD.

----


  • AT SELECTION-SCREEN ON VALUE-REQUEST

----


AT SELECTION-SCREEN ON VALUE-REQUEST FOR FILE.

CALL FUNCTION 'F4_FILENAME'

EXPORTING

PROGRAM_NAME = SYST-CPROG

IMPORTING

FILE_NAME = FILE

EXCEPTIONS

OTHERS = 1.

----


  • Initialization

----


Initialization.

clear: nodata.

----


  • START-OF-SELECTION

----


start-of-selection.

FILE1 = FILE. "+

CALL FUNCTION 'GUI_UPLOAD' "+

EXPORTING "+

FILENAME = FILE1 "+

FILETYPE = 'ASC' "+

HAS_FIELD_SEPARATOR = 'X' "+

TABLES "+

DATA_TAB = RECORD "+

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 . "+

CASE SY-SUBRC.

WHEN '1'. "-

WHEN '1'. "+

WRITE: /'file_open-error'.

WHEN '2'. "+

WRITE: /'file_read_error'.

WHEN '3'. "+

WRITE: / 'NO_BATCH'.

WHEN '4'. "+

WRITE: / 'GUI_REFUSE_FILE_TRANSFER'. "+

WHEN '5'.

WRITE:/ 'INVALID_TYPE'.

WHEN '7'.

WRITE:/ 'UNKNOWN_ERROR'.

WHEN '17'. "+

WRITE: /'OTHERS'. "+

ENDCASE.

data v_index type i.

perform open_group.

loop at RECORD.

v_index = sy-tabix.

IF RECORD-SRNO = 1.

IF SY-tabix <> 1.

perform bdc_dynpro using 'SAPMF05A' '0700'.

perform bdc_field using 'BDC_CURSOR' 'RF05A-NEWBS'.

perform bdc_field using 'BDC_OKCODE' '=BU'.

perform bdc_field using 'BKPF-XBLNR' wa-xblnr. "'SALARY'.

perform bdc_field using 'BKPF-BKTXT' wa-hbktxt. "'SALARY FOR NOV'.

perform bdc_transaction using 'F-02'.

ENDIF.

clear: wa.

wa = record.

perform bdc_dynpro using 'SAPMF05A' '0100'.

perform bdc_field using 'BDC_CURSOR' 'RF05A-NEWKO'.

perform bdc_field using 'BDC_OKCODE' '/00'.

perform bdc_field using 'BKPF-BLDAT' RECORD-BLDAT. "'10.11.2005'.

perform bdc_field using 'BKPF-BLART' RECORD-BLART. "'SA'.

perform bdc_field using 'BKPF-BUKRS' RECORD-BUKRS."'1500'.

perform bdc_field using 'BKPF-BUDAT' RECORD-BUDAT. "'10.11.2005'.

perform bdc_field using 'BKPF-MONAT' RECORD-MONAT."'8'.

perform bdc_field using 'BKPF-WAERS' RECORD-WAERS. "'INR'.

perform bdc_field using 'BKPF-KURSF' RECORD-KURSF. "Rate

perform bdc_field using 'BKPF-XBLNR' RECORD-XBLNR. "'sALARY'.

perform bdc_field using 'BKPF-BKTXT' RECORD-HBKTXT. "'SALARY FOR NOV'.

perform bdc_field using 'RF05A-NEWBS' record-newbs. " '40'.

perform bdc_field using 'RF05A-NEWKO' record-newko. " '511010'.

PERFORM BDC_FIELD USING 'RF05A-NEWUM' RECORD-NEWUM. " SP GL

perform find_screen_on_pkey using v_index.

ELSE.

perform bdc_field using 'RF05A-NEWBS' record-newbs. " '40'.

perform bdc_field using 'RF05A-NEWKO' record-newko. " '511010'.

PERFORM BDC_FIELD USING 'RF05A-NEWUM' RECORD-NEWUM. " SP GL

perform find_screen_on_pkey using v_index.

*addition by girish on 09/03/2006

v_index = v_index + 1.

read table record index v_index.

if record-set = 50 .

perform bdc_dynpro using 'SAPMF05A' '0701'.

perform bdc_field using 'BDC_CURSOR' 'RF05A-NEWBS'.

perform bdc_field using 'BDC_OKCODE' '=NK'.

perform bdc_dynpro using 'SAPMF05A' '0300'.

perform bdc_field using 'BSEG-SGTXT' RECORD-ISGTXT. .

perform bdc_field using 'BDC_OKCODE' '=BU'.

perform bdc_dynpro using 'SAPLKACB' '0002'.

perform bdc_field using 'BDC_OKCODE' '=ENTE'.

perform bdc_field using 'COBL-GSBER' RECORD-GSBER.

perform bdc_field using 'COBL-AUFNR' RECORD-AUFNR.

ELSEif record-set = 40 .

perform bdc_dynpro using 'SAPMF05A' '0701'.

perform bdc_field using 'BDC_CURSOR' 'RF05A-NEWBS'.

perform bdc_field using 'BDC_OKCODE' '=NK'.

perform bdc_dynpro using 'SAPMF05A' '0300'.

perform bdc_field using 'BSEG-SGTXT' RECORD-ISGTXT .

perform bdc_field using 'BDC_OKCODE' '=BU'.

perform bdc_dynpro using 'SAPLKACB' '0002'.

perform bdc_field using 'BDC_OKCODE' '=ENTE'.

perform bdc_field using 'COBL-GSBER' RECORD-GSBER .

perform bdc_field using 'COBL-AUFNR' RECORD-AUFNR.

ENDIF .

*end of addition on 09/03/2006

ENDIF.

WA_ITEM = RECORD. Clear: v_index.

ENDLOOP.

perform bdc_dynpro using 'SAPMF05A' '0700'.

perform bdc_field using 'BDC_CURSOR' 'RF05A-NEWBS'.

perform bdc_field using 'BDC_OKCODE' '=BU'.

perform bdc_field using 'BKPF-XBLNR' wa-xblnr.

perform bdc_field using 'BKPF-BKTXT' wa-hbktxt.

perform bdc_transaction using 'F-02'.

perform close_group.

&----


*& Form find_screen_on_pkey

&----


  • Find screen Based on Posting Key

----


FORM find_screen_on_pkey using v_index.

if record-newbs = '40' OR record-newbs = '50'. "300 screen

perform bdc_dynpro using 'SAPMF05A' '0300'.

perform bdc_field using 'BDC_CURSOR' 'BSEG-SGTXT'.

perform bdc_field using 'BDC_OKCODE' '=ZK'.

perform bdc_field using 'BSEG-WRBTR' RECORD-WRBTR."'50000'.

PERFORM BDC_FIELD USING 'BSEG-SGTXT' RECORD-ISGTXT.

PERFORM BDC_FIELD USING 'BSEG-ZUONR' RECORD-ZUONR.

perform bdc_dynpro using 'SAPLKACB' '0002'.

perform bdc_field using 'BDC_CURSOR' 'COBL-GSBER'.

perform bdc_field using 'BDC_OKCODE' '=ENTE'.

perform bdc_field using 'COBL-GSBER' RECORD-GSBER."'1520'.

PERFORM BDC_FIELD USING 'COBL-KOSTL' RECORD-KOSTL.

PERFORM BDC_FIELD USING 'COBL-PS_POSID' RECORD-PS_POSID.

perform bdc_field using 'COBL-NPLNR' RECORD-NPLNR."'4000000'.

perform bdc_field using 'COBL-VORNR' RECORD-VORNR."'0030'.

v_index = v_index + 1.

read table record index v_index.

if sy-subrc <> 0 or record-srno = 1.

perform bdc_dynpro using 'SAPMF05A' '0330'.

perform bdc_field using 'BDC_CURSOR' 'BSEG-CCBTC'.

perform bdc_field using 'BDC_OKCODE' '=BS'.

else.

perform bdc_dynpro using 'SAPMF05A' '0330'.

perform bdc_field using 'BDC_CURSOR' 'RF05A-NEWKO'.

perform bdc_field using 'BDC_OKCODE' '=BS' . "'/00'.

endif.

v_index = v_index - 1.

read table record index v_index.

elseif record-newbs = '01' or record-newbs = '02' or record-newbs = '03' or

record-newbs = '04' or record-newbs = '05' or record-newbs = '06' or

record-newbs = '07' or record-newbs = '08' or record-newbs = '09' or

record-newbs = '11' or record-newbs = '12' or record-newbs = '13' or

record-newbs = '14' or record-newbs = '15' or record-newbs = '16' or

record-newbs = '17' or record-newbs = '18'. "301 screen

v_index = v_index + 1.

read table record index v_index.

if sy-subrc <> 0 or record-srno = 1.

perform bdc_dynpro using 'SAPMF05A' '0301'.

perform bdc_field using 'BDC_CURSOR' 'BSEG-SGTXT'.

perform bdc_field using 'BDC_OKCODE' '=BU'.

else.

perform bdc_dynpro using 'SAPMF05A' '0301'.

perform bdc_field using 'BDC_CURSOR' 'BSEG-SGTXT'.

perform bdc_field using 'BDC_OKCODE' '=ZK'.

endif.

v_index = v_index - 1.

read table record index v_index.

perform bdc_field using 'BSEG-WRBTR' RECORD-WRBTR."'50000'.

perform bdc_field using 'BSEG-GSBER' RECORD-GSBER."'1520'.

PERFORM BDC_FIELD USING 'BSEG-ZUONR' RECORD-ZUONR.

PERFORM BDC_FIELD USING 'BSEG-ZFBDT' RECORD-ZFBDT.

PERFORM BDC_FIELD USING 'BSEG-SGTXT' RECORD-ISGTXT.

elseif record-newbs = '21' or record-newbs = '22' or record-newbs = '24' or

record-newbs = '25' or record-newbs = '26' or record-newbs = '27' or

record-newbs = '28' or record-newbs = '31' or

record-newbs = '32' or record-newbs = '34' or record-newbs = '36' or

record-newbs = '37' or record-newbs = '38' or

( record-newbs = '29' and record-newum = ' ') ."302 screen

v_index = v_index + 1.

read table record index v_index.

if sy-subrc <> 0 or record-srno = 1.

perform bdc_dynpro using 'SAPMF05A' '0302'.

perform bdc_field using 'BDC_CURSOR' 'BSEG-SGTXT'.

perform bdc_field using 'BDC_OKCODE' '=BU'.

else.

perform bdc_dynpro using 'SAPMF05A' '0302'.

perform bdc_field using 'BDC_CURSOR' 'BSEG-SGTXT'.

perform bdc_field using 'BDC_OKCODE' '=BU' . " '/00'.

endif.

v_index = v_index - 1.

read table record index v_index.

perform bdc_field using 'BSEG-WRBTR' RECORD-WRBTR."'500'.

perform bdc_field using 'BSEG-GSBER' RECORD-GSBER."'1520'.

perform bdc_field using 'BSEG-ZFBDT' RECORD-ZFBDT. "'10.11.2005'.

PERFORM BDC_FIELD USING 'BSEG-ZUONR' RECORD-ZUONR.

perform bdc_field using 'BSEG-SGTXT' RECORD-ISGTXT. "

elseif record-newbs = '19' or record-newbs = '39' OR

( record-newbs = '29' and record-newum = 'A' ). "304 screen

v_index = v_index + 1.

read table record index v_index.

if sy-subrc <> 0 or record-srno = 1.

perform bdc_dynpro using 'SAPMF05A' '0304'.

perform bdc_field using 'BDC_CURSOR' 'BSEG-SGTXT'.

perform bdc_field using 'BDC_OKCODE' '=BU'.

else.

perform bdc_dynpro using 'SAPMF05A' '0304'.

perform bdc_field using 'BDC_CURSOR' 'BSEG-SGTXT'.

perform bdc_field using 'BDC_OKCODE' '=BU' . " '/00'.

endif.

v_index = v_index - 1.

read table record index v_index.

perform bdc_field using 'BSEG-WRBTR' RECORD-WRBTR."'500'.

perform bdc_field using 'BSEG-GSBER' RECORD-GSBER."'1520'.

*addition by girish on 04/02/2006

perform bdc_field using 'BSEG-ZFBDT' RECORD-ZFBDT ."'10.11.2005'.

PERFORM BDC_FIELD USING 'BSEG-ZUONR' RECORD-ZUONR.

perform bdc_field using 'BSEG-SGTXT' RECORD-ISGTXT. "

endif.

ENDFORM. " find_screen_on_pkey

it was working fine in our production server .

Regards ,

Girish

0 Kudos

hi girish can u give the legacy file of bdc-f-02.

i m facing the problem.

i have gone thru your code which u have given to pratik

thanks

pankaj

Former Member
0 Kudos

O man BDC upload of F-02,those memories.I once did a BDC upload of this tcode and man it was annoying.

I will recommend you not to write BDC for F-02 because the screen keeps on changing with every posting key.

I was faced with the BDC for this again and this time I used LSMW.I hope you have some knowledge on LSMW.I still have the exported LSMW program.I have mailed you the exported file to you.

You just need to import it and run it.

Please reward if helpful.

Message was edited by:

Babar Haroon

0 Kudos

hi babarharoon

thanks for helping me . i have a little bit knowledge in LSMW . could you plz tell me how can i download the docu in LSMW. is there any option in the screen of LSMW . tell me wht is the procedure to do it.

0 Kudos

well its easy, all you need to do is goto the file menu and you will find Extras and there you will find Import projects (upload file) and Export Projects (download file).

Please reward if helpful.

0 Kudos

hi Babar i have done it by the same way but i dont know how to use that imported project. i have imported the text file from by desktop. then wht is the next steps . plz man guide me

0 Kudos

This message was moderated.

0 Kudos

This message was moderated.