Application Development 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: 

ALV that show 15 differents reports

former_member384574
Active Participant
0 Kudos

Hi experts!!

I need to create an ALV that depending on the button clicked must shown one or other report. I've 15 differents button and 15 differents reports and I can't make 15 differents tables... does anybody know how can I do this?

Thanks a lot,

Regards,

Rebeca

9 REPLIES 9

ThomasZloch
Active Contributor
0 Kudos

If the reports are not too different (same underlying tables, but different columns, sorting, summation), you can use prepared ALV layouts for this and work with one general field catalog.

Thomas

Former Member
0 Kudos

Hi,

What you can do is in the user command of the main report, check the user command and depending on that, call the next report. You will need 15 tables.


*&---------------------------------------------------------------------*
*&      Form  USER_COMMAND                                             *
*&---------------------------------------------------------------------*
FORM user_command USING r_ucomm LIKE sy-ucomm
                        rs_selfield TYPE slis_selfield.

  DATA : lw_answer(1) TYPE c.
  DATA: lw_idx TYPE i.

  CLEAR  : idocs_collected ,rs_selfield-refresh.

  CASE r_ucomm.

    WHEN '&IC1'.

      READ TABLE i_data INDEX rs_selfield-tabindex.
      IF sy-subrc IS INITIAL.

        IF rs_selfield-fieldname = 'IDOC_NUMBER'.
          DATA : docnum LIKE bapi_idoca-docnum.
          MOVE i_data-idoc_number TO docnum.
*          SHIFT docnum RIGHT DELETING TRAILING space.
*          TRANSLATE docnum USING ' 0'.

          CALL FUNCTION 'BAPI_IDOCAPPL_DISPLAY'  " Shows the IDoc
            EXPORTING
              idocnumber       =  docnum
*         IMPORTING
*           RETURN           =
  .
        ELSE.
          PERFORM display_options    " Calls ALV report
            USING i_data-aubel i_data-aupos i_data-knumv i_data-kursf
                  i_data-waerk.
        ENDIF.

      ENDIF.

    WHEN 'IDOC'.

      LOOP AT i_data WHERE mark = 'X'.

*       No IDoc for Commission Document Type and Special Vehicle type P
        IF i_data-blart IN so_comdt AND i_data-zzspecv = 'P'.
          i_data-mark = ''.
          MODIFY i_data TRANSPORTING mark.
          CONTINUE.
        ENDIF.

        lw_idx = sy-tabix.
*       If IDoc is not sent or Warning should be ignored.
        IF i_data-idoc_number IS INITIAL OR nowarn EQ c_x.
          PERFORM fill_data_record USING i_data lw_idx.
          IF p_lotus = c_x.
            PERFORM send_idoc CHANGING g_idoc_num.
*         Update the Idoc number on list
            i_data-idoc_number = g_idoc_num.
*            SHIFT i_data-idoc_number LEFT DELETING LEADING '0'.
            MODIFY i_data TRANSPORTING idoc_number.
*         Move data to be updated in DB later
            ADD 1 TO w_idocs.
            MOVE i_data-belnr TO i_zsd_idocs_sent-zzbelnr.
            MOVE 'L' TO i_zsd_idocs_sent-zzinterface.
            MOVE i_data-idoc_number TO i_zsd_idocs_sent-zzidoc_num.
            MOVE sy-datum TO i_zsd_idocs_sent-zzdate.
            APPEND i_zsd_idocs_sent.
            CLEAR : i_zsd_idocs_sent,g_idoc_num.
          ELSE. " For Conbat......
            idocs_collected = c_x.
          ENDIF.
        ELSE.
          PERFORM popup_idoc_sent USING i_data-belnr
                                  CHANGING lw_answer.

          CASE lw_answer.
            WHEN '1'.

              PERFORM fill_data_record USING i_data lw_idx.
              IF p_lotus = c_x.
                PERFORM send_idoc CHANGING g_idoc_num.
*               Update the Idoc number on list
                i_data-idoc_number = g_idoc_num.
*                SHIFT i_data-idoc_number LEFT DELETING LEADING '0'.
                MODIFY i_data TRANSPORTING idoc_number.
