Application Development and Automation 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: 
Read only

problem in bdc PROG

Former Member
0 Likes
1,336

Dear All,

Iam facing the problem in BDC Program..the code is..

LOOP AT IT_RECORD.

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' IT_RECORD-vramt. "'100000'.

perform bdc_field using 'RF05A-NEWBS' it_record-pkey. "'50'.

perform bdc_field using 'RF05A-NEWKO' it_Record-vrac. "'24450024'.

perform bdc_field using 'DKACB-FMORE' 'X'.

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' it_record-gsber. "'KABA' .

COUNT = COUNT + 1.

WRITE:/ COUNT.

IF COUNT = 4.

perform bdc_dynpro using 'SAPMF05A' '0302'.

perform bdc_field using 'BDC_CURSOR'

'BSEG-GSBER'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'BSEG-WRBTR' IT_RECORD-VRAMT. "'50000'.

perform bdc_field using 'BSEG-MWSKZ' '**'.

perform bdc_field using 'BSEG-GSBER' IT_RECORD-GSBER ."'kaba'.

perform bdc_field using 'BSEG-ZFBDT' '03.12.2007'.

perform bdc_dynpro using 'SAPMF05A' '0302'.

perform bdc_field using 'BDC_CURSOR'

'BSEG-WRBTR'.

perform bdc_field using 'BDC_OKCODE'

'=BS'.

perform bdc_field using 'BSEG-WRBTR' IT_RECORD-VRAMT. "'50,000.00'.

perform bdc_field using 'BSEG-MWSKZ'

'**'.

perform bdc_field using 'BSEG-BUPLA' '1800'.

perform bdc_field using 'BSEG-GSBER' IT_RECORD-GSBER."'KABA'.

perform bdc_field using 'BSEG-ZFBDT' '03.12.2007'.

perform bdc_dynpro using 'SAPMF05A' '0700'.

perform bdc_field using 'BDC_CURSOR'

'RF05A-NEWBS'.

perform bdc_field using 'BDC_OKCODE'

'=BU'.

CALL TRANSACTION 'F-02' USING BDCDATA MODE 'A'.

ELSE.

CONTINUE.

ENDIF.

ENDLOOP.

here iam using 4 line item(in text file) ..if count = 4 its not going to next screen, its repeating..its not simulating and posting the doc..

pls guide me friends.

Dear All,

Iam facing the problem in BDC Program..the code is..

LOOP AT IT_RECORD.

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' IT_RECORD-vramt. "'100000'.

perform bdc_field using 'RF05A-NEWBS' it_record-pkey. "'50'.

perform bdc_field using 'RF05A-NEWKO' it_Record-vrac. "'24450024'.

perform bdc_field using 'DKACB-FMORE' 'X'.

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' it_record-gsber. "'KABA' .

COUNT = COUNT + 1.

WRITE:/ COUNT.

IF COUNT = 4.

perform bdc_dynpro using 'SAPMF05A' '0302'.

perform bdc_field using 'BDC_CURSOR'

'BSEG-GSBER'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'BSEG-WRBTR' IT_RECORD-VRAMT. "'50000'.

perform bdc_field using 'BSEG-MWSKZ' '**'.

perform bdc_field using 'BSEG-GSBER' IT_RECORD-GSBER ."'kaba'.

perform bdc_field using 'BSEG-ZFBDT' '03.12.2007'.

perform bdc_dynpro using 'SAPMF05A' '0302'.

perform bdc_field using 'BDC_CURSOR'

'BSEG-WRBTR'.

perform bdc_field using 'BDC_OKCODE'

'=BS'.

perform bdc_field using 'BSEG-WRBTR' IT_RECORD-VRAMT. "'50,000.00'.

perform bdc_field using 'BSEG-MWSKZ'

'**'.

perform bdc_field using 'BSEG-BUPLA' '1800'.

perform bdc_field using 'BSEG-GSBER' IT_RECORD-GSBER."'KABA'.

perform bdc_field using 'BSEG-ZFBDT' '03.12.2007'.

perform bdc_dynpro using 'SAPMF05A' '0700'.

perform bdc_field using 'BDC_CURSOR'

'RF05A-NEWBS'.

perform bdc_field using 'BDC_OKCODE'

'=BU'.

CALL TRANSACTION 'F-02' USING BDCDATA MODE 'A'.

ELSE.

CONTINUE.

ENDIF.

ENDLOOP.

here iam using 4 line item(in text file) ..if count = 4 its not going to next screen, its repeating..its not simulating and posting the doc..

pls guide me friends.

10 REPLIES 10
Read only

Former Member
0 Likes
1,304

