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

Help on KO22 - BDC Update - Very Urgent

Dear Gurues,

Im writing a program for mass update the Budget Price in Transaction Code KO22 using a BDC.

I have complete my codings but,when i execute in foreground i found that the amount is not updated in the field.I belived is something wrong with my codings which i dont know how to solve it.

Can anyone review my BDC codes and let me know whats wrong with my code. Im only having problem in updating BPDY-WERT1(01) field. ( Which is Amount Field ).

Below is my codes for BDC :-

LOOP AT ITAB_BDC.

perform bdc_dynpro using 'SAPMKBUD' '0300'.

perform bdc_field using 'BDC_OKCODE'

'/EEOKS'.

perform bdc_field using 'BDC_CURSOR'

'CODIA-AUFNR'.

perform bdc_field using 'BDC_CURSOR'

'SVALD-VALUE(01)'.

perform bdc_field using 'BDC_OKCODE'

'=FURT'.

perform bdc_field using 'SVALD-VALUE(01)'

p_kokrs.

perform bdc_dynpro using 'SAPMKBUD' '0300'.

perform bdc_field using 'BDC_CURSOR'

'CODIA-AUFNR'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'CODIA-AUFNR'

ITAB_BDC-order.

  • 'E11101000100'.

perform bdc_dynpro using 'SAPLKBPP' '0320'.

perform bdc_field using 'BDC_CURSOR'

'BPDY-WERT1(01)'.

perform bdc_field using 'BDC_OKCODE'

'=POST'.

perform bdc_field using 'DROPT-PTIME'

'1'.

perform bdc_field using 'BPDY-WERT1(01)'

ITAB_BDC-amt.

  • ' 110.00'.

perform bdc_transaction using 'KO22'.

PERFORM BDC_REPORT.

