Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

BDC for F-02

Hi All,

I need to create a BDC for the transaction F-02. I got the recording done in SHDB.

I am quite new to work in BDC's - request you to help me -

Here I have to enter the Customer Account Number and Posting key in the first screen and its respective amount in the second screen - also the Customer a/c Number and the Posting key of the second line item.

If I loop my internal table - how to identify which a/c number and posting key has to be entered into the screen -

I need to complete this requirement quite soon - request you to help me..

Thanks

**********************************************

report ZBDC_REC

no standard page heading line-size 255.

include bdcrecx1.

start-of-selection.

perform open_group.

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'

'26.09.2008'.

perform bdc_field using 'BKPF-BLART'

'AB'.

perform bdc_field using 'BKPF-BUKRS'

'UNN'.

perform bdc_field using 'BKPF-BUDAT'

'26.09.2008'.

perform bdc_field using 'BKPF-MONAT'

'2'.

perform bdc_field using 'BKPF-WAERS'

'GBP'.

perform bdc_field using 'FS006-DOCID'

'*'.

perform bdc_field using 'RF05A-NEWBS'

'40'.

perform bdc_field using 'RF05A-NEWKO'

'250007'.

perform bdc_dynpro using 'SAPMF05A' '0300'.

perform bdc_field using 'BDC_CURSOR'

'RF05A-NEWKO'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'BSEG-WRBTR'

'100'.

perform bdc_field using 'RF05A-NEWBS'

'18'.

perform bdc_field using 'RF05A-NEWKO'

'5318'.

perform bdc_field using 'DKACB-FMORE'

'X'.

perform bdc_dynpro using 'SAPLKACB' '0002'.

perform bdc_field using 'BDC_CURSOR'

'COBL-AUFNR'.

perform bdc_field using 'BDC_OKCODE'

'=ENTE'.

perform bdc_field using 'COBL-KOSTL'

'100553'.

perform bdc_field using 'COBL-AUFNR'

'506240'.

perform bdc_dynpro using 'SAPMF05A' '0301'.

perform bdc_field using 'BDC_CURSOR'

'BSEG-WRBTR'.

perform bdc_field using 'BDC_OKCODE'

'=BU'.

perform bdc_field using 'BSEG-WRBTR'

'100'.

perform bdc_field using 'BSEG-ZFBDT'

'26.09.2008'.

perform bdc_transaction using 'F-02'.

perform bdc_dynpro using 'SAPMF05A' '0100'.

perform bdc_field using 'BDC_OKCODE'

'/EEND'.

perform bdc_field using 'BDC_CURSOR'

'BKPF-BLDAT'.

perform bdc_dynpro using 'SAPLSPO1' '0200'.

perform bdc_field using 'BDC_OKCODE'

'=YES'.

perform bdc_transaction using 'F-02'.

*************************

perform close_group.

Edited by: Jayavardhini A on Sep 26, 2008 3:06 PM

Tags:
replied

&----


*& Report ZBDC_F_02

*&

&----


*&Programmed by: Vamshi T

*& Reg: ECDK002345

&----


REPORT ZBDC_F_02.

Data: Begin of header occurs 0,

bldat(10), " bkpf-bldat

blart(2), " bkpf-blart

bukrs(4), " bkpf-bukrs

budat(10), " bkpf-budat

monat(2), " bkpf-monat

waers(3), " bkpf-wears

xblnr(30),

bktxt(60),

val1 type n,

end of header.

Data: Begin of item occurs 0,

newbs(2), " rf05a-newbs

newko(17), " rf05a-newko

wrbtr(13), " bseg-wrbtr

gsber(4), " cobl-gsber

sgtxt(50), " bseg-sgtxt

prctr(10), " cobl-prctr

kostl(10), " cobl-kostl

val2 type n,

end of item.

data: wa_header like header,

wa_item like item,

item1 like table of item with header line.

DATA: count type i, count1 type i, count2 type i.

DATA : w_file2 TYPE string,

w_file1 TYPE string.

PARAMETERS: filename LIKE rlgrap-filename.

PARAMETERS: filenam1 LIKE rlgrap-filename.

include zbdcrecx1.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR filename.

CALL FUNCTION 'F4_FILENAME'

IMPORTING

file_name = filename.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR filenam1.

CALL FUNCTION 'F4_FILENAME'

IMPORTING

file_name = filenam1.

START-OF-SELECTION.

w_file2 = filename.

w_file1 = filenam1.

                              • HEADER ************************

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename = w_file2

filetype = 'ASC'

has_field_separator = 'X'

TABLES

data_tab = header.

                              • Item *******************

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename = w_file1

filetype = 'ASC'

has_field_separator = 'X'

TABLES

data_tab = item.

perform open_group.

loop at header into wa_header.

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'

wa_header-bldat.

perform bdc_field using 'BKPF-BLART'

wa_header-blart.

perform bdc_field using 'BKPF-BUKRS'

wa_header-bukrs.

perform bdc_field using 'BKPF-BUDAT'

wa_header-budat.

perform bdc_field using 'BKPF-MONAT'

wa_header-monat.

perform bdc_field using 'BKPF-WAERS'

wa_header-waers.

perform bdc_field using 'BKPF-XBLNR'

wa_header-xblnr.

perform bdc_field using 'BKPF-BKTXT'

wa_header-bktxt.

clear item1[]. " please clear internal table here.

loop at item into wa_item where val2 = wa_header-val1.

append wa_item to item1.

clear wa_item.

count = count + 1.

endloop.

count1 = 1.

read table item1 into wa_item index count1.

perform bdc_field using 'RF05A-NEWBS'

wa_item-newbs.

perform bdc_field using 'RF05A-NEWKO'

wa_item-newko.

while count1 le count.

*read table item1 into wa_item index count1.

perform bdc_dynpro using 'SAPMF05A' '0300'.

perform bdc_field using 'BDC_CURSOR'

'RF05A-NEWKO'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'BSEG-WRBTR'

wa_item-wrbtr.

*perform bdc_field using 'BSEG-BUPLA'

  • '1000'.

*perform bdc_field using 'BSEG-VALUT'

  • '20.08.2008'.

perform bdc_field using 'BSEG-SGTXT'

wa_item-sgtxt.

count1 = count1 + 1.

read table item1 into wa_item index count1.

if sy-subrc eq 0.

wa_item = wa_item.

else.

clear wa_item.

endif.

perform bdc_field using 'RF05A-NEWBS'

wa_item-newbs.

perform bdc_field using 'RF05A-NEWKO'

wa_item-newko.

*if wa_item-kostl is not initial.

perform bdc_dynpro using 'SAPLKACB' '0002'.

perform bdc_field using 'BDC_CURSOR'

'COBL-KOSTL'.

perform bdc_field using 'BDC_OKCODE'

'=ENTE'.

perform bdc_field using 'COBL-GSBER'

wa_item-gsber.

perform bdc_field using 'COBL-KOSTL'

wa_item-kostl.

*endif.

endwhile.

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_header-xblnr.

perform bdc_field using 'BKPF-BKTXT'

wa_header-bktxt.

perform bdc_transaction using 'F-02'.

CHCK THE CODE..ITS FOR HEADER N ITEM DATA...

for further queries on this ask me/....

clear wa_header.

endloop.

perform close_group.

0 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question