Skip to Content

Regarding Message Collection bapiret1

Dear all,

I prepared one z report . i am getting some messages from that report into an internal table in the same program . I want to pass this to a Z bapi (function module) created by me . The internal table contain only one field of 220 characters.(in report) . I want to pass this table to bapiret1-message which is having the same length in fm . Can any body face this problem previously please share your ideas with me .

Regards,

Madhu.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

6 Answers

  • Best Answer
    Posted on Feb 12, 2010 at 08:49 AM

    Try declaring it_str like below in both areas.

    data: it_str type bapiret2_t.

    data: wa_str type bapiret2.

    CALL FUNCTION 'CONVERT_BDCMSGCOLL_TO_BAPIRET2'

    TABLES

    IMT_BDCMSGCOLL = it_msg

    EXT_RETURN = it_str[].

    Then try export and import.

    Will the user always execute this in mode 'A'.

    Im not sure whether export and import will work in MODE 'N'.

    Better to go with two fm's as i suggested before.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Kesavadas Thekkillath

      Hi Keshav, <li>SUBMIT does not create another session. It creates session but we call it as Internal session. You can call another program with Submit , there you will set EXPORT statement and in Calling program we can use IMPORT statement. Thanks Venkat.O

  • author's profile photo Former Member
    Former Member
    Posted on Feb 10, 2010 at 07:31 AM

    Hi,

    can you paste your code ..I am unable to understand the requirement..

    Thanks,

    Nagaraj

    Add a comment
    10|10000 characters needed characters exceeded

    • Hi Venkat,

      Thanks once again.

      ""Local Interface:

      *" IMPORTING

      *" VALUE(ZCUST) LIKE ZCUST_TABLE STRUCTURE ZCUST_TABLE

      *" TABLES

      *" RETURN STRUCTURE BAPIRET2

      *"----


      DATA:

      t_cust TYPE zcust_table .

      ***submit the bdc report

      ***Giving data from

      MOVE zcust TO t_cust. " "here from zcust contains 63 fields . The same fields i am maintaining in bdc report.

      EXPORT t_cust TO MEMORY ID 'TABLE'. ""these values are exporting to bdc report.

      SUBMIT zdup_customer. ( my report name ). " "here i am submitting these values to bdc report .They are going smoothly to the report.

      ***Getting data from program

      DATA it_str TYPE bapiret2 OCCURS 0 WITH HEADER LINE. " "i am collecting the bdc messages in a table it_str. Here also same name

      .

      IMPORT it_str FROM MEMORY ID 'MESS'. "TO GET DATA FROM REPORT. ""from there i am exporting the table .The same table i am importing here.

      LOOP AT it_str.

      MOVE-CORRESPONDING it_str TO return.

      APPEND return.

      ENDLOOP.

      ENDFUNCTION.

      Regards,

      Madhu.

  • Posted on Feb 11, 2010 at 03:52 PM

    Hello,

    in report

    EXPORT i_return to memory id 'RET'.

    in bapi

    IMPORT i_return from memory id 'RET'.

    here type data type of i_return must be same in both the areas.

    Instead of all this complications why cant you create two fm's in same function group.

    and access the message data globally avoiding export and import.

    Add a comment
    10|10000 characters needed characters exceeded

    • Hi Sravanthi,

      Thanks for your reply. You understand what i am doing in my report correctly . The problem here is what ever messages i am collecting in bdc should return to bapi. That is not happening here. Here i can import the return messages from bdc to bapi but Submit statement wont work for function module. If you have any idea share with me .

      Regards,

      Madhu.

  • Posted on Feb 11, 2010 at 10:08 AM

    Hi madhu,

    Forum is to help you in solving your problem.

    Please donot expect the exact code here.

    If there is any syntax errors you should correct it.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Feb 12, 2010 at 08:33 AM

    How did you declare IT_STR in your bdc program ?

    Add a comment
    10|10000 characters needed characters exceeded

    • Dear Keshav,

      DATA t_cust LIKE zcust.

      DATA it_bdc TYPE bdcdata OCCURS 1 WITH HEADER LINE.

      DATA t_message TYPE bapiret1 OCCURS 1 WITH HEADER LINE.

      DATA it_msg TYPE bdcmsgcoll OCCURS 1 WITH HEADER LINE.

      data it_str type bapiret2 occurs 0 with header line.

      data i_return TYPE TABLE OF bapiret2.

      DATA wa_return TYPE bapireturn.

      DATA str TYPE string.

      *data cm TYPE c LENGTH 16.

      *data t_cust like zcust.

      *IMPORT t_cust FROM MEMORY ID cm.

      START-OF-SELECTION.

      IMPORT t_cust FROM MEMORY ID 'TABLE'.

      MOVE t_cust TO zcust.

      APPEND zcust.

      *clear zcust.

      *free memory.

      *PERFORM get_file.

      • PERFORM get_execute.

      END-OF-SELECTION.

      PERFORM get_execute.

      *EXPORT t_cust TO MEMORY ID 'TABLE'. "EXPORT DATA FROM HERE

      &----


      *& Form GET_FILE

      &----


      • text

      .

      ----


      FORM get_file.

      DATA fn1 TYPE ibipparms-path.

      DATA fn2 TYPE string.

      DATA fn3 TYPE rlgrap-filename.

      CALL FUNCTION 'F4_FILENAME'

      IMPORTING

      file_name = fn1.

      fn2 = fn1.

      • FN3 = FN1.

      CALL FUNCTION 'GUI_UPLOAD'

      EXPORTING

      filename = fn2

      has_field_separator = 'X'

      TABLES

      data_tab = zcust[].

      ENDFORM. "GET_FILE

      ----


      FORM get_execute.

      data str type string.

      LOOP AT zcust.

      PERFORM get_data.

      CALL TRANSACTION 'XD01' USING it_bdc MODE 'A' MESSAGES INTO it_msg.

      ENDLOOP.

      LOOP AT it_msg.

      CALL FUNCTION 'FORMAT_MESSAGE'

      EXPORTING

      id = it_msg-msgid

      lang = sy-langu

      no = it_msg-msgnr

      v1 = it_msg-msgv1

      v2 = it_msg-msgv2

      v3 = it_msg-msgv3

      v4 = it_msg-msgv4

      IMPORTING

      msg = str.

      • WRITE :str.

      ENDLOOP.

      CALL FUNCTION 'CONVERT_BDCMSGCOLL_TO_BAPIRET2'

      TABLES

      IMT_BDCMSGCOLL = it_msg

      EXT_RETURN = it_str.

      .

      EXPORT it_str TO MEMORY ID 'MESS' ..

      ENDFORM. "get_execute

      In this wayi i declared it_str in my report.

      Regards,

      Madhu.

  • Posted on Feb 12, 2010 at 09:15 AM

    Hi 😊))

    Asking these many times is not at all a problem 😊

    I hope you did your bdc recording through SHDB.

    In SHDB after recording , Click the button 'Function module' instead of 'program'

    Now give a function group and your function module with recording will be created with all export and import parameters.

    Now just wrap this fm in your BAPI.

    For any more clarifications revert back.

    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.