SlideShare uma empresa Scribd logo
1 de 3
*&---------------------------------------------------------------------*
*& Report ZALV_D1
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT ZALV_D1.
TYPE-POOLS: slis.
* INTERNAL TABLES/WORK AREAS/VARIABLES *
*******************************************************************
DATA: i_fieldcat TYPE slis_t_fieldcat_alv,
i_index TYPE STANDARD TABLE OF i WITH HEADER LINE,
w_field TYPE slis_fieldcat_alv,
p_table LIKE dd02l-tabname,
dy_table TYPE REF TO data,
dy_tab TYPE REF TO data,
dy_line TYPE REF TO data.
* FIELD-SYMBOLS *
*******************************************************************
FIELD-SYMBOLS: <dyn_table> TYPE STANDARD TABLE,
<dyn_wa> TYPE ANY,
<dyn_field> TYPE ANY,
<dyn_tab_temp> TYPE STANDARD TABLE.
* SELECTION SCREEN *
*******************************************************************
PARAMETERS: tabname(30) TYPE c,
lines(5) TYPE n.
* START-OF-SELECTION *
*******************************************************************
START-OF-SELECTION.
p_table = tabname.
* entered in the selection screen
CREATE DATA dy_table TYPE STANDARD TABLE OF (p_table).
ASSIGN dy_table->* TO <dyn_table>.
IF sy-subrc <> 0.
MESSAGE i000(z_zzz_ca_messages) WITH ' No table found'. LEAVE TO LIST-
PROCESSING.
ENDIF.
* Create workarea for the table
CREATE DATA dy_line LIKE LINE OF <dyn_table>.
ASSIGN dy_line->* TO <dyn_wa>.
CREATE DATA dy_tab TYPE STANDARD TABLE OF (p_table).
ASSIGN dy_tab->* TO <dyn_tab_temp>. SORT i_fieldcat BY col_pos.
SELECT * FROM (p_table)
INTO TABLE <dyn_table>
UP TO lines ROWS. REFRESH <dyn_tab_temp>.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_structure_name = p_table
i_callback_user_command = 'USER_COMMAND'
i_callback_pf_status_set = 'SET_PF_STATUS'
TABLES
t_outtab = <dyn_table>
EXCEPTIONS
program_error = 1
OTHERS = 2. IF sy-subrc <> 0. ENDIF.
*& Form SET_PF_STATUS
*&-----------------------------------------------------------------*
* Setting custom PF-Status
*------------------------------------------------------------------*
* -->RT_EXTAB Excluding table
*------------------------------------------------------------------*
FORM set_pf_status USING rt_extab TYPE slis_t_extab. SET PF-STATUS
'Z_STANDARD'.ENDFORM.
*& Form user_command
*&-----------------------------------------------------------------*
* Handling custom function codes
*------------------------------------------------------------------*
* -->R_UCOMM Function code value
* -->RS_SELFIELD Info. of cursor position in ALV
*------------------------------------------------------------------*
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
DATA: li_tab TYPE REF TO data,
l_line TYPE REF TO data.
FIELD-SYMBOLS:<l_tab> TYPE table,
<l_wa> TYPE ANY." Create table
CREATE DATA li_tab TYPE STANDARD TABLE OF (p_table).
ASSIGN li_tab->* TO <l_tab>." Create workarea
CREATE DATA l_line LIKE LINE OF <l_tab>.
ASSIGN l_line->* TO <l_wa>. CASE r_ucomm.
WHEN '&IC1'.
READ TABLE <dyn_table> ASSIGNING <dyn_wa> INDEX
rs_selfield-tabindex. IF sy-subrc = 0.
APPEND <dyn_wa> TO <l_tab>.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = 'Z_DEMO_PDF_JG'
i_structure_name = p_table
CHANGING
ct_fieldcat = i_fieldcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
IF sy-subrc = 0.
w_field-input = 'X'. MODIFY i_fieldcat FROM w_field TRANSPORTING
input
WHERE key IS INITIAL. ENDIF.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_structure_name = p_table
it_fieldcat = i_fieldcat
i_screen_start_column = 10
i_screen_start_line = 15
i_screen_end_column = 200
i_screen_end_line = 20
TABLES
t_outtab = <l_tab>
EXCEPTIONS
program_error = 1
OTHERS = 2. IF sy-subrc = 0.
READ TABLE <l_tab> INDEX 1 INTO <l_wa>.
* and populate it in an internal table for future
* action
IF sy-subrc = 0 AND <dyn_wa> <> <l_wa>.
<dyn_wa> = <l_wa>.
i_index = rs_selfield-tabindex.
APPEND i_index.
ENDIF.
ENDIF. ENDIF.
WHEN 'SAVE'.
SORT i_index.
DELETE ADJACENT DUPLICATES FROM i_index. LOOP AT i_index.
* and populate these changes in another internal table
READ TABLE <dyn_table> ASSIGNING <dyn_wa> INDEX i_index.
IF sy-subrc = 0.
APPEND <dyn_wa> TO <dyn_tab_temp>.
ENDIF. ENDLOOP.
CALL FUNCTION 'ENQUEUE_E_TABLE'
EXPORTING
mode_rstable = 'E'
tabname = p_table
EXCEPTIONS
foreign_lock = 1
system_failure = 2
OTHERS = 3. IF sy-subrc = 0.
MODIFY (p_table) FROM TABLE <dyn_tab_temp>. REFRESH <dyn_tab_temp>.
CALL FUNCTION 'DEQUEUE_E_TABLE'
EXPORTING
mode_rstable = 'E'
tabname = p_table. ENDIF.
ENDCASE. rs_selfield-refresh = 'X'.ENDFORM. "user_command

