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

BDC FOR ME21

Former Member
0 Likes
577

Hi ALL,

Iam Creating BDC Program bu using ME21 for Uploading PO.

Iam getting error at Income term2 in the Second Screen of ME21. Iam Passing this value through Excel Sheet But event then it is not picking. When i check in debugging the value of income term2 is populating.

Let me know what are the mandotory fields for creating PO using Me21.

Here iam also attaching the code, Please help us because it is very urgent.

report ZPOUPLOADME21

no standard page heading line-size 255.

*include bdcrecx1.

INCLUDE YMM_BDCRECX1.

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

  • Internal Table T_BDCDATA to store BDC data

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

  • Batchinputdata of single transaction

DATA: T_BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE.

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

  • Internal Table T_BDC_MSG to store BDC messages

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

DATA: T_BDC_MSG LIKE STANDARD TABLE OF BDCMSGCOLL INITIAL

SIZE 0 WITH HEADER LINE.

DATA: V_FILE LIKE RLGRAP-FILENAME ,

V_COUNT(5) TYPE C,

V_MESSAGE_CNT(5) TYPE C .

DATA : BEGIN OF IT_DATA OCCURS 0,

LIFNR LIKE EKKO-LIFNR, " Vendor

BSART LIKE RM06E-BSART, " Order Type

BEDAT(10) TYPE C, " Date

EKORG LIKE EKKO-EKORG, " Purchasing Organization

EKGRP LIKE EKKO-EKGRP, " Purchasing Group

WERKS LIKE RM06E-WERKS, " Plant

INCO2 LIKE EKKO-INCO2, " Inco Terms

KNTTP LIKE EKPO-KNTTP, " A/C Assignment Category

EMATN LIKE EKPO-EMATN, " Material Number

MENGE LIKE EKPO-MENGE, " Purchase Order Quantity

NETPR LIKE EKPO-NETPR, " Net Price

MWSKZ LIKE EKPO-MWSKZ, " Tax Code

NPLNR LIKE MSEG-NPLNR, " Network

VORNR LIKE PSORDER-VORNR, " Operation

END OF IT_DATA.

START-OF-SELECTION.

PERFORM OPEN_GROUP.

PERFORM DATA_UPLOAD.

PERFORM CALL_TRANSACTION.

PERFORM CLOSE_GROUP.

PERFORM WRITE_ERROR.

&----


*& Form DATA_UPLOAD

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM DATA_UPLOAD.

*call function ws_upload to retrieve data from a flat file in the

*presentation server into an internal table

CALL FUNCTION 'UPLOAD'

EXPORTING

FILENAME = V_FILE

FILETYPE = 'DAT'

TABLES

DATA_TAB = IT_DATA

EXCEPTIONS

CONVERSION_ERROR = 1

INVALID_TABLE_WIDTH = 2

INVALID_TYPE = 3

NO_BATCH = 4

UNKNOWN_ERROR = 5

GUI_REFUSE_FILETRANSFER = 6

OTHERS = 7.

  • if ws_upload fails then display appropriate message

IF SY-SUBRC <> 0.

  • MESSAGE E000 WITH 'Data not Uploaded into internal table'.

ENDIF.

ENDFORM. " DATA_UPLOAD

&----


*& Form CALL_TRANSACTION

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM CALL_TRANSACTION.

DATA : V_IVDAT(10) TYPE C,

V_AKTIV(10) TYPE C,

V_MESSAGE(404) TYPE C.

REFRESH T_BDCDATA.

CLEAR T_BDCDATA.

V_COUNT = 0.

V_MESSAGE_CNT = 0.

LOOP AT IT_DATA .

V_COUNT = V_COUNT + 1.

*perform open_group.

perform bdc_dynpro using 'SAPMM06E' '0100'.

perform bdc_field using 'BDC_CURSOR'

'RM06E-WERKS'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'EKKO-LIFNR'

IT_DATA-LIFNR.

perform bdc_field using 'RM06E-BSART'

IT_DATA-BSART.

*perform bdc_field using 'RM06E-BEDAT'

  • '24.01.2008'.

perform bdc_field using 'RM06E-BEDAT'

IT_DATA-BEDAT.

perform bdc_field using 'EKKO-EKORG'

IT_DATA-EKORG.

perform bdc_field using 'EKKO-EKGRP'

IT_DATA-EKGRP.

*perform bdc_field using 'RM06E-LPEIN'

  • 'T'.

perform bdc_field using 'RM06E-WERKS'

IT_DATA-WERKS.

perform bdc_dynpro using 'SAPMM06E' '0101'.

perform bdc_field using 'BDC_CURSOR'

'EKKO-INCO2'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

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

*perform bdc_field using 'EKKO-EKGRP'

  • IT_DATA-EKGRP1. "'SP3'.

*perform bdc_field using 'EKKO-PINCR'

  • IT_DATA-PINCR. "'10'.

*perform bdc_field using 'EKKO-SPRAS'

  • IT_DATA-SPRAS. "'EN'.

*perform bdc_field using 'EKKO-UPINC'

  • IT_DATA-UPINC. "'1'.

*perform bdc_field using 'EKKO-ZTERM'

  • IT_DATA-ZTERM.

*perform bdc_field using 'EKKO-WAERS'

  • IT_DATA-WAERS. "'INR'.

*perform bdc_field using 'EKKO-ZBD1T'

  • IT_DATA-ZBD1T. "'44'.

*

*perform bdc_field using 'EKKO-WKURS'

  • IT_DATA-WKURS. "' 1.00000'.

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

*perform bdc_field using 'EKKO-INCO1'

  • IT_DATA-INCO1.

