BDC XK01

BDC for XK01 (Create Vendor)

Skip to end of metadata

Created by Former Member, last modified on Jan 05, 2009

Go to start of metadata

This wiki will help to learn BDC step by step and help to create vendor of XK01 transaction.

Steps: First we will be recording the perticular transaction.

Second  we will make an internal table with all required  fields.

Third and final we will upload the XL file to our internal table.

Community

Topics

Groups

Answers

Blogs

Events

Programs

Resources

What's New

Home

Community

Questions

Ask a Question

Write a Blog Post

Top of Form

Search Questions and Answers

Bottom of Form

0

Former Member

Mar 10, 2007 at 06:51 AM

BDC program for "XK01"

107 Views

Follow

RSS Feed

Hi Xperts,

I have bit confuse regarding <b>table control</b> in "XK01" i.e. how to handle multiple records (<b>vendor banks details</b>)

Could any one explain me with example.

Regards

Gopi

Add a Comment

Alert Moderator

Actions

I Have a Similar Question

Assigned Tags

ABAP Connectivity

Similar Questions

BDC : DATASET expected not P_DATASE

Former MemberNov 23, 2019

BDC for XK01

Former MemberNov 23, 2019

Join the Conversation

SAP TechEd

Tune in for tech talk. Stay for inspiration. Upskill your future.

SAP BTP Learning Group

SAP Business Technology Platform Learning Journeys.

Coffee Corner

Join the new Coffee Corner Discussion Group.

2 Answers

Sort by:

Votes

Newest

Oldest

0

Santosh Reddy Kallem

Mar 11, 2007 at 07:10 AM

example program

REPORT zsowja NO STANDARD PAGE HEADING LINE-SIZE 255.

DATA: bdcdat LIKE bdcdata OCCURS 0 WITH HEADER LINE.

DATA: BEGIN OF record OCCURS 0,

data element: ELIFN

lifnr(010),

data element: EKORG

ekorg(004),

data element: BKGRP

ekgrp(003),

data element: EMATNR

ematn(018),

data element: BSTMG

menge(017),

data element: EWERK

werks(004),

END OF record.

DATA : BEGIN OF head_itab OCCURS 0,

data element: ELIFN

lifnr(010),

data element: EKORG

ekorg(004),

data element: BKGRP

ekgrp(003),

END OF head_itab.

DATA : BEGIN OF item_itab OCCURS 0,

data element: ELIFN

lifnr(010),

data element: EMATNR

ematn(018),

data element: BSTMG

menge(017),

data element: EWERK

werks(004),

END OF item_itab.

CALL FUNCTION 'WS_UPLOAD'

EXPORTING

CODEPAGE = ' '

filename = 'c:/hello.txt'

filetype = 'ASC'

HEADLEN = ' '

LINE_EXIT = ' '

TRUNCLEN = ' '

USER_FORM = ' '

USER_PROG = ' '

DAT_D_FORMAT = ' '

IMPORTING

FILELENGTH =

TABLES

data_tab = record

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.

LOOP AT record.

ON CHANGE OF record-lifnr.

head_itab-lifnr = record-lifnr.

head_itab-ekorg = record-ekorg.

head_itab-ekgrp = record-ekgrp.

APPEND head_itab.

CLEAR head_itab.

ENDON.

TO HAVE LINK BETWEEN HEADER AND ITEM TABLE USE LIFNR AS LINKER

item_itab-lifnr = record-lifnr.

item_itab-ematn = record-ematn.

item_itab-menge = record-menge.

item_itab-werks = record-werks.

APPEND item_itab.

CLEAR item_itab.

ENDLOOP.

*TO CHECH THE DATA IN HEADET ITAB AND DETAIL/ITEM ITAB

*

*loop at head_itab.

*write :/ head_itab.

*endloop.

*skip 2.

*loop at item_itab.

*write:/ item_itab.

*endloop.

SORT head_itab BY lifnr ekorg ekgrp.