Mais conteúdo relacionado

Mais procurados

Lecture 3 sql {basics ddl commands}
Lecture 3 sql {basics  ddl commands}Lecture 3 sql {basics  ddl commands}
Lecture 3 sql {basics ddl commands}Shubham Shukla
 
Lecture 4 sql {basics keys and constraints}
Lecture 4 sql {basics  keys and constraints}Lecture 4 sql {basics  keys and constraints}
Lecture 4 sql {basics keys and constraints}Shubham Shukla
 
20150730 Sql AutoCommannotator - sac v2
20150730  Sql AutoCommannotator - sac v220150730  Sql AutoCommannotator - sac v2
20150730 Sql AutoCommannotator - sac v2Sharon Liu
 
Data Definition Language (DDL)
Data Definition Language (DDL) Data Definition Language (DDL)
Data Definition Language (DDL) Mohd Tousif
 
Oracle SQL Functions
Oracle SQL FunctionsOracle SQL Functions
Oracle SQL FunctionsA Data Guru
 

Mais procurados (7)

Lecture 3 sql {basics ddl commands}
Lecture 3 sql {basics  ddl commands}Lecture 3 sql {basics  ddl commands}
Lecture 3 sql {basics ddl commands}
 
ABAP Advanced List
ABAP Advanced ListABAP Advanced List
ABAP Advanced List
 
Lecture 4 sql {basics keys and constraints}
Lecture 4 sql {basics  keys and constraints}Lecture 4 sql {basics  keys and constraints}
Lecture 4 sql {basics keys and constraints}
 
20150730 Sql AutoCommannotator - sac v2
20150730  Sql AutoCommannotator - sac v220150730  Sql AutoCommannotator - sac v2
20150730 Sql AutoCommannotator - sac v2
 
7. copy1
7. copy17. copy1
7. copy1
 
Data Definition Language (DDL)
Data Definition Language (DDL) Data Definition Language (DDL)
Data Definition Language (DDL)
 
Oracle SQL Functions
Oracle SQL FunctionsOracle SQL Functions
Oracle SQL Functions
 

Destaque

Morbidity of iliac crest
Morbidity of iliac crestMorbidity of iliac crest
Morbidity of iliac crestNader Elbokle
 
Virtual scanning total joint
Virtual scanning total jointVirtual scanning total joint
Virtual scanning total jointNader Elbokle
 
Best friends forever
Best friends foreverBest friends forever
Best friends forevermrnham23
 
Nm petct clinical_perspectives_on_astonish_tf (1)
Nm petct clinical_perspectives_on_astonish_tf (1)Nm petct clinical_perspectives_on_astonish_tf (1)
Nm petct clinical_perspectives_on_astonish_tf (1)Jhon Arriaga Cordova
 
