Skip to Content

Dynamically change the value of selected row in BDC for transaction IM42

hello all,

my requirement is to update budget for Multiple PM orders say( 910000000164, 910000000165),

i have written a BDC for IM52 which is subsequently calling IM42 transaction,

in my BDC recording code ,

perform bdc_dynpro      using 'RAIMSELM' '1000'.

perform bdc_field using 'BDC_CURSOR'
'SO_AUFNR-LOW'.
perform bdc_field using 'BDC_OKCODE'
'=ONLI'.
perform bdc_field using 'PA_PRNAM'
p_prnam. " 'R&M'.
perform bdc_field using 'PA_POSID'
p_posid. " 'R&M DE/SAHUPALLY'.
perform bdc_field using 'PA_GJAHR'
p_gjahr. " '2014'.
perform bdc_field using 'PA_NEWMS'
'X'.
perform bdc_field using 'PA_ORG'
'X'.
perform bdc_field using 'PA_XIQ'
'X'.
perform bdc_field using 'PA_XPR'
'X'.
perform bdc_field using 'PA_XOR'
'X'.
perform bdc_field using 'SO_AUFNR-LOW'
wa_itab-aufnr. " '910000000164'.
perform bdc_dynpro using 'SAPLKBPP' '0320'.
perform bdc_field using 'BDC_CURSOR'
'DROPT-PTIME'.
perform bdc_field using 'BDC_OKCODE'
'=DROT'.
perform bdc_field using 'DROPT-PTIME'
'2016'.
perform bdc_dynpro using 'SAPLKBPP' '0320'.
perform bdc_field using 'BDC_CURSOR'
'DROPT-PTIME'.
perform bdc_field using 'BDC_OKCODE'
'=DROT'.
perform bdc_field using 'DROPT-PTIME'
'0'.
perform bdc_field using 'BPDY-WERT1(08)'
wa_itab-wert1. " ' 3210'.
perform bdc_dynpro using 'SAPLKBPP' '0320'.
perform bdc_field using 'BDC_CURSOR'
'BPDY-WERT1(08)'.
perform bdc_field using 'BDC_OKCODE'
'=POST'.
perform bdc_field using 'BPDY-WERT1(08)'
wa_itab-wert1. " ' 3210'.
perform bdc_dynpro using 'RAIMSELM' '1000'.
perform bdc_field using 'BDC_OKCODE'
'/EE'.
perform bdc_field using 'BDC_CURSOR'
'PA_PRNAM'.

in line no 39 and 46

perform bdc_field using 'BPDY-WERT1(08)'
wa_itab-wert1.


here this (08) in bracket indicates the row number in the above figure(i.e Table Control),


here my problem is while recording i have selected this line, that is why its taking (08)number,


however while executing for multiple orders this is not changing ,for the second record also it is trying to update the same ,


i.e here this number (08) in 'BPDY-WERT1(08)' should change dynamically...


below is my excel file ,




based on Order Number in IM42 i need to change the row number in BDC,


how do i catch this,....



thanks in advance..

im42.jpg (129.7 kB)
im42_excel.jpg (16.1 kB)
Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jul 15, 2016 at 01:25 PM

    Dear Vinay,

    Don't you try to use BAPI ?

    You can search in SE37 with search key : BAPI_EXPENDITUREPROGTREE_*

    Regards,

    Yance

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Dear Vinay,

      Sorry...better the query is like below :

      1. Get AUFK-OBJNR from AUFK with condition AUFNR

      2. Get IMPR-POSID from IMPR with condition IMPR-OBJNR = AUFK-OBJNR

      then pass IMPR-POSID to the BAPI_EXPENDITUREPROGTREE_GDVAL.

      I hope that it will help you.

      Regards,

      Yance

  • Posted on Jul 15, 2016 at 12:18 PM

    Try rewriting the the code using the concept of BDC Table control

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 15, 2016 at 12:22 PM

    Hello,

    If i understood correctly you would like to make it dynamic the 08 the first time and the second time move to 09.

    My suggestion is just add the following a char variable with two digits. After that check if you are still in the same PM order add one to this variable is that case.

    Something like this:

    data: lv_item type char2,

    lv_pmorder type pmorder.

    .

    if lv_pmorder = wa_itab-aufnr.

    add 1 to lv_item.

    else.

    lv_item = '08'.

    endif.



    perform bdc_field using 'BPDY-WERT1(lv_item)'

    wa_itab-wert1.


    Hope this will help.



    Regards

    Luis

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member VINAY REDDY

      Hi,

      I was checking and unfortunately this is a structure.

      So my recommendation is go to the table BSEG, there you have the AUFNR and add the condition like the company code, the year , etc to have the same number of PM Order.

      Like the following:

      data: lt_aufnr type table of aufnr.

      data: lv_lines type i.

      select aufnr into lt_aufnr where BUKRS = lv_bukrs and gjahr = 2014 and ....etc

      describe table lt_aufnr into lv_lines.

      add 1 to lv_lines. "This is for the first row that is not here.

      add 1 to lv_lines. " This is for the correct line.

      Please check also the field: bseg-buzid, I am not really sure but this can be the row number that you are looking for.

      Unfortunately I can not reproduce your issue in my system, because i am pretty sure that i will find something much better than this.

      Hopefully this will help in someway.

      Regards

      Luis

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.