SORT item_itab BY lifnr.

DATA linecount TYPE i.

START-OF-SELECTION.

LOOP AT head_itab.

ON CHANGE OF head_itab-lifnr.

REFRESH bdcdat.

CLEAR bdcdat.

PERFORM bdc_dynpro USING 'SAPMM06E' '0100'.

PERFORM bdc_field USING 'BDC_CURSOR'

'EKKO-LIFNR'.

PERFORM bdc_field USING 'BDC_OKCODE'

'/00'.

PERFORM bdc_field USING 'EKKO-LIFNR'

head_itab-lifnr.

PERFORM bdc_field USING 'EKKO-EKORG'

head_itab-ekorg.

PERFORM bdc_field USING 'EKKO-EKGRP'

head_itab-ekgrp.

linecount = 0.

LOOP AT item_itab WHERE lifnr = head_itab-lifnr.

linecount = linecount + 1.

IF linecount = 1.

PERFORM bdc_dynpro USING 'SAPMM06E' '0120'.

PERFORM bdc_field USING 'BDC_CURSOR'

'EKPO-WERKS(01)'.

PERFORM bdc_field USING 'BDC_OKCODE'

'/00'.

PERFORM bdc_field USING 'EKPO-EMATN(01)'

item_itab-ematn.

PERFORM bdc_field USING 'EKPO-MENGE(01)'

item_itab-menge.

PERFORM bdc_field USING 'EKPO-WERKS(01)'

item_itab-werks.

PERFORM bdc_dynpro USING 'SAPMM06E' '0120'.

ELSE.

PERFORM bdc_field USING 'BDC_CURSOR'

'EKPO-WERKS(02)'.

PERFORM bdc_field USING 'BDC_OKCODE'

'=NP'.

PERFORM bdc_field USING 'EKPO-EMATN(02)'

item_itab-ematn.

PERFORM bdc_field USING 'EKPO-MENGE(02)'

item_itab-menge.

PERFORM bdc_field USING 'EKPO-WERKS(02)'

item_itab-werks.

PERFORM bdc_dynpro USING 'SAPMM06E' '0120'.

ENDIF.

AT END OF lifnr.

PERFORM bdc_field USING 'BDC_OKCODE'

'=BU'.

ENDAT.

ENDLOOP.

ENDON.

CALL TRANSACTION 'ME21' USING bdcdat MODE 'A'.

REFRESH bdcdat.

ENDLOOP.

FORM bdc_dynpro USING value(a) value(b).

bdcdat-program = a.

bdcdat-dynpro = b.

bdcdat-dynbegin = 'X'.

APPEND bdcdat.

CLEAR bdcdat.

ENDFORM.

FORM bdc_field USING value(c) value(d).

bdcdat-fnam = c.

bdcdat-fval = d.

APPEND bdcdat.

CLEAR bdcdat.

ENDFORM.

Add a Comment

Alert Moderator

Share

0

Santosh Reddy Kallem

Mar 11, 2007 at 07:11 AM

Following is a sample code of handling table control in BDC.

REPORT Y730_BDC5 .

*HANDLING TABLE CONTROL IN BDC

DATA : BEGIN OF IT_DUMMY OCCURS 0,

DUMMY(100) TYPE C,

END OF IT_DUMMY.

DATA : BEGIN OF IT_XK01 OCCURS 0,

LIFNR(10) TYPE C,

BUKRS(4) TYPE C,

EKORG(4) TYPE C,

KTOKK(4) TYPE C,

NAME1(30) TYPE C,

SORTL(10) TYPE C,

LAND1(3) TYPE C,

SPRAS(2) TYPE C,

AKONT(6) TYPE C,

FDGRV(2) TYPE C,

WAERS(3) TYPE C,

END OF IT_XK01,

BEGIN OF IT_BANK OCCURS 0,

BANKS(3) TYPE C,

BANKL(10) TYPE C,

BANKN(10) TYPE C,

KOINH(30) TYPE C,