Central incisor implant
Central incisor implantCentral incisor implant
Central incisor implantNader Elbokle
 
Morbidity of iliac crest
Morbidity of iliac crestMorbidity of iliac crest
Morbidity of iliac crestNader Elbokle
 
best friends forever 23
best friends forever 23best friends forever 23
best friends forever 23mrnham23
 

Destaque (9)

Morbidity of iliac crest
Morbidity of iliac crestMorbidity of iliac crest
Morbidity of iliac crest
 
Virtual scanning total joint
Virtual scanning total jointVirtual scanning total joint
Virtual scanning total joint
 
Best friends forever
Best friends foreverBest friends forever
Best friends forever
 
Fmp storyboard
Fmp storyboardFmp storyboard
Fmp storyboard
 
Nm petct clinical_perspectives_on_astonish_tf (1)
Nm petct clinical_perspectives_on_astonish_tf (1)Nm petct clinical_perspectives_on_astonish_tf (1)
Nm petct clinical_perspectives_on_astonish_tf (1)
 
Central incisor implant
Central incisor implantCentral incisor implant
Central incisor implant
 
Surgical navigation
Surgical navigationSurgical navigation
Surgical navigation
 
Morbidity of iliac crest
Morbidity of iliac crestMorbidity of iliac crest
Morbidity of iliac crest
 
best friends forever 23
best friends forever 23best friends forever 23
best friends forever 23
 

Semelhante a Report zalv

Semelhante a Report zalv (20)

ZFINDALLZPROGAM
ZFINDALLZPROGAMZFINDALLZPROGAM
ZFINDALLZPROGAM
 
Alvedit programs
Alvedit programsAlvedit programs
Alvedit programs
 
Alv barra her
Alv barra herAlv barra her
Alv barra her
 
Alv Block
Alv BlockAlv Block
Alv Block
 
Zmd Constant
Zmd ConstantZmd Constant
Zmd Constant
 
Internal tables operations_chalapathi[1]
Internal tables operations_chalapathi[1]Internal tables operations_chalapathi[1]
Internal tables operations_chalapathi[1]
 
07.advanced abap
07.advanced abap07.advanced abap
07.advanced abap
 
Classical ABAP interactive report
Classical ABAP interactive reportClassical ABAP interactive report
Classical ABAP interactive report
 
Zmalv output type_v1.1
Zmalv output type_v1.1Zmalv output type_v1.1
Zmalv output type_v1.1
 
Program For Parsing2
Program For Parsing2Program For Parsing2
Program For Parsing2
 
Sap Abap Reports
Sap Abap ReportsSap Abap Reports
Sap Abap Reports
 
Call session Method of BDC
Call session Method of BDCCall session Method of BDC
Call session Method of BDC
 
Alv grid
Alv gridAlv grid
Alv grid
 
Classical report
Classical reportClassical report
Classical report
 
Zi fi final prog
Zi fi final progZi fi final prog
Zi fi final prog
 
Example syntax alv grid list
Example syntax alv grid listExample syntax alv grid list
Example syntax alv grid list
 
Sap abap report program
Sap abap report programSap abap report program
Sap abap report program
 
KLIMA Software - Some DEMO Results Outputs in SERBIAN Language
KLIMA Software - Some DEMO Results Outputs in SERBIAN LanguageKLIMA Software - Some DEMO Results Outputs in SERBIAN Language
KLIMA Software - Some DEMO Results Outputs in SERBIAN Language
 
Module Prog
Module ProgModule Prog
Module Prog
 
Alv theory
Alv theoryAlv theory
Alv theory
 

Último

A DAY IN THE LIFE OF A SALESMAN / WOMAN
A DAY IN THE LIFE OF A  SALESMAN / WOMANA DAY IN THE LIFE OF A  SALESMAN / WOMAN
A DAY IN THE LIFE OF A SALESMAN / WOMANIlamathiKannappan
 
Call Girls In DLf Gurgaon ➥99902@11544 ( Best price)100% Genuine Escort In 24...
Call Girls In DLf Gurgaon ➥99902@11544 ( Best price)100% Genuine Escort In 24...Call Girls In DLf Gurgaon ➥99902@11544 ( Best price)100% Genuine Escort In 24...
Call Girls In DLf Gurgaon ➥99902@11544 ( Best price)100% Genuine Escort In 24...lizamodels9
 
