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

MB5B Report

0 Likes
2,314

Hi,

My requirements is, Calling MB5B in custom report and add a extra column in custom report and display the all MB5B tcode values in report.

Please help me out with the logic,

Thanks and Regards,

Lakshmi N

Hi,

My requirements is, Calling MB5B in custom report and add a extra column in custom report and display the all MB5B tcode values in report.

Please help me out with the logic,

Thanks and Regards,

Lakshmi N

3 REPLIES 3
Read only

Abinathsiva
Active Contributor
0 Likes
2,052

Hi,

This can be addressed by submit code please find the sample code below...

  DATA: gr_table TYPE REF TO   data,
        gt_line  TYPE REF TO   data.

  FIELD-SYMBOLS: <gt_table> TYPE STANDARD TABLE,
                 <gt_tline> TYPE any.

  cl_salv_bs_runtime_info=>set(
      EXPORTING display  = abap_false
                metadata = abap_false
                data     = abap_true ).

*  FREE MEMORY ID sy-uname.
  SUBMIT rm07mlbd EXPORTING LIST TO MEMORY WITH matnr IN s_matnr " MatNo
                      WITH werks  IN s_werks            " Plant
                      WITH bukrs EQ 'XXXX'           " Company Code
                      WITH mtart  IN s_mtart          " Material type
                      WITH lgort  IN s_lgort  " Storage Location
                      WITH datum  IN s_budat " Selection Date
                    WITH lgbst  EQ 'X'   " Storage Loc/ Batch Stock
                      WITH bwbst  EQ ' '  " Valuated Stock
                    WITH sbbst  EQ ' '   " Special Stock
                    WITH pa_sumfl EQ 'X' " totals only - non heir rep
*                    WITH XCHAR EQ ' '
*                    WITH XNOMCHB EQ ' '
*                   WITH XCHAR EQ XCHAR " only matls handled in batches
*                   WITH XNOMCHB EQ XNOMCHB " also batches w/o stk seg
                      AND RETURN.

  TRY.
      cl_salv_bs_runtime_info=>get_data_ref(
        IMPORTING r_data      = gr_table ).
      ASSIGN gr_table->* TO <gt_table>.
    CATCH cx_salv_bs_sc_runtime_info.
      MESSAGE: text-m01 TYPE 'S' DISPLAY LIKE 'E'.
      LEAVE LIST-PROCESSING.
  ENDTRY.

  cl_salv_bs_runtime_info=>clear_all( ).
  IF <gt_table>[] IS ASSIGNED.

  ENDIF.

 
  CREATE DATA gt_line LIKE LINE OF <gt_table>.
  ASSIGN gt_line->* TO <gt_tline>.

    LOOP AT <gt_table> INTO <gt_tline>.
    MOVE-CORRESPONDING <gt_tline> TO wa_final.
     APPEND wa_final TO it_final.
    endloop.


Read only

0 Likes
2,052

More detailed information about this technique can be found in the following blog article:

Gain Programmatic Access to Data of SAPGUI ALV Reports

Regards,
Bartosz

Read only

0 Likes
2,052

Actully code as not working as of now.