LIFNR(10) TYPE C,

END OF IT_BANK.

DATA : IT_BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE,

IT_BDCMSGCOLL LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.

CALL FUNCTION 'WS_UPLOAD'

EXPORTING

FILENAME = 'C:\VENDOR.TXT'

FILETYPE = 'ASC'

TABLES

DATA_TAB = IT_DUMMY.

LOOP AT IT_DUMMY.

IF IT_DUMMY-DUMMY+0(2) = '11'.

IT_XK01-LIFNR = IT_DUMMY-DUMMY+2(10).

IT_XK01-BUKRS = IT_DUMMY-DUMMY+12(4).

IT_XK01-EKORG = IT_DUMMY-DUMMY+16(4).

IT_XK01-KTOKK = IT_DUMMY-DUMMY+20(4).

IT_XK01-NAME1 = IT_DUMMY-DUMMY+24(30).

IT_XK01-SORTL = IT_DUMMY-DUMMY+54(10).

IT_XK01-LAND1 = IT_DUMMY-DUMMY+64(3).

IT_XK01-SPRAS = IT_DUMMY-DUMMY+67(2).

IT_XK01-AKONT = IT_DUMMY-DUMMY+69(6).

IT_XK01-FDGRV = IT_DUMMY-DUMMY+75(2).

IT_XK01-WAERS = IT_DUMMY-DUMMY+77(3).

APPEND IT_XK01.

ELSE.

IT_BANK-BANKS = IT_DUMMY-DUMMY+2(3).

IT_BANK-BANKL = IT_DUMMY-DUMMY+5(10).

IT_BANK-BANKN = IT_DUMMY-DUMMY+15(10).

IT_BANK-KOINH = IT_DUMMY-DUMMY+25(30).

IT_BANK-LIFNR = IT_DUMMY-DUMMY+55(10).

APPEND IT_BANK.

ENDIF.

ENDLOOP.

LOOP AT IT_XK01.

REFRESH IT_BDCDATA.

perform bdc_dynpro using 'SAPMF02K' '0100'.

perform bdc_field using 'BDC_CURSOR'

'RF02K-REF_LIFNR'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'RF02K-LIFNR'

IT_XK01-LIFNR.

perform bdc_field using 'RF02K-BUKRS'

IT_XK01-BUKRS.

perform bdc_field using 'RF02K-EKORG'

IT_XK01-EKORG.

perform bdc_field using 'RF02K-KTOKK'

IT_XK01-KTOKK.

perform bdc_dynpro using 'SAPMF02K' '0110'.

perform bdc_field using 'BDC_CURSOR'

'LFA1-TELX1'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'LFA1-NAME1'

IT_XK01-NAME1.

perform bdc_field using 'LFA1-SORTL'

IT_XK01-SORTL.

perform bdc_field using 'LFA1-LAND1'

IT_XK01-LAND1.

perform bdc_field using 'LFA1-SPRAS'

IT_XK01-SPRAS.

perform bdc_dynpro using 'SAPMF02K' '0120'.

perform bdc_field using 'BDC_CURSOR'

'LFA1-KUNNR'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_dynpro using 'SAPMF02K' '0130'.

perform bdc_field using 'BDC_CURSOR'

'LFBK-KOINH(02)'.

perform bdc_field using 'BDC_OKCODE'

'=ENTR'.

DATA : FNAM(20) TYPE C,

IDX TYPE C.

MOVE 1 TO IDX.

LOOP AT IT_BANK WHERE LIFNR = IT_XK01-LIFNR.

CONCATENATE 'LFBK-BANKS(' IDX ')' INTO FNAM.

perform bdc_field using FNAM

IT_BANK-BANKS.

CONCATENATE 'LFBK-BANKL(' IDX ')' INTO FNAM.

perform bdc_field using FNAM

IT_BANK-BANKL.

CONCATENATE 'LFBK-BANKN(' IDX ')' INTO FNAM.

perform bdc_field using FNAM

IT_BANK-BANKN.

