Skip to Content
author's profile photo Former Member
Former Member

bdc for info records

Hi all ,

i have developed a bdc progoram for inforecords..

while uploading the data if there are two conditions or more for same vendor and material i am getting the correct one but netprice for first condition comes correctly . if the second condition comes netprice doesnot occurs..in the purchase org window which as to be generated according to the condition chosen.

ex: netprice is 250 for cond POOO and second condition is given ROOO(discount) 10 through upload when i go back to purc org window netprice is 0 .

here my program please suggest me ...

REPORT ymm_info_bdcrec NO STANDARD PAGE HEADING LINE-SIZE 255.

INCLUDE bdcrecx1."INCLUDE BDCRECX1.

DATA : IDX(2) TYPE C VALUE '01'.

data: var type string.

DATA: BEGIN OF lt_infrec OCCURS 0,

lifnr(20) TYPE c,

matnr(20) TYPE c,

ekorg(5) TYPE c,

werks(5) TYPE c,

esokz(2) TYPE c,

mahn1(5) TYPE c,

urztp(10) TYPE c,

mahn2(5) TYPE c,

urznr(10) TYPE c,

mahn3(5) TYPE c,

urzdt(10) TYPE c,

idnlf(10) TYPE c,

urzla(10) TYPE c,

ltsnr(10) TYPE c,

regio(10) TYPE c,

ltssf(10) TYPE c,

urzzt(10) TYPE c,

wglif(10) TYPE c,

mfrnr(10) TYPE c,

anzpu(10) TYPE c,

punei(10) TYPE c,

verkf(10) TYPE c,

telf1(10) TYPE c,

lifab(10) TYPE c,

rueck(10) TYPE c,

lifbi(10) TYPE c,

kolif(10) TYPE c,

relif(10) TYPE c,

meins(10) TYPE c,

umrez(10) TYPE c,

umren(10) TYPE c,

vabme(10) TYPE c,

aplfz(10) TYPE c,

untto(10) TYPE c,

mtxno(10) TYPE c,

ekgrp(10) TYPE c,

uebto(10) TYPE c,

kzabs(10) TYPE c,

norbm(10) TYPE c,

uebtk(10) TYPE c,

bstae(10) TYPE c,

minbm(10) TYPE c,

webre(10) TYPE c,

mwskz(10) TYPE c,

mhdrz(10) TYPE c,

iprkz(10) TYPE c,

xersn(10) TYPE c,

evers(10) TYPE c,

exprf(10) TYPE c,

bstma(10) TYPE c,

rdprf(10) TYPE c,

megru(10) TYPE c,

netpr(10) TYPE c,

waers(10) TYPE c,

peinh(10) TYPE c,

bprme(10) TYPE c,

sktof(10) TYPE c,

bpumz(10) TYPE c,

bpumn(10) TYPE c,

ekkol(10) TYPE c,

meprf(10) TYPE c,

inco1(10) TYPE c,

inco2(10) TYPE c,

datab(10) TYPE c,

datbi(10) TYPE c,

kschl(10) TYPE c,

kbetr(10) TYPE c,

konwa(10) TYPE c,

kpein(10) TYPE c,

kmein(10) TYPE c,

end of lt_infrec.

data: begin of lt_infrec1 occurs 0,

lifnr(20) TYPE c,

matnr(20) TYPE c,

ekorg(5) TYPE c,

werks(5) TYPE c,

esokz(2) TYPE c,

mahn1(5) TYPE c,

urztp(10) TYPE c,

mahn2(5) TYPE c,

urznr(10) TYPE c,

mahn3(5) TYPE c,

urzdt(10) TYPE c,

idnlf(10) TYPE c,

urzla(10) TYPE c,

ltsnr(10) TYPE c,

regio(10) TYPE c,

ltssf(10) TYPE c,

urzzt(10) TYPE c,

wglif(10) TYPE c,

