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

Problem in ALV

Former Member
0 Likes
2,370

Hi Guys,

I have a small problem in ALV.

For my report output I have used ALV.

I used two function modules

1) REUSE_ALV_FIELDCATALOG_MERGE

2) REUSE_ALV_GRID_DISPLAY

My output every thing is fine.

My problem here is when I am pressing Back or Up arrow its not going back .Its again coming to the same output screen..

Can you guide me how to go to previous screen..

Thanks & Regards,

Sudheer.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,312

Hi,

Drop the entire code, wil try to execute in my machine

Regards,

Venkatesh

Hi,

Drop the entire code, wil try to execute in my machine

Regards,

Venkatesh

20 REPLIES 20
Read only

Former Member
0 Likes
2,312

Hi ,

may be you dont have the GUI status activated in your program

Normaly for alv programs we wil be copying the GUI status from

SAPLKKBL program through the transaction SE41.

So you have to activate the gui status in your program

Then it will be solved.

Regards,

Venkatesh

Read only

0 Likes
2,312

Hi Venkatesh,

I didnt not copied any GUI status.

Read only

Former Member
0 Likes
2,312

check the sample code. if the problem still there post ur code.

REPORT  ztest_alv_color.
 
TYPE-POOLS: slis.
 
DATA: BEGIN OF it_flight OCCURS 0,
       carrid  LIKE sflight-carrid,
       connid   LIKE sflight-connid,
       fldate   LIKE sflight-fldate,
       seatsmax LIKE sflight-seatsmax,
       seatsocc LIKE sflight-seatsocc,
       color TYPE lvc_t_scol,
      END OF it_flight.
DATA: it_fieldcat TYPE  slis_t_fieldcat_alv,
      layout TYPE  slis_layout_alv.
 
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
  EXPORTING
    i_program_name         = sy-repid
    i_internal_tabname     = 'IT_FLIGHT'
    i_inclname             = sy-repid
  CHANGING
    ct_fieldcat            = it_fieldcat
  EXCEPTIONS
    inconsistent_interface = 1
    program_error          = 2.
 
SELECT  carrid
       connid
       fldate
       seatsmax
       seatsocc
 FROM sflight
 INTO CORRESPONDING FIELDS OF TABLE it_flight
 UP TO 20 ROWS.
DATA: col TYPE lvc_s_scol,
      coltab TYPE lvc_t_scol,
color TYPE lvc_s_colo.
 
color-col = '6'.
color-int = '0'.
color-inv = '0'.
 
LOOP AT it_flight.
 
  IF it_flight-seatsocc NE it_flight-seatsmax.
    col-fname = 'SEATSOCC'.
    col-color = color.
    APPEND col TO coltab.
    CLEAR col.
    it_flight-color = coltab.
  ENDIF.
  MODIFY  it_flight.
ENDLOOP.
layout-coltab_fieldname = 'COLOR'.
 
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
  EXPORTING
    i_callback_program = sy-repid
    is_layout          = layout
    it_fieldcat        = it_fieldcat
  TABLES
    t_outtab           = it_flight
  EXCEPTIONS
    program_error      = 1.

Read only

Former Member
0 Likes
2,312

Hi ,

Goto SE41 tcode and then give

SAPLKKBL program name

and inthe status give STANDARD_FULLSCREEN

and then there will be button called Status. ( copy status )

after that you need to give your program name and

status name.

after that goto your program activate it.

And after that you need to give a small code

also

Have this

----


*& Form SET_PF_STATUS

&----


  • text

----


  • -->EXTAB text

----


FORM SET_PF_STATUS USING EXTAB TYPE SLIS_T_EXTAB. "#EC NEEDED

SET PF-STATUS 'ZSTANDARD1'. ENDFORM. "set_pf_status

and

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

  • I_INTERFACE_CHECK = ' '

  • I_BYPASSING_BUFFER = ' '

  • I_BUFFER_ACTIVE = ' '

I_CALLBACK_PROGRAM = G_REPID

I_CALLBACK_PF_STATUS_SET = 'SET_PF_STATUS'

Then it will work fine.

regards,

Venkatesh

Read only

0 Likes
2,312

Hi Venkatesh I am getting syntax error for this.

there is no peform statement ..

so i have added perform statement like this

PERFORM SET_PF_STATUS

USING

EXTAB.

FORM SET_PF_STATUS USING EXTAB TYPE SLIS_T_EXTAB.

SET PF-STATUS 'ZSTANDARD'.

ENDFORM.

still getting error.

can u explain me in detail.

Thanks.....

Read only

0 Likes
2,312

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = SY-REPID

I_CALLBACK_PF_STATUS_SET = 'STATUS'

you dont need to use perform statement for that.

you have to use Form implementation with the name you mentioned in the above

but why you need this, Are you adding any extra buttons. if you dont want any buttons then you can use my above code and check .

FORM STATUS using extab type slis_t_extab.

set pf-status 'STANDARD' excluding extab.