See if this helps:

COUNT = COUNT + 1.
WRITE:/ COUNT.
IF COUNT = 4.
CLEAR count.                  "<====

Rob

Read only

0 Likes
1,304

Hi Rob,

I tried, but the result is same..its not calling the next screen of 0302.

could u suggest once again..

Read only

0 Likes
1,304

How many entries in IT_RECORD? Check this in debugging.

Rob

Read only

0 Likes
1,304

just 4 line item only..

Read only

0 Likes
1,304

Well, I think it should work then. Try:

COUNT = COUNT + 1.
WRITE:/ COUNT.
IF COUNT = 4.
CLEAR count.                  "<====
WRITE: /001 'Should enter screen'.      "<====

See if the new line gets printed.

Rob

Read only

0 Likes
1,304

hi could u give me ur gmail id..iam confusing, same thing i used, but its not calling the screen(end of screen)..pls guide me friend.

Read only

0 Likes
1,304

I like to work through the forum.

Are you saying that the new line is printing, but the new screen is not being called? That may be because the transaction processes a different screen next. Are you seeing a different screen?

Rob

Read only

0 Likes
1,304

hi i send the code here, if u can understand clear it..

report ZBDC_FI_MVF_02 no standard page heading line-size 255.

DATA : BEGIN OF IT_RECORDS OCCURS 0,

BLDAT LIKE BKPF-BLDAT,

BLART LIKE BKPF-BLART,

BUKRS LIKE BKPF-BUKRS,

BUDAT LIKE BKPF-BUDAT,

MONAT LIKE BKPF-MONAT,

WAERS LIKE BKPF-WAERS,

NEWBS LIKE RF05A-NEWBS,

NEWKO LIKE RF05A-NEWKO,

END OF IT_RECORDS.

DATA : BEGIN OF IT_RECORD OCCURS 0,

VRAMT(15), " LIKE BSEG-WRBTR,

PKEY LIKE RF05A-NEWBS,

VrAC(10), " LIKE RF05A-NEWKO,

GSBER LIKE COBL-GSBER,

END OF IT_RECORD.

DATA : BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE,

DATE1 LIKE SY-DATUM,

DATE2 LIKE SY-DATUM,

LOOP(3).

DATA : COUNT(3).

start-of-selection.

PERFORM GET_DATA1.

PERFORM GET_DATA2.

PERFORM PROCESS_DATA.

FORM PROCESS_DATA.

perform bdc_dynpro using 'SAPMF05A' '0100'.

perform bdc_field using 'BDC_CURSOR'

'RF05A-NEWKO'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

date1 = it_RecordS-bldat.

CONCATENATE DATE16(2) DATE14(2) DATE1+0(4) INTO DATE1.

perform bdc_field using 'BKPF-BLDAT' DATE1. "'03.12.2007'.

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

perform bdc_field using 'BKPF-BUKRS' IT_RECORDS-BUKRS. "'1800'.

date2 = it_RecordS-bUdat.

CONCATENATE DATE26(2) DATE24(2) DATE2+0(4) INTO DATE2.

perform bdc_field using 'BKPF-BUDAT' DATE2. "'03.12.2007'.

perform bdc_field using 'BKPF-MONAT' IT_RECORDS-MONAT. "'9'.

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

perform bdc_field using 'FS006-DOCID' '*'.

perform bdc_field using 'RF05A-NEWBS' IT_RECORDS-NEWBS. "'40'.

perform bdc_field using 'RF05A-NEWKO' IT_RECORDS-NEWKO. "'24450024'.

*perform bdc_field using 'RF05A-NEWBS' IT_RECORDS-PKEY. "'50'.

*perform bdc_field using 'RF05A-NEWKO' IT_RECORDS-VENAC. "'24450024'.

*perform bdc_field using 'DKACB-FMORE' 'X'.

COUNT = '0'.

LOOP AT IT_RECORD.

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' IT_RECORD-vramt. "'100000'.

perform bdc_field using 'RF05A-NEWBS' it_record-pkey. "'50'.

perform bdc_field using 'RF05A-NEWKO' it_Record-vrac. "'24450024'.

perform bdc_field using 'DKACB-FMORE' 'X'.

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' it_record-gsber. "'KABA' .

COUNT = COUNT + 1.

IF COUNT = 4.

clear count.

perform bdc_dynpro using 'SAPMF05A' '0302'.

perform bdc_field using 'BDC_CURSOR'

'BSEG-GSBER'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'BSEG-WRBTR' IT_RECORD-VRAMT. "'50000'.

perform bdc_field using 'BSEG-MWSKZ' '**'.

