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: 

Query Regarding ALV - Very Urgent

aaruljothi
Participant
0 Kudos

Hi experts,

I have defined a ALV grid in my program using the startdard function module as editable. Now I want the grid to be displayed in the screen with my pf-status. how can i do that?.

Here is the sample code.

REPORT zadvcformsub

NO STANDARD PAGE HEADING MESSAGE-ID zf

LINE-SIZE 255 LINE-COUNT 66.

INCLUDE zftsvar .

TYPE-POOLS : slis.

TABLES : zftsregstr, zftsintnum, zftscusttc,

zadvcform, konv, knvv, sscrfields.

DATA : it_fieldcat TYPE slis_t_fieldcat_alv.

DATA : w_layout TYPE slis_layout_alv,

w_fieldcat TYPE slis_fieldcat_alv.

DATA : BEGIN OF it_initial OCCURS 1,

bukrs(4) TYPE c,

wkreg(3) TYPE c,

zkunag(10) TYPE c,

validfrom(10) TYPE c,

validto(10) TYPE c,

vkorg(4) TYPE c,

aland(3) TYPE c,

zformtype(1) TYPE c,

frmintno(10) TYPE c,

uname(12) TYPE c,

datum(10) TYPE c,

uzeit(8) TYPE c,

END OF it_initial.

DATA : BEGIN OF it_part OCCURS 1,

zkunag LIKE zadvcform-zkunag,

frmintno LIKE zadvcform-frmintno,

validfrom LIKE zadvcform-validfrom,

validto LIKE zadvcform-validto,

END OF it_part.

DATA : w_sno(2) TYPE c,

w_cust(10) TYPE c,

w_cform(10) TYPE c,

w_from(10) TYPE c,

w_to(10) TYPE c,

w_blank1(10) TYPE c,

w_blank2(10) TYPE c,

w_blank3(10) TYPE c,

w_blank4(10) TYPE c,

w_string_len TYPE i,

w_sel_line(255) TYPE c,

w_indx(2) TYPE c.

SELECTION-SCREEN SKIP 1.

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.

SELECT-OPTIONS:

s_bukrs FOR zadvcform-bukrs NO INTERVALS NO-EXTENSION OBLIGATORY,

s_aland FOR zadvcform-aland NO INTERVALS NO-EXTENSION OBLIGATORY,

s_wkreg FOR zadvcform-wkreg NO INTERVALS NO-EXTENSION OBLIGATORY,

s_vkorg FOR zadvcform-vkorg NO INTERVALS NO-EXTENSION OBLIGATORY,

s_fmtyp FOR zadvcform-zformtype NO INTERVALS NO-EXTENSION OBLIGATORY.

SELECTION-SCREEN END OF BLOCK b1.

INITIALIZATION.

AT SELECTION-SCREEN.

START-OF-SELECTION.

w_fieldcat-fieldname = 'ZKUNAG'.

w_fieldcat-tabname = 'IT_PART'.

w_fieldcat-ref_fieldname = 'ZKUNAG'.

w_fieldcat-ref_tabname = 'ZADVCFORM'.

w_fieldcat-seltext_l = 'Customer Code'.

w_fieldcat-ddictxt = 'L'.

w_fieldcat-input = 'X'.

w_fieldcat-edit = 'X'.

APPEND w_fieldcat TO it_fieldcat.

w_fieldcat-fieldname = 'FRMINTNO'.

w_fieldcat-tabname = 'IT_PART'.

w_fieldcat-ref_fieldname = 'FRMINTNO'.

w_fieldcat-ref_tabname = 'ZADVCFORM'.

w_fieldcat-seltext_l = 'C Form No'.

w_fieldcat-ddictxt = 'L'.

w_fieldcat-input = 'X'.

w_fieldcat-edit = 'X'.

APPEND w_fieldcat TO it_fieldcat.

w_fieldcat-fieldname = 'VALIDFROM'.

w_fieldcat-tabname = 'IT_PART'.

w_fieldcat-ref_fieldname = 'VALIDFROM'.

w_fieldcat-ref_tabname = 'ZADVCFORM'.

w_fieldcat-seltext_l = 'Valid From'.

w_fieldcat-ddictxt = 'L'.

w_fieldcat-input = 'X'.

w_fieldcat-edit = 'X'.

APPEND w_fieldcat TO it_fieldcat.

w_fieldcat-fieldname = 'VALIDTO'.

w_fieldcat-tabname = 'IT_PART'.

w_fieldcat-ref_fieldname = 'VALIDTO'.

w_fieldcat-ref_tabname = 'ZADVCFORM'.

w_fieldcat-seltext_l = 'Valid To'.

w_fieldcat-ddictxt = 'L'.

w_fieldcat-input = ' '.

w_fieldcat-edit = ' '.

APPEND w_fieldcat TO it_fieldcat.

DO 15 TIMES.

CLEAR it_part.

APPEND it_part.

ENDDO.

SET PF-STATUS 'ZADVCFORM_COPY'.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = sy-cprog

  • i_callback_pf_status_set = 'ZADVCFORM_COPY'

