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

Function module not returning table

dayakar_sama
Explorer
0 Likes
1,284

Hi All,

I am using the function module ALM_ME_MOBILE_STATUS_CHANGE for deleting a system status by passing the object number.

But is not returning the messages.

Please help.


regards,

7 REPLIES 7
Read only

Clemenss
Active Contributor
0 Likes
1,240

no code no details no help

Read only

Former Member
0 Likes
1,240

Hi,

   You cannot get it directly, you must Declare and Get.

For Ex.

DATA:
        T_MSG TYPE TABLE OF BDCMSGCOLL,   " Collecting Error messages
        W_MSG TYPE BDCMSGCOLL.

     LOOP AT T_MSG INTO W_MSG WHERE MSGTYP EQ 'E'.

Endloop.

LikeWise you can get, Try this i may be Helpfull for you.

Thanks & Regards,

Gopi Manjunath.

Read only

0 Likes
1,240

Hi Clemens,

Please find the below code, which i am using.

can you please tell me why i am not getting the messages from the above mentioned FM.

*Tables

TABLES: aufk , jest.

*Types

TYPES:

   BEGIN OF ty_change_order,

     aufnr TYPE aufk-aufnr,

     objnr TYPE aufk-objnr,

     flag  TYPE flag,

   END OF ty_change_order,

   BEGIN OF ty_order_no_mobi,

     aufnr TYPE aufk-aufnr,

     objnr TYPE aufk-objnr,

     flag  TYPE flag,

     msg   TYPE char255,

   END OF ty_order_no_mobi,

   BEGIN OF ty_sys_status,

     objnr TYPE jest-objnr,

     stat  TYPE jest-stat,

   END OF ty_sys_status.

*Types tables

TYPES:

   tt_change_order  TYPE STANDARD TABLE OF ty_change_order,

   tt_order_no_mobi TYPE STANDARD TABLE OF ty_order_no_mobi,

   tt_sys_status    TYPE STANDARD TABLE OF ty_sys_status,

   tt_return        TYPE STANDARD TABLE OF bapiret2.

*Internal Tables

DATA:

  i_change_order       TYPE tt_change_order,

  i_order_no_mobi      TYPE tt_order_no_mobi,

  i_sys_status         TYPE tt_sys_status,

  i_return             TYPE tt_return,

  i_return2            TYPE bapiret2,

  i_fieldcat           TYPE lvc_t_fcat.

*Work areas

DATA:

  wa_change_order  TYPE ty_change_order,

  wa_order_no_mobi TYPE ty_order_no_mobi,

  wa_sys_status    TYPE ty_sys_status,

  wa_return        TYPE bapiret2,

  wa_fieldcat      TYPE lvc_s_fcat,

  wa_layout        TYPE lvc_s_layo.

DATA: grid1      TYPE REF TO cl_gui_alv_grid,

      container1 TYPE REF TO cl_gui_custom_container,

      gv_flag    TYPE flag.

*********************************************************************

***Select-options

*********************************************************************

SELECT-OPTIONS : s_order FOR aufk-aufnr.

*********************************************************************

***Start-of-selection

*********************************************************************

START-OF-SELECTION.

  SELECT aufnr

         objnr

    FROM aufk

    INTO TABLE i_change_order

   WHERE aufnr IN s_order.

  IF i_change_order[] IS NOT INITIAL.

    SELECT objnr

           stat

      FROM jest

      INTO TABLE i_sys_status

       FOR ALL ENTRIES IN i_change_order

     WHERE objnr = i_change_order-objnr

       AND stat = 'I0630'.

  ENDIF.

  IF sy-subrc EQ 0.

    SORT i_sys_status BY objnr.

  ENDIF.

  FIELD-SYMBOLS: <fs_change_order> TYPE ty_change_order.

  LOOP AT i_change_order ASSIGNING <fs_change_order>.

    READ TABLE i_sys_status

          INTO wa_sys_status

          WITH KEY objnr = <fs_change_order>-objnr.

    IF sy-subrc EQ 0.

      <fs_change_order>-objnr = wa_sys_status-objnr.

    ELSE.

      <fs_change_order>-flag = 'X'.

      wa_order_no_mobi = <fs_change_order>.

      wa_order_no_mobi-msg = 'Order is not having MOBI status'.

      APPEND wa_order_no_mobi TO i_order_no_mobi.

      CLEAR wa_order_no_mobi.

    ENDIF.

  ENDLOOP.

  DELETE i_change_order WHERE flag = 'X'.

*Remove the system status MOBI for orders

  LOOP AT i_change_order INTO wa_change_order.

    CALL FUNCTION 'ALM_ME_MOBILE_STATUS_CHANGE'

      EXPORTING

        object_no                      = wa_change_order-objnr

        delete                         = 'X'

        order_id                       = wa_change_order-aufnr

*   NOTIF_ID                       =

        commit                         = 'X'

      TABLES

        return                         = i_return

EXCEPTIONS

   cannot_lock_order              = 1

   status_cannot_be_changed       = 2

   order_not_released             = 3

   cannot_lock_notif              = 4

   OTHERS                         = 5

               .

    IF sy-subrc <> 0.

*      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

*              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

    ENDIF.

  ENDLOOP.

  CALL SCREEN 0100.

Read only

0 Likes
1,240

Hi,

Internal table  i_return[] will get you all the messages.Based on the i_return-type you can seperate between error messages, information messages and warnings.

With regards,

Read only

Former Member
0 Likes
1,240

hi,

Please Check The internal table of i_return and Structure of the Function 'ALM_ME_MOBILE_STATUS_CHANGE' are Same even this 2 are Different you will not get Value in i_return

Thanks & Regards,

Gopi Manjunath

Read only

0 Likes
1,240

Hi,

That didn't help.

If you can check the code , i am using the right structure.

thanks,

sama

Read only

Former Member
0 Likes
1,240

Hi Sama,

              There is nothing wrong in your code. You will get the messages in I_RETURN only in case of an Error or Warning and not for successful cases. It is working for me in my test system and i am getting messages in I_RETURN. Have you tried debugging inside the FM and noticed its behaviour for the data you are passing? If not please try. I guess you are executing the successfull cases.

Best Regards,

Srikanth