*&---------------------------------------------------------------------*
*& Report YJFIR02
*& Name : Jatin Singhal
* Date 04.02.15
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT yjfir02.
*TYPES : BEGIN OF gs_final_alv,
* bukrs TYPE bukrs,
* kunnr TYPE kunnr,
* name1_ku TYPE name1_gp,
* ort01_ku TYPE ort01_gp,
* ort02_ku TYPE ort02_gp,
* lifnr TYPE lifnr,
* name1_li TYPE name1_gp,
* ort01_li TYPE ort01_gp,
* ort02_li TYPE ort02_gp,
* END OF gs_final_alv.
TYPES gs_final_alv TYPE yjalv02.
TYPES : BEGIN OF gs_lifnr,
lifnr TYPE lifnr,
kunnr TYPE kunnr,
name1_li TYPE name1_gp,
ort01_li TYPE ort01_gp,
ort02_li TYPE ort02_gp,
END OF gs_lifnr.
TYPES gt_lifnr_tt TYPE TABLE OF gs_lifnr.
DATA : gt_final_alv TYPE TABLE OF gs_final_alv,
gt_fcat TYPE slis_t_fieldcat_alv.
DATA : gv_bukrs TYPE bukrs,
gv_kunnr TYPE kunnr,
gv_ort01 TYPE ort01_gp,
gv_lifnr TYPE lifnr.
DATA : gr_table TYPE REF TO cl_salv_table,
gr_columns TYPE REF TO cl_salv_columns_table,
gr_column TYPE REF TO cl_salv_column_table,
gr_functions TYPE REF TO cl_salv_functions,
gr_layout TYPE REF TO cl_salv_layout,
gr_display TYPE REF TO cl_salv_display_settings,
r_field_label TYPE REF TO ycl_field_label.
SELECTION-SCREEN BEGIN OF BLOCK b01 WITH FRAME TITLE text-001.
SELECT-OPTIONS : s_bukrs FOR gv_bukrs,
s_kunnr FOR gv_kunnr,
s_ort01k FOR gv_ort01,
s_lifnr FOR gv_lifnr,
s_ort01l FOR gv_ort01.
SELECTION-SCREEN END OF BLOCK b01.
SELECTION-SCREEN BEGIN OF BLOCK b02 WITH FRAME TITLE text-002.
PARAMETERS :p_layout AS CHECKBOX,
p_factor AS CHECKBOX.
SELECTION-SCREEN END OF BLOCK b02.
AT SELECTION-SCREEN.
IF s_bukrs IS INITIAL
AND s_kunnr IS INITIAL
AND s_lifnr IS INITIAL.
MESSAGE text-004 TYPE 'E'.
ENDIF.
AT SELECTION-SCREEN OUTPUT.
* LOOP AT SCREEN. " To change Selection screen name at run time
* CASE screen-name.
* WHEN '%_S_ORT01L_%_APP_%-TEXT'. PERFORM change_sel_screen_text USING 'XXX'. "Vendor City
* ENDCASE.
* ENDLOOP.
START-OF-SELECTION.
*Fetching Company code and Customer No
PERFORM fetch_data.
END-OF-SELECTION.
PERFORM cocd_auth_check .
*Displaying the report
PERFORM display_data.
FORM fetch_data.
DATA lt_lifnr TYPE gt_lifnr_tt.
FIELD-SYMBOLS : <fs_final_alv> TYPE gs_final_alv,
<fs_lifnr> TYPE gs_lifnr.
SELECT bukrs
kna1~kunnr
name1
ort01
ort02
INTO TABLE gt_final_alv
FROM kna1 INNER JOIN knb1
ON kna1~kunnr = knb1~kunnr
WHERE kna1~kunnr IN s_kunnr
AND bukrs IN s_bukrs
AND ort01 IN s_ort01k.
IF gt_final_alv IS NOT INITIAL.
SELECT kunnr
lifnr
name1
ort01
ort02
INTO TABLE lt_lifnr
FROM lfa1
FOR ALL ENTRIES IN gt_final_alv
WHERE kunnr = gt_final_alv-kunnr
AND lifnr IN s_lifnr
AND ort01 IN s_ort01l.
LOOP AT gt_final_alv ASSIGNING <fs_final_alv>.
READ TABLE lt_lifnr ASSIGNING <fs_lifnr> WITH KEY kunnr = <fs_final_alv>-kunnr.
IF sy-subrc = 0.
<fs_final_alv>-lifnr = <fs_lifnr>-lifnr.
<fs_final_alv>-name1_li = <fs_lifnr>-name1_li.
<fs_final_alv>-ort01_li = <fs_lifnr>-ort01_li.
<fs_final_alv>-ort02_li = <fs_lifnr>-ort02_li.
ENDIF.
ENDLOOP.
ELSE.
MESSAGE text-003 TYPE 'I'.
ENDIF.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form DISPLAY_DATA
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM display_data .
IF gt_final_alv IS INITIAL. " Return to Selection screen if Global Table is blank
RETURN.
ENDIF.
IF p_factor = 'X'. " Display data using Factory_alv
DATA: l_key TYPE salv_s_layout_key.
"Get instance of the CL_SALV_TABLE using Factory method
TRY.
CALL METHOD cl_salv_table=>factory
IMPORTING
r_salv_table = gr_table
CHANGING
t_table = gt_final_alv.
CATCH cx_salv_msg .
ENDTRY.
TRY.
*set functions
gr_functions = gr_table->get_functions( ).
gr_functions->set_all( abap_true ).
* add function
* gr_functions->add_function(
* name = 'ADVHAN'
* icon = '@BB@'
* text = 'Advisor'
* tooltip = 'Handled by advisor'
* position = if_salv_c_function_position=>right_of_salv_functions ).
* set column
gr_columns = gr_table->get_columns( ).
gr_columns->set_optimize( abap_true ).
* set hotspot
* gr_column ?= gr_columns->get_column( 'EQUNR' ).
* gr_column->set_cell_type( if_salv_c_cell_type=>hotspot ).
*
* gr_column ?= gr_columns->get_column( 'EQART' ).
* gr_column->set_cell_type( if_salv_c_cell_type=>hotspot ).
* highlight column
gr_column ?= gr_columns->get_column('BUKRS').
gr_column->set_key( abap_true ).
gr_column ?= gr_columns->get_column('KUNNR').
gr_column->set_key( if_salv_c_bool_sap=>true ).
* gr_column ?= gr_columns->get_column('BELNR').
* Hardcoding field label
gr_column ?= gr_columns->get_column('ORT01_KU').
gr_column->set_short_text('Cust City').
* "Get Display Settings
gr_display ?= gr_table->get_display_settings( ).
gr_display->set_striped_pattern( abap_true ). "Stripped Pattern
CREATE OBJECT r_field_label
EXPORTING
im_columns_table = gr_columns.
* To change field label at run time
* PERFORM set_texts USING 'BUKRS' 'XXX'. "Company code
* PERFORM set_texts USING 'KUNNR' 'XXX'. "Customer No.
* Disable few field in O/P
PERFORM set_technical USING 'ORT02_LI'.
"Display ALV
CALL METHOD gr_table->display.
CATCH cx_salv_not_found.
CATCH cx_salv_wrong_call.
CATCH cx_salv_existing.
CATCH cx_salv_data_error.
ENDTRY.
ELSE.
DATA: l_repid TYPE syrepid,
l_title TYPE lvc_title.
* Layout structure
DATA: l_layout TYPE slis_layout_alv.
DATA: l_gridset TYPE lvc_s_glay.
l_layout-info_fieldname = 'COLCODE'.
l_repid = sy-repid.
-------------------------------------------------------------------------
*Prepare Field catalog for the ALV report
PERFORM setup_fieldcatalog.
------------------------------------------------------------------------
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = l_repid
* i_callback_pf_status_set = 'SET_STATUS'
i_callback_user_command = 'USER_COMMAND'
* i_callback_top_of_page = 'TOP_OF_PAGE'
* i_background_id = 'ALV_BACKGROUND'
i_grid_title = l_title
i_grid_settings = l_gridset
is_layout = l_layout
it_fieldcat = gt_fcat
i_save = 'A'
TABLES
t_outtab = gt_final_alv
EXCEPTIONS
program_error = 1
OTHERS = 2.
ENDIF.
ENDFORM.
FORM setup_fieldcatalog .
DATA g_fcat_h TYPE slis_fieldcat_alv.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = 'YJFIR02'
i_structure_name = 'YJALV02'
CHANGING
ct_fieldcat = gt_fcat
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.
LOOP AT gt_fcat INTO g_fcat_h.
CASE g_fcat_h-fieldname.
WHEN 'KUNNR'.
g_fcat_h-key = 'X'.
g_fcat_h-key_sel = 'X'.
g_fcat_h-seltext_l = 'Customer number'. "#EC NOTEXT
g_fcat_h-seltext_m = 'Customer No.'. "#EC NOTEXT
g_fcat_h-seltext_s = 'Cust.No.'. "#EC NOTEXT
WHEN 'LIFNR'.
g_fcat_h-key = 'X'.
g_fcat_h-key_sel = 'X'.
g_fcat_h-seltext_l = 'Vendor number'. "#EC NOTEXT
g_fcat_h-seltext_m = 'Vendor No.'. "#EC NOTEXT
g_fcat_h-seltext_s = 'Vend.No.'. "#EC NOTEXT
WHEN 'NAME1_KU'.
g_fcat_h-seltext_l = 'Customer Name'. "#EC NOTEXT
g_fcat_h-seltext_m = 'Cust Name'. "#EC NOTEXT
g_fcat_h-outputlen = '20'.
WHEN 'NAME1_LI'.
g_fcat_h-seltext_l = 'Vendor Name'. "#EC NOTEXT
g_fcat_h-seltext_m = 'Vend Name'. "#EC NOTEXT
g_fcat_h-outputlen = '20'.
WHEN 'ORT01_KU'.
g_fcat_h-seltext_l = 'Customer City'. "#EC NOTEXT
g_fcat_h-seltext_m = 'Cust City'. "#EC NOTEXT
g_fcat_h-outputlen = '20'. "#EC NOTEXT
ENDCASE.
MODIFY gt_fcat FROM g_fcat_h.
ENDLOOP.
ENDFORM. " SETUP_FIELDCATALOG
FORM cocd_auth_check .
TYPES: BEGIN OF lt_t001,
bukrs TYPE bukrs,
butxt TYPE butxt,
ort01 TYPE ort01,
land1 TYPE land1,
END OF lt_t001.
DATA: lit_t001 TYPE STANDARD TABLE OF lt_t001 INITIAL SIZE 0,
lwa_t001 TYPE lt_t001.
SELECT bukrs
butxt
ort01
land1
INTO TABLE lit_t001
FROM t001
WHERE bukrs IN s_bukrs.
LOOP AT lit_t001 INTO lwa_t001.
AUTHORITY-CHECK OBJECT 'F_BKPF_BUK'
ID 'ACTVT' FIELD '03'
ID 'BUKRS' FIELD lwa_t001-bukrs.
IF sy-subrc IS NOT INITIAL.
MESSAGE e001(zfi_eucomp) WITH lwa_t001-bukrs.
ENDIF.
ENDLOOP.
ENDFORM. " COCD_AUTH_CHECK
*&---------------------------------------------------------------------*
*& Form SET_TEXTS
*&---------------------------------------------------------------------*
FORM set_texts USING p_columnname TYPE lvc_fname
p_field_label TYPE yfield_label.
DATA:
l_columnname TYPE lvc_fname,
l_field_label TYPE yfield_label.
l_columnname = p_columnname.
l_field_label = p_field_label.
r_field_label->set_texts(
EXPORTING
im_columnname = l_columnname
im_field_label = l_field_label
EXCEPTIONS
field_label_not_found = 1
columnname_not_found = 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.
ENDFORM. " SET_TEXTS
FORM set_technical USING p_columnname TYPE lvc_fname.
TRY.
gr_column ?= gr_columns->get_column( columnname = p_columnname ).
gr_column->set_technical( value = if_salv_c_bool_sap=>true ).
CATCH cx_salv_not_found cx_salv_existing cx_salv_data_error. "#EC NO_HANDLER
ENDTRY.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form CHANGE_SEL_SCREEN_TEXT
*&---------------------------------------------------------------------*
FORM change_sel_screen_text USING p_field_label TYPE yfield_label.
DATA:
l_long_text TYPE ybc_field_labelt-long_text.
FIELD-SYMBOLS:
<text> TYPE any.
* Get Field Label
ycl_field_label=>get_field_label(
EXPORTING
im_field_label = p_field_label
IMPORTING
* ex_short_text =
* ex_medium_text =
ex_long_text = l_long_text
* ex_tooltip =
EXCEPTIONS
field_label_not_found = 1
OTHERS = 2
).
IF sy-subrc = 0.
ASSIGN (screen-name) TO <text>.
<text> = l_long_text.
MODIFY SCREEN.
ENDIF.
ENDFORM. " CHANGE_SEL_SCREEN_TEXT
*& Report YJFIR02
*& Name : Jatin Singhal
* Date 04.02.15
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT yjfir02.
*TYPES : BEGIN OF gs_final_alv,
* bukrs TYPE bukrs,
* kunnr TYPE kunnr,
* name1_ku TYPE name1_gp,
* ort01_ku TYPE ort01_gp,
* ort02_ku TYPE ort02_gp,
* lifnr TYPE lifnr,
* name1_li TYPE name1_gp,
* ort01_li TYPE ort01_gp,
* ort02_li TYPE ort02_gp,
* END OF gs_final_alv.
TYPES gs_final_alv TYPE yjalv02.
TYPES : BEGIN OF gs_lifnr,
lifnr TYPE lifnr,
kunnr TYPE kunnr,
name1_li TYPE name1_gp,
ort01_li TYPE ort01_gp,
ort02_li TYPE ort02_gp,
END OF gs_lifnr.
TYPES gt_lifnr_tt TYPE TABLE OF gs_lifnr.
DATA : gt_final_alv TYPE TABLE OF gs_final_alv,
gt_fcat TYPE slis_t_fieldcat_alv.
DATA : gv_bukrs TYPE bukrs,
gv_kunnr TYPE kunnr,
gv_ort01 TYPE ort01_gp,
gv_lifnr TYPE lifnr.
DATA : gr_table TYPE REF TO cl_salv_table,
gr_columns TYPE REF TO cl_salv_columns_table,
gr_column TYPE REF TO cl_salv_column_table,
gr_functions TYPE REF TO cl_salv_functions,
gr_layout TYPE REF TO cl_salv_layout,
gr_display TYPE REF TO cl_salv_display_settings,
r_field_label TYPE REF TO ycl_field_label.
SELECTION-SCREEN BEGIN OF BLOCK b01 WITH FRAME TITLE text-001.
SELECT-OPTIONS : s_bukrs FOR gv_bukrs,
s_kunnr FOR gv_kunnr,
s_ort01k FOR gv_ort01,
s_lifnr FOR gv_lifnr,
s_ort01l FOR gv_ort01.
SELECTION-SCREEN END OF BLOCK b01.
SELECTION-SCREEN BEGIN OF BLOCK b02 WITH FRAME TITLE text-002.
PARAMETERS :p_layout AS CHECKBOX,
p_factor AS CHECKBOX.
SELECTION-SCREEN END OF BLOCK b02.
AT SELECTION-SCREEN.
IF s_bukrs IS INITIAL
AND s_kunnr IS INITIAL
AND s_lifnr IS INITIAL.
MESSAGE text-004 TYPE 'E'.
ENDIF.
AT SELECTION-SCREEN OUTPUT.
* LOOP AT SCREEN. " To change Selection screen name at run time
* CASE screen-name.
* WHEN '%_S_ORT01L_%_APP_%-TEXT'. PERFORM change_sel_screen_text USING 'XXX'. "Vendor City
* ENDCASE.
* ENDLOOP.
START-OF-SELECTION.
*Fetching Company code and Customer No
PERFORM fetch_data.
END-OF-SELECTION.
PERFORM cocd_auth_check .
*Displaying the report
PERFORM display_data.
FORM fetch_data.
DATA lt_lifnr TYPE gt_lifnr_tt.
FIELD-SYMBOLS : <fs_final_alv> TYPE gs_final_alv,
<fs_lifnr> TYPE gs_lifnr.
SELECT bukrs
kna1~kunnr
name1
ort01
ort02
INTO TABLE gt_final_alv
FROM kna1 INNER JOIN knb1
ON kna1~kunnr = knb1~kunnr
WHERE kna1~kunnr IN s_kunnr
AND bukrs IN s_bukrs
AND ort01 IN s_ort01k.
IF gt_final_alv IS NOT INITIAL.
SELECT kunnr
lifnr
name1
ort01
ort02
INTO TABLE lt_lifnr
FROM lfa1
FOR ALL ENTRIES IN gt_final_alv
WHERE kunnr = gt_final_alv-kunnr
AND lifnr IN s_lifnr
AND ort01 IN s_ort01l.
LOOP AT gt_final_alv ASSIGNING <fs_final_alv>.
READ TABLE lt_lifnr ASSIGNING <fs_lifnr> WITH KEY kunnr = <fs_final_alv>-kunnr.
IF sy-subrc = 0.
<fs_final_alv>-lifnr = <fs_lifnr>-lifnr.
<fs_final_alv>-name1_li = <fs_lifnr>-name1_li.
<fs_final_alv>-ort01_li = <fs_lifnr>-ort01_li.
<fs_final_alv>-ort02_li = <fs_lifnr>-ort02_li.
ENDIF.
ENDLOOP.
ELSE.
MESSAGE text-003 TYPE 'I'.
ENDIF.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form DISPLAY_DATA
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM display_data .
IF gt_final_alv IS INITIAL. " Return to Selection screen if Global Table is blank
RETURN.
ENDIF.
IF p_factor = 'X'. " Display data using Factory_alv
DATA: l_key TYPE salv_s_layout_key.
"Get instance of the CL_SALV_TABLE using Factory method
TRY.
CALL METHOD cl_salv_table=>factory
IMPORTING
r_salv_table = gr_table
CHANGING
t_table = gt_final_alv.
CATCH cx_salv_msg .
ENDTRY.
TRY.
*set functions
gr_functions = gr_table->get_functions( ).
gr_functions->set_all( abap_true ).
* add function
* gr_functions->add_function(
* name = 'ADVHAN'
* icon = '@BB@'
* text = 'Advisor'
* tooltip = 'Handled by advisor'
* position = if_salv_c_function_position=>right_of_salv_functions ).
* set column
gr_columns = gr_table->get_columns( ).
gr_columns->set_optimize( abap_true ).
* set hotspot
* gr_column ?= gr_columns->get_column( 'EQUNR' ).
* gr_column->set_cell_type( if_salv_c_cell_type=>hotspot ).
*
* gr_column ?= gr_columns->get_column( 'EQART' ).
* gr_column->set_cell_type( if_salv_c_cell_type=>hotspot ).
* highlight column
gr_column ?= gr_columns->get_column('BUKRS').
gr_column->set_key( abap_true ).
gr_column ?= gr_columns->get_column('KUNNR').
gr_column->set_key( if_salv_c_bool_sap=>true ).
* gr_column ?= gr_columns->get_column('BELNR').
* Hardcoding field label
gr_column ?= gr_columns->get_column('ORT01_KU').
gr_column->set_short_text('Cust City').
* "Get Display Settings
gr_display ?= gr_table->get_display_settings( ).
gr_display->set_striped_pattern( abap_true ). "Stripped Pattern
CREATE OBJECT r_field_label
EXPORTING
im_columns_table = gr_columns.
* To change field label at run time
* PERFORM set_texts USING 'BUKRS' 'XXX'. "Company code
* PERFORM set_texts USING 'KUNNR' 'XXX'. "Customer No.
* Disable few field in O/P
PERFORM set_technical USING 'ORT02_LI'.
"Display ALV
CALL METHOD gr_table->display.
CATCH cx_salv_not_found.
CATCH cx_salv_wrong_call.
CATCH cx_salv_existing.
CATCH cx_salv_data_error.
ENDTRY.
ELSE.
DATA: l_repid TYPE syrepid,
l_title TYPE lvc_title.
* Layout structure
DATA: l_layout TYPE slis_layout_alv.
DATA: l_gridset TYPE lvc_s_glay.
l_layout-info_fieldname = 'COLCODE'.
l_repid = sy-repid.
-------------------------------------------------------------------------
*Prepare Field catalog for the ALV report
PERFORM setup_fieldcatalog.
------------------------------------------------------------------------
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = l_repid
* i_callback_pf_status_set = 'SET_STATUS'
i_callback_user_command = 'USER_COMMAND'
* i_callback_top_of_page = 'TOP_OF_PAGE'
* i_background_id = 'ALV_BACKGROUND'
i_grid_title = l_title
i_grid_settings = l_gridset
is_layout = l_layout
it_fieldcat = gt_fcat
i_save = 'A'
TABLES
t_outtab = gt_final_alv
EXCEPTIONS
program_error = 1
OTHERS = 2.
ENDIF.
ENDFORM.
FORM setup_fieldcatalog .
DATA g_fcat_h TYPE slis_fieldcat_alv.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = 'YJFIR02'
i_structure_name = 'YJALV02'
CHANGING
ct_fieldcat = gt_fcat
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.
LOOP AT gt_fcat INTO g_fcat_h.
CASE g_fcat_h-fieldname.
WHEN 'KUNNR'.
g_fcat_h-key = 'X'.
g_fcat_h-key_sel = 'X'.
g_fcat_h-seltext_l = 'Customer number'. "#EC NOTEXT
g_fcat_h-seltext_m = 'Customer No.'. "#EC NOTEXT
g_fcat_h-seltext_s = 'Cust.No.'. "#EC NOTEXT
WHEN 'LIFNR'.
g_fcat_h-key = 'X'.
g_fcat_h-key_sel = 'X'.
g_fcat_h-seltext_l = 'Vendor number'. "#EC NOTEXT
g_fcat_h-seltext_m = 'Vendor No.'. "#EC NOTEXT
g_fcat_h-seltext_s = 'Vend.No.'. "#EC NOTEXT
WHEN 'NAME1_KU'.
g_fcat_h-seltext_l = 'Customer Name'. "#EC NOTEXT
g_fcat_h-seltext_m = 'Cust Name'. "#EC NOTEXT
g_fcat_h-outputlen = '20'.
WHEN 'NAME1_LI'.
g_fcat_h-seltext_l = 'Vendor Name'. "#EC NOTEXT
g_fcat_h-seltext_m = 'Vend Name'. "#EC NOTEXT
g_fcat_h-outputlen = '20'.
WHEN 'ORT01_KU'.
g_fcat_h-seltext_l = 'Customer City'. "#EC NOTEXT
g_fcat_h-seltext_m = 'Cust City'. "#EC NOTEXT
g_fcat_h-outputlen = '20'. "#EC NOTEXT
ENDCASE.
MODIFY gt_fcat FROM g_fcat_h.
ENDLOOP.
ENDFORM. " SETUP_FIELDCATALOG
FORM cocd_auth_check .
TYPES: BEGIN OF lt_t001,
bukrs TYPE bukrs,
butxt TYPE butxt,
ort01 TYPE ort01,
land1 TYPE land1,
END OF lt_t001.
DATA: lit_t001 TYPE STANDARD TABLE OF lt_t001 INITIAL SIZE 0,
lwa_t001 TYPE lt_t001.
SELECT bukrs
butxt
ort01
land1
INTO TABLE lit_t001
FROM t001
WHERE bukrs IN s_bukrs.
LOOP AT lit_t001 INTO lwa_t001.
AUTHORITY-CHECK OBJECT 'F_BKPF_BUK'
ID 'ACTVT' FIELD '03'
ID 'BUKRS' FIELD lwa_t001-bukrs.
IF sy-subrc IS NOT INITIAL.
MESSAGE e001(zfi_eucomp) WITH lwa_t001-bukrs.
ENDIF.
ENDLOOP.
ENDFORM. " COCD_AUTH_CHECK
*&---------------------------------------------------------------------*
*& Form SET_TEXTS
*&---------------------------------------------------------------------*
FORM set_texts USING p_columnname TYPE lvc_fname
p_field_label TYPE yfield_label.
DATA:
l_columnname TYPE lvc_fname,
l_field_label TYPE yfield_label.
l_columnname = p_columnname.
l_field_label = p_field_label.
r_field_label->set_texts(
EXPORTING
im_columnname = l_columnname
im_field_label = l_field_label
EXCEPTIONS
field_label_not_found = 1
columnname_not_found = 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.
ENDFORM. " SET_TEXTS
FORM set_technical USING p_columnname TYPE lvc_fname.
TRY.
gr_column ?= gr_columns->get_column( columnname = p_columnname ).
gr_column->set_technical( value = if_salv_c_bool_sap=>true ).
CATCH cx_salv_not_found cx_salv_existing cx_salv_data_error. "#EC NO_HANDLER
ENDTRY.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form CHANGE_SEL_SCREEN_TEXT
*&---------------------------------------------------------------------*
FORM change_sel_screen_text USING p_field_label TYPE yfield_label.
DATA:
l_long_text TYPE ybc_field_labelt-long_text.
FIELD-SYMBOLS:
<text> TYPE any.
* Get Field Label
ycl_field_label=>get_field_label(
EXPORTING
im_field_label = p_field_label
IMPORTING
* ex_short_text =
* ex_medium_text =
ex_long_text = l_long_text
* ex_tooltip =
EXCEPTIONS
field_label_not_found = 1
OTHERS = 2
).
IF sy-subrc = 0.
ASSIGN (screen-name) TO <text>.
<text> = l_long_text.
MODIFY SCREEN.
ENDIF.
ENDFORM. " CHANGE_SEL_SCREEN_TEXT
No comments:
Post a Comment