perform bdc_field using 'EKKO-INCO2'

IT_DATA-INCO2.

perform bdc_dynpro using 'SAPMM06E' '0120'.

perform bdc_field using 'BDC_CURSOR'

'EKPO-NETPR(01)'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

*perform bdc_field using 'EKPO-KNTTP(01)'

  • 'N'.

perform bdc_field using 'EKPO-KNTTP(01)'

IT_DATA-KNTTP.

perform bdc_field using 'EKPO-EMATN(01)'

IT_DATA-EMATN.

perform bdc_field using 'EKPO-MENGE(01)'

IT_DATA-MENGE.

perform bdc_field using 'EKPO-NETPR(01)'

IT_DATA-NETPR.

perform bdc_dynpro using 'SAPMM06E' '0111'.

perform bdc_field using 'BDC_CURSOR'

'EKPO-MWSKZ'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

*perform bdc_field using 'EKPO-KNTTP'

  • 'N'.

*perform bdc_field using 'EKPO-TXZ01'

  • 'Clamps & Connector'.

*perform bdc_field using 'EKPO-MENGE'

  • '4'.

*perform bdc_field using 'EKPO-SPINF'

  • 'A'.

*perform bdc_field using 'EKPO-NETPR'

  • '100.00'.

*perform bdc_field using 'EKPO-PEINH'

  • '1'.

*perform bdc_field using 'EKPO-BPRME'

  • 'NO'.

*perform bdc_field using 'EKPO-BPUMN'

  • '1'.

*perform bdc_field using 'EKPO-BPUMZ'

  • '1'.

*perform bdc_field using 'EKPO-PRSDR'

  • 'X'.

*perform bdc_field using 'RM06E-EEIND'

  • '24.01.2008'.

*perform bdc_field using 'RM06E-LPEIN'

  • 'D'.

*perform bdc_field using 'EKPO-WEPOS'

  • 'X'.

perform bdc_field using 'EKPO-MWSKZ'

IT_DATA-MWSKZ.

*perform bdc_field using 'EKPO-REPOS'

  • 'X'.

perform bdc_dynpro using 'SAPMM06E' '0511'.

perform bdc_field using 'BDC_CURSOR'

'EKKN-SAKTO'.

perform bdc_field using 'BDC_OKCODE'

'=ENTE'.

*perform bdc_field using 'EKKN-SAKTO'

  • '6034025'.

*perform bdc_field using 'DKACB-FMORE'

  • 'X'.

perform bdc_dynpro using 'SAPLKACB' '0002'.

*perform bdc_field using 'BDC_CURSOR'

  • 'COBL-VORNR'.

perform bdc_field using 'BDC_OKCODE'

'=ENTE'.

perform bdc_field using 'COBL-NPLNR'

IT_DATA-NPLNR.

perform bdc_field using 'COBL-VORNR'

IT_DATA-VORNR.

perform bdc_dynpro using 'SAPMM06E' '0111'.

perform bdc_dynpro using 'SAPMM06E' '0120'.

perform bdc_field using 'BDC_CURSOR'

'RM06E-EBELP'.

perform bdc_field using 'BDC_OKCODE'

'=BU'.

*perform bdc_field using 'RM06E-EBELP'

  • '10'.

perform bdc_dynpro using 'SAPLSPO1' '0300'.

perform bdc_field using 'BDC_OKCODE'

'=YES'.

perform bdc_transaction using 'ME21'.

perform close_group.

LOOP AT T_MESSTAB WHERE REC_NO IS INITIAL.

AT FIRST.

V_MESSAGE_CNT = V_MESSAGE_CNT + 1.

T_MESSTAB-REC_NO = V_COUNT.

ENDAT.

MODIFY T_MESSTAB TRANSPORTING REC_NO.

ENDLOOP.

REFRESH T_BDCDATA.

CLEAR T_BDCDATA.

ENDLOOP.

SKIP.

WRITE : /10 'Record Number ', 30 'Error Message'.

SKIP.

endform.

&----


*& Form WRITE_ERROR

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM WRITE_ERROR.

LOOP AT T_MESSTAB.

WRITE : /10 T_MESSTAB-REC_NO , 30 T_MESSTAB-MESSAGE.

ENDLOOP.

ULINE /10(100).

WRITE : /10 'No of Records : ' , V_COUNT.

WRITE : /10 'No of Erroneous Records : ' , V_MESSAGE_CNT.

ULINE /10(100).

ENDFORM. " WRITE_ERROR

&----


*& Form CHECK_BDC

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM CHECK_BDC.

DATA: L_CHECK LIKE YMMT_CHECK_BDC-YCHECK.

SELECT SINGLE YCHECK INTO L_CHECK FROM YMMT_CHECK_BDC

WHERE PROGRAMM EQ SY-REPID

AND YCHECK EQ 'X'.

IF SY-SUBRC NE 0.

MESSAGE S000(YM) WITH 'Execution not possible'.

STOP.

ENDIF.

ENDFORM. " CHECK_BDC

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

Answers will be awarded

Thanks

Rahul

4 REPLIES 4
Read only

Former Member
0 Likes
542

what is the error message?

Read only

0 Likes
542

When i run program Incoterm value is not populating but when i check in debugging incoterm value is coming .

could you please help me what might be the reason

Thanks

Rahul

Read only

0 Likes
542

I think that you need bdc_okcode /06 to jump from first screen to second screen

Read only

0 Likes
542

It is going into the second screen but whatever the value iam passing to incoterms2 it sis not populating when i run program, but in debugging value is coming.

Is there any possibility of user exits attached to this ME21 transaction

please advice

thanks

Madhukar Reddy