CONCATENATE 'LFBK-KOINH(' IDX ')' INTO FNAM.

perform bdc_field using FNAM

IT_BANK-KOINH.

IDX = IDX + 1.

ENDLOOP.

perform bdc_dynpro using 'SAPMF02K' '0130'.

perform bdc_field using 'BDC_CURSOR'

'LFBK-BANKS(01)'.

perform bdc_field using 'BDC_OKCODE'

'=ENTR'.

perform bdc_dynpro using 'SAPMF02K' '0210'.

perform bdc_field using 'BDC_CURSOR'

'LFB1-FDGRV'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'LFB1-AKONT'

IT_XK01-AKONT.

perform bdc_field using 'LFB1-FDGRV'

IT_XK01-FDGRV.

perform bdc_dynpro using 'SAPMF02K' '0215'.

perform bdc_field using 'BDC_CURSOR'

'LFB1-ZTERM'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_dynpro using 'SAPMF02K' '0220'.

perform bdc_field using 'BDC_CURSOR'

'LFB5-MAHNA'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_dynpro using 'SAPMF02K' '0310'.

perform bdc_field using 'BDC_CURSOR'

'LFM1-WAERS'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'LFM1-WAERS'

IT_XK01-WAERS.

perform bdc_dynpro using 'SAPMF02K' '0320'.

perform bdc_field using 'BDC_CURSOR'

'WYT3-PARVW(01)'.

perform bdc_field using 'BDC_OKCODE'

'=ENTR'.

perform bdc_dynpro using 'SAPLSPO1' '0300'.

perform bdc_field using 'BDC_OKCODE'

'=YES'.

CALL TRANSACTION 'XK01' USING IT_BDCDATA

MODE 'A'

UPDATE 'S'

MESSAGES INTO IT_BDCMSGCOLL.

ENDLOOP.

FORM BDC_DYNPRO USING PROG SCR.

CLEAR IT_BDCDATA.

IT_BDCDATA-PROGRAM = PROG.

IT_BDCDATA-DYNPRO = SCR.

IT_BDCDATA-DYNBEGIN = 'X'.

APPEND IT_BDCDATA.

ENDFORM.

FORM BDC_FIELD USING FNAM FVAL.

CLEAR IT_BDCDATA.

IT_BDCDATA-FNAM = FNAM.

IT_BDCDATA-FVAL = FVAL.

APPEND IT_BDCDATA.

ENDFORM.

Add a Comment

Alert Moderator

Share

Know someone who can answer? Share a link to this

question.

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.

Rules of Engagement

Your answer

Please provide a distinct answer and use the comment option for clarifying purposes.

10 characters required.

Submit your Answer

Find us on

Privacy

Terms of Use

Legal Disclosure

Copyright

Trademark

Cookie Preferences

Newsletter

Support

Community

Topics

Groups

Answers

Blogs

Events

Programs

Resources

What's New

Home

Community

Questions

Ask a Question

Write a Blog Post

Top of Form

Search Questions and Answers

Bottom of Form

0

Former Member

Sep 18, 2007 at 11:46 AM

BDC for XK01

134 Views

Follow

RSS Feed

Hello friends,

I am assigned a task to write a BDC program to upload vendor data using XK01 transaction using Call Transaction. As of now I not given a flat file to upload the data. If you have already worked on this transaction. Kindly send me the code to my id posimsetty.ramamurthy@lntinfotech.com.

Help full aswers will be promtly rewarded.

Regards,

Ram

Add a Comment

Alert Moderator

Actions

I Have a Similar Question

Assigned Tags

ABAP Development

Similar Questions

bdc for xk01

Former MemberNov 23, 2019

issue about bdc xk01.

Former MemberNov 23, 2019

Join the Conversation

SAP TechEd

Tune in for tech talk. Stay for inspiration. Upskill your future.

SAP BTP Learning Group

SAP Business Technology Platform Learning Journeys.

Coffee Corner