ENDLOOP.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Oct 11, 2005 at 04:56 AM

    hi,

    >>ITAB_BDC-amt.

    in BDC all the values should be in char format

    define one char value

    data L_amount(15) type c

    l_amount =ITAB_BDC-amt.

    perform bdc_field using 'BPDY-WERT1(01)'

    l_amount.

    try with this let me know any probs

    cheers,

    sasi

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 11, 2005 at 05:42 AM

    convert all numaric to char format before BDC.

    i think u r amt field numaric just convert it into char.

    just create one field as char type before assign to bdc field copy orginal value into char field and assign it.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 11, 2005 at 06:22 AM

    Hi Gurues,

    Thanks for your reply,But im not able to get the value in the amount field.When debug i saw the value.But somehow when execute the bdc in sm35 in foreground, im not able to see the amount value.

    Below is my detail codes :- pls advise if i have coded anything wrong ...

    REPORT zfilbi082 NO STANDARD PAGE HEADING LINE-SIZE 255.

    ----


    • Program name : ZFILBI080

    • ERN : 050001702

    • Title : MASS UPLOAD INTERNAL ORDER BUDGETTING

    • Purpose : MASS UPLOAD INTERNAL ORDER BUDGETTING

    ----


    • Author : VASANTHAN KRISHNAN

    • Date : 07 OCT 2005

    ----


    • Amendment *

    ----


    • Date Who ERN Description *

    ----


    Tables: coas.

    DATA:

    BEGIN OF ITAB_BDC OCCURS 0,

    order(14),

    amt(12),

    END OF ITAB_BDC.

    data L_amount(12) type c.

    • Declaration **************************

    DATA: BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE,

    NO TYPE I.

    • Screen Selection **********************

  • 11/02/2003 IPC ENHANCEMENT STARTS ERN 090000577 **

  • SELECTION-SCREEN BEGIN OF BLOCK bl3 WITH FRAME TITLE text-002.

    PARAMETERS :P_kokrs LIKE coas-kokrs DEFAULT 'HCPM' OBLIGATORY.

    SELECTION-SCREEN END OF BLOCK bl3.

    • 11/02/2003 IPC ENHANCEMENT ENDS ERN 090000577 **

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

    PARAMETERS :P_INPUT LIKE RLGRAP-FILENAME DEFAULT 'C:\io07102005.txt'.

    SELECTION-SCREEN END OF BLOCK bl2.

    SELECTION-SCREEN BEGIN OF BLOCK bl1

    WITH FRAME TITLE TEXT-002.

    SELECTION-SCREEN BEGIN OF LINE.

    SELECTION-SCREEN END OF LINE.

    PARAMETERS SESSION(12) DEFAULT 'IOBUDGET'.

    PARAMETERS USER(12) DEFAULT SY-UNAME.

    SELECTION-SCREEN END OF BLOCK bl1.

    SELECTION-SCREEN BEGIN OF BLOCK bl0 WITH FRAME TITLE text-003.

    PARAMETER: p_test AS CHECKBOX DEFAULT 'X'.

    PARAMETERS KEEP AS CHECKBOX DEFAULT 'X'.

    SELECTION-SCREEN END OF BLOCK bl0.

    *******Start Of Selection ***********

    START-OF-SELECTION.

    CLEAR NO.

    PERFORM UPLOAD.

    PERFORM PROCESS.

    &----


    *& Form process

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM PROCESS.

    IF P_TEST <> 'X'.

    PERFORM OPEN_GROUP.

    data :date(10) type c,

    date1(10) type c.

    LOOP AT ITAB_BDC.

    l_amount = ITAB_BDC-amt.

    perform bdc_dynpro using 'SAPMKBUD' '0300'.

    perform bdc_field using 'BDC_OKCODE'

    '/EEOKS'.

    perform bdc_field using 'BDC_CURSOR'

    'CODIA-AUFNR'.

    perform bdc_field using 'BDC_CURSOR'

    'SVALD-VALUE(01)'.

    perform bdc_field using 'BDC_OKCODE'

    '=FURT'.

    perform bdc_field using 'SVALD-VALUE(01)'

    p_kokrs.

    perform bdc_dynpro using 'SAPMKBUD' '0300'.

    perform bdc_field using 'BDC_CURSOR'

    'CODIA-AUFNR'.

    perform bdc_field using 'BDC_OKCODE'

    '/00'.

    perform bdc_field using 'CODIA-AUFNR'

    ITAB_BDC-order.

    • 'E11101000100'.

    perform bdc_dynpro using 'SAPLKBPP' '0320'.

    perform bdc_field using 'BDC_CURSOR'

    'BPDY-WERT1(01)'.

    perform bdc_field using 'BDC_OKCODE'

    '=POST'.

    perform bdc_field using 'DROPT-PTIME'

    '1'.

    perform bdc_field using 'BPDY-WERT1(01)'

    l_amount.

    • ITAB_BDC-amt.

    • ' 110.00'.

    perform bdc_transaction using 'KO22'.

    PERFORM BDC_REPORT.

    ENDLOOP.

    PERFORM CLOSE_GROUP.

    ELSE.

    WRITE:/'NO BATCH PROCESS UPDATES' COLOR COL_HEADING.

    WRITE:/ 'NO Of Internal Order BUdget' COLOR COL_HEADING.

    LOOP AT ITAB_BDC.

    PERFORM BDC_REPORT.

    ENDLOOP.

    ENDIF.

    ENDFORM.

    *& Form popup

    *&----


    • text

    *----


    • --> p1 text

    • <-- p2 text

    *----


    FORM POPUP CHANGING E_PFILE LIKE RLGRAP-FILENAME.

    DATA LD_PFILE LIKE RLGRAP-FILENAME.

    CALL FUNCTION 'WS_FILENAME_GET'

    EXPORTING

    • def_filename = ''

    DEF_PATH = 'C:\io.TXT'

    MASK = ',.txt,.txt,.,..'

    MODE = 'O'

    TITLE = TEXT-T01

    IMPORTING

    FILENAME = LD_PFILE

    EXCEPTIONS

    INV_WINSYS = 1

    NO_BATCH = 2

    SELECTION_CANCEL = 3

    SELECTION_ERROR = 4

    OTHERS = 5.

    CHECK SY-SUBRC EQ 0.

    E_PFILE = LD_PFILE.

    ENDFORM.

    &----


    *& Form upload

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM UPLOAD.

    CALL FUNCTION 'WS_UPLOAD'

    EXPORTING

    FILENAME = P_INPUT

    FILETYPE = 'DAT'

    TABLES

    DATA_TAB = ITAB_BDC

    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.

    • EXCEPTIONS

    • FILE_OPEN_ERROR = 1

    • FILE_READ_ERROR = 2

    • UNKNOWN_ERROR = 3

    • CUSTOMER_ERROR = 4

    • OTHERS = 5.

    ENDFORM.

    &----


    *& Form OPEN_GROUP

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    ----


    • create batchinput session *

    • (not for call transaction using...) *

    ----


    FORM OPEN_GROUP.

    IF SESSION EQ SPACE.

    MESSAGE e010(ad) WITH 'Create BDC session failed'.

    ELSE.

    SKIP.

    WRITE: /(20) 'Create group'(I01), SESSION.

    SKIP.

    • open batchinput group

    CALL FUNCTION 'BDC_OPEN_GROUP'

    EXPORTING

    CLIENT = SY-MANDT

    GROUP = SESSION

    USER = USER

    KEEP = KEEP.

    • HOLDDATE = HOLDDATE.

    WRITE: /(30) 'BDC_OPEN_GROUP'(I02),

    (12) 'returncode:'(I05),

    SY-SUBRC.

    ENDIF.

    ENDFORM.

    &----


    *& Form CLOSE_GROUP

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    ----


    • end batchinput session *

    • (call transaction using...: error session) *

    ----


    FORM CLOSE_GROUP.

    • close batchinput group

    CALL FUNCTION 'BDC_CLOSE_GROUP'.

    WRITE: /(30) 'BDC_CLOSE_GROUP'(I04),

    (12) 'returncode:'(I05),

    SY-SUBRC.

    ENDFORM.

    &----


    *& Form BDC_TRANSACTION

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    ----


    • Start new transaction according to parameters *

    ----


    FORM BDC_TRANSACTION USING TCODE.

    • batch input session

    IF SESSION EQ SPACE.

    MESSAGE e010(ad) WITH 'Create BDC session failed'.

    ELSE.

    CALL FUNCTION 'BDC_INSERT'

    EXPORTING

    TCODE = TCODE

    TABLES

    DYNPROTAB = BDCDATA.

    ENDIF.

    REFRESH BDCDATA.

    ENDFORM.

    &----


    *& Form BDC_DYNPRO

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    ----


    • Start new screen *

    ----


    FORM BDC_DYNPRO USING PROGRAM DYNPRO.

    CLEAR BDCDATA.

    BDCDATA-PROGRAM = PROGRAM.

    BDCDATA-DYNPRO = DYNPRO.

    BDCDATA-DYNBEGIN = 'X'.

    APPEND BDCDATA.

    ENDFORM.

    &----


    *& Form BDC_FIELD

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    ----


    • Insert field *

    ----


    FORM BDC_FIELD USING FNAM FVAL.

    CLEAR BDCDATA.

    BDCDATA-FNAM = FNAM.

    BDCDATA-FVAL = FVAL.

    APPEND BDCDATA.

    ENDFORM.

    &----


    *& Form BDC_REPORT

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    ----


    • REPORT

    ----


    WRITE:/ 'NO Of Internal Order Budget for Controlling Area',

    '(',P_kokrs,')'.

    ----


    • FORM BDC_REPORT *

    ----


    • ........ *

    ----


    FORM BDC_REPORT.

    NO = NO + 1.

    WRITE:/ NO,

    p_kokrs(4),

    ITAB_BDC-order(12),

    ITAB_BDC-AMT(10).

    ENDFORM.

