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: 

function to get info abt variant and layout of a secific report

Former Member
0 Kudos

Hi ,

I have report zmm4. I have created a variant 'var1' .

The output format of the report is defined in the layout

'lay1'. Which is the function which gives the complete info about the displaying coulmns of those layout ? because I need replicate these functionality in EP .

Please don't say USE "SAP transaction Iviews'.

any hint is appreciated

thanks

pkiran

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Assuming it's an ALV report and your display variant is lay1, you have one extra structure to fill and pass to REUSE_ALV_LIST_DISPLAY.


data: variant like disvariant.

  variant-report  = sy-repid.
  variant-variant = 'lay1'.
  variant-text    = 'Your text here'.

  call function 'REUSE_ALV_LIST_DISPLAY'
       exporting
...
            ls_variant               = variant
...

This will make the default display variant VAR1, and any others will still be selectable.

Rob

17 REPLIES 17

Former Member
0 Kudos

If your ZMM4 is an ALV report then REUSE_ALV_VARIANT_GET should help you get the layouts.

I am not sure of the variants of the report.

Ravi

Former Member
0 Kudos

Assuming it's an ALV report and your display variant is lay1, you have one extra structure to fill and pass to REUSE_ALV_LIST_DISPLAY.


data: variant like disvariant.

  variant-report  = sy-repid.
  variant-variant = 'lay1'.
  variant-text    = 'Your text here'.

  call function 'REUSE_ALV_LIST_DISPLAY'
       exporting
...
            ls_variant               = variant
...

This will make the default display variant VAR1, and any others will still be selectable.

Rob

0 Kudos

Table <b>VARIS</b> would give you the variants per program and the following FM can be used to get the details of the variant.

RS_VARIANT_CONTENTS_RFC

as for layout details you can use the FM mentioned by Ravi.

Regards

Raja

0 Kudos

Hi Raja,

thanks for the reply on variant part...

Yes On variant side.. RS_VARIANT_CONTENTS_RFC gives the complete info on the variant part by passwing the reports anme and varaint name ...

But on layout part .. ALV is not any use in my situation as I need the export the data to Enterprise portal(EP).

My focus is on the Number of coulmns displayed on that perticular layout and data. In EP , I will display the data in the HTML format in EP. In this situation I am interested in Data part not on the ALV part as I need to display in EP environment..

My requirement is something like this ..

I know the report name( ZMM4 ) and variant name( var1 )

by passing these to information to a FM I need to get the data in the specific layout format which is linked to those two parameter..

Please note that I am not using any ALV ... as this data has to be exported to the Enterprise portal ENV

thanks in advance

pkiran

0 Kudos

Here is my understanding.

You have a ABAP report which produces ABAP List. Now you want to be able to execute the report from EP and get the data and display it something like in a htmlb tableview.

Is it right?

its going to be little tricky.

wrap the ABAP report in a RFC FM. within that submit the report with the option EXPORTING LIST TO MEMORY

then us FM LIST_FROM_MEMORY

and then you have to build a logic to parse this list and present it in a tabulor format.

Hope this helps.

Regards

Raja

0 Kudos

Yes you got what my requirement is ...

Is there any built in function which can retrieve only the data or should I have to write the parsing logic on my own

thanks

pkiran

0 Kudos

there is no in built function.

there are couple of options:

1. there is a function called WWW_HTML_FROM_LISTOBJECT which would return the html string for the list with all the formatting as you see in ABAP list page. In this approach you wont have any control over the data. (check out the handler class for service report in scif tree at sap/bc/report)

2. If you can modify the Z ABAP report you could, based on certain parameter (for example when called from portal) generate xml output of the result table using <b>CALL TRANSFORMATION</b> and when its run online in SAP GUI just print it to ABAP list. This way this program can run online as well as used by portal application.

I would prefer the second, as this way you would just get the data alone in a nice XML format which portal application can parse easily.

Regards

Raja

0 Kudos

Thanks

pkiran

0 Kudos

can you mark this thread as answered

0 Kudos

Hi Raja,

can you please elaborate the second option even a bit of code is really helpful.

I tried with submit report in wraped RFC . but I am getting SAP GUI for the report enrty screnn and also the report result .. how to supress the SAP GUI window..

thanks

pkiran

0 Kudos

you have to pass the selection screen values and also use the addition exporting list to memory and return.

post the code here i will correct it.

give me some time i will post a code for the second example.

Regards

Raja

0 Kudos

here is the code sample.

parameters: r1 radiobutton group rg1 default 'X',
            r2 radiobutton group rg1 .

data: itab like sflight occurs 0 with header line.
data: xml_out type string.

start-of-selection.

select * up to 10 rows from sflight into table itab.

if r1 eq 'X'. "XML
clear xml_out .
    call transformation (`ID`)
             source output = itab[]
             result xml xml_out.
write:/ xml_out .

elseif r2 eq 'X' . "list
loop at itab .
write:/ itab-carrid ,
        itab-connid .
endloop .

endif .

you can do a submit of the report and then do lit_from_memory and get the data.

Regards

Raja

0 Kudos

thanks Raja

pkiran

0 Kudos

Hi Raja,

This is my src code

******

submit zrpt_mm_045 with s_werks-low = s_werks

with s_mtart-low = s_mtart_low

with s_mtart-high = s_mtart_high

with s_matnr-low = s_matnr_low

with s_matnr-high = s_matnr_high

with s_budat-low = s_budat_low

with s_budat-high = s_budat_high

with s_lgort-low = s_lgort

with rb1 = rb1

with rb2 = rb2

with rb3 = rb3

EXPORTING LIST TO MEMORY

AND RETURN.

CALL FUNCTION 'LIST_FROM_MEMORY'

TABLES

listobject = itheader

  • EXCEPTIONS

  • NOT_FOUND = 1

  • OTHERS = 2

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

*export itheader from itheader to internal table itab.

*SUBMIT ZRPT_MM_045 USING SELECTION-SET 'QQQ' AND RETURN.

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

I have tried in two ways

one is assgining the value to each parameter and just by calling the report with it's variant

I got the result in both ways but I need to accomplish two tasks .

One is to suppress the SAp GUI

second is to parse the data ... how to parse the reult data, After I transfereed ther data into a table All I got is just a hige numbers ... I do not know how to parse this data as I do not follow its structure ... Any help or a piece of code will be of greate help for me

thanks

pkiran

0 Kudos

with your code you should not be getting the GUI at all when submitting. (gui of the submitted program)

after the LIST_FROM_MEMORY

call the following function to convert to asci.

data: listasci like soli occurs 0 with header line .

CALL FUNCTION 'LIST_TO_ASCI'
* EXPORTING
*   LIST_INDEX               = -1
*   WITH_LINE_BREAK          = ' '
  TABLES
    listasci                 = listasci
   LISTOBJECT               = list
 EXCEPTIONS
   EMPTY_LIST               = 1
   LIST_INDEX_INVALID       = 2
   OTHERS                   = 3
          .
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

Regards

Raja

0 Kudos

i hope i have answered your question.

Can you mark the thread as answered and award point if it was helpful.

Regards

Raja

0 Kudos

Thanks Raja

pkiran