mfrnr(10) TYPE c,

anzpu(10) TYPE c,

punei(10) TYPE c,

verkf(10) TYPE c,

telf1(10) TYPE c,

lifab(10) TYPE c,

rueck(10) TYPE c,

lifbi(10) TYPE c,

kolif(10) TYPE c,

relif(10) TYPE c,

meins(10) TYPE c,

umrez(10) TYPE c,

umren(10) TYPE c,

vabme(10) TYPE c,

aplfz(10) TYPE c,

untto(10) TYPE c,

mtxno(10) TYPE c,

ekgrp(10) TYPE c,

uebto(10) TYPE c,

kzabs(10) TYPE c,

norbm(10) TYPE c,

uebtk(10) TYPE c,

bstae(10) TYPE c,

minbm(10) TYPE c,

webre(10) TYPE c,

mwskz(10) TYPE c,

mhdrz(10) TYPE c,

iprkz(10) TYPE c,

xersn(10) TYPE c,

evers(10) TYPE c,

exprf(10) TYPE c,

bstma(10) TYPE c,

rdprf(10) TYPE c,

megru(10) TYPE c,

netpr(10) TYPE c,

waers(10) TYPE c,

peinh(10) TYPE c,

bprme(10) TYPE c,

sktof(10) TYPE c,

bpumz(10) TYPE c,

bpumn(10) TYPE c,

ekkol(10) TYPE c,

meprf(10) TYPE c,

inco1(10) TYPE c,

inco2(10) TYPE c,

datab(10) TYPE c,

datbi(10) TYPE c,

kschl(10) TYPE c,

kbetr(10) TYPE c,

konwa(10) TYPE c,

kpein(10) TYPE c,

kmein(10) TYPE c,

END OF lt_infrec1.

.

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.

PARAMETERS: p_file LIKE rlgrap-filename.

SELECTION-SCREEN END OF BLOCK b1.

DATA: lv_file TYPE string.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.

CALL FUNCTION 'KD_GET_FILENAME_ON_F4'

EXPORTING

field_name = p_file

CHANGING

file_name = p_file.

*----


  • START OF SELECTION

*----


START-OF-SELECTION.

*----


  • UPLOADING THE FILE

*----


IF p_file IS NOT INITIAL.

lv_file = p_file.

CALL FUNCTION 'UPLOAD'

EXPORTING

  • CODEPAGE = ' '

filename = ' '

filetype = 'DAT'

  • ITEM = ' '

  • FILEMASK_MASK = ' '

  • FILEMASK_TEXT = ' '

  • FILETYPE_NO_CHANGE = ' '

  • FILEMASK_ALL = ' '

  • FILETYPE_NO_SHOW = ' '

  • LINE_EXIT = ' '

  • USER_FORM = ' '

  • USER_PROG = ' '

  • SILENT = 'S'

  • IMPORTING

  • FILESIZE =

  • CANCEL =

  • ACT_FILENAME =

  • ACT_FILETYPE =

TABLES

data_tab = lt_infrec

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.