perform bdc_field using 'BSEG-GSBER' IT_RECORD-GSBER ."'kaba'.

perform bdc_field using 'BSEG-ZFBDT' '03.12.2007'.

perform bdc_dynpro using 'SAPMF05A' '0302'.

perform bdc_field using 'BDC_CURSOR'

'BSEG-WRBTR'.

perform bdc_field using 'BDC_OKCODE'

'=BS'.

perform bdc_field using 'BSEG-WRBTR' IT_RECORD-VRAMT. "'50,000.00'.

perform bdc_field using 'BSEG-MWSKZ'

'**'.

perform bdc_field using 'BSEG-BUPLA' '1800'.

perform bdc_field using 'BSEG-GSBER' IT_RECORD-GSBER."'KABA'.

perform bdc_field using 'BSEG-ZFBDT' '03.12.2007'.

perform bdc_dynpro using 'SAPMF05A' '0700'.

perform bdc_field using 'BDC_CURSOR'

'RF05A-NEWBS'.

perform bdc_field using 'BDC_OKCODE'

'=BU'.

CALL TRANSACTION 'F-02' USING BDCDATA MODE 'A'.

ELSE.

CONTINUE.

ENDIF.

ENDLOOP.

  • perform bdc_dynpro using 'SAPMF05A' '0302'.

  • perform bdc_field using 'BDC_CURSOR'

  • 'BSEG-GSBER'.

  • perform bdc_field using 'BDC_OKCODE'

  • '/00'.

  • perform bdc_field using 'BSEG-WRBTR' '50000'.

  • perform bdc_field using 'BSEG-MWSKZ' '**'.

  • perform bdc_field using 'BSEG-GSBER' 'kaba'.

  • perform bdc_field using 'BSEG-ZFBDT' '03.12.2007'.

  • perform bdc_dynpro using 'SAPMF05A' '0302'.

  • perform bdc_field using 'BDC_CURSOR'

  • 'BSEG-WRBTR'.

  • perform bdc_field using 'BDC_OKCODE'

  • '=BS'.

*

  • perform bdc_field using 'BSEG-WRBTR' IT_RECORD-VRAMT. "'50,000.00'.

  • perform bdc_field using 'BSEG-MWSKZ' '**'.

    • perform bdc_field using 'BSEG-BUPLA' '1800'.

  • perform bdc_field using 'BSEG-GSBER' IT_RECORD-GSBER. "'KABA'.

    • perform bdc_field using 'BSEG-ZFBDT' '03.12.2007'.

*

  • perform bdc_dynpro using 'SAPMF05A' '0700'.

  • perform bdc_field using 'BDC_CURSOR'

  • 'RF05A-NEWBS'.

  • perform bdc_field using 'BDC_OKCODE'

  • '=BU'.

    • perform bdc_transaction using 'F-02'.

*CALL TRANSACTION 'F-02' USING BDCDATA MODE 'A'.

ENDFORM.

----


  • Start new screen *

----


FORM BDC_DYNPRO USING PROGRAM DYNPRO.

CLEAR BDCDATA.

BDCDATA-PROGRAM = PROGRAM.

BDCDATA-DYNPRO = DYNPRO.

BDCDATA-DYNBEGIN = 'X'.

APPEND BDCDATA.

ENDFORM.

----


  • Insert field *

----


FORM BDC_FIELD USING FNAM FVAL.

IF FVAL <> ' '.

CLEAR BDCDATA.

BDCDATA-FNAM = FNAM.

BDCDATA-FVAL = FVAL.

APPEND BDCDATA.

ENDIF.

ENDFORM.

&----


*& Form GET_DATA

&----


form GET_DATA1 .

CALL FUNCTION 'UPLOAD'

EXPORTING

FILENAME = 'C:\MVF-02_1.txt'

FILETYPE = 'DAT'

TABLES

data_tab = IT_RECORDS

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.

endform. " GET_DATA

&----


*& Form GET_DATA2

&----


form GET_DATA2 .

CALL FUNCTION 'UPLOAD'

EXPORTING

FILENAME = 'C:\MVF-02_2.TXT'

FILETYPE = 'DAT'

TABLES

data_tab = IT_RECORD

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.

endform. " GET_DATA2

Read only

0 Likes
1,304

Dear Rob..

i have send the query to sdn also but nobody replied to this actually scenario is like this...

In tcode migo there are two push buttons ..''check'' and ''push''

wen we will pres check button it will give system message about the shelf life of materials

now same mesage i want if i will press push button...

Read only

0 Likes
1,304

It would be better if you just answer the questions in my earlier post.

Rob