ENDFORM.

Read only

0 Likes
2,312

Hi Vijay,

I am still getting the same error that the structure introduced by form must be closed by endform..

Any how i will send my code plz check this.

form alvoutput.

type-pools: slis.

data repid type sy-repid.

data: t_previewb type slis_t_fieldcat_alv,

events_b type slis_t_event.

repid = sy-repid.

FORM STATUS using extab type slis_t_extab.

set pf-status 'STANDARD' excluding extab.

ENDFORM.

if pa_fcode eq 'ECSP'.

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

I_PROGRAM_NAME = REPID

I_INTERNAL_TABNAME = 'T_PREVIEW'

  • I_STRUCTURE_NAME = 'LFA1'

I_CLIENT_NEVER_DISPLAY = 'X'

I_INCLNAME = REPID

  • I_BYPASSING_BUFFER =

  • I_BUFFER_ACTIVE =

CHANGING

CT_FIELDCAT = t_previewb

EXCEPTIONS

INCONSISTENT_INTERFACE = 1

PROGRAM_ERROR = 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.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

  • I_INTERFACE_CHECK = ' '

  • I_BYPASSING_BUFFER =

  • I_BUFFER_ACTIVE = ' '

I_CALLBACK_PROGRAM = REPID

I_CALLBACK_PF_STATUS_SET = 'STATUS'

  • I_CALLBACK_USER_COMMAND = ' '

  • I_CALLBACK_TOP_OF_PAGE = ' '

  • I_CALLBACK_HTML_TOP_OF_PAGE = ' '

  • I_CALLBACK_HTML_END_OF_LIST = ' '

  • I_STRUCTURE_NAME =

  • I_BACKGROUND_ID = ' '

  • I_GRID_TITLE =

  • I_GRID_SETTINGS =

  • IS_LAYOUT =

IT_FIELDCAT = t_previewb

  • IT_EXCLUDING =

  • IT_SPECIAL_GROUPS =

  • IT_SORT =

  • IT_FILTER =

  • IS_SEL_HIDE =

I_DEFAULT = 'X'

I_SAVE = ' '

  • IS_VARIANT =

IT_EVENTS = EVENTS_B

  • IT_EVENT_EXIT =

  • IS_PRINT =

  • IS_REPREP_ID =

  • I_SCREEN_START_COLUMN =

  • I_SCREEN_START_LINE =

  • I_SCREEN_END_COLUMN =

  • I_SCREEN_END_LINE =

  • IT_ALV_GRAPHICS =

  • IT_ADD_FIELDCAT =

  • IT_HYPERLINK =

  • IMPORTING

  • E_EXIT_CAUSED_BY_CALLER =

  • ES_EXIT_CAUSED_BY_USER =

TABLES

T_OUTTAB = t_preview

EXCEPTIONS

PROGRAM_ERROR = 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.

elseif pa_fcode eq 'EVSP'.

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

I_PROGRAM_NAME = REPID

I_INTERNAL_TABNAME = 'T_PREVIEWV'

  • I_STRUCTURE_NAME = 'LFA1'

I_CLIENT_NEVER_DISPLAY = 'X'

I_INCLNAME = REPID

  • I_BYPASSING_BUFFER =

  • I_BUFFER_ACTIVE =

CHANGING

CT_FIELDCAT = t_previewb

EXCEPTIONS

INCONSISTENT_INTERFACE = 1

PROGRAM_ERROR = 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.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

  • I_INTERFACE_CHECK = ' '

  • I_BYPASSING_BUFFER =

  • I_BUFFER_ACTIVE = ' '

I_CALLBACK_PROGRAM = REPID

I_CALLBACK_PF_STATUS_SET = 'STATUS'

  • I_CALLBACK_USER_COMMAND = ' '

  • I_CALLBACK_TOP_OF_PAGE = ' '

  • I_CALLBACK_HTML_TOP_OF_PAGE = ' '

  • I_CALLBACK_HTML_END_OF_LIST = ' '

  • I_STRUCTURE_NAME =

  • I_BACKGROUND_ID = ' '

  • I_GRID_TITLE =

  • I_GRID_SETTINGS =

  • IS_LAYOUT =

IT_FIELDCAT = t_previewb

  • IT_EXCLUDING =

  • IT_SPECIAL_GROUPS =

  • IT_SORT =

  • IT_FILTER =

  • IS_SEL_HIDE =

I_DEFAULT = 'X'

I_SAVE = ' '

  • IS_VARIANT =

IT_EVENTS = EVENTS_B

  • IT_EVENT_EXIT =

  • IS_PRINT =

  • IS_REPREP_ID =

  • I_SCREEN_START_COLUMN =

  • I_SCREEN_START_LINE =

  • I_SCREEN_END_COLUMN ? =

  • I_SCREEN_END_LINE =

  • IT_ALV_GRAPHICS =

  • IT_ADD_FIELDCAT =

  • IT_HYPERLINK =

  • IMPORTING

  • E_EXIT_CAUSED_BY_CALLER =

  • ES_EXIT_CAUSED_BY_USER =