Pharma Works Profile of Karan Communications
Pharma Works Profile of Karan CommunicationsPharma Works Profile of Karan Communications
Pharma Works Profile of Karan Communicationskarancommunications
 
Yaroslav Rozhankivskyy: Три складові і три передумови максимальної продуктивн...
Yaroslav Rozhankivskyy: Три складові і три передумови максимальної продуктивн...Yaroslav Rozhankivskyy: Три складові і три передумови максимальної продуктивн...
Yaroslav Rozhankivskyy: Три складові і три передумови максимальної продуктивн...Lviv Startup Club
 
The Coffee Bean & Tea Leaf(CBTL), Business strategy case study
The Coffee Bean & Tea Leaf(CBTL), Business strategy case studyThe Coffee Bean & Tea Leaf(CBTL), Business strategy case study
The Coffee Bean & Tea Leaf(CBTL), Business strategy case studyEthan lee
 
Call Girls In Panjim North Goa 9971646499 Genuine Service
Call Girls In Panjim North Goa 9971646499 Genuine ServiceCall Girls In Panjim North Goa 9971646499 Genuine Service
Call Girls In Panjim North Goa 9971646499 Genuine Serviceritikaroy0888
 
Call Girls Pune Just Call 9907093804 Top Class Call Girl Service Available
Call Girls Pune Just Call 9907093804 Top Class Call Girl Service AvailableCall Girls Pune Just Call 9907093804 Top Class Call Girl Service Available
Call Girls Pune Just Call 9907093804 Top Class Call Girl Service AvailableDipal Arora
 
Insurers' journeys to build a mastery in the IoT usage
Insurers' journeys to build a mastery in the IoT usageInsurers' journeys to build a mastery in the IoT usage
Insurers' journeys to build a mastery in the IoT usageMatteo Carbone
 
Dr. Admir Softic_ presentation_Green Club_ENG.pdf
Dr. Admir Softic_ presentation_Green Club_ENG.pdfDr. Admir Softic_ presentation_Green Club_ENG.pdf
Dr. Admir Softic_ presentation_Green Club_ENG.pdfAdmir Softic
 
Mysore Call Girls 8617370543 WhatsApp Number 24x7 Best Services
Mysore Call Girls 8617370543 WhatsApp Number 24x7 Best ServicesMysore Call Girls 8617370543 WhatsApp Number 24x7 Best Services
Mysore Call Girls 8617370543 WhatsApp Number 24x7 Best ServicesDipal Arora
 
The Path to Product Excellence: Avoiding Common Pitfalls and Enhancing Commun...
The Path to Product Excellence: Avoiding Common Pitfalls and Enhancing Commun...The Path to Product Excellence: Avoiding Common Pitfalls and Enhancing Commun...
The Path to Product Excellence: Avoiding Common Pitfalls and Enhancing Commun...Aggregage
 