Join the new Coffee Corner Discussion Group.

3 Answers

Sort by:

Votes

Newest

Oldest

Best Answer

1

Former Member

Sep 18, 2007 at 11:49 AM

Check this code to upload vendor master through SHDB transaction.

report ZVEND_MST no standard page heading line-size

255.

*include bdcrecx1.

*parameters: dataset(132) lower case default

'c:\vend.mst'.

DO NOT CHANGE - the generated data section - DO

NOT CHANGE ***

*

If it is nessesary to change the data section use

the rules:

1.) Each definition of a field exists of two lines

2.) The first line shows exactly the comment

'* data element: ' followed with the data

element

which describes the field.

If you don't have a data element use the

comment without a data element name

3.) The second line shows the fieldname of the

structure, the fieldname must consist of

a fieldname and optional the character '_' and

three numbers and the field length in brackets

4.) Each field must be type C.

*

Generated data section with specific formatting -

DO NOT CHANGE ***

data: begin of record,

data element: LIF16

LIFNR_001(016),

data element: BUKRS

BUKRS_002(004),

data element: EKORG

EKORG_003(004),

data element: KTOKK

KTOKK_004(004),

data element: NAME1_GP

NAME1_005(035),

data element: SORTL

SORTL_006(010),

data element: LAND1_GP

LAND1_007(003),

data element: SPRAS

SPRAS_008(002),

data element: BSTWA

WAERS_009(005),

end of record.

End generated data section ***

DATA : ITAB TABLE OF RECORD WITH HEADER LINE.

start-of-selection.

*perform open_dataset using dataset.

*perform open_group.

*

*do.

*

*read dataset dataset into record.

*if sy-subrc <> 0. exit. endif.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

FILENAME = 'C:\VENDOR.TXT'

"TEXT FILE

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.

LOOP AT ITAB.

*In Loop Change Record With ITAB

like record-lifnr_001 with itab-lifnr_001

perform bdc_dynpro using 'SAPMF02K' '0100'.

perform bdc_field using 'BDC_CURSOR'

'RF02K-KTOKK'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'RF02K-LIFNR'

record-LIFNR_001.

perform bdc_field using 'RF02K-BUKRS'

record-BUKRS_002.

perform bdc_field using 'RF02K-EKORG'

record-EKORG_003.

perform bdc_field using 'RF02K-KTOKK'

record-KTOKK_004.

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'

record-NAME1_005.

perform bdc_field using 'LFA1-SORTL'

record-SORTL_006.

perform bdc_field using 'LFA1-LAND1'

record-LAND1_007.

perform bdc_field using 'LFA1-SPRAS'

record-SPRAS_008.

perform bdc_dynpro using 'SAPMF02K' '0120'.

perform bdc_field using 'BDC_CURSOR'

'LFA1-KUNNR'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_dynpro using 'SAPMF02K' '0130'.

perform bdc_field using 'BDC_CURSOR'

'LFBK-BANKS(01)'.

perform bdc_field using 'BDC_OKCODE'

'=ENTR'.

perform bdc_dynpro using 'SAPMF02K' '0210'.

perform bdc_field using 'BDC_CURSOR'

'LFB1-AKONT'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_dynpro using 'SAPMF02K' '0215'.

perform bdc_field using 'BDC_CURSOR'

'LFB1-ZTERM'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_dynpro using 'SAPMF02K' '0220'.

perform bdc_field using 'BDC_CURSOR'

'LFB5-MAHNA'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_dynpro using 'SAPMF02K' '0310'.

perform bdc_field using 'BDC_CURSOR'

'LFM1-WAERS'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'LFM1-WAERS'

record-WAERS_009.

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'.

perform bdc_transaction using 'XK01'.

endLOOP..

Check It, Activate it and process in SM35.

regards,

srinivas

Add a Comment

Alert Moderator

Share

1

nagaraj kumar nishtala

Sep 18, 2007 at 11:49 AM

hI,

CHECK teh code..