Add a comment
10|10000 characters needed characters exceeded

  • Former Member

    Change the loop to look like:

        LOOP AT itab_bdc.
    
          l_amount = itab_bdc-amt.
    
          PERFORM bdc_dynpro USING 'SAPMKBUD' '0300'.
          PERFORM bdc_field USING 'BDC_OKCODE'
          '/EEOKS'.
    
          PERFORM bdc_field USING 'BDC_CURSOR'
          'CODIA-AUFNR'.
          PERFORM bdc_dynpro USING 'SAPLSPO4' '0300'.
          PERFORM bdc_field USING 'SVALD-VALUE(1)'
          p_kokrs.
    
          PERFORM bdc_dynpro USING 'SAPMKBUD' '0300'.
          PERFORM bdc_field USING 'BDC_CURSOR'
          'CODIA-AUFNR'.
          PERFORM bdc_field USING 'BDC_OKCODE'
          '/00'.
    
          PERFORM bdc_field USING 'CODIA-AUFNR'
          itab_bdc-order.
    * 'E11101000100'.
    
          PERFORM bdc_dynpro USING 'SAPLKBPP' '0320'.
          PERFORM bdc_field USING 'BDC_CURSOR'
          'BPDY-WERT1(01)'.
          PERFORM bdc_field USING 'BDC_OKCODE'
          '=POST'.
    
          PERFORM bdc_field USING 'DROPT-PTIME'
          '1'.
          PERFORM bdc_field USING 'BPDY-WERT1(01)'
          l_amount.
    
    * ITAB_BDC-amt.
    * ' 110.00'.
          PERFORM bdc_transaction USING 'KO22'.
          PERFORM bdc_report.
    
        ENDLOOP.
    

    Rob

  • author's profile photo Former Member
    Former Member
    Posted on Oct 11, 2005 at 07:51 AM

    Hi Mr.Sasi,

    Thanks for your reply.

    I still havent get the result.The amount value still the same.

    I changed the command as you said :-

    perform bdc_field using 'BPDY-WERT1'

    l_amount.

    Still not working..

    what should i do ??

    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.