B.COM Unit – 4 ( CORPORATE SOCIAL RESPONSIBILITY ( CSR ).pptx
B.COM Unit – 4 ( CORPORATE SOCIAL RESPONSIBILITY ( CSR ).pptxB.COM Unit – 4 ( CORPORATE SOCIAL RESPONSIBILITY ( CSR ).pptx
B.COM Unit – 4 ( CORPORATE SOCIAL RESPONSIBILITY ( CSR ).pptxpriyanshujha201
 
Value Proposition canvas- Customer needs and pains
Value Proposition canvas- Customer needs and painsValue Proposition canvas- Customer needs and pains
Value Proposition canvas- Customer needs and painsP&CO
 
Call Girls Hebbal Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Hebbal Just Call 👗 7737669865 👗 Top Class Call Girl Service BangaloreCall Girls Hebbal Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Hebbal Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangaloreamitlee9823
 
Mondelez State of Snacking and Future Trends 2023
Mondelez State of Snacking and Future Trends 2023Mondelez State of Snacking and Future Trends 2023
Mondelez State of Snacking and Future Trends 2023Neil Kimberley
 
Ensure the security of your HCL environment by applying the Zero Trust princi...
Ensure the security of your HCL environment by applying the Zero Trust princi...Ensure the security of your HCL environment by applying the Zero Trust princi...
Ensure the security of your HCL environment by applying the Zero Trust princi...Roland Driesen
 
HONOR Veterans Event Keynote by Michael Hawkins
HONOR Veterans Event Keynote by Michael HawkinsHONOR Veterans Event Keynote by Michael Hawkins
HONOR Veterans Event Keynote by Michael HawkinsMichael W. Hawkins
 
RSA Conference Exhibitor List 2024 - Exhibitors Data
RSA Conference Exhibitor List 2024 - Exhibitors DataRSA Conference Exhibitor List 2024 - Exhibitors Data
RSA Conference Exhibitor List 2024 - Exhibitors DataExhibitors Data
 

Último (20)

A DAY IN THE LIFE OF A SALESMAN / WOMAN
A DAY IN THE LIFE OF A  SALESMAN / WOMANA DAY IN THE LIFE OF A  SALESMAN / WOMAN
A DAY IN THE LIFE OF A SALESMAN / WOMAN
 
Call Girls In DLf Gurgaon ➥99902@11544 ( Best price)100% Genuine Escort In 24...
Call Girls In DLf Gurgaon ➥99902@11544 ( Best price)100% Genuine Escort In 24...Call Girls In DLf Gurgaon ➥99902@11544 ( Best price)100% Genuine Escort In 24...
Call Girls In DLf Gurgaon ➥99902@11544 ( Best price)100% Genuine Escort In 24...
 
Pharma Works Profile of Karan Communications
Pharma Works Profile of Karan CommunicationsPharma Works Profile of Karan Communications
Pharma Works Profile of Karan Communications
 
Yaroslav Rozhankivskyy: Три складові і три передумови максимальної продуктивн...
Yaroslav Rozhankivskyy: Три складові і три передумови максимальної продуктивн...Yaroslav Rozhankivskyy: Три складові і три передумови максимальної продуктивн...
Yaroslav Rozhankivskyy: Три складові і три передумови максимальної продуктивн...
 
The Coffee Bean & Tea Leaf(CBTL), Business strategy case study
The Coffee Bean & Tea Leaf(CBTL), Business strategy case studyThe Coffee Bean & Tea Leaf(CBTL), Business strategy case study
The Coffee Bean & Tea Leaf(CBTL), Business strategy case study
 
Call Girls In Panjim North Goa 9971646499 Genuine Service
Call Girls In Panjim North Goa 9971646499 Genuine ServiceCall Girls In Panjim North Goa 9971646499 Genuine Service
Call Girls In Panjim North Goa 9971646499 Genuine Service
 
Call Girls Pune Just Call 9907093804 Top Class Call Girl Service Available
Call Girls Pune Just Call 9907093804 Top Class Call Girl Service AvailableCall Girls Pune Just Call 9907093804 Top Class Call Girl Service Available
Call Girls Pune Just Call 9907093804 Top Class Call Girl Service Available
 
Insurers' journeys to build a mastery in the IoT usage
Insurers' journeys to build a mastery in the IoT usageInsurers' journeys to build a mastery in the IoT usage
Insurers' journeys to build a mastery in the IoT usage
 
Dr. Admir Softic_ presentation_Green Club_ENG.pdf
Dr. Admir Softic_ presentation_Green Club_ENG.pdfDr. Admir Softic_ presentation_Green Club_ENG.pdf
Dr. Admir Softic_ presentation_Green Club_ENG.pdf
 
Mysore Call Girls 8617370543 WhatsApp Number 24x7 Best Services
Mysore Call Girls 8617370543 WhatsApp Number 24x7 Best ServicesMysore Call Girls 8617370543 WhatsApp Number 24x7 Best Services
Mysore Call Girls 8617370543 WhatsApp Number 24x7 Best Services
 
The Path to Product Excellence: Avoiding Common Pitfalls and Enhancing Commun...
The Path to Product Excellence: Avoiding Common Pitfalls and Enhancing Commun...The Path to Product Excellence: Avoiding Common Pitfalls and Enhancing Commun...
The Path to Product Excellence: Avoiding Common Pitfalls and Enhancing Commun...
 
unwanted pregnancy Kit [+918133066128] Abortion Pills IN Dubai UAE Abudhabi
unwanted pregnancy Kit [+918133066128] Abortion Pills IN Dubai UAE Abudhabiunwanted pregnancy Kit [+918133066128] Abortion Pills IN Dubai UAE Abudhabi
unwanted pregnancy Kit [+918133066128] Abortion Pills IN Dubai UAE Abudhabi
 
B.COM Unit – 4 ( CORPORATE SOCIAL RESPONSIBILITY ( CSR ).pptx
B.COM Unit – 4 ( CORPORATE SOCIAL RESPONSIBILITY ( CSR ).pptxB.COM Unit – 4 ( CORPORATE SOCIAL RESPONSIBILITY ( CSR ).pptx
B.COM Unit – 4 ( CORPORATE SOCIAL RESPONSIBILITY ( CSR ).pptx
 
Value Proposition canvas- Customer needs and pains
Value Proposition canvas- Customer needs and painsValue Proposition canvas- Customer needs and pains
Value Proposition canvas- Customer needs and pains
 
Call Girls Hebbal Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Hebbal Just Call 👗 7737669865 👗 Top Class Call Girl Service BangaloreCall Girls Hebbal Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Hebbal Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
 
Mondelez State of Snacking and Future Trends 2023
Mondelez State of Snacking and Future Trends 2023Mondelez State of Snacking and Future Trends 2023
Mondelez State of Snacking and Future Trends 2023
 
Ensure the security of your HCL environment by applying the Zero Trust princi...
Ensure the security of your HCL environment by applying the Zero Trust princi...Ensure the security of your HCL environment by applying the Zero Trust princi...
Ensure the security of your HCL environment by applying the Zero Trust princi...
 
HONOR Veterans Event Keynote by Michael Hawkins
HONOR Veterans Event Keynote by Michael HawkinsHONOR Veterans Event Keynote by Michael Hawkins
HONOR Veterans Event Keynote by Michael Hawkins
 
Mifty kit IN Salmiya (+918133066128) Abortion pills IN Salmiyah Cytotec pills
Mifty kit IN Salmiya (+918133066128) Abortion pills IN Salmiyah Cytotec pillsMifty kit IN Salmiya (+918133066128) Abortion pills IN Salmiyah Cytotec pills
Mifty kit IN Salmiya (+918133066128) Abortion pills IN Salmiyah Cytotec pills
 
RSA Conference Exhibitor List 2024 - Exhibitors Data
RSA Conference Exhibitor List 2024 - Exhibitors DataRSA Conference Exhibitor List 2024 - Exhibitors Data
RSA Conference Exhibitor List 2024 - Exhibitors Data
 

Report zalv

  • 1. *&---------------------------------------------------------------------* *& Report ZALV_D1 *& *&---------------------------------------------------------------------* *& *& *&---------------------------------------------------------------------* REPORT ZALV_D1. TYPE-POOLS: slis. * INTERNAL TABLES/WORK AREAS/VARIABLES * ******************************************************************* DATA: i_fieldcat TYPE slis_t_fieldcat_alv, i_index TYPE STANDARD TABLE OF i WITH HEADER LINE, w_field TYPE slis_fieldcat_alv, p_table LIKE dd02l-tabname, dy_table TYPE REF TO data, dy_tab TYPE REF TO data, dy_line TYPE REF TO data. * FIELD-SYMBOLS * ******************************************************************* FIELD-SYMBOLS: <dyn_table> TYPE STANDARD TABLE, <dyn_wa> TYPE ANY, <dyn_field> TYPE ANY, <dyn_tab_temp> TYPE STANDARD TABLE. * SELECTION SCREEN * ******************************************************************* PARAMETERS: tabname(30) TYPE c, lines(5) TYPE n. * START-OF-SELECTION * ******************************************************************* START-OF-SELECTION. p_table = tabname. * entered in the selection screen CREATE DATA dy_table TYPE STANDARD TABLE OF (p_table). ASSIGN dy_table->* TO <dyn_table>. IF sy-subrc <> 0. MESSAGE i000(z_zzz_ca_messages) WITH ' No table found'. LEAVE TO LIST- PROCESSING. ENDIF. * Create workarea for the table CREATE DATA dy_line LIKE LINE OF <dyn_table>. ASSIGN dy_line->* TO <dyn_wa>. CREATE DATA dy_tab TYPE STANDARD TABLE OF (p_table). ASSIGN dy_tab->* TO <dyn_tab_temp>. SORT i_fieldcat BY col_pos. SELECT * FROM (p_table) INTO TABLE <dyn_table> UP TO lines ROWS. REFRESH <dyn_tab_temp>. CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY' EXPORTING i_callback_program = sy-repid i_structure_name = p_table i_callback_user_command = 'USER_COMMAND' i_callback_pf_status_set = 'SET_PF_STATUS' TABLES t_outtab = <dyn_table> EXCEPTIONS program_error = 1 OTHERS = 2. IF sy-subrc <> 0. ENDIF. *& Form SET_PF_STATUS *&-----------------------------------------------------------------*
  • 2. * Setting custom PF-Status *------------------------------------------------------------------* * -->RT_EXTAB Excluding table *------------------------------------------------------------------* FORM set_pf_status USING rt_extab TYPE slis_t_extab. SET PF-STATUS 'Z_STANDARD'.ENDFORM. *& Form user_command *&-----------------------------------------------------------------* * Handling custom function codes *------------------------------------------------------------------* * -->R_UCOMM Function code value * -->RS_SELFIELD Info. of cursor position in ALV *------------------------------------------------------------------* FORM user_command USING r_ucomm LIKE sy-ucomm rs_selfield TYPE slis_selfield. DATA: li_tab TYPE REF TO data, l_line TYPE REF TO data. FIELD-SYMBOLS:<l_tab> TYPE table, <l_wa> TYPE ANY." Create table CREATE DATA li_tab TYPE STANDARD TABLE OF (p_table). ASSIGN li_tab->* TO <l_tab>." Create workarea CREATE DATA l_line LIKE LINE OF <l_tab>. ASSIGN l_line->* TO <l_wa>. CASE r_ucomm. WHEN '&IC1'. READ TABLE <dyn_table> ASSIGNING <dyn_wa> INDEX rs_selfield-tabindex. IF sy-subrc = 0. APPEND <dyn_wa> TO <l_tab>. CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE' EXPORTING i_program_name = 'Z_DEMO_PDF_JG' i_structure_name = p_table CHANGING ct_fieldcat = i_fieldcat EXCEPTIONS inconsistent_interface = 1 program_error = 2 OTHERS = 3. IF sy-subrc = 0. w_field-input = 'X'. MODIFY i_fieldcat FROM w_field TRANSPORTING input WHERE key IS INITIAL. ENDIF. CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY' EXPORTING i_callback_program = sy-repid i_structure_name = p_table it_fieldcat = i_fieldcat i_screen_start_column = 10 i_screen_start_line = 15 i_screen_end_column = 200 i_screen_end_line = 20 TABLES t_outtab = <l_tab> EXCEPTIONS program_error = 1 OTHERS = 2. IF sy-subrc = 0. READ TABLE <l_tab> INDEX 1 INTO <l_wa>. * and populate it in an internal table for future * action IF sy-subrc = 0 AND <dyn_wa> <> <l_wa>. <dyn_wa> = <l_wa>. i_index = rs_selfield-tabindex. APPEND i_index. ENDIF.
  • 3. ENDIF. ENDIF. WHEN 'SAVE'. SORT i_index. DELETE ADJACENT DUPLICATES FROM i_index. LOOP AT i_index. * and populate these changes in another internal table READ TABLE <dyn_table> ASSIGNING <dyn_wa> INDEX i_index. IF sy-subrc = 0. APPEND <dyn_wa> TO <dyn_tab_temp>. ENDIF. ENDLOOP. CALL FUNCTION 'ENQUEUE_E_TABLE' EXPORTING mode_rstable = 'E' tabname = p_table EXCEPTIONS foreign_lock = 1 system_failure = 2 OTHERS = 3. IF sy-subrc = 0. MODIFY (p_table) FROM TABLE <dyn_tab_temp>. REFRESH <dyn_tab_temp>. CALL FUNCTION 'DEQUEUE_E_TABLE' EXPORTING mode_rstable = 'E' tabname = p_table. ENDIF. ENDCASE. rs_selfield-refresh = 'X'.ENDFORM. "user_command