Checkbox field in ALV for REUSE_ALV_GRID_DISPLAY
how to handle Checkbox field in ALV for REUSE_ALV_GRID_DISPLAY????
For example Alv has displayed 400 entries if user checks 4 entries and wants to donwload only those 4 entries from ALV using Copy to local file option then how should it be done. please provide some help...
REPORT YHRMR_LTC_TAXABLE NO STANDARD PAGE HEADING LINE-SIZE 120.
TYPE-POOLS: SLIS.
Start of Data Declaration *
DATA: G_PLVAR TYPE PLVAR.
DATA: P_MONTH TYPE TFMATAGE.
DATA: TOTAL_NO TYPE I.
DATA: TOTAL_NO_SUM TYPE I.
DATA: COUNT_15 TYPE I.
DATA: COUNT_15_SUM TYPE I.
DATA: COUNT_LTC TYPE I.
DATA: COUNT_LTC_SUM TYPE I.
DATA: COUNT_ERROR_IT15 TYPE I.
DATA: COUNT_ERROR_IT15_SUM TYPE I.
DATA: COUNT_ERROR_LTC TYPE I.
DATA: COUNT_ERROR_LTC_SUM TYPE I.
DATA: COUNT_ENTRY_IT15 TYPE I.
DATA: COUNT_ENTRY_IT15_SUM TYPE I.
--LOCAL TABLE TYPE--
DATA: T_DATA_LTC LIKE YHRMT_LTC OCCURS 0 WITH HEADER LINE.
DATA: T_DATA_LTC_NEW LIKE YHRMT_LTC OCCURS 0 WITH HEADER LINE.
DATA: T_PA0015 LIKE PA0015 OCCURS 0 WITH HEADER LINE.
DATA: T_P0015 LIKE PA0015 OCCURS 0 WITH HEADER LINE.
DATA: BEGIN OF T_FINAL OCCURS 0,
CHECK_BOX(1),
MANDT TYPE MANDT,
PERNR TYPE PERSNO,
ABKRS TYPE ABKRS,
PERSK TYPE PERSK,
WAGETYPE TYPE LGART,
LTCSTART TYPE YAJAHR,
LTCEND TYPE YYAJAHR,
FLAG TYPE YCHAR1,
SEQNR TYPE SEQNR,
LEVSTART TYPE URBEG,
LEVEND TYPE BDATU_052R,
PAYDATE TYPE YBEGDA,
AMOUNTPAY TYPE AMUNT,
TAXYR TYPE PHK_TAXYR,
DOCUNO TYPE YCHAR20,
DOCUDATE TYPE YENDDA,
VOUCHNO TYPE YCHAR20,
APDATE TYPE BPS_APPDA,
CANCEL_MOD TYPE YCANCELMOD,
LTC_IND TYPE ATZH1,
APPL_TAG TYPE YAPPTAG,
CANCEL_DATE TYPE AEDTM,
CANCEL_USER TYPE AENAM,
LASTCHANGE TYPE AEDTM,
USERNAME TYPE AENAM,
END OF T_FINAL.
DATA: BEGIN OF T_PA0001 OCCURS 0,
PERNR LIKE PA0001-PERNR,
ABKRS LIKE PA0001-ABKRS,
END OF T_PA0001.
--Message Part Declaration--
DATA: BEGIN OF T_SUCCESS OCCURS 0,
PERNR TYPE PERSNO,
MESSAGE(50) TYPE C,
END OF T_SUCCESS.
DATA: BEGIN OF T_ERROR OCCURS 0,
PERNR TYPE PERSNO,
MESSAGE(50) TYPE C,
END OF T_ERROR.
--TABLE TYPE OF SLIS TYPE-GROUP--
DATA: G_FLD TYPE SLIS_T_FIELDCAT_ALV,
G_EV TYPE SLIS_T_EVENT,
G_SORT TYPE SLIS_T_SORTINFO_ALV,
G_LST TYPE SLIS_T_LISTHEADER.
DATA: FIELDCATALOG TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE,
GD_TAB_GROUP TYPE SLIS_T_SP_GROUP_ALV,
GD_LAYOUT TYPE SLIS_LAYOUT_ALV,
I_EVENTS TYPE SLIS_T_EVENT,
GD_REPID LIKE SY-REPID.
--STRUCTURE TYPE OF SLIS TYPE-GROUP--
DATA: L_EV TYPE SLIS_ALV_EVENT.
CONSTANTS : C_PF TYPE SLIS_FORMNAME VALUE 'PF_STATUS_SET',
C_UCOM TYPE SLIS_FORMNAME VALUE 'USER_COMMAND'.
*---- Start Change by Bibek/Shankar Dated : 12-03-2008 via cmr no : J/08/03/062/1.
DATA: L_ENDDATE LIKE SY-DATUM.
*---- End Change by Bibek/Shankar Dated : 12-03-2008 via cmr no : J/08/03/062/1.
End of Data Declaration *
Start of Selection screen Parameters *
SELECTION-SCREEN BEGIN OF BLOCK A WITH FRAME TITLE TEXT-002.
*START CHANGE BY SHAYARI ON 18.02.2008, CMR No.:- J/08/02/323
PARAMETERS:P_ABKRS LIKE PA0001-ABKRS OBLIGATORY.
*END CHANGE BY SHAYARI ON 18.02.2008, CMR No.:- J/08/02/323
*START CHANGE BY BIBEk Dt : 06.03.2008, CMR No.:- J/08/03/062/1
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN POSITION 1.
SELECTION-SCREEN COMMENT 1(78) TEXT-006 FOR FIELD P_LES.
PARAMETER P_LES RADIOBUTTON GROUP RB1.
SELECTION-SCREEN END OF LINE.
*END CHANGE BY BIBEk Dt : 06.03.2008, CMR No.:- J/08/03/062/1
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN POSITION 1.
SELECTION-SCREEN COMMENT 1(78) TEXT-003 FOR FIELD P_ONE.
PARAMETER P_ONE RADIOBUTTON GROUP RB1.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN POSITION 1.
SELECTION-SCREEN COMMENT 1(78) TEXT-004 FOR FIELD P_TWO.
PARAMETER P_TWO RADIOBUTTON GROUP RB1.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN POSITION 1.
SELECTION-SCREEN COMMENT 1(78) TEXT-005 FOR FIELD P_MORE.
PARAMETER P_MORE RADIOBUTTON GROUP RB1.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK A.
End of Selection screen Parameters *
*Get Plan Version
CALL FUNCTION 'RH_GET_PLVAR'
IMPORTING
PLVAR = G_PLVAR.
PERFORM CLEAR.
CALL FUNCTION 'HR_JP_MONTH_BEGIN_END_DATE'
EXPORTING
IV_DATE = SY-DATUM
IMPORTING
EV_MONTH_BEGIN_DATE =
EV_MONTH_END_DATE = L_ENDDATE.
SELECT *
FROM YHRMT_LTC
INTO TABLE T_DATA_LTC
WHERE FLAG = '1'
AND WAGETYPE = '1640'
AND LEVEND LE L_ENDDATE
AND PAYDATE GE '20080101'.
If SY-SUBRC <> 0.
MESSAGE I398(00) with 'No Records to display '.
ENDIF.
DELETE T_DATA_LTC WHERE LEVEND = '00000000'.
*START CHANGE BY BIBEk Dt : 06.03.2008, CMR No.:- J/08/03/062/1
*For Less Than One Month from Leave End Date
IF P_LES = 'X'.
LOOP AT T_DATA_LTC.
CLEAR P_MONTH.
CALL FUNCTION 'HR_AUPBS_MONTH_DAY'
EXPORTING
BEG_DA = T_DATA_LTC-LEVEND
END_DA = SY-DATUM
IMPORTING
NO_MONTH = P_MONTH.
IF P_MONTH LT '1'.
T_FINAL-MANDT = T_DATA_LTC-MANDT.
T_FINAL-PERNR = T_DATA_LTC-PERSONNELNO.
T_FINAL-PERSK = T_DATA_LTC-PERSK.
T_FINAL-WAGETYPE = T_DATA_LTC-WAGETYPE.
T_FINAL-LTCSTART = T_DATA_LTC-LTCSTART.
T_FINAL-LTCEND = T_DATA_LTC-LTCEND.
T_FINAL-FLAG = T_DATA_LTC-FLAG.
T_FINAL-SEQNR = T_DATA_LTC-SEQNR.
T_FINAL-LEVSTART = T_DATA_LTC-LEVSTART.
T_FINAL-LEVEND = T_DATA_LTC-LEVEND.
T_FINAL-PAYDATE = T_DATA_LTC-PAYDATE.
T_FINAL-AMOUNTPAY = T_DATA_LTC-AMOUNTPAY.
T_FINAL-TAXYR = T_DATA_LTC-TAXYR.
T_FINAL-DOCUNO = T_DATA_LTC-DOCUNO.
T_FINAL-DOCUDATE = T_DATA_LTC-DOCUDATE.
T_FINAL-VOUCHNO = T_DATA_LTC-VOUCHNO.
T_FINAL-APDATE = T_DATA_LTC-APDATE.
T_FINAL-CANCEL_MOD = T_DATA_LTC-CANCEL_MOD.
T_FINAL-LTC_IND = T_DATA_LTC-LTC_IND.
T_FINAL-APPL_TAG = T_DATA_LTC-APPL_TAG.
T_FINAL-CANCEL_DATE = T_DATA_LTC-CANCEL_DATE.
T_FINAL-CANCEL_USER = T_DATA_LTC-CANCEL_USER.
T_FINAL-LASTCHANGE = T_DATA_LTC-LASTCHANGE.
T_FINAL-USERNAME = T_DATA_LTC-USERNAME.
APPEND T_FINAL.
CLEAR T_FINAL.
ENDIF.
ENDLOOP.
*For One Month from Leave End Date
ELSEIF P_ONE = 'X'.
LOOP AT T_DATA_LTC.
CLEAR P_MONTH.
CALL FUNCTION 'HR_AUPBS_MONTH_DAY'
EXPORTING
BEG_DA = T_DATA_LTC-LEVEND
END_DA = SY-DATUM
IMPORTING
NO_MONTH = P_MONTH.
IF P_MONTH EQ '1' AND P_MONTH LT '2'.
T_FINAL-MANDT = T_DATA_LTC-MANDT.
T_FINAL-PERNR = T_DATA_LTC-PERSONNELNO.
T_FINAL-PERSK = T_DATA_LTC-PERSK.
T_FINAL-WAGETYPE = T_DATA_LTC-WAGETYPE.
T_FINAL-LTCSTART = T_DATA_LTC-LTCSTART.
T_FINAL-LTCEND = T_DATA_LTC-LTCEND.
T_FINAL-FLAG = T_DATA_LTC-FLAG.
T_FINAL-SEQNR = T_DATA_LTC-SEQNR.
T_FINAL-LEVSTART = T_DATA_LTC-LEVSTART.
T_FINAL-LEVEND = T_DATA_LTC-LEVEND.
T_FINAL-PAYDATE = T_DATA_LTC-PAYDATE.
T_FINAL-AMOUNTPAY = T_DATA_LTC-AMOUNTPAY.
T_FINAL-TAXYR = T_DATA_LTC-TAXYR.
T_FINAL-DOCUNO = T_DATA_LTC-DOCUNO.
T_FINAL-DOCUDATE = T_DATA_LTC-DOCUDATE.
T_FINAL-VOUCHNO = T_DATA_LTC-VOUCHNO.
T_FINAL-APDATE = T_DATA_LTC-APDATE.
T_FINAL-CANCEL_MOD = T_DATA_LTC-CANCEL_MOD.
T_FINAL-LTC_IND = T_DATA_LTC-LTC_IND.
T_FINAL-APPL_TAG = T_DATA_LTC-APPL_TAG.
T_FINAL-CANCEL_DATE = T_DATA_LTC-CANCEL_DATE.
T_FINAL-CANCEL_USER = T_DATA_LTC-CANCEL_USER.
T_FINAL-LASTCHANGE = T_DATA_LTC-LASTCHANGE.
T_FINAL-USERNAME = T_DATA_LTC-USERNAME.
APPEND T_FINAL.
CLEAR T_FINAL.
ENDIF.
ENDLOOP.
*For Two Month from Leave End Date
ELSEIF P_TWO = 'X'.
LOOP AT T_DATA_LTC.
CLEAR P_MONTH.
CALL FUNCTION 'HR_AUPBS_MONTH_DAY'
EXPORTING
BEG_DA = T_DATA_LTC-LEVEND
END_DA = SY-DATUM
IMPORTING
NO_MONTH = P_MONTH.
IF P_MONTH EQ '2' AND P_MONTH LT '3'.
T_FINAL-MANDT = T_DATA_LTC-MANDT.
T_FINAL-PERNR = T_DATA_LTC-PERSONNELNO.
T_FINAL-PERSK = T_DATA_LTC-PERSK.
T_FINAL-WAGETYPE = T_DATA_LTC-WAGETYPE.
T_FINAL-LTCSTART = T_DATA_LTC-LTCSTART.
T_FINAL-LTCEND = T_DATA_LTC-LTCEND.
T_FINAL-FLAG = T_DATA_LTC-FLAG.
T_FINAL-SEQNR = T_DATA_LTC-SEQNR.
T_FINAL-LEVSTART = T_DATA_LTC-LEVSTART.
T_FINAL-LEVEND = T_DATA_LTC-LEVEND.
T_FINAL-PAYDATE = T_DATA_LTC-PAYDATE.
T_FINAL-AMOUNTPAY = T_DATA_LTC-AMOUNTPAY.
T_FINAL-TAXYR = T_DATA_LTC-TAXYR.
T_FINAL-DOCUNO = T_DATA_LTC-DOCUNO.
T_FINAL-DOCUDATE = T_DATA_LTC-DOCUDATE.
T_FINAL-VOUCHNO = T_DATA_LTC-VOUCHNO.
T_FINAL-APDATE = T_DATA_LTC-APDATE.
T_FINAL-CANCEL_MOD = T_DATA_LTC-CANCEL_MOD.
T_FINAL-LTC_IND = T_DATA_LTC-LTC_IND.
T_FINAL-APPL_TAG = T_DATA_LTC-APPL_TAG.
T_FINAL-CANCEL_DATE = T_DATA_LTC-CANCEL_DATE.
T_FINAL-CANCEL_USER = T_DATA_LTC-CANCEL_USER.
T_FINAL-LASTCHANGE = T_DATA_LTC-LASTCHANGE.
T_FINAL-USERNAME = T_DATA_LTC-USERNAME.
APPEND T_FINAL.
CLEAR T_FINAL.
ENDIF.
ENDLOOP.
*For More than Two Month from Leave End Date
ELSEIF P_MORE = 'X'.
LOOP AT T_DATA_LTC.
CLEAR P_MONTH.
CALL FUNCTION 'HR_AUPBS_MONTH_DAY'
EXPORTING
BEG_DA = T_DATA_LTC-LEVEND
END_DA = SY-DATUM
IMPORTING
NO_MONTH = P_MONTH.
IF P_MONTH GT '2' .
T_FINAL-MANDT = T_DATA_LTC-MANDT.
T_FINAL-PERNR = T_DATA_LTC-PERSONNELNO.
T_FINAL-PERSK = T_DATA_LTC-PERSK.
T_FINAL-WAGETYPE = T_DATA_LTC-WAGETYPE.
T_FINAL-LTCSTART = T_DATA_LTC-LTCSTART.
T_FINAL-LTCEND = T_DATA_LTC-LTCEND.
T_FINAL-FLAG = T_DATA_LTC-FLAG.
T_FINAL-SEQNR = T_DATA_LTC-SEQNR.
T_FINAL-LEVSTART = T_DATA_LTC-LEVSTART.
T_FINAL-LEVEND = T_DATA_LTC-LEVEND.
T_FINAL-PAYDATE = T_DATA_LTC-PAYDATE.
T_FINAL-AMOUNTPAY = T_DATA_LTC-AMOUNTPAY.
T_FINAL-TAXYR = T_DATA_LTC-TAXYR.
T_FINAL-DOCUNO = T_DATA_LTC-DOCUNO.
T_FINAL-DOCUDATE = T_DATA_LTC-DOCUDATE.
T_FINAL-VOUCHNO = T_DATA_LTC-VOUCHNO.
T_FINAL-APDATE = T_DATA_LTC-APDATE.
T_FINAL-CANCEL_MOD = T_DATA_LTC-CANCEL_MOD.
T_FINAL-LTC_IND = T_DATA_LTC-LTC_IND.
T_FINAL-APPL_TAG = T_DATA_LTC-APPL_TAG.
T_FINAL-CANCEL_DATE = T_DATA_LTC-CANCEL_DATE.
T_FINAL-CANCEL_USER = T_DATA_LTC-CANCEL_USER.
T_FINAL-LASTCHANGE = T_DATA_LTC-LASTCHANGE.
T_FINAL-USERNAME = T_DATA_LTC-USERNAME.
APPEND T_FINAL.
CLEAR T_FINAL.
ENDIF.
ENDLOOP.
ENDIF.
****Payroll Area Put
SELECT PERNR ABKRS FROM PA0001
INTO CORRESPONDING FIELDS OF TABLE T_PA0001
FOR ALL ENTRIES IN T_FINAL
WHERE PERNR = T_FINAL-PERNR
AND ABKRS = P_ABKRS
AND BEGDA LE SY-DATUM
AND ENDDA GE SY-DATUM.
LOOP AT T_FINAL.
READ TABLE T_PA0001 WITH KEY PERNR = T_FINAL-PERNR.
IF SY-SUBRC = 0.
T_FINAL-ABKRS = T_PA0001-ABKRS.
MODIFY T_FINAL.
CLEAR T_FINAL.
ENDIF.
ENDLOOP.
CLEAR T_FINAL.
DELETE T_FINAL WHERE ABKRS = ''.
*Output Form ALV List
PERFORM ALV.
*& Form ALV
FORM ALV .
PERFORM BUILD_FIELDCATALOG.
PERFORM BUILD_EVENT.
PERFORM DISPLAY_DATA.
ENDFORM. " ALV
*& Form BUILD_FIELDCATALOG
FORM BUILD_FIELDCATALOG .
FIELDCATALOG-TABNAME = 'T_FINAL'.
FIELDCATALOG-FIELDNAME = 'PERNR'.
FIELDCATALOG-SELTEXT_M = 'Personnel number'.
FIELDCATALOG-COL_POS = 1.
FIELDCATALOG-OUTPUTLEN = 17.
APPEND FIELDCATALOG TO FIELDCATALOG.
CLEAR FIELDCATALOG.
FIELDCATALOG-TABNAME = 'T_FINAL'.
FIELDCATALOG-FIELDNAME = 'ABKRS'.
FIELDCATALOG-SELTEXT_M = 'Payroll Area'.
FIELDCATALOG-COL_POS = 2.
FIELDCATALOG-OUTPUTLEN = 17.
APPEND FIELDCATALOG TO FIELDCATALOG.
CLEAR FIELDCATALOG.
FIELDCATALOG-TABNAME = 'T_FINAL'.
FIELDCATALOG-FIELDNAME = 'LTCSTART'.
FIELDCATALOG-SELTEXT_M = 'LTC Start year'.
FIELDCATALOG-COL_POS = 3.
FIELDCATALOG-OUTPUTLEN = 15.
APPEND FIELDCATALOG TO FIELDCATALOG.
CLEAR FIELDCATALOG.
FIELDCATALOG-TABNAME = 'T_FINAL'.
FIELDCATALOG-FIELDNAME = 'LTCEND'.
FIELDCATALOG-SELTEXT_M = 'LTC End year'.
FIELDCATALOG-COL_POS = 4.
FIELDCATALOG-OUTPUTLEN = 15.
APPEND FIELDCATALOG TO FIELDCATALOG.
CLEAR FIELDCATALOG.
FIELDCATALOG-TABNAME = 'T_FINAL'.
FIELDCATALOG-FIELDNAME = 'LEVSTART'.
FIELDCATALOG-SELTEXT_M = 'Start of leave'.
FIELDCATALOG-COL_POS = 5.
FIELDCATALOG-OUTPUTLEN = 15.
APPEND FIELDCATALOG TO FIELDCATALOG.
CLEAR FIELDCATALOG.
FIELDCATALOG-TABNAME = 'T_FINAL'.
FIELDCATALOG-FIELDNAME = 'LEVEND'.
FIELDCATALOG-SELTEXT_M = 'End of leave'.
FIELDCATALOG-COL_POS = 6.
FIELDCATALOG-OUTPUTLEN = 15.
APPEND FIELDCATALOG TO FIELDCATALOG.
CLEAR FIELDCATALOG.
FIELDCATALOG-TABNAME = 'T_FINAL'.
FIELDCATALOG-FIELDNAME = 'AMOUNTPAY'.
FIELDCATALOG-SELTEXT_M = 'Amount'.
FIELDCATALOG-DO_SUM = 'X'.
FIELDCATALOG-COL_POS = 7.
FIELDCATALOG-OUTPUTLEN = 13.
APPEND FIELDCATALOG TO FIELDCATALOG.
CLEAR FIELDCATALOG.
FIELDCATALOG-TABNAME = 'T_FINAL'.
FIELDCATALOG-FIELDNAME = 'PAYDATE'.
FIELDCATALOG-SELTEXT_M = 'Payment Date'.
FIELDCATALOG-COL_POS = 8.
FIELDCATALOG-OUTPUTLEN = 15.
APPEND FIELDCATALOG TO FIELDCATALOG.
CLEAR FIELDCATALOG.
FIELDCATALOG-TABNAME = 'T_FINAL'.
FIELDCATALOG-FIELDNAME = 'APPL_TAG'.
FIELDCATALOG-SELTEXT_M = 'Application Tag '.
FIELDCATALOG-COL_POS = 9.
FIELDCATALOG-OUTPUTLEN = 15.
APPEND FIELDCATALOG TO FIELDCATALOG.
CLEAR FIELDCATALOG.
*Check Box Field Add
CLEAR GD_LAYOUT.
GD_LAYOUT-BOX_FIELDNAME = 'CHECK_BOX'.
GD_LAYOUT-BOX_TABNAME = 'T_FINAL'.
ENDFORM. " BUILD_FIELDCATALOG
*& Form BUILD_EVENT
FORM BUILD_EVENT .
*Event Handler
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = G_EV
EXCEPTIONS
LIST_TYPE_WRONG = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
ELSE.
READ TABLE G_EV INTO L_EV WITH KEY NAME = SLIS_EV_PF_STATUS_SET.
IF SY-SUBRC = 0.
MOVE C_PF TO L_EV-FORM.
MODIFY G_EV FROM L_EV INDEX SY-TABIX TRANSPORTING FORM.
ENDIF.
READ TABLE G_EV INTO L_EV WITH KEY NAME = SLIS_EV_USER_COMMAND.
IF SY-SUBRC = 0.
MOVE C_UCOM TO L_EV-FORM.
MODIFY G_EV FROM L_EV INDEX SY-TABIX TRANSPORTING FORM.
ENDIF.
ENDIF.
ENDFORM. " BUILD_EVENT
*& Form DISPLAY_DATA
FORM DISPLAY_DATA .
GD_REPID = SY-REPID.
CLEAR I_EVENTS. REFRESH I_EVENTS.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = GD_REPID
I_CALLBACK_PF_STATUS_SET = C_PF
I_CALLBACK_USER_COMMAND = C_UCOM
IS_LAYOUT = GD_LAYOUT
IT_FIELDCAT = FIELDCATALOG[]
IT_EVENTS = G_EV
TABLES
T_OUTTAB = T_FINAL.
ENDFORM. " DISPLAY_DATA
FORM PF_STATUS_SET *
FORM PF_STATUS_SET USING RX_TAB TYPE SLIS_T_EXTAB.
SET PF-STATUS 'LTC'.
ENDFORM. "PF_STATUS_SET
FORM USER_COMMAND *
FORM USER_COMMAND USING R_UCOM LIKE SY-UCOMM
RS_SELFIELD TYPE SLIS_SELFIELD.
CASE R_UCOM.
WHEN 'POST'.
PERFORM POST_IT15_LTC_TABLE.
ENDCASE.
ENDFORM. "USER_COMMAND
*& Form POST_IT15_LTC_TABLE
FORM POST_IT15_LTC_TABLE .
ENDFORM. " POST_IT15_LTC_TABLE
*& Form clear
FORM CLEAR .
CLEAR T_DATA_LTC.
REFRESH T_DATA_LTC.
CLEAR T_DATA_LTC_NEW.
REFRESH T_DATA_LTC_NEW.
CLEAR T_FINAL.
REFRESH T_FINAL.
CLEAR T_PA0015.
REFRESH T_PA0015.
CLEAR T_SUCCESS.
REFRESH T_SUCCESS.
CLEAR T_ERROR.
REFRESH T_ERROR.
CLEAR G_PLVAR.
CLEAR P_MONTH.
CLEAR COUNT_15.
CLEAR COUNT_15_SUM.
CLEAR COUNT_LTC.
CLEAR COUNT_LTC_SUM.
CLEAR TOTAL_NO.
CLEAR TOTAL_NO_SUM.
CLEAR COUNT_ERROR_IT15.
CLEAR COUNT_ERROR_IT15_SUM.
CLEAR COUNT_ERROR_LTC.
CLEAR COUNT_ERROR_LTC_SUM.
CLEAR COUNT_ENTRY_IT15.
CLEAR COUNT_ENTRY_IT15_SUM.
ENDFORM. " clear
Similar Messages
-
Field in ALV for ME51N/ME52N/ME53N
Hi.
I want to include a field in the ALV of transactions for purchase requisitions. I have already enhanced the structure CI_EBANDB with the new fields, so the fields are already in MEREQ3211GRID.
What else I have to do to have this fields available in the ALV with the "Change Layout" option.
Thanks in advance.
Joaquin.Hi.
I want to include a field in the ALV of transactions for purchase requisitions. I have already enhanced the structure CI_EBANDB with the new fields, so the fields are already in MEREQ3211GRID.
What else I have to do to have this fields available in the ALV with the "Change Layout" option.
Thanks in advance.
Joaquin. -
ALV LIST with few checkboxes fields
Hi everyone,
I want to create an ALV with 2 fields that are checkboxes.
I am succeeding to create an ALV with one checkbox field.
How do we do in order to create an ALV with 2 checkboxes fields using ALV LIST ?
I know that we have to specify in the layout of the ALV the name of the field we want it to be checkbox.
For example :
gs_layout-box_fieldname = 'FLAG'.
But, how do we specify a second checkbox field ?
Thanks.
Regards.Slight modification to my earlier post. this is with 2 checkboxes.
REPORT ztest_alv_checkbox.
TYPE-POOLS: slis.
DATA: it_fcat TYPE slis_t_fieldcat_alv,
wa_cat LIKE LINE OF it_fcat.
DATA: BEGIN OF it_alv OCCURS 0,
check1(1),
check2(1),
carrid LIKE sflight-carrid,
connid LIKE sflight-connid,
END OF it_alv.
DATA:it_events TYPE slis_t_event,
wa_events LIKE LINE OF it_events.
SELECT carrid
connid
FROM sflight
INTO CORRESPONDING FIELDS OF TABLE it_alv
UP TO 20 ROWS.
wa_cat-fieldname = 'CHECK1'.
wa_cat-input = 'X'.
wa_cat-edit = 'X'.
wa_cat-checkbox = 'X'.
wa_cat-seltext_l = 'Check'.
wa_cat-tabname = 'IT_ALV'.
APPEND wa_cat TO it_fcat.
CLEAR wa_cat.
wa_cat-fieldname = 'CHECK2'.
wa_cat-input = 'X'.
wa_cat-edit = 'X'.
wa_cat-checkbox = 'X'.
wa_cat-seltext_l = 'Check'.
wa_cat-tabname = 'IT_ALV'.
APPEND wa_cat TO it_fcat.
CLEAR wa_cat.
wa_cat-fieldname = 'CARRID'.
wa_cat-seltext_l = 'Carrid'.
wa_cat-tabname = 'IT_ALV'.
APPEND wa_cat TO it_fcat.
CLEAR wa_cat.
wa_cat-fieldname = 'CONNID'.
wa_cat-seltext_l = 'Connid'.
wa_cat-tabname = 'IT_ALV'.
APPEND wa_cat TO it_fcat.
wa_events-name = slis_ev_end_of_list.
wa_events-form = 'MODIFY_LIST'.
APPEND wa_events TO it_events.
CLEAR wa_events.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = sy-repid
it_fieldcat = it_fcat
it_events = it_events
TABLES
t_outtab = it_alv
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc NE 0.
ENDIF.
"After The list display i am modifying the report output
"using the END_OF_LIST event of ALV
"here conditionally i can make the cell input off
*& Form MODIFY_LIST
* text
FORM modify_list.
DATA: l_lines TYPE i,
l_index TYPE i.
l_lines = l_lines + 3.
"because we have 3 lines extra occupied by lables.
"if we have header,i mean top of page add the no.of lines
"how many ever top of page have + 3 for labels.
DESCRIBE TABLE it_alv LINES l_lines.
l_lines = l_lines + 3.
"understnad this part alone.
DO l_lines TIMES.
IF sy-index GT 3.
l_index = sy-index - 3.
READ TABLE it_alv INDEX l_index.
"this is my condition..
IF sy-subrc = 0 .
IF it_alv-carrid <> 'AA'. "place your condition here.
"accordingly you can disable the checkbox
"use the below logic
READ LINE sy-index INDEX sy-lsind.
IF sy-subrc = 0.
MODIFY LINE sy-index INDEX sy-lsind
FIELD FORMAT it_alv-check1 INPUT OFF
it_alv-check2 INPUT OFF.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDDO.
ENDFORM. "MODIFY_LIST -
Hiding some fields from ALV report
Hi All,
I want to know if there is way to hide certain fields in ALV for some users only and not for others?
If I use the option NO_OUT = 'X' it will not be displayed in the list but the user can see the in the Layout option fields but if use NO_OUT = 'X' and TECH = 'X' the field will not be in the list and in the layout also but other users will miss that field.
If I create user specific variant, but once the user is in the report he can change the layout so certain fields cannot be hidden.
So, is there any way to hide some fields for certain users and not for others without hard coding user ids in program and restricting the fields from display??
Thanks in Advance.
Sonali.Thank You Vijay for the reply.
I knew that Authorization object was the final solution but before using it I wanted to find out if there was a way in the ALV report to restrict certain fields.
Sonali. -
To calculate average for a currency field in alv
Hi,
I have a requirement in which i need to find the average of a currency field in alv. For the particular field, i'm passing the value of DO_SUM = 'C' in thr field catalog(as suggested in many threads); but I'm not able to calculate the average. it still shows me summation when i click on summation button.
What could be the possible error??? Is there any other method we can do the same??
Thanks in Advance.
JaspreetHi
U can try this way.
*& Report Z_DEMO_JG
*& Display average in ALV report
REPORT z_demo_jg LINE-SIZE 80 LINE-COUNT 50
NO STANDARD PAGE HEADING.
TABLES: sflight.
TYPE-POOLS: slis.
* Data declaration
DATA: i_flight TYPE STANDARD TABLE OF sflight,
i_catalog TYPE slis_t_fieldcat_alv,
w_flight TYPE sflight,
w_catalog TYPE slis_fieldcat_alv.
DATA: v_repid TYPE syrepid.
* Selection screen
SELECT-OPTIONS: s_carrid FOR sflight-carrid.
START-OF-SELECTION.
* Fetch data from sflight table
SELECT *
FROM sflight
INTO TABLE i_flight
WHERE carrid IN s_carrid.
CHECK sy-subrc = 0.
v_repid = sy-repid.
* Build field catalog for ALV report
PERFORM build_catalog.
* Display ALV report
PERFORM display_report.
*& Form build_catalog
* Build field catalog for ALV report
* None
FORM build_catalog .
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = v_repid
i_structure_name = 'SFLIGHT'
CHANGING
ct_fieldcat = i_catalog
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
IF sy-subrc = 0.
* For average populate 'C' as value in
* field DO_SUM
w_catalog-do_sum = 'C'. " C = Average
* Modify record with new value
MODIFY i_catalog FROM w_catalog TRANSPORTING
do_sum WHERE fieldname = 'PRICE'.
ENDIF.
ENDFORM. " build_catalog
*& Form display_report
* Display ALV report
* None
FORM display_report .
IF i_catalog[] IS NOT INITIAL.
* Call ALV grid
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = v_repid
it_fieldcat = i_catalog
TABLES
t_outtab = i_flight
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc = 0.
ENDIF.
ENDIF.
ENDFORM. " display_report
Edited by: meetjoe on Sep 15, 2009 7:17 PM -
Reg : F4 help for custom fields in ALV report
hi friends..
in my internal table i have fields including 1 custom field..
DATA : BEGIN OF i_final OCCURS 0,
pernr LIKE p0000-pernr,
begda LIKE p0000-begda,
plans LIKE ZPOSITION-plans, (custom)
werks LIKE pspar-werks,
end of i_final.
i want to display this i_final table in alv. for that i genetrate one fieldcatalog
PERFORM fcat USING:
'I_FINAL' 'PERNR' 'P0000' 'PERNR' '15' 'X' '',
'I_FINAL' 'BEGDA' 'P0000' 'BEGDA' '10' 'X' '',
'I_FINAL' 'PLANS' 'ZPOSITION' 'PLANS' '8' 'X' '',
'I_FINAL' 'WERKS' 'PSPAR' 'WERKS' '14' 'X' ''.
in custom table zposition, i maintain serch help for custom field "PLANS".
then i used reuse_alv_grid_display.. for all the std fields along wit custom fields
i got f4 all std fields but for my custom i am not getting the f4 help
how can i get the F$ help for this custom fields Zposition-plans..
plz give some ideaHi
In that Ztable against the field
PLANS give the check table name as <b>T528B</b>
then it will automatically give the search help
or you can create your own search help(elementary) and add to that field
Reward if useful
regards
Anji -
How to provide hyperlink for a particular field in ALV
Hi,
How to provide hyperlink for a particular field in alv report.
Regards,
Ramu.Yes you can do that. using the fieldcatalog there is an option for that. give HOT_SPOT = 'X'. for the column you want.
wa_field-hotspot = 'X'.
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.
DATA: layout TYPE slis_layout_alv.
wa_field-fieldname = 'VBELN'.
wa_field-tabname = 'IT_LIKP'.
wa_field-hotspot = 'X'.
wa_field-outputlen = 10.
wa_field-no_zero = 'X'.
wa_field-seltext_l = 'Sales'.
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
is_layout = layout
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 '&IC1'.
SET PARAMETER ID 'VL' FIELD selfield-value.
CALL TRANSACTION 'VL02N' AND SKIP FIRST SCREEN.
ENDCASE.
ENDFORM. "user_Command -
How to make checkbox field inactive in the output of ALV report.
Dear All,
I am having one ALV report in whose output there are checkboxes against each record. Example: the output columns of my ALV report are:
Checkbox, Sales Document No, Billing Document No.
Now, my requirement is that if for the Sales Document No there exists any Billing Document No in the output then the Checkbox should be inactive but if the Billing document coloumn is empty for a particular Sales Document No then only the Checkbox field should become active.
Kindly guide me on how to make this checkbox field inactive.
Waiting for your reply.
Warm Regards,
N.JainHello,
Follow the below steps:
1.Define as--> GS_STATUS TYPE SLIS_STATUS,
2.check layout check box fieldname is not initial.
then set the status according to your logical conditions
GS_STATUS-FLG_CHECKBOXES_ACTIVE = 'X'
Hope this would help you.
Let me know your feedback.
Regards,
Raju -
Checkbox field in REUSE_ALV_GRID_DISPLAY without creating additional field
Hi Experts,
I want to show checkboxes in ALV without adding an additional checkbox field in my structure. OO-ALV will also do.......
Plz Help........hi check this...
REPORT Z_TEST7 .
*Table declaration
tables: vbak,vbap.
*internal table
data: begin of i_sales occurs 0,
vbeln like vbak-vbeln,
erdat like vbak-erdat,
audat like vbak-audat,
kunnr like vbak-kunnr,
vkorg like vbak-vkorg,
matnr like vbap-matnr,
netpr like vbap-netpr,
check type c, "checkbox
end of i_sales.
type-pools: slis.
data: v_fieldcat type slis_fieldcat_alv,
gt_fieldcat type slis_t_fieldcat_alv,
gt_layout type slis_layout_alv,
gt_sort type slis_sortinfo_alv,
fieldcat like line of gt_fieldcat.
*Selection screen
parameters: p_vkorg like vbak-vkorg.
select-options: s_vbeln for vbak-vbeln.
*start of selection.
start-of-selection.
perform get_data.
perform fill_fieldcatalog.
perform write_data.
FORM get_data .
select avbeln aerdat aaudat akunnr avkorg bmatnr b~netpr into
corresponding fields of table i_sales from vbak
as a inner join vbap as b on avbeln = bvbeln
where a~vkorg = p_vkorg and
a~vbeln in s_vbeln.
ENDFORM. " get_data
FORM write_data .
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = sy-repid
IS_LAYOUT = gt_layout
IT_FIELDCAT = gt_fieldcat
TABLES
T_OUTTAB = i_sales .
ENDFORM. " write_data
FORM fill_fieldcatalog .
sort i_sales by vbeln.
clear v_fieldcat.
"for check box
v_fieldcat-col_pos = 1.
v_fieldcat-fieldname = 'CHECK'.
v_fieldcat-seltext_m = 'chek'.
v_fieldcat-checkbox = 'X'.
v_fieldcat-input = 'X'.
v_fieldcat-edit = 'X'.
append v_fieldcat to gt_fieldcat.
clear v_fieldcat.
v_fieldcat-col_pos = 2.
v_fieldcat-fieldname = 'VBELN'.
v_fieldcat-seltext_m = 'Sales Document'.
append v_fieldcat to gt_fieldcat.
clear v_fieldcat.
v_fieldcat-col_pos = 3.
v_fieldcat-fieldname = 'ERDAT'.
v_fieldcat-seltext_m = 'Creation Date'.
append v_fieldcat to gt_fieldcat.
clear v_fieldcat.
v_fieldcat-col_pos = 4.
v_fieldcat-fieldname = 'AUDAT'.
v_fieldcat-seltext_m = 'Document Date'.
append v_fieldcat to gt_fieldcat.
clear v_fieldcat.
v_fieldcat-col_pos = 5.
v_fieldcat-fieldname = 'KUNNR'.
v_fieldcat-seltext_m = 'Customer'.
append v_fieldcat to gt_fieldcat.
clear v_fieldcat.
v_fieldcat-col_pos = 6.
v_fieldcat-fieldname = 'VKORG'.
v_fieldcat-seltext_m = 'Sales Organization'.
append v_fieldcat to gt_fieldcat.
clear v_fieldcat.
v_fieldcat-col_pos = 7.
v_fieldcat-fieldname = 'MATNR'.
v_fieldcat-seltext_m = 'Material'.
append v_fieldcat to gt_fieldcat.
clear v_fieldcat.
v_fieldcat-col_pos = 8.
v_fieldcat-fieldname = 'NETPR'.
v_fieldcat-seltext_m = 'Net Value'.
append v_fieldcat to gt_fieldcat.
clear v_fieldcat.
endform. -
Negative sign for DMBTR field in ALV output
Hi Experts,
Before posting I have searched for more than 3 hours in the forums to get a solution for this.
I did not get any solution so I am posting this problem which I need to resolve.
I have to display the DMBTR field in ALV output for which a grand total will have to be displayed.
Here for all the values in DMBTR which are negative are getting displayed as '- 6673.56','- 289956.23' as I am using the edit mask 'V_____________.__'.
I have to get the value shown as '-6673.56', '-289956.23'.
I tried to use convert this DMBTR to String and have successfully displayed the negative sign correctly in front of the value but I am not getting the totals which I need to have
PLease check and suggest for a solution.
Regards
KishoreHi,
If this is the case, then you can use character field to display the sign on the left. Sum up the total and use the event end of list to display the same. Remember to set the TECH and NO_OUT in the field catalog.
Hope this helps.
Regards,
Siva -
F4 for Editable field in ALV, display Name but capture ID
Hi Friends,
I have a ALV for which i have defined a Structure, which is passed to Fieldcatlog.
I have defined a Search help - ZUSER_NAME which has following fields to display.
USERID - USR02-BNAME
FNAME
LNAME
FULLNAME
So my structure for fieldcatalog has User-id which is linked to this search help with Domain XUBNAME.
So in my report i made this User-Id as editable and F4 available, everything is working fine.
when user does a F4, its displaying Userid,Fname,Lname and complete name.upon selection and save i am capturing the id and storing in the ztable.
But now i have a requirement that when user selects a value from this search help on F4, i need to display Fullname but capture the User Id. How can i do that?
This is something similar to the one we have in BSP- key-value pair.
how to do this in ALV.
Appreciate if someone can guide me thru.
Thanks,
Simha
Edited by: Simha on Sep 6, 2008 2:24 PMhai , this is example code for editing the F4 display .. check out this
REPORT zalv_editf4display.
*Type pools for alv
TYPE-POOLS : slis.
*structure for t582a tbale
TYPES : BEGIN OF ty_table,
infty TYPE infty,
pnnnn TYPE pnnnn_d,
zrmkz TYPE dzrmkz,
zeitb TYPE dzeitb,
dname TYPE dianm,
davo TYPE davo,
davoe TYPE davoe,
END OF ty_table.
*Structure for infotype text
TYPES : BEGIN OF ty_itext,
infty TYPE infty,
itext TYPE intxt,
sprsl TYPE sprsl,
END OF ty_itext.
*Structure for output display
TYPES : BEGIN OF ty_output,
infty TYPE infty,
itext TYPE intxt,
pnnnn TYPE pnnnn_d,
zrmkz TYPE dzrmkz,
zeitb TYPE dzeitb,
dname TYPE dianm,
davo TYPE davo,
davoe TYPE davoe,
END OF ty_output.
*internal table and work area declarations
DATA : it_table TYPE STANDARD TABLE OF ty_table INITIAL SIZE 0,
it_output TYPE STANDARD TABLE OF ty_output INITIAL SIZE 0,
it_pbo TYPE STANDARD TABLE OF ty_output INITIAL SIZE 0,
it_ittext TYPE STANDARD TABLE OF ty_itext INITIAL SIZE 0,
wa_table TYPE ty_table,
wa_output TYPE ty_output,
wa_ittext TYPE ty_itext.
*Data declarations for dropdown lists for f4
DATA: it_dropdown TYPE lvc_t_drop,
ty_dropdown TYPE lvc_s_drop,
*data declaration for refreshing of alv
stable TYPE lvc_s_stbl.
*Global variable declaration
DATA: gstring TYPE c.
*Data declarations for ALV
DATA: c_ccont TYPE REF TO cl_gui_custom_container, "Custom container object
c_alvgd TYPE REF TO cl_gui_alv_grid, "ALV grid object
it_fcat TYPE lvc_t_fcat, "Field catalogue
it_layout TYPE lvc_s_layo. "Layout
*ok code declaration
DATA:
ok_code TYPE ui_func.
*initialization event
INITIALIZATION.
*start of selection event
START-OF-SELECTION.
*select the infotypes maintained
SELECT infty
pnnnn
zrmkz
zeitb
dname
davo
davoe
FROM t582a UP TO 10 ROWS
INTO CORRESPONDING FIELDS OF TABLE it_table.
*Select the infotype texts
IF it_table[] IS NOT INITIAL.
SELECT itext
infty
sprsl
FROM t582s
INTO CORRESPONDING FIELDS OF TABLE it_ittext
FOR ALL ENTRIES IN it_table
WHERE infty = it_table-infty
AND sprsl = 'E'.
ENDIF.
*Apppending the data to the internal table of ALV output
LOOP AT it_table INTO wa_table.
wa_output-infty = wa_table-infty.
wa_output-pnnnn = wa_table-pnnnn.
wa_output-zrmkz = wa_table-zrmkz.
wa_output-zeitb = wa_table-zeitb.
wa_output-dname = wa_table-dname.
wa_output-davo = wa_table-davo.
wa_output-davoe = wa_table-davoe.
For texts
READ TABLE it_ittext INTO wa_ittext WITH KEY infty = wa_table-infty.
wa_output-itext = wa_ittext-itext.
APPEND wa_output TO it_output.
CLEAR wa_output.
ENDLOOP.
Calling the ALV screen with custom container
CALL SCREEN 0600.
*On this statement double click it takes you to the screen painter SE51.
*Enter the attributes
*Create a Custom container and name it CCONT and OK code as OK_CODE.
*Save check and Activate the screen painter.
*Now a normal screen with number 600 is created which holds the ALV grid.
PBO of the actual screen ,
Here we can give a title and customized menus
*create 2 buttons with function code 'SAVE' and 'EXIT'.
GIVE A SUITABLE TITLE
*& Module STATUS_0600 OUTPUT
text
MODULE status_0600 OUTPUT.
SET PF-STATUS 'DISP'.
SET TITLEBAR 'ALVF4'.
ENDMODULE. " STATUS_0600 OUTPUT
calling the PBO module ALV_GRID.
*& Module PBO OUTPUT
text
MODULE pbo OUTPUT.
*Creating objects of the container
CREATE OBJECT c_ccont
EXPORTING
container_name = 'CCONT'.
create object for alv grid
create object c_alvgd
exporting
i_parent = c_ccont.
SET field for ALV
PERFORM alv_build_fieldcat.
Set ALV attributes FOR LAYOUT
PERFORM alv_report_layout.
CHECK NOT c_alvgd IS INITIAL.
Call ALV GRID
CALL METHOD c_alvgd->set_table_for_first_display
EXPORTING
is_layout = it_layout
i_save = 'A'
CHANGING
it_outtab = it_output
it_fieldcatalog = it_fcat
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDMODULE. " PBO OUTPUT
*& Form alv_build_fieldcat
text
<--P_IT_FCAT text
*subroutine to build fieldcat
FORM alv_build_fieldcat.
DATA lv_fldcat TYPE lvc_s_fcat.
CLEAR lv_fldcat.
lv_fldcat-row_pos = '1'.
lv_fldcat-col_pos = '1'.
lv_fldcat-fieldname = 'INFTY'.
lv_fldcat-tabname = 'IT_OUTPUT'.
lv_fldcat-outputlen = 8.
lv_fldcat-scrtext_m = 'Infotype'.
lv_fldcat-icon = 'X'.
APPEND lv_fldcat TO it_fcat.
CLEAR lv_fldcat.
lv_fldcat-row_pos = '1'.
lv_fldcat-col_pos = '2'.
lv_fldcat-fieldname = 'PNNNN'.
lv_fldcat-tabname = 'IT_OUTPUT'.
lv_fldcat-outputlen = 15.
lv_fldcat-scrtext_m = 'Structure'.
lv_fldcat-icon = ''.
APPEND lv_fldcat TO it_fcat.
CLEAR lv_fldcat.
lv_fldcat-row_pos = '1'.
lv_fldcat-col_pos = '3'.
lv_fldcat-fieldname = 'ITEXT'.
lv_fldcat-tabname = 'IT_OUTPUT'.
lv_fldcat-outputlen = 60.
lv_fldcat-scrtext_m = 'Description'.
lv_fldcat-icon = ''.
APPEND lv_fldcat TO it_fcat.
CLEAR lv_fldcat.
lv_fldcat-row_pos = '1'.
lv_fldcat-col_pos = '5'.
lv_fldcat-fieldname = 'ZRMKZ'.
lv_fldcat-tabname = 'IT_OUTPUT'.
lv_fldcat-outputlen = 1.
lv_fldcat-scrtext_m = 'PERIOD'.
lv_fldcat-icon = ''.
APPEND lv_fldcat TO it_fcat.
CLEAR lv_fldcat.
lv_fldcat-row_pos = '1'.
lv_fldcat-col_pos = '6'.
lv_fldcat-fieldname = 'ZEITB'.
lv_fldcat-tabname = 'IT_OUTPUT'.
lv_fldcat-outputlen = 5.
lv_fldcat-scrtext_m = 'Time constraint'.
lv_fldcat-edit = 'X'.
*To avail the existing F4 help these are to
*be given in the field catalogue
lv_fldcat-f4availabl = 'X'.
lv_fldcat-ref_table = 'T582A'.
lv_fldcat-ref_field = 'ZEITB'.
APPEND lv_fldcat TO it_fcat.
CLEAR lv_fldcat.
lv_fldcat-row_pos = '1'.
lv_fldcat-col_pos = '7'.
lv_fldcat-fieldname = 'DNAME'.
lv_fldcat-tabname = 'IT_OUTPUT'.
lv_fldcat-outputlen = 15.
lv_fldcat-scrtext_m = 'Dialogmodule'.
lv_fldcat-icon = ''.
APPEND lv_fldcat TO it_fcat.
CLEAR lv_fldcat.
lv_fldcat-row_pos = '1'.
lv_fldcat-col_pos = '8'.
lv_fldcat-fieldname = 'DAVO'.
lv_fldcat-tabname = 'IT_OUTPUT'.
lv_fldcat-outputlen = 15.
lv_fldcat-scrtext_m = 'Start'.
lv_fldcat-edit = 'X'.
APPEND lv_fldcat TO it_fcat.
CLEAR lv_fldcat.
lv_fldcat-row_pos = '1'.
lv_fldcat-col_pos = '9'.
lv_fldcat-fieldname = 'DAVOE'.
lv_fldcat-tabname = 'IT_OUTPUT'.
lv_fldcat-outputlen = 15.
lv_fldcat-scrtext_m = 'End'.
lv_fldcat-icon = ''.
APPEND lv_fldcat TO it_fcat.
CLEAR lv_fldcat.
*To create drop down for the field 'DAVO'
with our own f4 help
ty_dropdown-handle = '1'.
ty_dropdown-value = ' '.
APPEND ty_dropdown TO it_dropdown.
ty_dropdown-handle = '1'.
ty_dropdown-value = '1'.
APPEND ty_dropdown TO it_dropdown.
ty_dropdown-handle = '1'.
ty_dropdown-value = '2'.
APPEND ty_dropdown TO it_dropdown.
ty_dropdown-handle = '1'.
ty_dropdown-value = '3'.
APPEND ty_dropdown TO it_dropdown.
CALL METHOD c_alvgd->set_drop_down_table
EXPORTING
it_drop_down = it_dropdown.
LOOP AT it_fcat INTO lv_fldcat.
CASE lv_fldcat-fieldname.
To assign dropdown in the fieldcataogue
WHEN 'DAVO'.
lv_fldcat-drdn_hndl = '1'.
lv_fldcat-outputlen = 15.
MODIFY it_fcat FROM lv_fldcat.
ENDCASE.
ENDLOOP.
ENDFORM. " alv_build_fieldcat
*& Form alv_report_layout
text
<--P_IT_LAYOUT text
*Subroutine for setting alv layout
FORM alv_report_layout.
it_layout-cwidth_opt = 'X'.
it_layout-col_opt = 'X'.
it_layout-zebra = 'X'.
ENDFORM. " alv_report_layout
PAI module of the screen created. In case we use an interactive ALV or
*for additional functionalities we can create OK codes
*and based on the user command we can do the coding.
*& Module PAI INPUT
text
MODULE pai INPUT.
*To change the existing values and refresh the grid
*And only values in the dropdown or in the default
*F4 can be given , else no action takes place for the dropdown
*and error is thrown for the default F4 help and font changes to red
*and on still saving, value is not changed
c_alvgd->check_changed_data( ).
*Based on the user input
*When user clicks 'SAVE;
CASE ok_code.
WHEN 'SAVE'.
*A pop up is called to confirm the saving of changed data
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
titlebar = 'SAVING DATA'
text_question = 'Continue?'
icon_button_1 = 'icon_booking_ok'
IMPORTING
answer = gstring
EXCEPTIONS
text_not_found = 1
OTHERS = 2.
IF sy-subrc NE 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*When the User clicks 'YES'
IF ( gstring = '1' ).
MESSAGE 'Saved' TYPE 'S'.
*Now the changed data is stored in the it_pbo internal table
it_pbo = it_output.
*Subroutine to display the ALV with changed data.
PERFORM redisplay.
ELSE.
*When user clicks NO or Cancel
MESSAGE 'Not Saved' TYPE 'S'.
ENDIF.
**When the user clicks the 'EXIT; he is out
WHEN 'EXIT'.
LEAVE PROGRAM.
ENDCASE.
CLEAR: ok_code.
ENDMODULE. " PAI INPUT
*& Form REDISPLAY
text
--> p1 text
<-- p2 text
FORM redisplay .
*Cells of the alv are made non editable after entering OK to save
CALL METHOD c_alvgd->set_ready_for_input
EXPORTING
i_ready_for_input = 0.
*Row and column of the alv are refreshed after changing values
stable-row = 'X'.
stable-col = 'X'.
*REfreshed ALV display with the changed values
*This ALV is non editable and contains new values
CALL METHOD c_alvgd->refresh_table_display
EXPORTING
is_stable = stable
EXCEPTIONS
finished = 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.
ENDFORM. " REDISPLAY -
How to assign a tooltip for a field in ALV editable grid?
I have to display some instructions ( 50 chars long) for an editable field in alv.
How to do this?
BCALV_DEMO_TOOLTIP tells about assiging tooltip to an icon or symbol.
Thanks,
Ven..Neither of these two example programs help much in regards to tooltips against any field of any row. Both of these examples use tooltips for Icons. I have also been looking for a single example of tooltips usage outside of these two programs, and have found nothing in SAP, or on the internet, so far.
Having said that, I have tried to implement the same method used by the later example, but have not got this to work. What I think we need is an example of this functionality where these Icons are not used!. I believe.
Gary King -
Custom F4 for a field in ALV GRID
I am want to provide a custom f4 fro a field in alv gird
similiar to the functionality of process on value request
on a normal screenHi Kaushik
You can find some information at page 37 of the document:
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/documents/a1-8-4/an easy reference for alv grid control.pdf
*--Serdar -
Total for a Numeric field in ALV Grid display
Hi all,
I am not getting the Total for a Numeric field in ALV Grid output. What might be the problem.
Regards,
Balavardhan.KCheck this code for subtotals and totals..
REPORT ZYFI_REPT007
NO STANDARD PAGE HEADING
LINE-SIZE 300
LINE-COUNT 50
MESSAGE-ID ZYFI.
TABLES : COOI, " Commitments Management: Line Items
LFA1, " Vendor master (general section)
VBEP,
RKPLN.
TABLE TYPES AND INTERNAL TABLES *
DATA : BEGIN OF TYP_COOI ,
OBJNR LIKE COOI-OBJNR,
SAKTO LIKE COOI-SAKTO,
MEGBTR LIKE COOI-MEGBTR,
MEINH LIKE COOI-MEINH,
WKGBTR LIKE COOI-WKGBTR,
REFBN LIKE COOI-REFBN,
RFPOS LIKE COOI-RFPOS,
SGTXT LIKE COOI-SGTXT,
BUDAT LIKE COOI-BUDAT,
LIFNR LIKE COOI-LIFNR,
END OF TYP_COOI.
DATA : BEGIN OF TYP_LFA1 ,
LIFNR LIKE LFA1-LIFNR,
NAME1 LIKE LFA1-NAME1,
END OF TYP_LFA1.
DATA : BEGIN OF IT_OUTTAB OCCURS 0,
OBJNR LIKE COOI-OBJNR,
SAKTO LIKE COOI-SAKTO,
MEGBTR LIKE COOI-MEGBTR,
MEINH LIKE COOI-MEINH,
WKGBTR LIKE COOI-WKGBTR,
REFBN LIKE COOI-REFBN,
RFPOS LIKE COOI-RFPOS,
SGTXT LIKE COOI-SGTXT,
BUDAT LIKE COOI-BUDAT,
LIFNR LIKE COOI-LIFNR,
NAME1 LIKE LFA1-NAME1,
END OF IT_OUTTAB.
DATA : IT_COOI LIKE TYP_COOI OCCURS 0 WITH HEADER LINE,
IT_LFA1 LIKE TYP_LFA1 OCCURS 0 WITH HEADER LINE.
*-- ALV Declarations
TYPE-POOLS SLIS.
DATA: IT_EVENTS TYPE SLIS_T_EVENT,
GS_EVENT TYPE SLIS_ALV_EVENT,
wa_fldcat type slis_fieldcat_alv.
DATA: S_LAYOUT TYPE SLIS_LAYOUT_ALV,
GT_PRINT TYPE SLIS_PRINT_ALV.
DATA: IT_FLDCAT TYPE SLIS_T_FIELDCAT_ALV.
DATA: IT_SORT TYPE SLIS_T_SORTINFO_ALV.
DATA: V_REPID LIKE SY-REPID.
SELECTION SCREEN *
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS : S_KOKRS FOR COOI-KOKRS NO-EXTENSION NO INTERVALS,
" Controlling Area
S_BUKRS FOR COOI-BUKRS NO-EXTENSION NO INTERVALS,
" Company code
S_GJAHR FOR COOI-GJAHR NO-EXTENSION NO INTERVALS,
" Fiscal Year
S_OBJNR FOR RKPLN-AUFNR MATCHCODE OBJECT ORDE,
" Internal order
S_SAKTO FOR COOI-SAKTO MATCHCODE OBJECT KART,
" Cost Element
S_BUDAT FOR COOI-BUDAT, " Debit Date
S_LIFNR FOR COOI-LIFNR. " Vendor
SELECTION-SCREEN END OF BLOCK B1.
S T A R T O F S E L E C T I O N *
START-OF-SELECTION.
*-- Read data
PERFORM GET_DATA.
E N D O F S E L E C T I O N *
END-OF-SELECTION.
*-- Process the data and prepare the output data
PERFORM CALCULATE_FINAL_INFO.
*--Display Report output
PERFORM DISPLAY_REPORT.
FORM CALCULATE_FINAL_INFO *
Process the data and prepare final internal table *
FORM CALCULATE_FINAL_INFO.
DATA : L_OBJNR LIKE COOI-OBJNR.
SORT IT_LFA1 BY LIFNR.
DELETE ADJACENT DUPLICATES FROM IT_LFA1 COMPARING LIFNR.
LOOP AT IT_COOI.
L_OBJNR = IT_COOI-OBJNR+2(20).
SHIFT L_OBJNR LEFT DELETING LEADING '0'.
IF L_OBJNR IN S_OBJNR.
READ TABLE IT_LFA1 WITH KEY LIFNR = IT_COOI-LIFNR.
IF SY-SUBRC EQ 0.
IT_OUTTAB-NAME1 = IT_LFA1-NAME1.
ENDIF.
MOVE-CORRESPONDING IT_COOI TO IT_OUTTAB.
CLEAR IT_OUTTAB-OBJNR.
IT_OUTTAB-OBJNR = L_OBJNR.
APPEND IT_OUTTAB.
CLEAR IT_OUTTAB.
CLEAR IT_LFA1.
CLEAR L_OBJNR.
ENDIF.
ENDLOOP.
ENDFORM.
*& Form GET_DATA
Fetch the Data from the table COOI and LFA1
FORM GET_DATA.
SELECT OBJNR
SAKTO
MEGBTR
MEINH
WKGBTR
REFBN
RFPOS
SGTXT
BUDAT
LIFNR
FROM COOI
INTO TABLE IT_COOI
WHERE BUDAT IN S_BUDAT
AND LIFNR IN S_LIFNR
AND KOKRS IN S_KOKRS
AND BUKRS IN S_BUKRS
AND GJAHR IN S_GJAHR
AND SAKTO IN S_SAKTO.
IF SY-SUBRC EQ 0 .
Get the Vendor name from LFA1
SELECT LIFNR
NAME1
FROM LFA1
INTO TABLE IT_LFA1
FOR ALL ENTRIES IN IT_COOI
WHERE LIFNR EQ IT_COOI-LIFNR.
ELSE.
MESSAGE I999 WITH TEXT-013.
ENDIF.
ENDFORM. " GET_DATA
*& Form DISPLAY_REPORT
Display the output
FORM DISPLAY_REPORT.
PERFORM BUILD_CATALOG.
PERFORM FRM_PREPARE_EVENT_LIST TABLES IT_EVENTS.
IF NOT IT_OUTTAB[] IS INITIAL.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = V_REPID
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
IT_FIELDCAT = IT_FLDCAT
IT_SORT = IT_SORT
IT_EVENTS = IT_EVENTS
TABLES
T_OUTTAB = IT_OUTTAB
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
ELSE.
MESSAGE I999 WITH TEXT-013.
ENDIF.
ENDFORM. " DISPLAY_REPORT
*& Form BUILD_CATALOG
Build the Field catalog for the ALV Report
FORM BUILD_CATALOG.
DATA: V_INDEX LIKE SY-TABIX.
V_REPID = SY-REPID.
DATA: LS_SORT TYPE SLIS_SORTINFO_ALV.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = V_REPID
I_INTERNAL_TABNAME = 'IT_OUTTAB'
I_INCLNAME = V_REPID
CHANGING
CT_FIELDCAT = IT_FLDCAT
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.
READ TABLE IT_FLDCAT WITH KEY FIELDNAME = 'WKGBTR'
TABNAME = 'IT_OUTTAB' INTO WA_FLDCAT.
IF SY-SUBRC EQ 0.
WA_FLDCAT-DO_SUM = 'X'.
MODIFY IT_FLDCAT FROM WA_FLDCAT INDEX SY-TABIX.
ENDIF.
READ TABLE IT_FLDCAT WITH KEY FIELDNAME = 'OBJNR'
TABNAME = 'IT_OUTTAB' INTO WA_FLDCAT.
IF SY-SUBRC EQ 0.
WA_FLDCAT-SELTEXT_L = 'Order'.
WA_FLDCAT-COL_POS = 1.
WA_FLDCAT-DDICTXT = 'L'.
MODIFY IT_FLDCAT FROM WA_FLDCAT INDEX SY-TABIX.
ENDIF.
LS_SORT-FIELDNAME = 'OBJNR'.
LS_SORT-SPOS = 1.
LS_SORT-UP = 'X'.
LS_SORT-SUBTOT = 'X'.
APPEND LS_SORT TO IT_SORT.
ENDFORM. " BUILD_CATALOG
*& Form FRM_PREPARE_EVENT_LIST
Build the Events
FORM FRM_PREPARE_EVENT_LIST TABLES IT_EVENTS TYPE SLIS_T_EVENT.
CLEAR GS_EVENT.
GS_EVENT-NAME = SLIS_EV_TOP_OF_PAGE.
GS_EVENT-FORM = 'TOP_OF_PAGE_REPORT'.
APPEND GS_EVENT TO IT_EVENTS.
ENDFORM. " FRM_PREPARE_EVENT_LIST
TOP OF PAGE
FORM TOP_OF_PAGE_REPORT.
CALL FUNCTION 'Z_YREPORT_HEADER'
EXPORTING
DL_TITLE = SY-TITLE
DL_REPID = SY-CPROG
DL_LINSZ = SY-LINSZ
EXCEPTIONS
OTHERS = 1.
ENDFORM. " FRM_TOP_OF_PAGE_REPORT
*& Form USER_COMMAND
Drill Down Functionality to Call the Transaction ME23
FORM USER_COMMAND USING P_UCOMM LIKE SY-UCOMM
P_SELFIELD TYPE SLIS_SELFIELD.
DATA : L_INDEX LIKE SY-INDEX,
L_REFBN LIKE COOI-REFBN.
L_INDEX = P_SELFIELD-TABINDEX. " holds the selected table index
CLEAR L_REFBN.
CASE P_UCOMM.
*-- On Double Click
WHEN '&IC1'.
CLEAR L_REFBN.
*-- Read the Current Line
READ TABLE IT_OUTTAB INDEX L_INDEX.
IF SY-SUBRC EQ 0.
L_REFBN = IT_OUTTAB-REFBN.
IF NOT L_REFBN IS INITIAL.
*-- Set the BES Paramater Id to the Current line Purchase Order Number
SET PARAMETER ID 'BES' FIELD L_REFBN.
*-- Call the Transaction Purchase Order Display with the above PO Number
CALL TRANSACTION 'ME23' AND SKIP FIRST SCREEN.
ENDIF.
ELSE.
MESSAGE E999 WITH TEXT-014.
ENDIF.
ENDCASE.
ENDFORM. " USER_COMMAND -
How to add a search help for a field in alv?
HI!Everyone ,
i want to add a search help created by myself for one field in alv,
and i want to use this function "HELP_VALUES_GET_WITH_TABLE".
can anyone help me ?
thanks!HI,Vijay.
My code like this :
PERFORM build_fcat.
PERFORM build_objects.
PERFORM layo_build.
PERFORM set_drdn_table .
CALL METHOD alv_grid->set_table_for_first_display
EXPORTING
i_structure_name = 'STU_S'
is_layout = s_layo
CHANGING
it_outtab = itab_out
it_fieldcatalog = i_fcat
."Period
IF sy-subrc <> 0.
EXIT.
ENDIF.
for example, there is a field 'UNAME' IN Structure 'STU_S',
i want to add a search help for 'UNAME'.
the 'UNAME' is not users in SAP R/3 , i want to add some data by myself or from a table .
Maybe you are looking for
-
Hi, I have a senario in which I have to pass the "last" N301 of ST to one of the scripting functoid. My map looks like below: As you can see in the map, "=" functoid checks if the current loop is for N1. If so then I have used value mapping which giv
-
Problem- Create Remote Delta link in Federated Portal Network environment
Dear Experts, I am working in a Fedeated protal network environment where the producer is BI 7.0 Portal and the EP portal is the consumer. FPN was already configured at client side and some reports were already integrated . Now i am working to integ
-
Adding fades without doing it in PSD
Please see the attached that i made in indesign. notice the low-res comp [until client approves it] of the flag in the BG. see at the bottom how i did a fade of the flag into white. i couldn't figure out how to do this in indesign, so i went to ph
-
Can we use GPO for FireFox 3.6.8 on windows 7 systems
Our GPO's control our firefox settings on windows xp systems but not windows 7 64 bit.
-
Every CC program shuts down immediately after starting
This happens without any error pop-up, the programs just disappear. I haven't the faintest idea why this is happening and would really appreciate some help.