*CALL FUNCTION 'GUI_UPLOAD'

  • EXPORTING

  • filename =

  • FILETYPE = 'DAT'

  • HAS_FIELD_SEPARATOR = ' '

  • HEADER_LENGTH = 0

  • READ_BY_LINE = 'X'

  • DAT_MODE = ' '

  • CODEPAGE = ' '

  • IGNORE_CERR = ABAP_TRUE

  • REPLACEMENT = '#'

  • CHECK_BOM = ' '

  • VIRUS_SCAN_PROFILE =

  • NO_AUTH_CHECK = ' '

  • IMPORTING

  • FILELENGTH =

  • HEADER =

  • tables

  • data_tab = lt_infrec

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

    ENDIF.

    loop at lt_infrec.

    • ON CHANGE OF lt_infrec-lifnr or lt_infrec-matnr or lt_infrec-ekorg.

    MOVE-CORRESPONDING lt_infrec TO lt_infrec1.

    append lt_infrec1.

    endloop.

    DELETE ADJACENT DUPLICATES FROM lt_infrec1 COMPARING lifnr matnr ekorg.

    • REFRESH t_bdcdata.

    • CLEAR lv_lifnr.

    • CLEAR lv_matnr.

    PERFORM open_group.

    LOOP AT lt_infrec1.

    *----


    • SCREEN 1

    *----


    PERFORM bdc_dynpro USING 'SAPMM06I' '0100'.

    PERFORM bdc_field USING 'BDC_CURSOR'

    'RM06I-NORMB'.

    PERFORM bdc_field USING 'BDC_OKCODE'

    '/00'.

    PERFORM bdc_field USING 'EINA-LIFNR' lt_infrec1-lifnr.

    PERFORM bdc_field USING 'EINA-MATNR' lt_infrec1-matnr.

    PERFORM bdc_field USING 'EINE-EKORG' lt_infrec1-ekorg.

    PERFORM bdc_field USING 'EINE-WERKS' lt_infrec1-werks.

    IF lt_infrec1-esokz = '0'.

    PERFORM bdc_field USING 'RM06I-NORMB'

    'x'.

    ELSEIF lt_infrec1-esokz = '1'.

    PERFORM bdc_field USING 'RM06I-LOHNB'

    'x'.

    ELSEIF lt_infrec1-esokz = '2'.

    PERFORM bdc_field USING 'RM06I-PIPEL'

    'x'.

    ELSEIF lt_infrec1-esokz = '3' .

    PERFORM bdc_field USING 'RM06I-KONSI'

    'x'.

    ENDIF.

    *----


    • SCREEN 2

    *----


    *

    PERFORM bdc_dynpro USING 'SAPMM06I' '0101'.

    PERFORM bdc_field USING 'BDC_CURSOR'

    'EINA-VABME'.

    PERFORM bdc_field USING 'BDC_OKCODE'

    '=EINE'.

    PERFORM bdc_field USING 'EINA-MAHN1' lt_infrec1-mahn1.

    PERFORM bdc_field USING 'EINA-URZTP' lt_infrec1-urztp.

    PERFORM bdc_field USING 'EINA-MAHN2' lt_infrec1-mahn2.

    PERFORM bdc_field USING 'EINA-URZNR' lt_infrec1-urznr.

    PERFORM bdc_field USING 'EINA-MAHN3' lt_infrec1-mahn3.

    PERFORM bdc_field USING 'EINA-URZDT' lt_infrec1-urzdt.

    PERFORM bdc_field USING 'EINA-IDNLF' lt_infrec1-idnlf.

    PERFORM bdc_field USING 'EINA-URZLA' lt_infrec1-urzla.

    PERFORM bdc_field USING 'EINA-LTSNR' lt_infrec1-ltsnr.

    PERFORM bdc_field USING 'EINA-REGIO' lt_infrec1-regio.

    PERFORM bdc_field USING 'EINA-LTSSF' lt_infrec1-ltssf.

    PERFORM bdc_field USING 'EINA-URZZT' lt_infrec1-urzzt.

    PERFORM bdc_field USING 'EINA-WGLIF' lt_infrec1-wglif.

    PERFORM bdc_field USING 'EINA-MFRNR' lt_infrec1-mfrnr.

    PERFORM bdc_field USING 'EINA-ANZPU' lt_infrec1-anzpu.

    PERFORM bdc_field USING 'EINA-PUNEI' lt_infrec1-punei.

    PERFORM bdc_field USING 'EINA-VERKF' lt_infrec1-verkf.

    PERFORM bdc_field USING 'EINA-TELF1' lt_infrec1-telf1.

    PERFORM bdc_field USING 'EINA-LIFAB' lt_infrec1-lifab.

    PERFORM bdc_field USING 'EINA-RUECK' lt_infrec1-rueck.

    PERFORM bdc_field USING 'EINA-LIFBI' lt_infrec1-lifbi.

    PERFORM bdc_field USING 'EINA-KOLIF' lt_infrec1-kolif.

    PERFORM bdc_field USING 'EINA-RELIF' lt_infrec1-relif.

    PERFORM bdc_field USING 'EINA-MEINS' lt_infrec1-meins.

    PERFORM bdc_field USING 'EINA-UMREZ' lt_infrec1-umrez.

    PERFORM bdc_field USING 'EINA-UMREN' lt_infrec1-umren.

    PERFORM bdc_field USING 'EINA-VABME' lt_infrec1-vabme.

    *

    **----


    • SCREEN 2(B)

    **----


    **

    *

    PERFORM bdc_dynpro USING 'SAPMM06I' '0102'.

    PERFORM bdc_field USING 'BDC_CURSOR'

    'EINE-INCO2'.

    PERFORM bdc_field USING 'BDC_OKCODE'

    '=KO'.

    PERFORM bdc_field USING 'EINE-APLFZ' lt_infrec1-aplfz.

    PERFORM bdc_field USING 'EINE-UNTTO' lt_infrec1-untto.

    PERFORM bdc_field USING 'EINE-MTXNO' lt_infrec1-mtxno.

    PERFORM bdc_field USING 'EINE-EKGRP' lt_infrec1-ekgrp.

    PERFORM bdc_field USING 'EINE-UEBTO' lt_infrec1-uebto.

    PERFORM bdc_field USING 'EINE-KZABS' lt_infrec1-kzabs.

    PERFORM bdc_field USING 'EINE-NORBM' lt_infrec1-norbm.

    PERFORM bdc_field USING 'EINE-UEBTK' lt_infrec1-uebtk.

    PERFORM bdc_field USING 'EINE-BSTAE' lt_infrec1-bstae.

    PERFORM bdc_field USING 'EINE-MINBM' lt_infrec1-minbm.

    PERFORM bdc_field USING 'EINE-WEBRE' lt_infrec1-webre.

    PERFORM bdc_field USING 'EINE-MWSKZ' lt_infrec1-mwskz.

    PERFORM bdc_field USING 'EINE-MHDRZ' lt_infrec1-mhdrz.

    PERFORM bdc_field USING 'EINE-IPRKZ' lt_infrec1-iprkz.

    PERFORM bdc_field USING 'EINE-XERSN' lt_infrec1-xersn.

    PERFORM bdc_field USING 'EINE-EVERS' lt_infrec1-evers.

    PERFORM bdc_field USING 'EINE-EXPRF' lt_infrec1-exprf.

    PERFORM bdc_field USING 'EINE-BSTMA' lt_infrec1-bstma.

    PERFORM bdc_field USING 'EINE-RDPRF' lt_infrec1-rdprf.

    PERFORM bdc_field USING 'EINE-MEGRU' lt_infrec1-megru.

    PERFORM bdc_field USING 'EINE-NETPR' lt_infrec1-netpr.

    PERFORM bdc_field USING 'EINE-WAERS' lt_infrec1-waers.

    PERFORM bdc_field USING 'EINE-PEINH' lt_infrec1-peinh.

    PERFORM bdc_field USING 'EINE-BPRME' lt_infrec1-bprme.

    PERFORM bdc_field USING 'EINE-SKTOF' lt_infrec1-sktof.

    PERFORM bdc_field USING 'EINE-BPUMZ' lt_infrec1-bpumz.

    PERFORM bdc_field USING 'EINE-BPUMN' lt_infrec1-bpumn.

    PERFORM bdc_field USING 'EINE-EKKOL' lt_infrec1-ekkol.

    PERFORM bdc_field USING 'EINE-MEPRF' lt_infrec1-meprf.

    PERFORM bdc_field USING 'EINE-INCO1' lt_infrec1-inco1.

    PERFORM bdc_field USING 'EINE-INCO2' lt_infrec1-inco2.

    *----


    • SCREEN 2(C)

    *----


    PERFORM bdc_dynpro USING 'SAPMV13A' '0201'.

    PERFORM bdc_field USING 'BDC_CURSOR'

    'KONP-KMEIN'.

    PERFORM bdc_field USING 'BDC_OKCODE'

    '/00'.

    PERFORM bdc_field USING 'RV13A-DATAB' lt_infrec1-datab.

    PERFORM bdc_field USING 'RV13A-DATBI' lt_infrec1-datbi.

    loop at lt_infrec where lifnr = lt_infrec-lifnr and

    matnr = lt_infrec-matnr and

    ekorg = lt_infrec-ekorg.

    CONCATENATE 'KONP-KSCHL(' IDX ')' INTO var.

    • PERFORM bdc_field USING 'KONP-KSCHL' lt_infrec1-kschl.

    PERFORM bdc_field USING VAR lt_infrec-kschl.

    CONCATENATE 'KONP-KBETR(' IDX ')' INTO VAR.

    • PERFORM bdc_field USING 'KONP-KBETR' lt_infrec1-kbetr.

    PERFORM bdc_field USING VAR lt_INFREC-KBETR.

    CONCATENATE 'KONP-KONWA(' IDX ')' INTO VAR.

    • PERFORM bdc_field USING 'KONP-KONWA' lt_infrec1-konwa.

    PERFORM bdc_field USING VAR lt_infrec-KONWA.

    CONCATENATE 'KONP-KPEIN(' IDX ')' INTO VAR.

    • PERFORM bdc_field USING 'KONP-KPEIN' lt_infrec1-kpein.

    PERFORM bdc_field USING VAR lt_infrec-kPEIN.

    CONCATENATE 'KONP-KMEIN(' IDX ')' INTO VAR.

    • PERFORM bdc_field USING 'KONP-KMEIN' lt_infrec1-kmein.

    PERFORM bdc_field USING VAR lt_infrec-kMEIN.

    idx = idx + 1.

    ENDLOOP.

    CLEAR idx.

    *----


    • SCREEN 2(D)

    *----


    PERFORM bdc_dynpro USING 'SAPMV13A' '0201'.

    PERFORM bdc_field USING 'BDC_CURSOR'

    'RV13A-DATAB'.

    PERFORM bdc_field USING 'BDC_OKCODE'

    '/00'.

    PERFORM bdc_field USING 'RV13A-DATAB' lt_infrec-datab.

    PERFORM bdc_field USING 'RV13A-DATBI' lt_infrec-datbi.

    PERFORM bdc_dynpro USING 'SAPMM06I' '0102'.

    PERFORM bdc_field USING 'BDC_CURSOR'

    'EINE-APLFZ'.

    PERFORM bdc_field USING 'BDC_OKCODE'

    '=TEXT'.

    PERFORM bdc_field USING 'EINE-APLFZ' lt_infrec-aplfz.

    PERFORM bdc_field USING 'EINE-UNTTO' lt_infrec-untto.

    PERFORM bdc_field USING 'EINE-EKGRP' lt_infrec-ekgrp.

    PERFORM bdc_field USING 'EINE-UEBTO' lt_infrec-uebto.

    PERFORM bdc_field USING 'EINE-KZABS' lt_infrec-kzabs.

    PERFORM bdc_field USING 'EINE-NORBM' lt_infrec-norbm.

    PERFORM bdc_field USING 'EINE-MINBM' lt_infrec-minbm.

    PERFORM bdc_field USING 'EINE-WEBRE' lt_infrec-webre.

    PERFORM bdc_field USING 'EINE-MWSKZ' lt_infrec-mwskz.

    PERFORM bdc_field USING 'EINE-IPRKZ' lt_infrec-iprkz.

    PERFORM bdc_field USING 'EINE-NETPR' lt_infrec-netpr.

    PERFORM bdc_field USING 'EINE-WAERS' lt_infrec-waers.

    PERFORM bdc_field USING 'EINE-PEINH' lt_infrec-peinh.

    PERFORM bdc_field USING 'EINE-BPRME' lt_infrec-bprme.

    PERFORM bdc_field USING 'EINE-BPUMZ' lt_infrec-bpumz.

    PERFORM bdc_field USING 'EINE-BPUMN' lt_infrec-bpumn.

    PERFORM bdc_field USING 'EINE-MEPRF' lt_infrec-meprf.

    PERFORM bdc_field USING 'EINE-INCO1' lt_infrec-inco1.

    PERFORM bdc_field USING 'EINE-INCO2' lt_infrec-inco2.

    ***----


    • SCREEN 4

    ***----


    ***

    *

    • PERFORM bdc_dynpro USING 'SAPMM06I' '0103'.

    • PERFORM bdc_field USING 'BDC_CURSOR'

    • 'RM06I-LTEX5(02)'.

    • PERFORM bdc_field USING 'BDC_OKCODE'

    • '/00'.

    • PERFORM bdc_field USING 'RM06I-SELKZ(02)'

    • ','.

    • PERFORM bdc_field USING 'RM06I-LTEX1(01)'

    • ','.

    • PERFORM bdc_field USING 'RM06I-LTEX1(02)'

    • ','.

    • PERFORM bdc_field USING 'RM06I-LTEX2(01)'

    • ','.

    • PERFORM bdc_field USING 'RM06I-LTEX2(02)'

    • ','.

    • PERFORM bdc_field USING 'RM06I-LTEX3(01)'

    • ','.

    • PERFORM bdc_field USING 'RM06I-LTEX3(02)'

    • ','.

    • PERFORM bdc_field USING 'RM06I-LTEX4(01)'

    • ','.

    • PERFORM bdc_field USING 'RM06I-LTEX4(02)'

    • ','.

    • PERFORM bdc_field USING 'RM06I-LTEX5(01)'

    • ','.

    • PERFORM bdc_field USING 'RM06I-LTEX5(02)'

    • ','.

    *

    **----


    • SCREEN 5

    **----


    **

    *

    • PERFORM bdc_dynpro USING 'SAPMM06I' '0103'.

    • PERFORM bdc_field USING 'BDC_CURSOR'

    • 'RM06I-LTEX1(01)'.

    • PERFORM bdc_field USING 'BDC_OKCODE'

    • '=BU'.

    PERFORM bdc_transaction USING 'ME11'.

    CLEAR lt_infrec.

    clear lt_infrec1.

    • CALL TRANSACTION 'ME11' USING t_bdcdata MODE 'A'.

    ENDLOOP.

    PERFORM close_group.

    *

    *

    *ENDFORM. "BDC_FIELD

    thanks in advance ...

    bye

    pradeep

    Add a comment
    10|10000 characters needed characters exceeded

    Assigned Tags

    Related questions

    1 Answer

    • Posted on Aug 31, 2007 at 05:15 AM

      Hi,

      for loading the Inforecords I suggest you to use LSMW with following methods:

      PurchasingInfoRecord:

      Object               0060   Purchasing info rec.
      Method               0000                       
      Program name         RM06IBI0                   
      Program type         B   Batch input           

      Conditions:

      with IDoc:

      Message type         COND_A          
      Basic type           COND_A02       

      or with BI program:

      Object               0070   Condition record 
      Method               0000                    
      Program name         RV14BTCI                
      Program type         B   Batch input        

      The above methods would provide you an efficient & effective way of loading mass data with all possible complexicity w.r.t conditions.

      Hope this helps.

      Best Regards, Murugesh AS

      Add a comment
      10|10000 characters needed characters exceeded

    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.
    You must be Logged in to submit an answer.

    Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.