DATA : BEGIN OF IT_DUMMY OCCURS 0,

DUMMY(100) TYPE C,

END OF IT_DUMMY.

DATA : BEGIN OF IT_XK01 OCCURS 0,

LIFNR(10) TYPE C,

BUKRS(4) TYPE C,

EKORG(4) TYPE C,

KTOKK(4) TYPE C,

NAME1(30) TYPE C,

SORTL(10) TYPE C,

LAND1(3) TYPE C,

SPRAS(2) TYPE C,

AKONT(6) TYPE C,

FDGRV(2) TYPE C,

WAERS(3) TYPE C,

END OF IT_XK01,

BEGIN OF IT_BANK OCCURS 0,

BANKS(3) TYPE C,

BANKL(10) TYPE C,

BANKN(10) TYPE C,

KOINH(30) TYPE C,

LIFNR(10) TYPE C,

END OF IT_BANK.

DATA : IT_BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE,

IT_BDCMSGCOLL LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.

CALL FUNCTION 'WS_UPLOAD'

EXPORTING

FILENAME = 'C:\VENDOR.TXT'

FILETYPE = 'ASC'

TABLES

DATA_TAB = IT_DUMMY.

LOOP AT IT_DUMMY.

IF IT_DUMMY-DUMMY+0(2) = '11'.

IT_XK01-LIFNR = IT_DUMMY-DUMMY+2(10).

IT_XK01-BUKRS = IT_DUMMY-DUMMY+12(4).

IT_XK01-EKORG = IT_DUMMY-DUMMY+16(4).

IT_XK01-KTOKK = IT_DUMMY-DUMMY+20(4).

IT_XK01-NAME1 = IT_DUMMY-DUMMY+24(30).

IT_XK01-SORTL = IT_DUMMY-DUMMY+54(10).

IT_XK01-LAND1 = IT_DUMMY-DUMMY+64(3).

IT_XK01-SPRAS = IT_DUMMY-DUMMY+67(2).

IT_XK01-AKONT = IT_DUMMY-DUMMY+69(6).

IT_XK01-FDGRV = IT_DUMMY-DUMMY+75(2).

IT_XK01-WAERS = IT_DUMMY-DUMMY+77(3).

APPEND IT_XK01.

ELSE.

IT_BANK-BANKS = IT_DUMMY-DUMMY+2(3).

IT_BANK-BANKL = IT_DUMMY-DUMMY+5(10).

IT_BANK-BANKN = IT_DUMMY-DUMMY+15(10).

IT_BANK-KOINH = IT_DUMMY-DUMMY+25(30).

IT_BANK-LIFNR = IT_DUMMY-DUMMY+55(10).

APPEND IT_BANK.

ENDIF.

ENDLOOP.

LOOP AT IT_XK01.

REFRESH IT_BDCDATA.

perform bdc_dynpro using 'SAPMF02K' '0100'.

perform bdc_field using 'BDC_CURSOR'

'RF02K-REF_LIFNR'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'RF02K-LIFNR'

IT_XK01-LIFNR.

perform bdc_field using 'RF02K-BUKRS'

IT_XK01-BUKRS.

perform bdc_field using 'RF02K-EKORG'

IT_XK01-EKORG.

perform bdc_field using 'RF02K-KTOKK'

IT_XK01-KTOKK.

perform bdc_dynpro using 'SAPMF02K' '0110'.

perform bdc_field using 'BDC_CURSOR'

'LFA1-TELX1'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'LFA1-NAME1'

IT_XK01-NAME1.

perform bdc_field using 'LFA1-SORTL'

IT_XK01-SORTL.

perform bdc_field using 'LFA1-LAND1'

IT_XK01-LAND1.

perform bdc_field using 'LFA1-SPRAS'

IT_XK01-SPRAS.

perform bdc_dynpro using 'SAPMF02K' '0120'.

perform bdc_field using 'BDC_CURSOR'

'LFA1-KUNNR'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_dynpro using 'SAPMF02K' '0130'.