TABLES

T_OUTTAB = t_preview

EXCEPTIONS

PROGRAM_ERROR = 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.

endif.

endform.

plz check this....

Read only

0 Likes
2,312

move this out of main form. this should be out of the form.

FORM STATUS using extab type slis_t_extab.

set pf-status 'STANDARD' excluding extab.

ENDFORM.

one more Question why you want PF-status , are you adding any new buttons.

Read only

0 Likes
2,312

No Vijay,

I am not using any new buttons.

U can c my code above.

I am getting my output exactly,but when I am trying to click on BACK or UP Arrow symbol it not going back or not going to Exit from the screen.

Thanks & Regards,

Sudheer.

Read only

Former Member
0 Likes
2,312

Hi,

you did a small mistake here

form alvoutput.

type-pools: slis.

data repid type sy-repid.

data: t_previewb type slis_t_fieldcat_alv,

events_b type slis_t_event.

repid = sy-repid.

FORM STATUS using extab type slis_t_extab.

set pf-status 'STANDARD' excluding extab.

ENDFORM.

here how can you write form inside a form

remove this

FORM STATUS using extab type slis_t_extab.

set pf-status 'STANDARD' excluding extab.

ENDFORM.

out and put it some other place.

nested forms are not allowed in SAP

regards,

Venkatesh

Read only

Former Member
0 Likes
2,313

Hi,

Drop the entire code, wil try to execute in my machine

Regards,

Venkatesh

Read only

0 Likes
2,312

Hi Venkatesh,

RIght now I have added this PF-STATUS .

I dont know really what happened only the output is coming remaing screen is completely diabled.

I cannot give u the complete code bcoz for this ALV the data is coming from different table and different report programs.

This program is 3000 lines code .

I am really not understanding what to do?

huhhhhhhhhhhhhhh

Edited by: sudheer chowdhary on Jul 26, 2008 2:25 AM

Read only

0 Likes
2,312

Hi All,

Is there any solution for this...

My Back and Up Button in not working in ALV's.

Thanks........

Read only

0 Likes
2,312

I asked many times but you never responded to that.

why you need the PF-STATUS ? , You have any Custom Buttons in the ALV

otherwise you don't need the PF-STATUS , By Default ALV COmes up with its own status. and did you got a chance to check the Program i mentioned in My post.

you are telling it is not working, but not telling any thing beyond that what you are doing.

Read only

0 Likes
2,312

Hi Vijay,

In Fact there is no need of PF-STATUS.

I have desinged an alv report by using the two ALV FM's as I have mentioned .

I have linked this program to a seperate transaction.

When I go to that transaction and execute this I am getting my output correctly.

For coming back out of report output when I am pressing back button its again staying in the same screen.

This is the only problem I am facing...

Read only

0 Likes
2,312

Now it is clear.check this and let me know.

you can use user_command , not PF_STATUS &F03

REPORT  ztest_alv.
 
TYPE-POOLS:slis.
DATA:it_fieldcat  TYPE  slis_t_fieldcat_alv,
     wa_field LIKE LINE OF it_fieldcat.
DATA: BEGIN OF it_likp OCCURS 0,
       vbeln TYPE likp-vbeln,
      END OF it_likp.
 
wa_field-fieldname = 'VBELN'.
wa_field-tabname = 'IT_LIKP'.
wa_field-hotspot = 'X'.
APPEND wa_field TO it_fieldcat.
 
SELECT vbeln FROM likp
UP TO 10 ROWS
INTO TABLE it_likp.
 
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
  EXPORTING
    i_callback_program      = sy-repid
    i_callback_user_command = 'USER_COMMAND'
    it_fieldcat             = it_fieldcat
  TABLES
    t_outtab                = it_likp
  EXCEPTIONS
    program_error           = 1.
 
*&---------------------------------------------------------------------*
*&      Form  user_Command
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->UCOMM      text
*      -->SELFIELD   text
*----------------------------------------------------------------------*
FORM user_command USING ucomm TYPE sy-ucomm
                    selfield TYPE slis_selfield.
  CASE ucomm.
 
    WHEN '&F03'. "<--this is for Back
  
      selfeild-exit = 'X'.
      leave to screen 0.
   
    ENDCASE.
 
ENDFORM. "user_Command

Read only

0 Likes
2,312

Hi Vijay,

I have used the same .

Right now its working fine...

Thanks a lot Dude...

But Still I have a question why is the need of using this sy-ucomm.

The ALV Grid control itself should provide these functionalities.

Any way Thanks a lot .

Read only

0 Likes
2,312

It will handle when it is executed directly. But in your case you are calling from Transaction, that is not taking you back. So we handled that case.

Read only

0 Likes
2,312

Thanks for ur continuous support vijay

Read only

0 Likes
2,312

Welcome.

Best Regards

Vijay Babu Dudla