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

Reading Data From Tcode using BDC

Former Member
0 Likes
1,652

Hello Experts,

I am creating an Info Record in ME11 by uploading data from excel sheet.

First I fetch data from excel sheet to int table, then int table to ME11 via BDC Call Transaction.

Everything was working fine untill now sicne I encoutered this new situation.

Lets say I have to enter textline in some fileds like Infopath in my case, if all there is no text present already and I am setting data in the fields from my XLS only than its ok but if there are already entries present in that case my recording is appending new lines above theold text but I want them below the old text.

Please guide me.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,422

Hi,

My understanding from you is ,You want to append an entry in the Info Record note and when an entry is already existing your value overwrites the entry.I noted that the first line's fieldname is 'ltext1' and for the second is 'ltext2' ,...you can try putting the perform bdc_field for that particular field(ltext1) inside an if statement like...

If table-ltext1 ne ' '.

perform bdc_field using 'table-ltext1' 'aaaaaa'.

else.

perform bdc_field using 'table-ltext2' 'bbbbbb'.

endif.

Kindly ignore if not useful or incorrect.

Thank You.

7 REPLIES 7
Read only

Former Member
0 Likes
1,422

Hi aamreta

Not sure I understand the problem, but here's 2 things worth a mention. If you're entering data repetitively in BDCs I usually do a page down as first step and then I fill line 2. This always appends the new record instead of inserting. Another thing worth a mention is that if you have no data to fill a field, use standard BDC NO_DATA field == '/'.

I hope this is useful. Best regards, Adrian

Read only

Former Member
0 Likes
1,422

Hi,

I have done this recording in ME11 for creating info record earlier,can you please be clear on which field you are appending and your requirement.

With Regards,

Shanmugam

Read only

0 Likes
1,422

Hello,

I am doing this for Info Record note & Purchase Order Text.

Please guide me.

Read only

0 Likes
1,422

Hi,

you need to do BDC for multiple entires.. in your case you have done for single entry thats why the values are over written..Adrian's suggestion is correct.

Regards,

Nagaraj

Read only

Former Member
0 Likes
1,423

Hi,

My understanding from you is ,You want to append an entry in the Info Record note and when an entry is already existing your value overwrites the entry.I noted that the first line's fieldname is 'ltext1' and for the second is 'ltext2' ,...you can try putting the perform bdc_field for that particular field(ltext1) inside an if statement like...

If table-ltext1 ne ' '.

perform bdc_field using 'table-ltext1' 'aaaaaa'.

else.

perform bdc_field using 'table-ltext2' 'bbbbbb'.

endif.

Kindly ignore if not useful or incorrect.

Thank You.

Read only

Former Member
0 Likes
1,422

I had a program which did something similar using BDC and I got fed up with such problems after a few changes and after an upgrade (which totally changed the screens). I ended up re-writing the program to populate an INFREC IDOC and processing it using the IDOC_INPUT_INFREC function module.

Read only

0 Likes
1,422

Hello Experts,

I appreciate your responses but my problem has been resolved in other way.

I need to put value in Inforecord and if the value already exist then my value should get appended in bottom else it should be inserted from first line.

Now for this i made a func call for READ_TEXT:

CALL FUNCTION 'READ_TEXT'
    EXPORTING
      client   = sy-mandt
      id       = 'AT'
      language = 'EN'
      name     = ''
      object   = 'EINA'
    TABLES
      lines    = it_lines1[].
  DESCRIBE TABLE it_lines1 LINES idx1.

then in BDC,, I have done:

v_len = STRLEN( wa_upload-txtline1 ).                         "since only 71 char are allowed
      count = ( v_len / 71 ) + 1.
      DO count TIMES.                                                                   "no of lines form of 71 or less chars
        PERFORM bdc_dynpro      USING 'SAPLSTXX' '1100'.
        PERFORM bdc_field       USING 'BDC_CURSOR'
                                      'RSTXT-TXLINE'.
        v_len = STRLEN( wa_upload-txtline1 ).
        IF v_len > 71.
          v_txt1 = wa_upload-txtline1+(71).
          wa_upload-txtline1 = wa_upload-txtline1+71().            "first line of text and all lines in middle have fval = EDNP
          PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '=EDNP'.
        ELSE.
          v_txt1 = wa_upload-txtline1.
          PERFORM bdc_field       USING 'BDC_OKCODE'           "Last line of text have fval = TXBA
                                     '=TXBA'.
        ENDIF.
        idx1 = idx1 + 1.
        IF cnt <= 9.
          CONCATENATE 'RSTXT-TXLINE' '(0' idx1 ')' INTO v_fname.          " this will set the fnam eq to fieldname(line no) for  
        ELSE.                                                                                " line no <= 9
          CONCATENATE 'RSTXT-TXLINE' '(' idx1 ')' INTO v_fname.            " this will set the fnam eq to fieldname(line no) for             
        ENDIF.                                                                                " line no <= 9
        PERFORM bdc_field       USING v_fname
                                      v_txt1.
      ENDDO.

Hope this will help you as well.

Edited by: aamreta on Feb 14, 2011 12:23 PM