it_fieldcat = it_fieldcat

i_grid_title = 'Advanced C Form Submission'

TABLES

t_outtab = it_part[]

EXCEPTIONS

program_error = 1

OTHERS = 2.

IF sy-subrc <> 0.

MESSAGE i039(zaba) WITH 'Error in ALV'.

ENDIF.

-


I am geting the editable ALV grid but how to set my gui status.

regards,

Arul Jothi.

1 ACCEPTED SOLUTION

jayanthi_jayaraman
Active Contributor
0 Kudos

Hi,

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = sy-cprog

I_CALLBACK_PF_STATUS_SET = 'SET_STATUS'

it_fieldcat = it_fieldcat

i_grid_title = 'Advanced C Form Submission'

TABLES

t_outtab = it_part[]

EXCEPTIONS

program_error = 1

OTHERS = 2.

form set_status .

SET PF-STATUS ''ZADVCFORM_COPY' .

endform. " SET_STATUS

Kindly reward points by clicking the star on the left of reply,if it helps.

7 REPLIES 7

alex_m
Active Contributor
0 Kudos

Already discussed go through the link.

https://www.sdn.sap.com/irj/sdn/collaboration

Regards

Alex

Former Member
0 Kudos

Hi arul,

1. First of all create a gui-status with some name.

say 'ZADVCFORM_COPY'.

i assume u have already created it.

MAKE SURE U HAVE ACTIVATED IT.

*----


2. write this code FORM

FORM set_pf_status USING rt_extab TYPE slis_t_extab.

SET PF-STATUS 'ZADVCFORM_COPY'.

ENDFORM. "SET_PF_STATUS

*----


while calling the FM

pass this parameter :

i_callback_pf_status_set = 'SET_PF_STATUS'

Thats it.

regards,

amit m.

Message was edited by: Amit Mittal

jayanthi_jayaraman
Active Contributor
0 Kudos

Hi,

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = sy-cprog

I_CALLBACK_PF_STATUS_SET = 'SET_STATUS'

it_fieldcat = it_fieldcat

i_grid_title = 'Advanced C Form Submission'

TABLES

t_outtab = it_part[]

EXCEPTIONS

program_error = 1

OTHERS = 2.

form set_status .

SET PF-STATUS ''ZADVCFORM_COPY' .

endform. " SET_STATUS

Kindly reward points by clicking the star on the left of reply,if it helps.

0 Kudos

Hi Amit and Jayanthi,

Thanks a lot. It really hepled me in solving the problem. Now I want to capture the events of teh user. i.e. after entering all the values in a row I have to validate the entries. How to do that.

The forum point will be assigned to both of u when i close this thread.

Regards,

arul jothi.

0 Kudos

Hi,

Here is an sample code to handle events.

DATA: I_EVENTS TYPE SLIS_T_EVENT.

PERFORM F4000_EVENTS_INIT CHANGING I_EVENTS.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

..

IT_EVENTS = I_EVENTS

..

TABLES

T_OUTTAB = I_MARA

  • 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.

FORM F4000_EVENTS_INIT USING I_EVENTS TYPE SLIS_T_EVENT.

DATA: LINE_EVENT TYPE SLIS_ALV_EVENT.

CLEAR LINE_EVENT.

LINE_EVENT-NAME = 'TOP_OF_PAGE'.

LINE_EVENT-FORM = 'F4001_TOP_OF_PAGE'.

APPEND LINE_EVENT TO I_EVENTS.

CLEAR LINE_EVENT.

LINE_EVENT-NAME = 'PF_STATUS_SET'.

LINE_EVENT-FORM = 'F4002_PF_STATUS_SET'.

APPEND LINE_EVENT TO I_EVENTS.

CLEAR LINE_EVENT.

LINE_EVENT-NAME = 'USER_COMMAND'.

LINE_EVENT-FORM = 'F4003_USER_COMMAND'.

APPEND LINE_EVENT TO I_EVENTS.

ENDFORM.

FORM F4003_USER_COMMAND USING UCOMM LIKE SY-UCOMM

SELFIELD TYPE SLIS_SELFIELD.

CASE UCOMM.

WHEN '&CHNG'.

READ TABLE I_MARA INDEX SELFIELD-TABINDEX.

IF I_MARA-MATNR NE SPACE.

SET PARAMETER ID 'MAT' FIELD I_MARA-MATNR.

CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN.

CLEAR UCOMM.

ENDIF.

ENDCASE.

ENDFORM.

0 Kudos

Hi Jayanthi,

Thanks for ur reply. now i am able to caputure the events.

Now I have a new problem. I have a field named validfrom which is editable. It can hold date and dependign on that date entered by the user I need to set a date in the other field "validto" which is not editable by user. How to do that. How to capture the "ENTER" key pressed or "TAB" key pressed by the user?

regards,

Arul Jothi.

0 Kudos

Hi Arul,

Set the Function code for 'ENTER' which is the Green Tick button. give some code and handle the ENTER .

Regards

vijay