*               Move data to be updated in DB later
                ADD 1 TO w_idocs.
                MOVE i_data-belnr TO i_zsd_idocs_sent-zzbelnr.
                MOVE 'L' TO i_zsd_idocs_sent-zzinterface.
                MOVE i_data-idoc_number TO i_zsd_idocs_sent-zzidoc_num.
                MOVE sy-datum TO i_zsd_idocs_sent-zzdate.
                APPEND i_zsd_idocs_sent.
                CLEAR : i_zsd_idocs_sent,g_idoc_num.
              ELSE.  " For Conbat......
*             Flag to tell that there are IDocs to be sent.
                idocs_collected = c_x.

              ENDIF.

            WHEN OTHERS.
*             clear the mark.
              i_data-mark = ''.
              MODIFY i_data.
          ENDCASE.

        ENDIF.
        CLEAR lw_idx.
      ENDLOOP.
*     for Conbat check if there are records to be sent.
      IF p_conbat = c_x AND idocs_collected = c_x.

        PERFORM send_idoc CHANGING g_idoc_num.

        LOOP AT i_data WHERE mark = 'X'.
          i_data-idoc_number = g_idoc_num.
*          SHIFT i_data-idoc_number LEFT DELETING LEADING '0'.
          MODIFY i_data TRANSPORTING idoc_number.

*         Move data to be updated in DB later
          ADD 1 TO w_idocs.
          MOVE i_data-belnr TO i_zsd_idocs_sent-zzbelnr.
          MOVE 'C' TO i_zsd_idocs_sent-zzinterface.
          MOVE i_data-idoc_number TO i_zsd_idocs_sent-zzidoc_num.
          MOVE sy-datum TO i_zsd_idocs_sent-zzdate.
          APPEND i_zsd_idocs_sent.
          CLEAR : i_zsd_idocs_sent.

        ENDLOOP.
        CLEAR g_idoc_num.
      ENDIF.
*     refresh the list when the user command to send the IDoc.
      rs_selfield-refresh = 'X'.

    WHEN 'COND'.

      READ TABLE i_data INDEX rs_selfield-tabindex.
      IF sy-subrc IS INITIAL.
        PERFORM display_conditions USING i_data.  " Calls a ALV
      ELSE.
        MESSAGE 'No conditions found' TYPE 'I'.
      ENDIF.

  ENDCASE.

In the above code, I'm calling 2 reports and 1 transaction based on the user command.

regards,

Advait

Edited by: Advait Gode on Oct 17, 2008 11:32 AM

former_member188685
Active Contributor
0 Kudos

Thomas suggestion is good. Adding to that if your internal tables are same then it works very well. If they are different then you may have to work with 15 internal tables, and one Field-symbols , one function call.

0 Kudos

The problem is that I can't use 15 tables...I don't know why...but I can't use them...the reports aren't very differents, probably only change, more or less, 4 or 5 fields... I think I can do this with an ALV OO with blocks or something like that, I read any documentation through internet but I can't understand how to do...and If I add two differents blocks (one for common data and the other for the variant data) I don't know when I see the completly ALV I will have two differents section...because I only want a tabla....

I don't know how to make this.... :S

Thanks a lot,

Regards,

Rebeca

0 Kudos

But you said you are having 15 buttons....

imagine 15 report on a single report , who will watch them. they may miss some information if at all some body really interested to see them.

My suggestion would be combine all of them and show one report. control them using the Layout Variants.

0 Kudos

u can make a single table which has all the fields and hide the fields as applicable using fieldcat .

Former Member
0 Kudos

Hi,

You can do it easily..............Just use the Interactive ALV feature for this.......For every button Click..call an ALV ....

Former Member
0 Kudos

hi,

ALV shows report based on field catelog. you write code 15 different field catelog. it is enough to display diffrent output

former_member585060
Active Contributor
0 Kudos

Hi,

Not sure this idea will work or not,

First create a Output for 1st Report, and in that report in

REUSE_ALV_LIST_DISPLAY function module, assign a STATUS to I_CALLBACK_PF_STATUS, I

n that create 14 push buttons on Application toolbar.

Now do the coding with CASE statement, when ever you click any button, under that, write the logic to get data and display with REUSE_ALV_LIST_DISPLAY, and assign same I_CALLBACK_PF_STATUS as STATUS.

Like that create 14 separate REUSE_ALV_LIST_DISPLAY for each button.

Regards

Bala Krishna