perform bdc_field using 'BDC_CURSOR'

'LFBK-KOINH(02)'.

perform bdc_field using 'BDC_OKCODE'

'=ENTR'.

DATA : FNAM(20) TYPE C,

IDX TYPE C.

MOVE 1 TO IDX.

LOOP AT IT_BANK WHERE LIFNR = IT_XK01-LIFNR.

CONCATENATE 'LFBK-BANKS(' IDX ')' INTO FNAM.

perform bdc_field using FNAM

IT_BANK-BANKS.

CONCATENATE 'LFBK-BANKL(' IDX ')' INTO FNAM.

perform bdc_field using FNAM

IT_BANK-BANKL.

CONCATENATE 'LFBK-BANKN(' IDX ')' INTO FNAM.

perform bdc_field using FNAM

IT_BANK-BANKN.

CONCATENATE 'LFBK-KOINH(' IDX ')' INTO FNAM.

perform bdc_field using FNAM

IT_BANK-KOINH.

IDX = IDX + 1.

ENDLOOP.

perform bdc_dynpro using 'SAPMF02K' '0130'.

perform bdc_field using 'BDC_CURSOR'

'LFBK-BANKS(01)'.

perform bdc_field using 'BDC_OKCODE'

'=ENTR'.

perform bdc_dynpro using 'SAPMF02K' '0210'.

perform bdc_field using 'BDC_CURSOR'

'LFB1-FDGRV'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'LFB1-AKONT'

IT_XK01-AKONT.

perform bdc_field using 'LFB1-FDGRV'

IT_XK01-FDGRV.

perform bdc_dynpro using 'SAPMF02K' '0215'.

perform bdc_field using 'BDC_CURSOR'

'LFB1-ZTERM'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_dynpro using 'SAPMF02K' '0220'.

perform bdc_field using 'BDC_CURSOR'

'LFB5-MAHNA'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_dynpro using 'SAPMF02K' '0310'.

perform bdc_field using 'BDC_CURSOR'

'LFM1-WAERS'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'LFM1-WAERS'

IT_XK01-WAERS.

perform bdc_dynpro using 'SAPMF02K' '0320'.

perform bdc_field using 'BDC_CURSOR'

'WYT3-PARVW(01)'.

perform bdc_field using 'BDC_OKCODE'

'=ENTR'.

perform bdc_dynpro using 'SAPLSPO1' '0300'.

perform bdc_field using 'BDC_OKCODE'

'=YES'.

CALL TRANSACTION 'XK01' USING IT_BDCDATA

MODE 'A'

UPDATE 'S'

MESSAGES INTO IT_BDCMSGCOLL.

ENDLOOP.

FORM BDC_DYNPRO USING PROG SCR.

CLEAR IT_BDCDATA.

IT_BDCDATA-PROGRAM = PROG.

IT_BDCDATA-DYNPRO = SCR.

IT_BDCDATA-DYNBEGIN = 'X'.

APPEND IT_BDCDATA.

ENDFORM.

FORM BDC_FIELD USING FNAM FVAL.

CLEAR IT_BDCDATA.

IT_BDCDATA-FNAM = FNAM.

IT_BDCDATA-FVAL = FVAL.

APPEND IT_BDCDATA.

ENDFORM.

Reward points if u find useful.

Regards,

Nagaraj

Add a Comment

Alert Moderator

Share

0

Former Member

Sep 24, 2007 at 10:08 AM

Thanks allot guys,

My issue is solved, than you for the valuable inputs.

Regards,

Rama Murthy.P

Add a Comment

Alert Moderator

Share

Know someone who can answer? Share a link to this

question.

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.

Rules of Engagement

Your answer

Please provide a distinct answer and use the comment option for clarifying purposes.

10 characters required.

Submit your Answer

Find us on

Privacy

Terms of Use

Legal Disclosure

Copyright

Trademark

Cookie Preferences

Newsletter

Support

返回ABAP参考资料列表