ALV BLOCK with frame titles
Hi all,
I need an example of ALV Blocks with frame titles.
Can anyone help me?
Regards,
Roxana
Hi,
Check this link for ALV block list..
https://wiki.sdn.sap.com/wiki/display/Snippets/ABAP-ProgramforALVBlocklist
Not sure what do you mean by WITH FRAME TITLE.
Thanks,
Naren
Similar Messages
-
ALV output with different Titles
Hi,
I have one requirement,that we have set of radibuttons in selection screen.
when we are selecting that radiobutton ALV out put will be displayed.
but user wants the description of the selected radio button in Menu Title Bar of AlV out put.
can any one help me to know ,what is approach to sort this...?
Thanks...Hi Sekhar,
go through this thread.
Changing title bar of ALV list
also try this code patch.
start-of-selection.
SET PF-STATUS 'MAIN'.
SET TITLEBAR 'TEST'.
write 'hi'.
at user-command.
if sy-ucomm = 'TEST'.
MESSAGE 'HI' TYPE 'I'.
ENDIF.
Regards,
Vijay -
ALV REPORT WITH MULTIPLE BLOCKS - COLUM TOTAL
Hi friends,
In the following code, I am not getting the column total.
--- SAMPLE 1--
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
EXPORTING
i_callback_program = sy-cprog
i_callback_user_command = 'USER_COMMAND'.
PERFORM list_append TABLES IT_CTV
USING '1'
'IT_CTV'.
PERFORM list_append TABLES IT_APP
USING '2'
'IT_APP'.
PERFORM f_list_display.
FORM USER_COMMAND *
FORM user_command USING i_ucomm LIKE sy-ucomm
is_selfield TYPE slis_selfield. "#EC CALLED
ENDFORM. " USER_COMMAND
Form list_append
FORM list_append TABLES ut_table
USING u_no TYPE char1
u_tabname TYPE slis_tabname.
DEFINE m_fieldcat.
ls_fieldcat-fieldname = &1.
ls_fieldcat-ref_tabname = &2.
append ls_fieldcat to lt_fieldcat.
END-OF-DEFINITION.
DATA: GT_ZSUM TYPE SLIS_T_SORTINFO_ALV WITH HEADER LINE.
DEFINE m_sort.
ls_sort-fieldname = &1.
ls_sort-up = 'X'.
append ls_sort to lt_sort.
END-OF-DEFINITION.
DATA :
ls_fieldcat TYPE slis_fieldcat_alv,
lt_fieldcat TYPE slis_t_fieldcat_alv, " Field catalog
ls_sort TYPE slis_sortinfo_alv,
lt_sort TYPE slis_t_sortinfo_alv. " Sort table
DATA:
lt_events TYPE slis_t_event,
ls_event TYPE slis_alv_event,
ls_layout TYPE slis_layout_alv.
ls_layout-group_change_edit = 'X'.
ls_layout-colwidth_optimize = 'X'.
ls_layout-zebra = 'X'.
ls_layout-cell_merge = 'X'.
ls_layout-detail_popup = 'X'.
ls_layout-get_selinfos = 'X'.
ls_layout-max_linesize = '300'.
CASE u_no.
WHEN '1'.
ls_fieldcat-SELTEXT_L = ' REGION'.
m_fieldcat 'BZIRK' 'IT_CTV'.
ls_fieldcat-just = 'R'.
ls_fieldcat-SELTEXT_L = ' CTV STOCK'.
m_fieldcat 'CTVST' 'IT_CTV'.
ls_fieldcat-just = 'R'.
ls_fieldcat-SELTEXT_L = ' CTV VALUE'.
m_fieldcat 'CTVVL' 'IT_CTV'.
ls_fieldcat-DO_SUM = 'X'.
m_sort 'BZIRK'.
WHEN '2'.
ls_fieldcat-SELTEXT_L = ' REGION'.
m_fieldcat 'BZIRK' 'IT_APP'.
ls_fieldcat-just = 'R'.
ls_fieldcat-SELTEXT_L = ' RFG STK'.
m_fieldcat 'RFGST' 'IT_APP'.
ls_fieldcat-just = 'R'.
ls_fieldcat-SELTEXT_L = ' RFG VAL'.
m_fieldcat 'RFGVL' 'IT_APP'.
ls_fieldcat-just = 'R'.
ls_fieldcat-SELTEXT_L = ' WM STK'.
m_fieldcat 'WMCST' 'IT_APP'.
ls_fieldcat-just = 'R'.
ls_fieldcat-SELTEXT_L = ' WM VAL'.
m_fieldcat 'WMCVL' 'IT_APP'.
ls_fieldcat-just = 'R'.
ls_fieldcat-SELTEXT_L = ' MCCS STK'.
m_fieldcat 'MOVST' 'IT_APP'.
ls_fieldcat-just = 'R'.
ls_fieldcat-SELTEXT_L = ' MCCS VAL'.
m_fieldcat 'MOVVL' 'IT_APP'.
ls_fieldcat-just = 'R'.
ls_fieldcat-SELTEXT_L = ' APP STK'.
m_fieldcat 'APPST' 'IT_APP'.
ls_fieldcat-just = 'R'.
ls_fieldcat-SELTEXT_L = ' APP VAL'.
m_fieldcat 'APPVL' 'IT_APP'.
ls_fieldcat-just = 'R'.
ls_fieldcat-DO_SUM = 'X'.
m_sort 'BZIRK'.
ENDCASE.
ls_fieldcat-COL_POS = 1.
ls_fieldcat-FIELDNAME = 'BZIRK'.
ls_fieldcat-DO_SUM = 'X'.
ls_fieldcat-FIX_COLUMN = 'X'.
APPEND ls_fieldcat TO lT_fieldcat.
IF u_no CA '13'.
MOVE 'TOP_OF_PAGE' TO ls_event-name.
CONCATENATE 'TOP_OF_PAGE' u_no INTO ls_event-form.
APPEND ls_event TO lt_events.
ELSE.
MOVE 'TOP_OF_LIST' TO ls_event-name.
CONCATENATE 'TOP_OF_LIST' u_no INTO ls_event-form.
APPEND ls_event TO lt_events.
ENDIF.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
it_fieldcat = lt_fieldcat
is_layout = ls_layout
i_tabname = u_tabname
it_events = lt_events
it_sort = lt_sort
TABLES
t_outtab = ut_table
EXCEPTIONS
program_error = 1
maximum_of_appends_reached = 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. " LIST_APPEND
Form f_list_display
FORM f_list_display.
DATA ls_print TYPE slis_print_alv.
ls_print-no_print_selinfos = 'X'. " Display no selection infos
ls_print-no_print_listinfos = 'X'. " Display no listinfos
ls_print-reserve_lines = 2. " Lines reserved for end of page
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'
EXPORTING
i_interface_check = ' '
is_print = ls_print
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.
ENDFORM. " F_LIST_DISPLAY
FORM top_of_page1 *
FORM top_of_page1. "#EC CALLED
WRITE 'SALES REPORT'.
PERFORM TOP_LIST1.
ENDFORM.
FORM top_of_list2 *
FORM top_of_list2. "#EC CALLED
WRITE 'STOCK REPORT'.
PERFORM top_of_page.
ENDFORM.
*-----END OF SAMPLE 1 -
Could any help me.
Thanx in advance.
Regards,
A S VINCENTHai Vincent
Check & Run the follow ABAP Code
*& Report ZALV_Block *
REPORT ZALV_block NO STANDARD PAGE HEADING
MESSAGE-ID ZZ.
*..Type Definitions for ALV Report
TYPE-POOLS SLIS.
Table Declarations. *
TABLES: MARA, "Material Master
MARC, "Plant Data for Material
MARD, "Storage Location Data for Material
VBAP, "Sales Document: Item Data
VBUP. "Sales Document: Item Status
Internal table to store sales orders.......
DATA: BEGIN OF IT_VBAP OCCURS 0,
VBELN LIKE VBAP-VBELN, "Sales Document
POSNR LIKE VBAP-POSNR, "Sales Document Item
KWMENG LIKE VBAP-KWMENG, "Cumulative order quantity in sales
" Units
END OF IT_VBAP.
internal table to store final data
DATA: BEGIN OF IT_FINAL OCCURS 0,
WERKS LIKE MARD-WERKS, "Plant
MATNR LIKE MARD-MATNR, "Material Number
LGORT LIKE MARD-LGORT, "Storage Location
LABST LIKE MARD-LABST, "Valuated stock with unrestricted use
INSME LIKE MARD-INSME, "Stock in quality inspection
RETME LIKE MARD-RETME, "Blocked Stock Returns
UMLME LIKE MARD-UMLME, "Stock in transfer
MAKTX LIKE MAKT-MAKTX, "Material description
VBELN LIKE VBAP-VBELN, "Sales Document
POSNR LIKE VBAP-POSNR, "Sales Document Item
KWMENG LIKE VBAP-KWMENG, "Cumulative order quantity in sales
" Units
END OF IT_FINAL.
ALV Type declaration *
*..Field Catalog for Basic List.
DATA : IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
*..Events For Basic List.
DATA : IT_EVENTS TYPE SLIS_T_EVENT,
WA_EVENTS TYPE SLIS_ALV_EVENT.
*..Layout For Basic List
DATA : WA_LAYOUT TYPE SLIS_LAYOUT_ALV.
*..Sort Table For Basic List
DATA: IT_SORT TYPE SLIS_SORTINFO_ALV OCCURS 0 WITH HEADER LINE.
DATA DECLARATIONS *
DATA: V_FLAG,
VINDEX TYPE SY-TABIX,
TOTAL TYPE VBAP-KWMENG. "Open order quantity
*..To Store Program Name
DATA: V_REPID TYPE SYREPID.
*..To know whether basic list contains any data
Selection Screen. *
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-H01.
SELECT-OPTIONS: S_MATNR FOR MARA-MATNR,
S_WERKS FOR MARC-WERKS,
S_LGORT FOR MARD-LGORT.
SELECTION-SCREEN END OF BLOCK B1.
Event:Initialization *
INITIALIZATION.
V_REPID = SY-REPID.
AT Selection Screen. *
AT SELECTION-SCREEN.
PERFORM VALIDATIONS.
Event: Start-of-Selection *
START-OF-SELECTION.
To get data from vbap into internal table IT_VBAP
PERFORM FETCH_OPEN_DATA.
To get data into final internal table IT_FINAL
IF V_FLAG = 'X'.
PERFORM FETCH_FINAL_DATA.
ENDIF.
IF V_FLAG = ''.
MESSAGE I010 WITH 'NO DATA TO BE DISPLAYED'.
EXIT.
ELSE.
--Setting the FIELD CATALOG for ALV
PERFORM FILL_FIELDCAT_HEADER.
*-----Setting the LAYOUT for ALV
PERFORM GET_LAYOUT.
*-----Getting the ALV Events
PERFORM GET_EVENT.
*---- To Sort the list
PERFORM DO_SORT.
ENDIF.
Event: End-of-Selection *
END-OF-SELECTION.
*--Generating the ALV LIST DISPLAY
PERFORM DISPLAY_LIST.
FORM DEFINITIONS *
*& Form VALIDATIONS
To validate data in selection screen
--> p1 text
<-- p2 text
FORM VALIDATIONS.
PERFORM VALIDATE_MATNR.
PERFORM VALIDATE_WERKS.
PERFORM VALIDATE_LGORT.
IF NOT ( ( MARA-MATNR IS INITIAL ) AND
( MARC-WERKS IS INITIAL ) AND
( MARD-LGORT IS INITIAL ) ).
SELECT SINGLE MATNR
WERKS
LGORT
FROM MARD
INTO (MARD-MATNR, MARD-WERKS, MARD-LGORT)
WHERE MATNR = MARA-MATNR
AND WERKS = MARC-WERKS
AND LGORT = MARD-LGORT.
ENDIF.
ENDFORM. " VALIDATIONS
*& Form VALIDATE_MATNR
To validate MATNR
--> p1 text
<-- p2 text
FORM VALIDATE_MATNR.
IF NOT S_MATNR[] IS INITIAL.
SELECT MATNR
UP TO 1 ROWS
INTO (MARD-MATNR)
FROM MARA
WHERE MATNR IN S_MATNR.
ENDSELECT.
ENDIF.
IF SY-SUBRC NE 0.
MESSAGE E000 WITH TEXT-001.
ENDIF.
ENDFORM. " VALIDATE_MATNR
*& Form VALIDATE_WERKS
To validate plant
--> p1 text
<-- p2 text
FORM VALIDATE_WERKS.
IF NOT S_WERKS[] IS INITIAL.
SELECT WERKS
UP TO 1 ROWS
INTO (MARD-WERKS)
FROM MARC
WHERE WERKS IN S_WERKS.
ENDSELECT.
ENDIF.
IF SY-SUBRC NE 0.
MESSAGE E000 WITH TEXT-002.
ENDIF.
ENDFORM. " VALIDATE_WERKS
*& Form VALIDATE_LGORT
To validate storage
--> p1 text
<-- p2 text
FORM VALIDATE_LGORT.
IF NOT S_LGORT[] IS INITIAL.
SELECT LGORT
UP TO 1 ROWS
INTO (MARD-LGORT)
FROM MARD
WHERE LGORT IN S_LGORT.
ENDSELECT.
ENDIF.
IF SY-SUBRC NE 0.
MESSAGE E000 WITH TEXT-003.
ENDIF.
ENDFORM. " VALIDATE_LGORT
*& Form FETCH_OPEN_DATA
To get data into internal table IT_VBAP
--> p1 text
<-- p2 text
FORM FETCH_OPEN_DATA.
IF NOT ( ( MARA-MATNR IS INITIAL ) AND
( MARC-WERKS IS INITIAL ) AND
( MARD-LGORT IS INITIAL ) ).
SELECT VBELN
POSNR
KWMENG
INTO CORRESPONDING FIELDS OF TABLE IT_VBAP
FROM VBAP
WHERE MATNR IN S_MATNR
AND WERKS IN S_WERKS
AND LGORT IN S_LGORT.
ENDIF.
LOOP AT IT_VBAP.
SELECT * FROM VBUP
INTO VBUP
WHERE VBELN = IT_VBAP-VBELN
AND POSNR = IT_VBAP-POSNR
AND LFSTA NE 'C'.
ENDSELECT.
ENDLOOP.
IF SY-SUBRC NE 0.
REFRESH IT_VBAP.
MESSAGE E000 WITH TEXT-004.
EXIT.
ELSE.
V_FLAG = 'X'.
ENDIF.
To get sum of all quantities as open order quantity
LOOP AT IT_VBAP.
TOTAL = TOTAL + IT_VBAP-KWMENG.
ENDLOOP.
ENDFORM. " FETCH_OPEN_DATA
*& Form FETCH_FINAL_DATA
To get data into final internal table IT_FINAL
--> p1 text
<-- p2 text
FORM FETCH_FINAL_DATA.
SELECT A~MATNR
A~WERKS
A~LGORT
MAKTX
LABST
INSME
RETME
UMLME
VBELN
POSNR
KWMENG
INTO CORRESPONDING FIELDS OF TABLE IT_FINAL
FROM MARD AS A
INNER JOIN MAKT AS B
ON AMATNR = BMATNR
AND SPRAS = 'E'
INNER JOIN VBAP AS C
ON AMATNR = CMATNR
FOR ALL ENTRIES IN IT_VBAP
WHERE VBELN = IT_VBAP-VBELN
AND POSNR = IT_VBAP-POSNR
AND KWMENG = IT_VBAP-KWMENG
AND A~MATNR IN S_MATNR
AND A~WERKS IN S_WERKS
AND A~LGORT IN S_LGORT.
IF SY-SUBRC NE 0.
V_FLAG = SPACE.
MESSAGE E001 WITH 'No data found IN the selection criteria'.
EXIT.
ELSE.
V_FLAG = 'X'.
ENDIF.
ENDFORM. " FETCH_FINAL_DATA
*& Form FILL_FIELDCAT_HEADER
text
--> p1 text
<-- p2 text
FORM FILL_FIELDCAT_HEADER .
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = V_REPID
I_INTERNAL_TABNAME = 'IT_FINAL'
I_STRUCTURE_NAME =
I_CLIENT_NEVER_DISPLAY = 'X'
I_INCLNAME = V_REPID
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
CHANGING
CT_FIELDCAT = IT_FIELDCAT
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 IT_FIELDCAT INTO WA_FIELDCAT.
CASE WA_FIELDCAT-FIELDNAME.
WHEN 'KWMENG'.
WA_FIELDCAT-COL_POS = '11'.
WA_FIELDCAT-OUTPUTLEN = '22'.
WA_FIELDCAT-SELTEXT_L = 'Net Value'.
WA_FIELDCAT-DO_SUM = 'X'.
ENDCASE.
MODIFY IT_FIELDCAT FROM WA_FIELDCAT INDEX SY-TABIX.
ENDLOOP.
ENDFORM. " FILL_FIELDCAT_HEADER
*& Form GET_LAYOUT
text
--> p1 text
<-- p2 text
FORM GET_LAYOUT .
WA_LAYOUT-TOTALS_TEXT = 'TOTAL'.
ENDFORM. " GET_LAYOUT
*& Form GET_EVENT
text
--> p1 text
<-- p2 text
FORM GET_EVENT .
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = IT_EVENTS
EXCEPTIONS
LIST_TYPE_WRONG = 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.
LOOP AT IT_EVENTS INTO WA_EVENTS.
CASE WA_EVENTS-NAME.
WHEN 'TOP_OF_PAGE'.
WA_EVENTS-FORM = 'FILL_LIST_HEADER'.
WHEN 'USER_COMMAND'.
WA_EVENTS-FORM = 'PROCESS_BASIC_LIST'.
ENDCASE.
MODIFY IT_EVENTS FROM WA_EVENTS INDEX SY-TABIX.
ENDLOOP.
ENDFORM. " GET_EVENT
FORM FILL_LIST_HEADER *
FORM FILL_LIST_HEADER.
WRITE:2'Report :' , SY-REPID,
: 85 ' Intelligroup Asia Pvt Ltd' CENTERED,
: 159 'Date :' ,SY-DATUM,
:/2'User :', SY-UNAME,
: 82 ' Hyderabad ' CENTERED ,
: 159 'Pg.No :' ,SY-PAGNO,
:/86 ' Stock Report ' CENTERED.
SKIP 2.
ENDFORM. "FILL_LIST_HEADER
*& Form DISPLAY_LIST
text
--> p1 text
<-- p2 text
FORM DISPLAY_LIST .
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = V_REPID
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
I_STRUCTURE_NAME =
IS_LAYOUT = WA_LAYOUT
IT_FIELDCAT = IT_FIELDCAT
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT = IT_SORT[]
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS = IT_EVENTS
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = IT_FINAL
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.
ENDFORM. " DISPLAY_LIST
*& Form do_sort
text
--> p1 text
<-- p2 text
FORM DO_SORT .
*-- Populating the sort table
IT_SORT-FIELDNAME = 'MATNR'.
IT_SORT-TABNAME = 'IT_FINAL'.
IT_SORT-UP = 'X'.
it_sort-subtot = 'X'.
APPEND IT_SORT.
ENDFORM. " do_sort
Thanks & Regards
Sreenivasulu P -
ALV REPORT WITH MULTIPLE BLOCKS
To print two blocks in a single ALV report, I have taken the sample and modified to my requirement. I am having the following problems in this code.
1. Columnwise total not appearing.
2. Amount and numbers in all the columns are
left justified instead of right justified.
The code written is given below. Kindly check the same and suggest for corrections.
--- SAMPLE 1--
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
EXPORTING
i_callback_program = sy-cprog
i_callback_user_command = 'USER_COMMAND'.
PERFORM list_append TABLES IT_CTV
USING '1'
'IT_CTV'.
PERFORM list_append TABLES IT_APP
USING '2'
'IT_APP'.
PERFORM f_list_display.
FORM USER_COMMAND *
FORM user_command USING i_ucomm LIKE sy-ucomm
is_selfield TYPE slis_selfield. "#EC CALLED
ENDFORM. " USER_COMMAND
Form list_append
FORM list_append TABLES ut_table
USING u_no TYPE char1
u_tabname TYPE slis_tabname.
DEFINE m_fieldcat.
ls_fieldcat-fieldname = &1.
ls_fieldcat-ref_tabname = &2.
append ls_fieldcat to lt_fieldcat.
END-OF-DEFINITION.
DEFINE m_sort.
ls_sort-fieldname = &1.
ls_sort-up = 'X'.
append ls_sort to lt_sort.
END-OF-DEFINITION.
DATA :
ls_fieldcat TYPE slis_fieldcat_alv,
lt_fieldcat TYPE slis_t_fieldcat_alv, " Field catalog
ls_sort TYPE slis_sortinfo_alv,
lt_sort TYPE slis_t_sortinfo_alv. " Sort table
DATA:
lt_events TYPE slis_t_event,
ls_event TYPE slis_alv_event,
ls_layout TYPE slis_layout_alv.
ls_layout-group_change_edit = 'X'.
ls_layout-colwidth_optimize = 'X'.
ls_layout-zebra = 'X'.
ls_layout-cell_merge = 'X'.
ls_layout-detail_popup = 'X'.
ls_layout-get_selinfos = 'X'.
ls_layout-max_linesize = '300'.
CASE u_no.
WHEN '1'.
ls_fieldcat-SELTEXT_L = ' REGION'.
ls_fieldcat-DO_SUM = 'X'.
m_fieldcat 'BZIRK' 'IT_CTV'.
ls_fieldcat-SELTEXT_L = ' CTV STOCK'.
m_fieldcat 'CTVST' 'IT_CTV'.
ls_fieldcat-SELTEXT_L = ' CTV VALUE'.
m_fieldcat 'CTVVL' 'IT_CTV'.
m_sort 'BZIRK'.
ls_fieldcat-DO_SUM = 'X'.
WHEN '2'.
ls_fieldcat-SELTEXT_L = ' REGION'.
m_fieldcat 'BZIRK' 'IT_APP'.
ls_fieldcat-SELTEXT_L = ' RFG STK'.
m_fieldcat 'RFGST' 'IT_APP'.
ls_fieldcat-SELTEXT_L = ' RFG VAL'.
m_fieldcat 'RFGVL' 'IT_APP'.
ls_fieldcat-SELTEXT_L = ' WM STK'.
m_fieldcat 'WMCST' 'IT_APP'.
ls_fieldcat-SELTEXT_L = ' WM VAL'.
m_fieldcat 'WMCVL' 'IT_APP'.
ls_fieldcat-SELTEXT_L = ' MCCS STK'.
m_fieldcat 'MOVST' 'IT_APP'.
ls_fieldcat-SELTEXT_L = ' MCCS VAL'.
m_fieldcat 'MOVVL' 'IT_APP'.
ls_fieldcat-SELTEXT_L = ' APP STK'.
m_fieldcat 'APPST' 'IT_APP'.
ls_fieldcat-SELTEXT_L = ' APP VAL'.
m_fieldcat 'APPVL' 'IT_APP'.
m_sort 'BZIRK'.
ENDCASE.
ls_fieldcat-COL_POS = 1.
ls_fieldcat-FIELDNAME = 'BZIRK'.
ls_fieldcat-DO_SUM = 'X'.
ls_fieldcat-FIX_COLUMN = 'X'.
APPEND ls_fieldcat TO lT_fieldcat.
IF u_no CA '13'.
MOVE 'TOP_OF_PAGE' TO ls_event-name.
CONCATENATE 'TOP_OF_PAGE' u_no INTO ls_event-form.
APPEND ls_event TO lt_events.
ELSE.
MOVE 'TOP_OF_LIST' TO ls_event-name.
CONCATENATE 'TOP_OF_LIST' u_no INTO ls_event-form.
APPEND ls_event TO lt_events.
ENDIF.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
it_fieldcat = lt_fieldcat
is_layout = ls_layout
i_tabname = u_tabname
it_events = lt_events
it_sort = lt_sort
TABLES
t_outtab = ut_table
EXCEPTIONS
program_error = 1
maximum_of_appends_reached = 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. " LIST_APPEND
Form f_list_display
FORM f_list_display.
DATA ls_print TYPE slis_print_alv.
ls_print-no_print_selinfos = 'X'. " Display no selection infos
ls_print-no_print_listinfos = 'X'. " Display no listinfos
ls_print-reserve_lines = 2. " Lines reserved for end of page
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'
EXPORTING
i_interface_check = ' '
is_print = ls_print
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.
ENDFORM. " F_LIST_DISPLAY
Thanks in advance.
A S VINCENTHai Vincent
Check the following Code
*& Report ZALV_BLOCK *
REPORT ZALV_BLOCK NO STANDARD PAGE HEADING
MESSAGE-ID ZZ.
*..Type Definitions for ALV Report
TYPE-POOLS SLIS.
Table Declarations. *
TABLES: MARA, "Material Master
MARC, "Plant Data for Material
MARD, "Storage Location Data for Material
VBAP, "Sales Document: Item Data
VBUP. "Sales Document: Item Status
Internal table to store sales orders.......
DATA: BEGIN OF IT_VBAP OCCURS 0,
VBELN LIKE VBAP-VBELN, "Sales Document
POSNR LIKE VBAP-POSNR, "Sales Document Item
KWMENG LIKE VBAP-KWMENG, "Cumulative order quantity in sales
" Units
END OF IT_VBAP.
internal table to store final data
DATA: BEGIN OF IT_FINAL OCCURS 0,
WERKS LIKE MARD-WERKS, "Plant
MATNR LIKE MARD-MATNR, "Material Number
LGORT LIKE MARD-LGORT, "Storage Location
LABST LIKE MARD-LABST, "Valuated stock with unrestricted use
INSME LIKE MARD-INSME, "Stock in quality inspection
RETME LIKE MARD-RETME, "Blocked Stock Returns
UMLME LIKE MARD-UMLME, "Stock in transfer
MAKTX LIKE MAKT-MAKTX, "Material description
VBELN LIKE VBAP-VBELN, "Sales Document
POSNR LIKE VBAP-POSNR, "Sales Document Item
KWMENG LIKE VBAP-KWMENG, "Cumulative order quantity in sales
" Units
END OF IT_FINAL.
ALV Type declaration *
*..Field Catalog for Basic List.
DATA : IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
*..Events For Basic List.
DATA : IT_EVENTS TYPE SLIS_T_EVENT,
WA_EVENTS TYPE SLIS_ALV_EVENT.
*..Layout For Basic List
DATA : WA_LAYOUT TYPE SLIS_LAYOUT_ALV.
*..Sort Table For Basic List
DATA: IT_SORT TYPE SLIS_SORTINFO_ALV OCCURS 0 WITH HEADER LINE.
DATA DECLARATIONS *
DATA: V_FLAG,
VINDEX TYPE SY-TABIX,
TOTAL TYPE VBAP-KWMENG. "Open order quantity
*..To Store Program Name
DATA: V_REPID TYPE SYREPID.
*..To know whether basic list contains any data
Selection Screen. *
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-H01.
SELECT-OPTIONS: S_MATNR FOR MARA-MATNR,
S_WERKS FOR MARC-WERKS,
S_LGORT FOR MARD-LGORT.
SELECTION-SCREEN END OF BLOCK B1.
Event:Initialization *
INITIALIZATION.
V_REPID = SY-REPID.
AT Selection Screen. *
AT SELECTION-SCREEN.
PERFORM VALIDATIONS.
Event: Start-of-Selection *
START-OF-SELECTION.
To get data from vbap into internal table IT_VBAP
PERFORM FETCH_OPEN_DATA.
To get data into final internal table IT_FINAL
IF V_FLAG = 'X'.
PERFORM FETCH_FINAL_DATA.
ENDIF.
IF V_FLAG = ''.
MESSAGE I010 WITH 'NO DATA TO BE DISPLAYED'.
EXIT.
ELSE.
--Setting the FIELD CATALOG for ALV
PERFORM FILL_FIELDCAT_HEADER.
*-----Setting the LAYOUT for ALV
PERFORM GET_LAYOUT.
*-----Getting the ALV Events
PERFORM GET_EVENT.
*---- To Sort the list
PERFORM DO_SORT.
ENDIF.
Event: End-of-Selection *
END-OF-SELECTION.
*--Generating the ALV LIST DISPLAY
PERFORM DISPLAY_LIST.
FORM DEFINITIONS *
*& Form VALIDATIONS
To validate data in selection screen
--> p1 text
<-- p2 text
FORM VALIDATIONS.
PERFORM VALIDATE_MATNR.
PERFORM VALIDATE_WERKS.
PERFORM VALIDATE_LGORT.
IF NOT ( ( MARA-MATNR IS INITIAL ) AND
( MARC-WERKS IS INITIAL ) AND
( MARD-LGORT IS INITIAL ) ).
SELECT SINGLE MATNR
WERKS
LGORT
FROM MARD
INTO (MARD-MATNR, MARD-WERKS, MARD-LGORT)
WHERE MATNR = MARA-MATNR
AND WERKS = MARC-WERKS
AND LGORT = MARD-LGORT.
ENDIF.
ENDFORM. " VALIDATIONS
*& Form VALIDATE_MATNR
To validate MATNR
--> p1 text
<-- p2 text
FORM VALIDATE_MATNR.
IF NOT S_MATNR[] IS INITIAL.
SELECT MATNR
UP TO 1 ROWS
INTO (MARD-MATNR)
FROM MARA
WHERE MATNR IN S_MATNR.
ENDSELECT.
ENDIF.
IF SY-SUBRC NE 0.
MESSAGE E000 WITH TEXT-001.
ENDIF.
ENDFORM. " VALIDATE_MATNR
*& Form VALIDATE_WERKS
To validate plant
--> p1 text
<-- p2 text
FORM VALIDATE_WERKS.
IF NOT S_WERKS[] IS INITIAL.
SELECT WERKS
UP TO 1 ROWS
INTO (MARD-WERKS)
FROM MARC
WHERE WERKS IN S_WERKS.
ENDSELECT.
ENDIF.
IF SY-SUBRC NE 0.
MESSAGE E000 WITH TEXT-002.
ENDIF.
ENDFORM. " VALIDATE_WERKS
*& Form VALIDATE_LGORT
To validate storage
--> p1 text
<-- p2 text
FORM VALIDATE_LGORT.
IF NOT S_LGORT[] IS INITIAL.
SELECT LGORT
UP TO 1 ROWS
INTO (MARD-LGORT)
FROM MARD
WHERE LGORT IN S_LGORT.
ENDSELECT.
ENDIF.
IF SY-SUBRC NE 0.
MESSAGE E000 WITH TEXT-003.
ENDIF.
ENDFORM. " VALIDATE_LGORT
*& Form FETCH_OPEN_DATA
To get data into internal table IT_VBAP
--> p1 text
<-- p2 text
FORM FETCH_OPEN_DATA.
IF NOT ( ( MARA-MATNR IS INITIAL ) AND
( MARC-WERKS IS INITIAL ) AND
( MARD-LGORT IS INITIAL ) ).
SELECT VBELN
POSNR
KWMENG
INTO CORRESPONDING FIELDS OF TABLE IT_VBAP
FROM VBAP
WHERE MATNR IN S_MATNR
AND WERKS IN S_WERKS
AND LGORT IN S_LGORT.
ENDIF.
LOOP AT IT_VBAP.
SELECT * FROM VBUP
INTO VBUP
WHERE VBELN = IT_VBAP-VBELN
AND POSNR = IT_VBAP-POSNR
AND LFSTA NE 'C'.
ENDSELECT.
ENDLOOP.
IF SY-SUBRC NE 0.
REFRESH IT_VBAP.
MESSAGE E000 WITH TEXT-004.
EXIT.
ELSE.
V_FLAG = 'X'.
ENDIF.
To get sum of all quantities as open order quantity
LOOP AT IT_VBAP.
TOTAL = TOTAL + IT_VBAP-KWMENG.
ENDLOOP.
ENDFORM. " FETCH_OPEN_DATA
*& Form FETCH_FINAL_DATA
To get data into final internal table IT_FINAL
--> p1 text
<-- p2 text
FORM FETCH_FINAL_DATA.
SELECT A~MATNR
A~WERKS
A~LGORT
MAKTX
LABST
INSME
RETME
UMLME
VBELN
POSNR
KWMENG
INTO CORRESPONDING FIELDS OF TABLE IT_FINAL
FROM MARD AS A
INNER JOIN MAKT AS B
ON AMATNR = BMATNR
AND SPRAS = 'E'
INNER JOIN VBAP AS C
ON AMATNR = CMATNR
FOR ALL ENTRIES IN IT_VBAP
WHERE VBELN = IT_VBAP-VBELN
AND POSNR = IT_VBAP-POSNR
AND KWMENG = IT_VBAP-KWMENG
AND A~MATNR IN S_MATNR
AND A~WERKS IN S_WERKS
AND A~LGORT IN S_LGORT.
IF SY-SUBRC NE 0.
V_FLAG = SPACE.
MESSAGE E001 WITH 'No data found IN the selection criteria'.
EXIT.
ELSE.
V_FLAG = 'X'.
ENDIF.
ENDFORM. " FETCH_FINAL_DATA
*& Form FILL_FIELDCAT_HEADER
text
--> p1 text
<-- p2 text
FORM FILL_FIELDCAT_HEADER .
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = V_REPID
I_INTERNAL_TABNAME = 'IT_FINAL'
I_STRUCTURE_NAME =
I_CLIENT_NEVER_DISPLAY = 'X'
I_INCLNAME = V_REPID
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
CHANGING
CT_FIELDCAT = IT_FIELDCAT
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 IT_FIELDCAT INTO WA_FIELDCAT.
CASE WA_FIELDCAT-FIELDNAME.
WHEN 'KWMENG'.
WA_FIELDCAT-COL_POS = '11'.
WA_FIELDCAT-OUTPUTLEN = '22'.
WA_FIELDCAT-SELTEXT_L = 'Net Value'.
WA_FIELDCAT-DO_SUM = 'X'.
ENDCASE.
MODIFY IT_FIELDCAT FROM WA_FIELDCAT INDEX SY-TABIX.
ENDLOOP.
ENDFORM. " FILL_FIELDCAT_HEADER
*& Form GET_LAYOUT
text
--> p1 text
<-- p2 text
FORM GET_LAYOUT .
WA_LAYOUT-TOTALS_TEXT = 'TOTAL'.
ENDFORM. " GET_LAYOUT
*& Form GET_EVENT
text
--> p1 text
<-- p2 text
FORM GET_EVENT .
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = IT_EVENTS
EXCEPTIONS
LIST_TYPE_WRONG = 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.
LOOP AT IT_EVENTS INTO WA_EVENTS.
CASE WA_EVENTS-NAME.
WHEN 'TOP_OF_PAGE'.
WA_EVENTS-FORM = 'FILL_LIST_HEADER'.
WHEN 'USER_COMMAND'.
WA_EVENTS-FORM = 'PROCESS_BASIC_LIST'.
ENDCASE.
MODIFY IT_EVENTS FROM WA_EVENTS INDEX SY-TABIX.
ENDLOOP.
ENDFORM. " GET_EVENT
FORM FILL_LIST_HEADER *
FORM FILL_LIST_HEADER.
WRITE:2'Report :' , SY-REPID,
: 85 ' Intelligroup Asia Pvt Ltd' CENTERED,
: 159 'Date :' ,SY-DATUM,
:/2'User :', SY-UNAME,
: 82 ' Hyderabad ' CENTERED ,
: 159 'Pg.No :' ,SY-PAGNO,
:/86 ' Stock Report ' CENTERED.
SKIP 2.
ENDFORM. "FILL_LIST_HEADER
*& Form DISPLAY_LIST
text
--> p1 text
<-- p2 text
FORM DISPLAY_LIST .
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = V_REPID
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
I_STRUCTURE_NAME =
IS_LAYOUT = WA_LAYOUT
IT_FIELDCAT = IT_FIELDCAT
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT = IT_SORT[]
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS = IT_EVENTS
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = IT_FINAL
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.
ENDFORM. " DISPLAY_LIST
*& Form do_sort
text
--> p1 text
<-- p2 text
FORM DO_SORT .
*-- Populating the sort table
IT_SORT-FIELDNAME = 'MATNR'.
IT_SORT-TABNAME = 'IT_FINAL'.
IT_SORT-UP = 'X'.
it_sort-subtot = 'X'.
APPEND IT_SORT.
ENDFORM. " do_sort
Thanks & Regards
Sreenivasulu P -
ALV: Issue with double click event after sorting the ALV
Hello Experts,
I have an internal table that populates an ALV grid. When the user doubleclicks a row, my method HANDLE_DOUBLE_CLICK returns the e_row-index value from the ALV Grid. I use this index value to read the internal table, then retrieve additional data.
My problem is the user may sort the ALV grid before double clicking on a line. If this happens my internal table is not sorted to match the ALV grid, so reading the internal table with the e_row-index value returns the wrong information.
When the double click event occurs, is it possible to capture the value in column 1 instead of a value for e_row-index?
There is one more paramter in HANDLE_DOUBLE_CLICK for row id. It is coming blank in debugging . what is the purpose of this parameter and how i can make use of it ?
Regards
VivekHi,
I am Posting The Code Which Uses Double Click Event.
And This Code will provide the total information to you.
REPORT ZALVGRID_PG.
TABLES: SSCRFIELDS.
DATA: V_BELNR TYPE RBKP-BELNR.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS: IRNO FOR V_BELNR.
PARAMETERS: P_GJAHR TYPE RBKP-GJAHR.
SELECTION-SCREEN END OF BLOCK B1.
DATA: WA TYPE ZALVGRID_DISPLAY,
ITAB TYPE STANDARD TABLE OF ZALVGRID_DISPLAY.
DATA: IDENTITY TYPE REF TO CL_GUI_CUSTOM_CONTAINER.
DATA: GRID TYPE REF TO CL_GUI_ALV_GRID.
DATA: L_IDENTITY TYPE REF TO CL_GUI_CUSTOM_CONTAINER.
DATA: L_TREE TYPE REF TO CL_GUI_ALV_TREE_SIMPLE.
TYPE-POOLS: SLIS,SDYDO.
DATA: L_LOGO TYPE SDYDO_VALUE,
L_LIST TYPE SLIS_T_LISTHEADER.
END-OF-SELECTION.
CLASS CL_LC DEFINITION.
PUBLIC SECTION.
METHODS: DC FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID IMPORTING E_ROW E_COLUMN.
ENDCLASS.
CLASS CL_LC IMPLEMENTATION.
METHOD DC.
DATA: WA1 TYPE ZALVGRID_DISPLAY.
READ TABLE ITAB INTO WA1 INDEX E_ROW-INDEX.
BREAK-POINT.
SET PARAMETER ID 'BLN' FIELD WA1-BELNR.
CALL TRANSACTION 'FB02'.
ENDMETHOD. "DC
ENDCLASS.
DATA: OBJ_CL TYPE REF TO CL_LC.
START-OF-SELECTION.
PERFORM SELECT_DATA.
IF SY-SUBRC = 0.
CALL SCREEN 100.
ELSE.
MESSAGE E000(0) WITH 'DATA NOT FOUND'.
ENDIF.
INCLUDE ZALVGRID_PG_STATUS_0100O01.
INCLUDE ZALVGRID_PG_LOGOSUBF01.
INCLUDE ZALVGRID_PG_SELECT_DATAF01.
INCLUDE ZALVGRID_PG_USER_COMMAND_01I01.
***INCLUDE ZALVGRID_PG_STATUS_0100O01 .
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'AB'.
* SET TITLEBAR 'xxx'.
IF IDENTITY IS INITIAL.
CREATE OBJECT IDENTITY
EXPORTING
CONTAINER_NAME = 'ALVCONTROL'.
CREATE OBJECT GRID
EXPORTING
I_PARENT = IDENTITY.
CALL METHOD GRID->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
I_STRUCTURE_NAME = 'ZALVGRID_DISPLAY'
CHANGING
IT_OUTTAB = ITAB.
CREATE OBJECT OBJ_CL.
SET HANDLER OBJ_CL->DC FOR GRID.
ENDIF.
IF L_IDENTITY IS INITIAL.
CREATE OBJECT L_IDENTITY
EXPORTING
CONTAINER_NAME = 'LOGO'.
CREATE OBJECT L_TREE
EXPORTING
I_PARENT = L_IDENTITY.
PERFORM LOGOSUB USING L_LOGO.
CALL METHOD L_TREE->CREATE_REPORT_HEADER
EXPORTING
IT_LIST_COMMENTARY = L_LIST
I_LOGO = L_LOGO.
ENDIF .
ENDMODULE. " STATUS_0100 OUTPUT
***INCLUDE ZALVGRID_PG_LOGOSUBF01 .
FORM LOGOSUB USING P_L_LOGO.
P_L_LOGO = 'ERPLOGO'.
ENDFORM. " LOGOSUB
***INCLUDE ZALVGRID_PG_SELECT_DATAF01 .
FORM SELECT_DATA .
SELECT RBKP~BELNR
RBKP~BLDAT
RSEG~BUZEI
RSEG~MATNR
INTO TABLE ITAB
FROM RBKP INNER JOIN RSEG
ON RBKP~BELNR = RSEG~BELNR
WHERE RBKP~BELNR IN IRNO
AND RBKP~GJAHR = P_GJAHR.
ENDFORM. " SELECT_DATA
***INCLUDE ZALVGRID_PG_USER_COMMAND_01I01 .
MODULE USER_COMMAND_0100 INPUT.
CASE SY-UCOMM.
WHEN 'EXIT'.
LEAVE PROGRAM.
WHEN 'CANCEL'.
EXIT.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
Warm Regards,
PavanKumar.G
Edited by: pavankumar.g on Jan 19, 2012 5:30 AM -
HI,
PLZ help me .
By using this code I select data from TXT file and insert data in CS13 transaction then I want to show each material which present in TXT file as ALV BLOCK DISPLAY.
Suppose txt file contain four material so report will show 4 list block .means data of every material showing in different blocks in the report.
Code which I am using showing data for last item from txt file in one block and other items showing when I click back button .
i am using below codes..........
*& Report ZCS13 *
REPORT zcs13 .
TABLES:
mara,
stpo,
t001w,
stko.
TYPE-POOLS: slis.
DATA: BEGIN OF it_stb OCCURS 0.
INCLUDE STRUCTURE zstpox.
DATA:END OF it_stb.
DATA: BEGIN OF it_matmaster OCCURS 0,
matnr TYPE matnr,
werks TYPE werks,
stlal type stlal,
capid type capid,
emeng TYPE emeng,
END OF it_matmaster.
DATA : ievent TYPE slis_t_event.
DATA: it_stb2 LIKE stpox OCCURS 0 WITH HEADER LINE,
it_stb3 LIKE stpox OCCURS 0 WITH HEADER LINE,
temp_cat TYPE slis_fieldcat_alv,
sline TYPE slis_listheader,
gt_list_top_of_page TYPE slis_t_listheader,
gs_layout TYPE slis_layout_alv ,
gt_events TYPE slis_t_event,
gt_sort TYPE slis_t_sortinfo_alv,
w_msg(255) TYPE c,
int TYPE i VALUE 0.
Declaration of parameters
*SELECTION-SCREEN BEGIN OF BLOCK b2.
*SELECTION-SCREEN BEGIN OF LINE.
*SELECTION-SCREEN COMMENT (8) FOR FIELD p_matnr.
*SELECTION-SCREEN POSITION 25 .
*PARAMETERS: p_matnr LIKE mara-matnr OBLIGATORY .
*SELECTION-SCREEN END OF LINE.
*SELECTION-SCREEN BEGIN OF LINE.
*SELECTION-SCREEN COMMENT (8) FOR FIELD p_werks.
*SELECTION-SCREEN POSITION 25 .
*PARAMETERS: p_werks LIKE t001w-werks OBLIGATORY .
*SELECTION-SCREEN END OF LINE.
*SELECTION-SCREEN BEGIN OF LINE.
*SELECTION-SCREEN COMMENT (15) FOR FIELD p_albom.
*SELECTION-SCREEN POSITION 25 .
*PARAMETERS: p_albom LIKE stko-stlal DEFAULT ' '.
*SELECTION-SCREEN END OF LINE.
*SELECTION-SCREEN BEGIN OF LINE.
*SELECTION-SCREEN COMMENT (15) FOR FIELD p_bomap.
*SELECTION-SCREEN POSITION 25 .
*PARAMETERS: p_bomap(4) DEFAULT 'PP01'.
*SELECTION-SCREEN END OF LINE.
*SELECTION-SCREEN END OF BLOCK b2.
*DATA :anr_datuv LIKE aenr-datuv.
*SELECTION-SCREEN BEGIN OF BLOCK b3.
*SELECTION-SCREEN BEGIN OF LINE.
*SELECTION-SCREEN COMMENT (15) text-s02 .
*SELECTION-SCREEN END OF LINE.
*SELECTION-SCREEN BEGIN OF LINE.
*SELECTION-SCREEN COMMENT (15) text-s02 .
*SELECTION-SCREEN END OF LINE.
*SELECTION-SCREEN BEGIN OF LINE.
*SELECTION-SCREEN COMMENT (15) text-s03 .
*SELECTION-SCREEN END OF LINE.
*SELECTION-SCREEN END OF BLOCK b3.
*SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-s01 .
*SELECTION-SCREEN BEGIN OF LINE.
*SELECTION-SCREEN COMMENT (15) FOR FIELD p_vfrom.
*SELECTION-SCREEN POSITION 25 .
*PARAMETERS p_vfrom LIKE stpo-datuv DEFAULT sy-datum.
*SELECTION-SCREEN END OF LINE.
*SELECTION-SCREEN BEGIN OF LINE.
*SELECTION-SCREEN COMMENT (15) FOR FIELD pm_aennr.
*SELECTION-SCREEN POSITION 25 .
*PARAMETERS pm_aennr LIKE aenr-aennr.
*SELECTION-SCREEN END OF LINE.
*SELECTION-SCREEN BEGIN OF LINE.
*SELECTION-SCREEN COMMENT (17) FOR FIELD p_reqty.
*SELECTION-SCREEN POSITION 25 .
*PARAMETERS p_reqty LIKE stpo-menge DEFAULT '1' .
*SELECTION-SCREEN END OF LINE.
*SELECTION-SCREEN BEGIN OF LINE.
*SELECTION-SCREEN COMMENT (15) FOR FIELD p_assd.
*SELECTION-SCREEN POSITION 25 .
*PARAMETERS p_assd AS CHECKBOX.
*SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-002.
PARAMETERS:p_file LIKE rlgrap-filename OBLIGATORY.
SELECTION-SCREEN END OF BLOCK b1 .
CONSTANTS c_x VALUE 'X'.
DATA: w_topmat LIKE cstmat,
fieldcat TYPE slis_t_fieldcat_alv,
wa_fieldcat TYPE slis_fieldcat_alv.
DATA:v_file TYPE string.
*SELECTION-SCREEN END OF BLOCK b1.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
program_name = syst-cprog
dynpro_number = syst-dynnr
field_name = 'P_FILE'
IMPORTING
file_name = p_file.
START-OF-SELECTION.
v_file = p_file.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = v_file
filetype = 'ASC'
has_field_separator = 'X'
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
IMPORTING
FILELENGTH =
HEADER =
TABLES
data_tab = it_matmaster
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
OTHERS = 17
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 it_matmaster.
PERFORM explode_assembly.
PERFORM f01_set_layo CHANGING gs_layout.
PERFORM eventtab_build USING ievent.
perform fldcat.
PERFORM display_grid.
ENDLOOP.
PERFORM display_grid.
*& Form EXPLODE_ASSEMBLY
text
FORM explode_assembly.
CALL FUNCTION 'CS_BOM_EXPL_MAT_V2'
EXPORTING
capid = 'BEST'
cuols = c_x
datuv = sy-datum
emeng = it_matmaster-emeng
knfba = c_x
ksbvo = c_x
mehrs = c_x
mbwls = c_x
mdmps = c_x
mktls = c_x
stlal = it_matmaster-stlal
stlan = p_bomap
mtnrv = it_matmaster-matnr
werks = it_matmaster-werks
svwvo = 'X'
vrsvo = 'X'
IMPORTING
topmat = w_topmat
TABLES
stb = it_stb
EXCEPTIONS
alt_not_found = 1
call_invalid = 2
material_not_found = 3
missing_authorization = 4
no_bom_found = 5
no_plant_data = 6
no_suitable_bom_found = 7
conversion_error = 8
OTHERS = 9.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
INTO w_msg.
WRITE: / w_msg.
EXIT.
ENDIF.
ENDFORM. "explode_assembly
*& Form display_grid
text
--> p1 text
<-- p2 text
form display_grid .
*CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = 'ZCS13'
i_callback_top_of_page = 'TOP_OF_PAGE_GRID'
is_layout = gs_layout
it_fieldcat = fieldcat
IT_SORT = GT_SORT[]
i_save = 'A'
it_events = gt_events[]
TABLES
t_outtab = it_stb
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.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
EXPORTING
i_callback_program = 'ZALVTOTAL'
I_CALLBACK_PF_STATUS_SET = PFSTATUS
i_callback_user_command = 'USER_COMMAND'(001)
IT_EXCLUDING =
*CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
is_layout = gs_layout
it_fieldcat = i_fieldcat
i_tabname = 'IT_TAB[]'
it_events = gt_events
it_sort = gt_sort
I_TEXT = ' '
TABLES
t_outtab = it_tab[]
EXCEPTIONS
program_error = 1
maximum_of_appends_reached = 2
OTHERS = 3
*IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
*ENDIF.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
is_layout = gs_layout
it_fieldcat = fieldcat
i_tabname = 'IT_STB[]'
it_events = gt_events
it_sort = gt_sort
I_TEXT = ' '
TABLES
t_outtab = it_stb[]
EXCEPTIONS
program_error = 1
maximum_of_appends_reached = 2
OTHERS = 3
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'
EXPORTING
i_interface_check = 'x_print_layout'
IS_PRINT =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
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.
endform. " display_grid
*& Form fldcat
text
--> p1 text
<-- p2 text
form fldcat .
*DATA: wa_fieldcat TYPE slis_fieldcat_alv,
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = 'ZCS13'
I_INTERNAL_TABNAME = 'IT_STB'
i_structure_name = 'ZSTPOX'
I_CLIENT_NEVER_DISPLAY = 'X'
i_inclname = 'ZCS13'
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
CHANGING
ct_fieldcat = fieldcat[]
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.
endform. " fldcatHi ,
plz check the below codeand suggest me why it not showing data.....
i make changes according to you ...
waiting for your reply
*& Report ZCS13 *
REPORT zcs13 .
TABLES:
mara,
stpo,
t001w,
stko.
TYPE-POOLS: slis.
DATA: BEGIN OF it_stb OCCURS 0.
INCLUDE STRUCTURE zstpox.
DATA:END OF it_stb.
DATA: BEGIN OF it_matmaster OCCURS 0,
matnr TYPE matnr,
werks TYPE werks,
stlal type stlal,
capid type capid,
emeng TYPE emeng,
END OF it_matmaster.
DATA : ievent TYPE slis_t_event.
DATA: it_stb2 LIKE stpox OCCURS 0 WITH HEADER LINE,
it_stb3 LIKE stpox OCCURS 0 WITH HEADER LINE,
temp_cat TYPE slis_fieldcat_alv,
sline TYPE slis_listheader,
gt_list_top_of_page TYPE slis_t_listheader,
gs_layout TYPE slis_layout_alv ,
gt_events TYPE slis_t_event,
gt_sort TYPE slis_t_sortinfo_alv,
w_msg(255) TYPE c,
int TYPE i VALUE 0.
Declaration of parameters
*SELECTION-SCREEN BEGIN OF BLOCK b2.
*SELECTION-SCREEN BEGIN OF LINE.
*SELECTION-SCREEN COMMENT (8) FOR FIELD p_matnr.
*SELECTION-SCREEN POSITION 25 .
*PARAMETERS: p_matnr LIKE mara-matnr OBLIGATORY .
*SELECTION-SCREEN END OF LINE.
*SELECTION-SCREEN BEGIN OF LINE.
*SELECTION-SCREEN COMMENT (8) FOR FIELD p_werks.
*SELECTION-SCREEN POSITION 25 .
*PARAMETERS: p_werks LIKE t001w-werks OBLIGATORY .
*SELECTION-SCREEN END OF LINE.
*SELECTION-SCREEN BEGIN OF LINE.
*SELECTION-SCREEN COMMENT (15) FOR FIELD p_albom.
*SELECTION-SCREEN POSITION 25 .
*PARAMETERS: p_albom LIKE stko-stlal DEFAULT ' '.
*SELECTION-SCREEN END OF LINE.
*SELECTION-SCREEN BEGIN OF LINE.
*SELECTION-SCREEN COMMENT (15) FOR FIELD p_bomap.
*SELECTION-SCREEN POSITION 25 .
*PARAMETERS: p_bomap(4) DEFAULT 'PP01'.
*SELECTION-SCREEN END OF LINE.
*SELECTION-SCREEN END OF BLOCK b2.
*DATA :anr_datuv LIKE aenr-datuv.
*SELECTION-SCREEN BEGIN OF BLOCK b3.
*SELECTION-SCREEN BEGIN OF LINE.
*SELECTION-SCREEN COMMENT (15) text-s02 .
*SELECTION-SCREEN END OF LINE.
*SELECTION-SCREEN BEGIN OF LINE.
*SELECTION-SCREEN COMMENT (15) text-s02 .
*SELECTION-SCREEN END OF LINE.
*SELECTION-SCREEN BEGIN OF LINE.
*SELECTION-SCREEN COMMENT (15) text-s03 .
*SELECTION-SCREEN END OF LINE.
*SELECTION-SCREEN END OF BLOCK b3.
*SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-s01 .
*SELECTION-SCREEN BEGIN OF LINE.
*SELECTION-SCREEN COMMENT (15) FOR FIELD p_vfrom.
*SELECTION-SCREEN POSITION 25 .
*PARAMETERS p_vfrom LIKE stpo-datuv DEFAULT sy-datum.
*SELECTION-SCREEN END OF LINE.
*SELECTION-SCREEN BEGIN OF LINE.
*SELECTION-SCREEN COMMENT (15) FOR FIELD pm_aennr.
*SELECTION-SCREEN POSITION 25 .
*PARAMETERS pm_aennr LIKE aenr-aennr.
*SELECTION-SCREEN END OF LINE.
*SELECTION-SCREEN BEGIN OF LINE.
*SELECTION-SCREEN COMMENT (17) FOR FIELD p_reqty.
*SELECTION-SCREEN POSITION 25 .
*PARAMETERS p_reqty LIKE stpo-menge DEFAULT '1' .
*SELECTION-SCREEN END OF LINE.
*SELECTION-SCREEN BEGIN OF LINE.
*SELECTION-SCREEN COMMENT (15) FOR FIELD p_assd.
*SELECTION-SCREEN POSITION 25 .
*PARAMETERS p_assd AS CHECKBOX.
*SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-002.
PARAMETERS:p_file LIKE rlgrap-filename OBLIGATORY.
SELECTION-SCREEN END OF BLOCK b1 .
CONSTANTS c_x VALUE 'X'.
DATA: w_topmat LIKE cstmat,
fieldcat TYPE slis_t_fieldcat_alv,
wa_fieldcat TYPE slis_fieldcat_alv.
DATA:v_file TYPE string.
*SELECTION-SCREEN END OF BLOCK b1.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
program_name = syst-cprog
dynpro_number = syst-dynnr
field_name = 'P_FILE'
IMPORTING
file_name = p_file.
START-OF-SELECTION.
v_file = p_file.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = v_file
filetype = 'ASC'
has_field_separator = 'X'
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
IMPORTING
FILELENGTH =
HEADER =
TABLES
data_tab = it_matmaster
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
OTHERS = 17
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
EXPORTING
i_callback_program = 'ZCS13'
I_CALLBACK_PF_STATUS_SET = PFSTATUS
i_callback_user_command = 'USER_COMMAND'(001).
IT_EXCLUDING =.
DATA :int1(10) .
PERFORM fldcat.
LOOP AT it_matmaster.
PERFORM explode_assembly.
PERFORM f01_set_layo CHANGING gs_layout.
PERFORM eventtab_build USING ievent.
PERFORM fldcat.
PERFORM display_grid.
ENDLOOP.
PERFORM display_grid.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'
EXPORTING
i_interface_check = 'x_print_layout'
IS_PRINT =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
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 EXPLODE_ASSEMBLY
text
FORM explode_assembly.
CALL FUNCTION 'CS_BOM_EXPL_MAT_V2'
EXPORTING
capid = 'BEST'
cuols = c_x
datuv = sy-datum
emeng = it_matmaster-emeng
knfba = c_x
ksbvo = c_x
mehrs = c_x
mbwls = c_x
mdmps = c_x
mktls = c_x
stlal = it_matmaster-stlal
stlan = p_bomap
mtnrv = it_matmaster-matnr
werks = it_matmaster-werks
svwvo = 'X'
vrsvo = 'X'
IMPORTING
topmat = w_topmat
TABLES
stb = it_stb
EXCEPTIONS
alt_not_found = 1
call_invalid = 2
material_not_found = 3
missing_authorization = 4
no_bom_found = 5
no_plant_data = 6
no_suitable_bom_found = 7
conversion_error = 8
OTHERS = 9.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
INTO w_msg.
WRITE: / w_msg.
EXIT.
ENDIF.
ENDFORM. "explode_assembly
*& Form display_grid
text
--> p1 text
<-- p2 text
FORM display_grid .
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
is_layout = gs_layout
it_fieldcat = fieldcat
i_tabname = 'IT_STB[]'
it_events = gt_events
it_sort = gt_sort
I_TEXT = ' '
TABLES
t_outtab = it_stb
EXCEPTIONS
program_error = 1
maximum_of_appends_reached = 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. " display_grid
*& Form fldcat
text
--> p1 text
<-- p2 text
FORM fldcat .
*DATA: wa_fieldcat TYPE slis_fieldcat_alv,
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = 'ZCS13'
I_INTERNAL_TABNAME = 'IT_STB'
i_structure_name = 'ZSTPOX'
I_CLIENT_NEVER_DISPLAY = 'X'
i_inclname = 'ZCS13'
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
CHANGING
ct_fieldcat = fieldcat[]
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.
ENDFORM. " fldcat -
Hi All,
I am trying to displaying BOM explosion for materials in ALV Block list.
I am taking the materials to be exploded from a local file. Taking the contents of the file in an internal table and then passing the parameters like material number bom application , alternative BOM to the function 'CS_BOM_EXPL_MAT_V2'
Then I am calling the functions for ALV Block display for each material.
But when I am displaying the data in the block display , only the BOM explosion for the last material is getting displayed.
I am pasting the code also for ur reference.
REPORT zcs13 .
TABLES:
mara,
stpo,
t001w,
stko.
TYPE-POOLS: slis.
DATA: BEGIN OF it_stb OCCURS 0.
INCLUDE STRUCTURE zstpox.
DATA:END OF it_stb.
DATA: BEGIN OF it_matmaster OCCURS 0,
matnr TYPE matnr,
werks TYPE werks,
stlal type stlal,
capid type capid,
emeng TYPE emeng,
END OF it_matmaster.
DATA : ievent TYPE slis_t_event.
DATA: it_stb2 LIKE stpox OCCURS 0 WITH HEADER LINE,
it_stb3 LIKE stpox OCCURS 0 WITH HEADER LINE,
temp_cat TYPE slis_fieldcat_alv,
sline TYPE slis_listheader,
gt_list_top_of_page TYPE slis_t_listheader,
gs_layout TYPE slis_layout_alv ,
gt_events TYPE slis_t_event,
gt_sort TYPE slis_t_sortinfo_alv,
w_msg(255) TYPE c,
int TYPE i VALUE 0.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-002.
PARAMETERS:p_file LIKE rlgrap-filename OBLIGATORY.
SELECTION-SCREEN END OF BLOCK b1 .
CONSTANTS c_x VALUE 'X'.
DATA: w_topmat LIKE cstmat,
fieldcat TYPE slis_t_fieldcat_alv,
wa_fieldcat TYPE slis_fieldcat_alv.
DATA:v_file TYPE string.
*SELECTION-SCREEN END OF BLOCK b1.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
program_name = syst-cprog
dynpro_number = syst-dynnr
field_name = 'P_FILE'
IMPORTING
file_name = p_file.
START-OF-SELECTION.
v_file = p_file.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = v_file
filetype = 'ASC'
has_field_separator = 'X'
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
IMPORTING
FILELENGTH =
HEADER =
TABLES
data_tab = it_matmaster
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
OTHERS = 17
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 it_matmaster.
PERFORM explode_assembly.
PERFORM f01_set_layo CHANGING gs_layout.
PERFORM eventtab_build USING ievent.
perform fldcat.
PERFORM display_grid.
ENDLOOP.
PERFORM display_grid.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'
EXPORTING
i_interface_check = 'x_print_layout'
IS_PRINT =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
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 EXPLODE_ASSEMBLY
text
FORM explode_assembly.
CALL FUNCTION 'CS_BOM_EXPL_MAT_V2'
EXPORTING
capid = 'BEST'
cuols = c_x
datuv = sy-datum
emeng = it_matmaster-emeng
knfba = c_x
ksbvo = c_x
mehrs = c_x
mbwls = c_x
mdmps = c_x
mktls = c_x
stlal = it_matmaster-stlal
stlan = p_bomap
mtnrv = it_matmaster-matnr
werks = it_matmaster-werks
svwvo = 'X'
vrsvo = 'X'
IMPORTING
topmat = w_topmat
TABLES
stb = it_stb
EXCEPTIONS
alt_not_found = 1
call_invalid = 2
material_not_found = 3
missing_authorization = 4
no_bom_found = 5
no_plant_data = 6
no_suitable_bom_found = 7
conversion_error = 8
OTHERS = 9.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
INTO w_msg.
WRITE: / w_msg.
EXIT.
ENDIF.
ENDFORM. "explode_assembly
*& Form display_grid
text
--> p1 text
<-- p2 text
form display_grid .
*CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = 'ZCS13'
i_callback_top_of_page = 'TOP_OF_PAGE_GRID'
is_layout = gs_layout
it_fieldcat = fieldcat
IT_SORT = GT_SORT[]
i_save = 'A'
it_events = gt_events[]
TABLES
t_outtab = it_stb
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.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
EXPORTING
i_callback_program = 'ZALVTOTAL'
I_CALLBACK_PF_STATUS_SET = PFSTATUS
i_callback_user_command = 'USER_COMMAND'(001)
IT_EXCLUDING =
*CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
is_layout = gs_layout
it_fieldcat = i_fieldcat
i_tabname = 'IT_TAB[]'
it_events = gt_events
it_sort = gt_sort
I_TEXT = ' '
TABLES
t_outtab = it_tab[]
EXCEPTIONS
program_error = 1
maximum_of_appends_reached = 2
OTHERS = 3
*IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
*ENDIF.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
is_layout = gs_layout
it_fieldcat = fieldcat
i_tabname = 'IT_STB[]'
it_events = gt_events
it_sort = gt_sort
I_TEXT = ' '
TABLES
t_outtab = it_stb[]
EXCEPTIONS
program_error = 1
maximum_of_appends_reached = 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.
clear it_stb[].
endform. " display_grid
*& Form fldcat
text
--> p1 text
<-- p2 text
form fldcat .
*DATA: wa_fieldcat TYPE slis_fieldcat_alv,
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = 'ZCS13'
I_INTERNAL_TABNAME = 'IT_STB'
i_structure_name = 'ZSTPOX'
I_CLIENT_NEVER_DISPLAY = 'X'
i_inclname = 'ZCS13'
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
CHANGING
ct_fieldcat = fieldcat[]
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.
Pls Suggest
Thanks.Hi All,
I am trying to displaying BOM explosion for materials in ALV Block list.
I am taking the materials to be exploded from a local file. Taking the contents of the file in an internal table and then passing the parameters like material number bom application , alternative BOM to the function 'CS_BOM_EXPL_MAT_V2'
Then I am calling the functions for ALV Block display for each material.
But when I am displaying the data in the block display , only the BOM explosion for the last material is getting displayed.
I am pasting the code also for ur reference.
REPORT zcs13 .
TABLES:
mara,
stpo,
t001w,
stko.
TYPE-POOLS: slis.
DATA: BEGIN OF it_stb OCCURS 0.
INCLUDE STRUCTURE zstpox.
DATA:END OF it_stb.
DATA: BEGIN OF it_matmaster OCCURS 0,
matnr TYPE matnr,
werks TYPE werks,
stlal type stlal,
capid type capid,
emeng TYPE emeng,
END OF it_matmaster.
DATA : ievent TYPE slis_t_event.
DATA: it_stb2 LIKE stpox OCCURS 0 WITH HEADER LINE,
it_stb3 LIKE stpox OCCURS 0 WITH HEADER LINE,
temp_cat TYPE slis_fieldcat_alv,
sline TYPE slis_listheader,
gt_list_top_of_page TYPE slis_t_listheader,
gs_layout TYPE slis_layout_alv ,
gt_events TYPE slis_t_event,
gt_sort TYPE slis_t_sortinfo_alv,
w_msg(255) TYPE c,
int TYPE i VALUE 0.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-002.
PARAMETERS:p_file LIKE rlgrap-filename OBLIGATORY.
SELECTION-SCREEN END OF BLOCK b1 .
CONSTANTS c_x VALUE 'X'.
DATA: w_topmat LIKE cstmat,
fieldcat TYPE slis_t_fieldcat_alv,
wa_fieldcat TYPE slis_fieldcat_alv.
DATA:v_file TYPE string.
*SELECTION-SCREEN END OF BLOCK b1.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
program_name = syst-cprog
dynpro_number = syst-dynnr
field_name = 'P_FILE'
IMPORTING
file_name = p_file.
START-OF-SELECTION.
v_file = p_file.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = v_file
filetype = 'ASC'
has_field_separator = 'X'
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
IMPORTING
FILELENGTH =
HEADER =
TABLES
data_tab = it_matmaster
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
OTHERS = 17
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 it_matmaster.
PERFORM explode_assembly.
PERFORM f01_set_layo CHANGING gs_layout.
PERFORM eventtab_build USING ievent.
perform fldcat.
PERFORM display_grid.
ENDLOOP.
PERFORM display_grid.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'
EXPORTING
i_interface_check = 'x_print_layout'
IS_PRINT =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
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 EXPLODE_ASSEMBLY
text
FORM explode_assembly.
CALL FUNCTION 'CS_BOM_EXPL_MAT_V2'
EXPORTING
capid = 'BEST'
cuols = c_x
datuv = sy-datum
emeng = it_matmaster-emeng
knfba = c_x
ksbvo = c_x
mehrs = c_x
mbwls = c_x
mdmps = c_x
mktls = c_x
stlal = it_matmaster-stlal
stlan = p_bomap
mtnrv = it_matmaster-matnr
werks = it_matmaster-werks
svwvo = 'X'
vrsvo = 'X'
IMPORTING
topmat = w_topmat
TABLES
stb = it_stb
EXCEPTIONS
alt_not_found = 1
call_invalid = 2
material_not_found = 3
missing_authorization = 4
no_bom_found = 5
no_plant_data = 6
no_suitable_bom_found = 7
conversion_error = 8
OTHERS = 9.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
INTO w_msg.
WRITE: / w_msg.
EXIT.
ENDIF.
ENDFORM. "explode_assembly
*& Form display_grid
text
--> p1 text
<-- p2 text
form display_grid .
*CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = 'ZCS13'
i_callback_top_of_page = 'TOP_OF_PAGE_GRID'
is_layout = gs_layout
it_fieldcat = fieldcat
IT_SORT = GT_SORT[]
i_save = 'A'
it_events = gt_events[]
TABLES
t_outtab = it_stb
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.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
EXPORTING
i_callback_program = 'ZALVTOTAL'
I_CALLBACK_PF_STATUS_SET = PFSTATUS
i_callback_user_command = 'USER_COMMAND'(001)
IT_EXCLUDING =
*CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
is_layout = gs_layout
it_fieldcat = i_fieldcat
i_tabname = 'IT_TAB[]'
it_events = gt_events
it_sort = gt_sort
I_TEXT = ' '
TABLES
t_outtab = it_tab[]
EXCEPTIONS
program_error = 1
maximum_of_appends_reached = 2
OTHERS = 3
*IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
*ENDIF.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
is_layout = gs_layout
it_fieldcat = fieldcat
i_tabname = 'IT_STB[]'
it_events = gt_events
it_sort = gt_sort
I_TEXT = ' '
TABLES
t_outtab = it_stb[]
EXCEPTIONS
program_error = 1
maximum_of_appends_reached = 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.
clear it_stb[].
endform. " display_grid
*& Form fldcat
text
--> p1 text
<-- p2 text
form fldcat .
*DATA: wa_fieldcat TYPE slis_fieldcat_alv,
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = 'ZCS13'
I_INTERNAL_TABNAME = 'IT_STB'
i_structure_name = 'ZSTPOX'
I_CLIENT_NEVER_DISPLAY = 'X'
i_inclname = 'ZCS13'
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
CHANGING
ct_fieldcat = fieldcat[]
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.
Pls Suggest
Thanks. -
Problem while using Alv Block List
HI All,
PLZ help me .
By using this code I select data from TXT file and insert data in CS13 transaction then I want to show each material which present in TXT file as ALV BLOCK DISPLAY.
Suppose txt file contain 4 material so report will show 4 list block .means data of every material showing in different blocks in the report.
Code which I am using showing showing data only for last material which present in the table it_matmaster in every block.
Please guide me what is the problem.
I am pasting changed code for you.
i am using below codes..........
*& Report ZCS13 *
REPORT zcs13 .
TABLES:
mara,
stpo,
t001w,
stko.
TYPE-POOLS: slis.
DATA: BEGIN OF it_stb OCCURS 0.
INCLUDE STRUCTURE zstpox.
DATA:END OF it_stb.
DATA: BEGIN OF it_matmaster OCCURS 0,
matnr TYPE matnr,
werks TYPE werks,
stlal type stlal,
capid type capid,
emeng TYPE emeng,
END OF it_matmaster.
DATA : ievent TYPE slis_t_event.
DATA: it_stb2 LIKE stpox OCCURS 0 WITH HEADER LINE,
it_stb3 LIKE stpox OCCURS 0 WITH HEADER LINE,
temp_cat TYPE slis_fieldcat_alv,
sline TYPE slis_listheader,
gt_list_top_of_page TYPE slis_t_listheader,
gs_layout TYPE slis_layout_alv ,
gt_events TYPE slis_t_event,
gt_sort TYPE slis_t_sortinfo_alv,
w_msg(255) TYPE c,
int TYPE i VALUE 0.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-002.
PARAMETERS:p_file LIKE rlgrap-filename OBLIGATORY.
SELECTION-SCREEN END OF BLOCK b1 .
CONSTANTS c_x VALUE 'X'.
DATA: w_topmat LIKE cstmat,
fieldcat TYPE slis_t_fieldcat_alv ,
wa_fieldcat TYPE slis_fieldcat_alv.
DATA:v_file TYPE string.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
program_name = syst-cprog
dynpro_number = syst-dynnr
field_name = 'P_FILE'
IMPORTING
file_name = p_file.
START-OF-SELECTION.
v_file = p_file.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = v_file
filetype = 'ASC'
has_field_separator = 'X'
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
IMPORTING
FILELENGTH =
HEADER =
TABLES
data_tab = it_matmaster
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
OTHERS = 17
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
EXPORTING
i_callback_program = 'ZCS13'
I_CALLBACK_PF_STATUS_SET = PFSTATUS
i_callback_user_command = ''
IT_EXCLUDING =
PERFORM fldcat.
LOOP AT it_matmaster.
PERFORM explode_assembly.
PERFORM fldcat.
PERFORM append_blocklist.
PERFORM alv_display_grid.
ENDLOOP.
PERFORM alv_display_grid.
*& Form EXPLODE_ASSEMBLY
text
FORM explode_assembly.
CALL FUNCTION 'CS_BOM_EXPL_MAT_V2'
EXPORTING
capid = 'BEST'
cuols = c_x
datuv = sy-datum
emeng = it_matmaster-emeng
knfba = c_x
ksbvo = c_x
mehrs = c_x
mbwls = c_x
mdmps = c_x
mktls = c_x
stlal = it_matmaster-stlal
stlan = p_bomap
mtnrv = it_matmaster-matnr
werks = it_matmaster-werks
svwvo = 'X'
vrsvo = 'X'
IMPORTING
topmat = w_topmat
TABLES
stb = it_stb
EXCEPTIONS
alt_not_found = 1
call_invalid = 2
material_not_found = 3
missing_authorization = 4
no_bom_found = 5
no_plant_data = 6
no_suitable_bom_found = 7
conversion_error = 8
OTHERS = 9.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
INTO w_msg.
WRITE: / w_msg.
EXIT.
ENDIF.
ENDFORM. "explode_assembly
*& Form fldcat
text
--> p1 text
<-- p2 text
FORM fldcat .
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = 'ZCS13'
i_internal_tabname = 'IT_STB'
i_structure_name = 'ZSTPOX'
I_CLIENT_NEVER_DISPLAY = 'X'
i_inclname = 'ZCS13'
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
CHANGING
ct_fieldcat = fieldcat[]
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.
ENDFORM. " fldcat
*& Form alv_display_grid
text
--> p1 text
<-- p2 text
FORM alv_display_grid .
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'
EXPORTING
i_interface_check = 'x_print_layout'
IS_PRINT =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
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.
ENDFORM. " alv_display_grid
*& Form append_blocklist
text
--> p1 text
<-- p2 text
FORM append_blocklist .
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
is_layout = gs_layout
it_fieldcat = fieldcat
i_tabname = 'IT_STB[]'
it_events = gt_events
it_sort = gt_sort
I_TEXT = ' '
TABLES
t_outtab = it_stb[]
EXCEPTIONS
program_error = 1
maximum_of_appends_reached = 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. " append_blocklistHi ,
Use the upload function 'WS_UPLOAD' . Declare ITAB of type table of your choice.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
FILENAME = FILENAME( Has to specified by you )
FILETYPE = 'ASC'
TABLES
DATA_TAB = ITAB
EXCEPTIONS
CONVERSION_ERROR = 1
FILE_OPEN_ERROR = 2
FILE_READ_ERROR = 3
INVALID_TYPE = 4
NO_BATCH = 5
UNKNOWN_ERROR = 6
INVALID_TABLE_WIDTH = 7
GUI_REFUSE_FILETRANSFER = 8
CUSTOMER_ERROR = 9
OTHERS = 10.
LOOP AT ITAB.
Use Split function to seperate the fields of the Internal table and append to a new Internal table of your choice.
ENDLOOP. -
Hi All,
iam Using ALV BLOCK list to print the output along with check boxes, iam able to print the output along with the check boxes but when i select any of the check box and click button on application tool bar it is going to dump and saying,
FIELD SYMBOL HAS NOT YET BEEN ASSIGNED.
i populated layout with following fields.
w_layout-box_fieldname = 'BOX'.
w_layout-box_tabname = 'T_FINAL2'.
Plz Help me out.
Thanks in Advance.
Neha*& Report BCALV_TEST_BLOCK_LIST
report bcalv_test_block_list.
types: g_ty_t_carrid type standard table of alv_tab,
g_ty_t_connid type standard table of alv_chck,
g_ty_t_curr type standard table of alv_cur,
g_ty_s_sflight type alv_t_t2,
g_ty_s_carrid type alv_tab,
g_ty_s_connid type alv_chck,
g_ty_s_curr type alv_cur.
constants: con_sflight type lvc_fname value 'ALV_T_T2',
con_scarr type lvc_fname value 'ALV_TAB',
con_spfli type lvc_fname value 'ALV_CHCK',
con_scurx type lvc_fname value 'ALV_CUR',
con_event_01 type lvc_fname value 'PF_STATUS_SET',
con_event_02 type lvc_fname value 'USER_COMMAND',
con_event_03 type lvc_fname value 'CALLER_EXIT',
con_event_04 type lvc_fname value 'LIST_MODIFY',
con_event_05 type lvc_fname value 'BEFORE_LINE_OUTPUT',
con_event_06 type lvc_fname value 'AFTER_LINE_OUTPUT',
con_event_07 type lvc_fname value 'SUBTOTAL_TEXT',
con_event_08 type lvc_fname value 'REPREP_MODIFY',
con_event_09 type lvc_fname value 'TOP_OF_PAGE',
con_event_10 type lvc_fname value 'END_OF_PAGE',
con_event_11 type lvc_fname value 'TOP_OF_LIST',
con_event_12 type lvc_fname value 'END_OF_LIST',
con_event_13 type lvc_fname value 'TOP_OF_COVERPAGE',
con_event_14 type lvc_fname value 'END_OF_COVERPAGE',
con_event_15 type lvc_fname value 'TOP_OF_FOREIGN_PAGE',
con_event_16 type lvc_fname value 'END_OF_FOREIGN_PAGE',
con_event_17 type lvc_fname value 'GROUPLEVEL_CHANGE'.
DATA *
tables: sscrfields. " for processing the FCODEs in Selektion screens
include <icon>.
include <symbol>.
type-pools: slis, kkblo.
types: g_ty_t_icon type standard table of icon,
g_ty_t_icont type standard table of icont,
begin of g_ty_s_plane,
carrid type g_ty_s_sflight-carrid,
connid type g_ty_s_sflight-connid,
planetype type g_ty_s_sflight-planetype,
seatsmax type g_ty_s_sflight-seatsmax,
end of g_ty_s_plane,
g_ty_t_plane type sorted table of g_ty_s_plane
with unique key carrid connid,
begin of g_ty_s_fcat_curr,
fieldname type lvc_fname,
cfieldname type lvc_fname,
currency type lvc_s_fcat-currency,
end of g_ty_s_fcat_curr,
g_ty_t_fcat_curr type sorted table of g_ty_s_fcat_curr
with unique key fieldname,
begin of g_ty_s_sort.
include type slis_sortinfo_alv.
types: end of g_ty_s_sort,
g_ty_t_sort type sorted table of g_ty_s_sort
with unique key spos fieldname,
begin of g_ty_s_test,
list_amount type num1,
select_amount type i,
only_db_info type char1,
db_short type char1,
excp_display type char1,
excp_condense type char1,
layo_title type lvc_s_layo-grid_title,
layo_zebra type char1,
layo_no_vert_lines type char1,
layo_no_horiz_lines type char1,
layo_cell_merge type char1,
layo_count type char1,
layo_box type char1,
layo_no_colhead type char1,
layo_column_optimize type char1,
layo_keys_hotspot type char1,
layo_no_keyfix type char1,
layo_no_hotspot type char1,
layo_hotspot_rows type i occurs 0,
layo_hotspot_columns type lvc_fname occurs 0,
layo_no_scrolling type char1,
layo_no_authcheck type char1,
layo_no_min_linesize type char1,
layo_min_linesize type sylinsz,
layo_max_linesize type sylinsz,
layo_group_change_edit type char1,
layo_get_selinfo type char1,
layo_confirmation_prompt type char1,
layo_f2code type syucomm,
layo_reprep type char1,
sum_before type char1,
sum_no_sumline type char1,
sum_no_sumchoice type char1,
sum_numc type char1,
sum_no_unitsplit type char1,
sum_totals_only type char1,
sum_totals_text type symsgli,
sum_no_subtotals type char1,
sum_no_subchoice type char1,
sum_subtotals_text type symsgli,
prnt_print type char1,
prnt_reserve_lines type lvc_s_prnt-reservelns,
prnt_no_listinfo type char1,
prnt_no_selinfo type char1,
prnt_with_title type char1,
prnt_footline type lvc_s_prnt-footline,
prnt_printinfo type char1,
prnt_no_coverpage type char1,
prnt_no_new_page type char1,
prnt_no_change_print_params type char1,
color_rows type i occurs 0,
color_fields_column type lvc_fname occurs 0,
color_fields_cell type lvc_fname occurs 0,
fcat_no_out_fields type lvc_fname occurs 0,
fcat_tech_fields type lvc_fname occurs 0,
fcat_fix_column_fields type lvc_fname occurs 0,
fcat_do_sum_fields type lvc_fname occurs 0,
fcat_no_sum_fields type lvc_fname occurs 0,
fcat_curr_fields type g_ty_t_fcat_curr,
curr_amount type i,
curr_space type char1,
t_sort type g_ty_t_sort,
no_info_popup type char1,
info_popup_once type char1,
events_info_popup type lvc_fname occurs 0,
events type lvc_fname occurs 0,
buffer_active type char1,
bypassing_buffer type char1,
end of g_ty_s_test,
begin of g_ty_s_outtab.
include type g_ty_s_sflight.
types: list type num1,
box type char1,
count type i,
lights type char1,
checkbox type char1,
hotspot type char1,
color(4) type c,
tabcolor type slis_t_specialcol_alv,
price2 type g_ty_s_sflight-price,
currency2 type g_ty_s_sflight-currency,
char(10) type c,
string type string,
int1 type int1,
int2 type int2,
int4 type int4,
numc(10) type n,
dec(10) type p decimals 2,
fltp type f,
dats type d,
tims type t,
icon type icon-id,
icon_qinfo type icon-name,
symbol type icon-id,
end of g_ty_s_outtab,
g_ty_t_outtab type table of g_ty_s_outtab.
constants: con_true type char1 value 'X',
con_ok type sy-ucomm value 'OK',
con_exit type sy-ucomm value 'EXIT',
con_canc type sy-ucomm value 'CANC',
con_back type sy-ucomm value 'BACK'.
data: gt_outtab1 type g_ty_t_outtab,
gt_outtab2 type g_ty_t_outtab,
gt_outtab3 type g_ty_t_outtab,
gt_outtab4 type g_ty_t_outtab,
gt_outtab5 type g_ty_t_outtab,
gt_outtab6 type g_ty_t_outtab,
gt_outtab7 type g_ty_t_outtab,
gt_outtab8 type g_ty_t_outtab,
gt_outtab9 type g_ty_t_outtab.
data: gt_outtab type g_ty_t_outtab with header line,
gs_test type g_ty_s_test.
data: g_repid type sy-repid.
data: g_field type lvc_s_fcat-fieldname,
g_int_field type i.
CLASS random DEFINITION
class random definition.
public section.
types:
value(16) type p decimals 0,
numcv(15) type n.
constants:
max type random=>value value 4294967295.
class-methods:
computes a random natural number from the set {0, ..., random=>max}.
number returning value(rval) type random=>value,
computes a random character from the set {A-Za-z0-9}
c returning value(rval) type char01,
computes a random string consisting of "len" random characters
string importing len type i
returning value(rval) type string,
computes a date
dats returning value(rval) type d,
computes a time
time returning value(rval) type t,
computes a random numc from the set {low, ..., high}
numc importing low type random=>numcv high type random=>numcv
returning value(rval) type random=>numcv,
computes a random integer from the set {low, ..., high}
i importing low type i high type i
returning value(rval) type i,
computes a random integer from the set {low, ..., high}
int2 importing low type int2 high type int2
returning value(rval) type int2,
computes a random integer from the set {low, ..., high}
int1 importing low type int1 high type int1
returning value(rval) type int1,
computes a random float from the interval [low ; high]
f importing low type f high type f
returning value(rval) type f,
computes a random character from the set {A-F0-9}
hex returning value(rval) type char01,
computes a random character from the set {0-1}
x returning value(rval) type char01,
method "random=>class_constructor"
class_constructor.
private section.
class-data:
precomputed maximal index (= string length - 1) of "random=>chars"
or of "random=>x_data".
charsmax type i,
xmax type i,
random number seed value.
(Used in method "random=>number".)
seed type random=>value.
constants:
characters for class-method "random=>hex"
hex_data(100) type c value 'ABCDEF' &
'0123456789',
characters for class-method "random=>x"
x_data(100) type c value '01',
characters for class-metshod "random=>c"
chars(100) type c value 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' &
'abcdefghijklmnopqrstuvwxyz' &
'0123456789'.
endclass. "random DEFINITION
CLASS random IMPLEMENTATION
class random implementation.
implementation of the methods for randomizing the values
method x.
data: ri type i.
ri = random=>i( low = 0 high = random=>xmax ).
move x_data+ri(1) to rval.
endmethod. "x
method hex.
data: ri type i.
ri = random=>i( low = 0 high = random=>charsmax ).
move hex_data+ri(1) to rval.
endmethod. "hex
method number.
constants:
a(3) type p value 67301, " Coefficient
c(1) type p value 1, " Increment
m(6) type p value 4294967296. " Modulus 2**32
random=>seed = ( a * random=>seed + c ) mod m.
rval = random=>seed.
endmethod. "number
method c.
data:
ri type i.
ri = random=>i( low = 0 high = random=>charsmax ).
move chars+ri(1) to rval.
endmethod. "c
method string.
data:
char(1) type c.
clear rval.
do len times.
char = random=>c( ).
concatenate rval char into rval.
enddo.
endmethod. "string
method dats.
data: l_date type sy-datum,
l_day(2) type n,
l_month(2) type n,
l_year(4) type n,
l_value type random=>numcv,
l_low type random=>numcv,
l_high type random=>numcv.
l_year = sy-datum+0(4).
l_low = l_year - 5.
l_high = l_year + 5.
l_value = random=>numc( low = l_low high = l_high ).
l_year = l_value+11(4).
l_value = random=>numc( low = 1 high = 12 ).
l_month = l_value+13(2).
case l_month.
when 2.
l_high = 28.
when 4 or 6 or 9 or 11.
l_high = 30.
when others.
l_high = 31.
endcase.
l_value = random=>numc( low = 1 high = l_high ).
l_day = l_value+13(2).
l_date+0(4) = l_year.
l_date+4(2) = l_month.
l_date+6(2) = l_day.
rval = l_date.
endmethod. "dats
method time.
data: l_time type t,
l_hour(2) type n,
l_min(2) type n,
l_sec(2) type n,
l_value type random=>numcv.
l_value = random=>numc( low = 0 high = 60 ).
l_sec = l_value+13(2).
l_value = random=>numc( low = 0 high = 60 ).
l_min = l_value+13(2).
l_value = random=>numc( low = 1 high = 24 ).
l_hour = l_value+13(2).
l_time+0(2) = l_hour.
l_time+2(2) = l_min.
l_time+4(2) = l_sec.
rval = l_time.
endmethod. "time
method numc.
Go from {0,...,random=>max} to {low,...,high} with ABAP rounding
data: l_dec(16) type p,
l_char(16) type c.
l_dec = ( ( high - low + 1 ) * random=>number( ) ) / random=>max
+ '0.5'.
subtract 1 from l_dec.
add low to l_dec.
data: lr_type_descr type ref to cl_abap_typedescr,
lr_elem_descr type ref to cl_abap_elemdescr.
lr_type_descr =
cl_abap_typedescr=>describe_by_data( rval ).
lr_elem_descr ?= lr_type_descr.
l_char = l_dec.
shift l_char left deleting leading space.
rval = l_char+0(lr_elem_descr->output_length).
endmethod. "i
method i.
Go from {0,...,random=>max} to {low,...,high} with ABAP rounding
data: l_dec(16) type p,
l_char(16) type c.
l_dec = ( ( high - low + 1 ) * random=>number( ) ) / random=>max
+ '0.5'.
subtract 1 from l_dec.
add low to l_dec.
data: lr_type_descr type ref to cl_abap_typedescr,
lr_elem_descr type ref to cl_abap_elemdescr.
lr_type_descr =
cl_abap_typedescr=>describe_by_data( rval ).
lr_elem_descr ?= lr_type_descr.
l_char = l_dec.
shift l_char left deleting leading space.
rval = l_char+0(lr_elem_descr->output_length).
endmethod. "i
method int2.
Go from {0,...,random=>max} to {low,...,high} with ABAP rounding
data: l_dec(16) type p,
l_char(16) type c.
l_dec = ( ( high - low + 1 ) * random=>number( ) ) / random=>max
+ '0.5'.
subtract 1 from l_dec.
add low to l_dec.
data: lr_type_descr type ref to cl_abap_typedescr,
lr_elem_descr type ref to cl_abap_elemdescr.
lr_type_descr =
cl_abap_typedescr=>describe_by_data( rval ).
lr_elem_descr ?= lr_type_descr.
l_char = l_dec.
shift l_char left deleting leading space.
rval = l_char+0(lr_elem_descr->output_length).
endmethod. "i
method int1.
Go from {0,...,random=>max} to {low,...,high} with ABAP rounding
data: l_dec(16) type p,
l_char(16) type c.
l_dec = ( ( high - low + 1 ) * random=>number( ) ) / random=>max
+ '0.5'.
subtract 1 from l_dec.
add low to l_dec.
data: lr_type_descr type ref to cl_abap_typedescr,
lr_elem_descr type ref to cl_abap_elemdescr.
lr_type_descr =
cl_abap_typedescr=>describe_by_data( rval ).
lr_elem_descr ?= lr_type_descr.
l_char = l_dec.
shift l_char left deleting leading space.
rval = l_char+0(lr_elem_descr->output_length).
endmethod. "i
method f.
Go from {0,...,random=>max} to [low;high]
rval = ( ( high - low ) * random=>number( ) ) / random=>max
+ low.
endmethod. "f
method class_constructor.
charsmax = strlen( chars ) - 1.
xmax = strlen( x_data ) - 1.
seed = 1.
endmethod. "class_constructor
endclass. "random IMPLEMENTATION
SELECTION-SCREEN *
selection-screen begin of block gen with frame.
parameters:
p_amount type i default 30,
p_dbinfo as checkbox,
p_dbshrt as checkbox.
selection-screen end of block gen.
parameters:
p_list type num1 default 3.
selection-screen begin of block tit with frame title text-tit.
parameters:
p_tit01 type lvc_s_layo-grid_title default text-p01. "TITLE
selection-screen end of block tit.
selection-screen begin of block lay with frame title text-lay.
parameters:
p_lay01 as checkbox. "ZEBRA
selection-screen skip.
parameters:
p_lay02 as checkbox, "NO HORIZONTAL LINES
p_lay03 as checkbox. "NO VERTICAL LINES
selection-screen skip.
parameters:
p_lay04 as checkbox. "NO SCROLLING
selection-screen skip.
parameters:
p_lay06 type syucomm, "F2CODE
p_lay07 as checkbox. "CONFIRMATION PROMPT
selection-screen end of block lay.
selection-screen begin of block spa with frame title text-spa.
parameters:
p_spa01 as checkbox, "BOX
p_spa02 as checkbox, "COUNT FELD
p_spa03 as checkbox, "NO COLUMN HEADERS
p_spa04 as checkbox. "COLUMN OPTIMIZE
selection-screen begin of block hot with frame title text-hot.
parameters:
p_hot01 as checkbox. "NO HOTSPOT
parameters:
p_hot02 as checkbox. "Hotspot auf Zeilenebene
select-options:
p_hotf02 for g_int_field no intervals default 1.
parameters:
p_hot03 as checkbox.
select-options:
p_hotf03 for g_field no intervals.
selection-screen end of block hot.
selection-screen begin of block mrg with frame title text-mrg.
parameters:
p_mrg01 radiobutton group mrge, "Default
p_mrg02 radiobutton group mrge, "kein Merge
p_mrg03 radiobutton group mrge. "Merge
selection-screen end of block mrg.
selection-screen begin of block out with frame title text-out.
parameters:
p_out01 as checkbox.
select-options:
p_outf01 for g_field no intervals.
selection-screen end of block out.
selection-screen begin of block tec with frame title text-tec.
parameters:
p_tec01 as checkbox.
select-options:
p_tecf01 for g_field no intervals.
selection-screen end of block tec.
selection-screen begin of block fix with frame title text-fix.
parameters:
p_fix01 as checkbox.
select-options:
p_fixf01 for g_field no intervals.
selection-screen end of block fix.
selection-screen begin of block txt with frame title text-txt.
selection-screen pushbutton /1(50) text-pb2 user-command pb02.
selection-screen end of block txt.
selection-screen begin of block cur with frame title text-cur.
parameters:
p_curanz type i,
p_curspc as checkbox default space.
selection-screen skip.
select-options:
p_curf00 for g_field no intervals.
parameters:
p_cur01 radiobutton group cur default 'X',
p_curf01 type lvc_s_fcat-fieldname.
parameters:
p_cur02 radiobutton group cur,
p_curf02 type g_ty_s_sflight-currency.
selection-screen end of block cur.
selection-screen begin of block sort with frame title text-srt.
selection-screen pushbutton /1(20) text-pb1 user-command pb01.
selection-screen end of block sort.
selection-screen end of block spa.
selection-screen begin of block key with frame title text-key.
parameters:
p_key01 as checkbox, "KEYFELDER ALS HOTSPOT
p_key02 as checkbox. "NO KEY FIXIERUNG
selection-screen end of block key.
selection-screen begin of block exp with frame title text-exp.
parameters:
p_excp01 as checkbox, "EXCEPTION
p_excp_c as checkbox. "EXCEPTION CONDENSE
selection-screen end of block exp.
selection-screen begin of block sum with frame title text-sum.
parameters:
p_sum01 as checkbox, "SUM BEFORE
p_sum02 as checkbox, "NUMC
p_sum03 as checkbox, "NO UNITSPLIT
p_sum04 as checkbox, "TOTALS ONLY
p_sum05 as checkbox, "NO SUMCHOICE
p_sum06 as checkbox, "NO SUMLINE
p_sum07 type sy-msgli, "TOTALS TEXT
p_sum08 as checkbox, "NO SUBCHOICE
p_sum09 as checkbox, "NO SUBTOTALS
p_sum10 type sy-msgli. "SUBTOTALS TEXT
selection-screen begin of block dos with frame title text-dos.
parameters:
p_dos01 as checkbox.
select-options:
p_dosf01 for g_field no intervals.
selection-screen end of block dos.
selection-screen begin of block nos with frame title text-nos.
parameters:
p_nos01 as checkbox.
select-options:
p_nosf01 for g_field no intervals.
selection-screen end of block nos.
selection-screen end of block sum.
selection-screen begin of block col with frame title text-col.
parameters:
p_col01 as checkbox.
select-options:
p_colf01 for g_int_field no intervals default 1.
parameters:
p_col02 as checkbox.
select-options:
p_colf02 for g_field no intervals.
parameters:
p_col03 as checkbox.
select-options:
p_colf03 for g_field no intervals.
selection-screen end of block col.
selection-screen begin of block prn with frame title text-prn.
parameters:
p_lpr01 as checkbox default 'X'. "GROUP CHANGE EDIT
selection-screen skip.
parameters:
p_lpr02 as checkbox. "GET SELINFO
selection-screen skip.
parameters:
p_lpr03 as checkbox, "NO MIN LINESIZE
p_lpr04 type sylinsz, "MIN LINESIZE
p_lpr05 type sylinsz. "MAX LINESIZE
selection-screen skip.
parameters:
p_prn01 as checkbox, "PRINT
p_prn02 type lvc_s_prnt-reservelns, "RESERVE LINES
p_prn03 as checkbox, "NO LISTINFO
p_prn04 as checkbox, "NO SELINFO
p_prn05 as checkbox, "TITEL
p_prn06 type lvc_s_prnt-footline, "FOOTLINE
p_prn07 as checkbox, "PRINT INFO
p_prn08 as checkbox, "NO COVERPAGE
p_prn09 as checkbox, "NO NEW PAGE
p_prn10 as checkbox. "NO CHANGE PRINT PARAMS
selection-screen end of block prn.
selection-screen begin of block evt with frame.
parameters:
p_evt01 as checkbox, "PF_STATUS_SET
p_evt02 as checkbox. "USER_COMMAND
selection-screen skip.
parameters:
p_evt03 as checkbox, "CALLER_EXIT
p_evt04 as checkbox, "LIST_MODIFY
p_evt05 as checkbox, "BEFORE_LINE_OUTPUT
p_evt06 as checkbox. "AFTER_LINE_OUTPUT
selection-screen skip.
parameters:
p_evt07 as checkbox, "SUBTOTAL_TEXT
p_evt08 as checkbox. "REPREP_SEL_MODIFY
selection-screen skip.
parameters:
p_evt09 as checkbox, "TOP_OF_PAGE
p_evt10 as checkbox, "END_OF_PAGE
p_evt11 as checkbox, "TOP_OF_LIST
p_evt12 as checkbox. "END_OF_LIST
selection-screen skip.
parameters:
p_evt13 as checkbox, "TOP_OF_COVERPAGE
p_evt14 as checkbox. "END_OF_COVERPAGE
selection-screen skip.
parameters:
p_evt15 as checkbox, "FOREIGN_TOP_OF_PAGE
p_evt16 as checkbox. "FOREIGN_END_OF_PAGE
selection-screen skip.
parameters:
p_evt17 as checkbox. "GROUPLEVEL_CHANGE
selection-screen end of block evt.
INITIALIZATION *
initialization.
perform f01_f4_field using 'SUM' space changing p_dosf01-low.
p_dosf01-option = 'EQ'.
p_dosf01-sign = 'I'.
append p_dosf01.
perform f01_f4_field using 'SUM' space changing p_nosf01-low.
p_nosf01-option = 'EQ'.
p_nosf01-sign = 'I'.
append p_nosf01.
perform f01_f4_field using 'KEY' space changing p_outf01-low.
p_outf01-option = 'EQ'.
p_outf01-sign = 'I'.
append p_outf01.
perform f01_f4_field using space space changing p_tecf01-low.
p_tecf01-option = 'EQ'.
p_tecf01-sign = 'I'.
append p_tecf01.
perform f01_f4_field using space space changing p_fixf01-low.
p_fixf01-option = 'EQ'.
p_fixf01-sign = 'I'.
append p_fixf01.
perform f01_f4_field using 'CURR' space changing p_curf00-low.
p_curf00-option = 'EQ'.
p_curf00-sign = 'I'.
append p_curf00.
perform f01_f4_field using 'CUKY' space changing p_curf01.
perform f01_f4_field using space space changing p_hotf03-low.
p_hotf03-option = 'EQ'.
p_hotf03-sign = 'I'.
append p_hotf03.
perform f01_f4_field using space space changing p_colf02-low.
p_colf02-option = 'EQ'.
p_colf02-sign = 'I'.
append p_colf02.
perform f01_f4_field using space space changing p_colf03-low.
p_colf03-option = 'EQ'.
p_colf03-sign = 'I'.
append p_colf03.
AT SELECTION-SCREEN *
at selection-screen.
case sscrfields-ucomm.
when 'PB01'.
call screen 1001 starting at 1 1 ending at 80 20.
when 'PB02'.
call screen 1002 starting at 1 1 ending at 80 20.
endcase.
AT SELECTION-SCREEN ON VALUE-REQUEST *
at selection-screen on value-request for p_dosf01-low.
perform f01_f4_field using 'SUM' 'X' changing p_dosf01-low.
at selection-screen on value-request for p_nosf01-low.
perform f01_f4_field using 'SUM' 'X' changing p_nosf01-low.
at selection-screen on value-request for p_outf01-low.
perform f01_f4_field using 'KEY' 'X' changing p_outf01-low.
at selection-screen on value-request for p_tecf01-low.
perform f01_f4_field using space 'X' changing p_tecf01-low.
at selection-screen on value-request for p_fixf01-low.
perform f01_f4_field using space 'X' changing p_fixf01-low.
at selection-screen on value-request for p_curf00-low.
perform f01_f4_field using 'CURR' 'X' changing p_curf00-low.
at selection-screen on value-request for p_curf01.
perform f01_f4_field using 'CUKY' 'X' changing p_curf01.
at selection-screen on value-request for p_hotf03-low.
perform f01_f4_field using space 'X' changing p_hotf03-low.
at selection-screen on value-request for p_colf02-low.
perform f01_f4_field using space 'X' changing p_colf02-low.
at selection-screen on value-request for p_colf03-low.
perform f01_f4_field using space 'X' changing p_colf03-low.
at selection-screen on value-request for p_lay06.
perform f01_f4_fcode using space
space
changing p_lay06.
START-OF-SELECTION *
start-of-selection.
g_repid = sy-repid.
gs_test-select_amount = p_amount.
gs_test-only_db_info = p_dbinfo.
gs_test-db_short = p_dbshrt.
gs_test-list_amount = p_list.
gs_test-layo_title = p_tit01.
gs_test-layo_zebra = p_lay01.
gs_test-layo_no_horiz_lines = p_lay02.
gs_test-layo_no_vert_lines = p_lay03.
gs_test-layo_no_scrolling = p_lay04.
gs_test-layo_f2code = p_lay06.
gs_test-layo_confirmation_prompt = p_lay07.
gs_test-layo_box = p_spa01.
gs_test-layo_count = p_spa02.
gs_test-layo_no_colhead = p_spa03.
gs_test-layo_column_optimize = p_spa04.
gs_test-layo_no_hotspot = p_hot01.
if p_hot02 eq con_true.
loop at p_hotf02.
if not p_hotf02-low is initial.
append p_hotf02-low to gs_test-layo_hotspot_rows.
endif.
endloop.
endif.
if p_hot03 eq con_true.
loop at p_hotf03.
if not p_hotf03-low is initial.
append p_hotf03-low to gs_test-layo_hotspot_columns.
endif.
endloop.
endif.
case con_true.
when p_mrg01.
gs_test-layo_cell_merge = space.
when p_mrg02.
gs_test-layo_cell_merge = 'N'.
when p_mrg03.
gs_test-layo_cell_merge = 'Y'.
endcase.
if p_out01 eq con_true.
loop at p_outf01.
if not p_outf01-low is initial.
append p_outf01-low to gs_test-fcat_no_out_fields.
endif.
endloop.
endif.
if p_tec01 eq con_true.
loop at p_tecf01.
if not p_tecf01-low is initial.
append p_tecf01-low to gs_test-fcat_tech_fields.
endif.
endloop.
endif.
if p_fix01 eq con_true.
loop at p_fixf01.
if not p_fixf01-low is initial.
append p_fixf01-low to gs_test-fcat_fix_column_fields.
endif.
endloop.
endif.
gs_test-curr_amount = p_curanz.
gs_test-curr_space = p_curspc.
if p_cur01 eq con_true or p_cur02 eq con_true.
data: ls_fcat_curr type g_ty_s_fcat_curr.
loop at p_curf00.
clear ls_fcat_curr.
if not p_curf00-low is initial.
ls_fcat_curr-fieldname = p_curf00-low.
case con_true.
when p_cur01.
ls_fcat_curr-cfieldname = p_curf01.
when p_cur02.
ls_fcat_curr-currency = p_curf02.
endcase.
append ls_fcat_curr to gs_test-fcat_curr_fields.
endif.
endloop.
endif.
gs_test-layo_keys_hotspot = p_key01.
gs_test-layo_no_keyfix = p_key02.
gs_test-excp_display = p_excp01.
gs_test-excp_condense = p_excp_c.
gs_test-sum_before = p_sum01.
gs_test-sum_numc = p_sum02.
gs_test-sum_no_unitsplit = p_sum03.
gs_test-sum_totals_only = p_sum04.
gs_test-sum_no_sumchoice = p_sum05.
gs_test-sum_no_sumline = p_sum06.
gs_test-sum_totals_text = p_sum07.
gs_test-sum_no_subchoice = p_sum08.
gs_test-sum_no_subtotals = p_sum09.
gs_test-sum_subtotals_text = p_sum10.
if p_dos01 eq con_true.
loop at p_dosf01.
if not p_dosf01-low is initial.
append p_dosf01-low to gs_test-fcat_do_sum_fields.
endif.
endloop.
endif.
if p_nos01 eq con_true.
loop at p_nosf01.
if not p_nosf01-low is initial.
append p_nosf01-low to gs_test-fcat_no_sum_fields.
endif.
endloop.
endif.
gs_test-layo_group_change_edit = p_lpr01.
gs_test-layo_get_selinfo = p_lpr02.
gs_test-layo_no_min_linesize = p_lpr03.
gs_test-layo_min_linesize = p_lpr04.
gs_test-layo_max_linesize = p_lpr05.
gs_test-prnt_print = p_prn01.
gs_test-prnt_reserve_lines = p_prn02.
gs_test-prnt_no_listinfo = p_prn03.
gs_test-prnt_no_selinfo = p_prn04.
gs_test-prnt_with_title = p_prn05.
gs_test-prnt_footline = p_prn06.
gs_test-prnt_printinfo = p_prn07.
gs_test-prnt_no_coverpage = p_prn08.
gs_test-prnt_no_new_page = p_prn09.
gs_test-prnt_no_change_print_params = p_prn10.
if p_col01 eq con_true.
loop at p_colf01.
if not p_colf01-low is initial.
append p_colf01-low to gs_test-color_rows.
endif.
endloop.
endif.
if p_col02 eq con_true.
loop at p_colf02.
if not p_colf02-low is initial.
append p_colf02-low to gs_test-color_fields_column.
endif.
endloop.
endif.
if p_col03 eq con_true.
loop at p_colf03.
if not p_colf03-low is initial.
append p_colf03-low to gs_test-color_fields_cell.
endif.
endloop.
endif.
if p_evt01 eq con_true.
append con_event_01 to gs_test-events.
endif.
if p_evt02 eq con_true.
append con_event_02 to gs_test-events.
endif.
if p_evt03 eq con_true.
append con_event_03 to gs_test-events.
endif.
if p_evt04 eq con_true.
append con_event_04 to gs_test-events.
endif.
if p_evt05 eq con_true.
append con_event_05 to gs_test-events.
endif.
if p_evt06 eq con_true.
append con_event_06 to gs_test-events.
endif.
if p_evt07 eq con_true.
append con_event_07 to gs_test-events.
endif.
if p_evt08 eq con_true.
append con_event_08 to gs_test-events.
endif.
if p_evt09 eq con_true.
append con_event_09 to gs_test-events.
endif.
if p_evt10 eq con_true.
append con_event_10 to gs_test-events.
endif.
if p_evt11 eq con_true.
append con_event_11 to gs_test-events.
endif.
if p_evt12 eq con_true.
append con_event_12 to gs_test-events.
endif.
if p_evt13 eq con_true.
append con_event_13 to gs_test-events.
endif.
if p_evt14 eq con_true.
append con_event_14 to gs_test-events.
endif.
if p_evt15 eq con_true.
append con_event_15 to gs_test-events.
endif.
if p_evt16 eq con_true.
append con_event_16 to gs_test-events.
endif.
if p_evt17 eq con_true.
append con_event_17 to gs_test-events.
endif.
gs_test-buffer_active = space.
gs_test-bypassing_buffer = space.
END-OF-SELECTION *
end-of-selection.
perform f01_call_list.
*& Form f01_call_list
text
form f01_call_list .
data: ls_prnt type slis_print_alv,
lt_excl type slis_t_extab,
l_exit type char1,
ls_exit type slis_exit_by_user,
l_list type num1.
call function 'REUSE_ALV_BLOCK_LIST_INIT'
exporting
i_callback_program = g_repid
i_callback_pf_status_set = ' '
i_callback_user_command = ' '
it_excluding = lt_excl.
do gs_test-list_amount times.
add 1 to l_list.
perform f01_append_list using l_list.
enddo.
perform f01_set_prnt changing ls_prnt.
call function 'REUSE_ALV_BLOCK_LIST_DISPLAY'
exporting
i_interface_check = ' '
is_print = ls_prnt
i_screen_start_column = 0
i_screen_start_line = 0
i_screen_end_column = 0
i_screen_end_line = 0
importing
e_exit_caused_by_caller = l_exit
es_exit_caused_by_user = ls_exit
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.
endform. " f01_call_list
*& Form f01_append_list
text
form f01_append_list using value(i_list) type num1.
data: ls_layo type slis_layout_alv,
lt_fcat type slis_t_fieldcat_alv,
lt_sort type slis_t_sortinfo_alv,
lt_evts type slis_t_event,
l_tabname type slis_tabname.
field-symbols: <l_table> type any.
perform f01_get_outtab using i_list.
case i_list.
when 1.
gt_outtab1 = gt_outtab[].
when 2.
gt_outtab2 = gt_outtab[].
when 3.
gt_outtab3 = gt_outtab[].
when 4.
gt_outtab4 = gt_outtab[].
when 5.
gt_outtab5 = gt_outtab[].
when 6.
gt_outtab6 = gt_outtab[].
when 7.
gt_outtab7 = gt_outtab[].
when 8.
gt_outtab8 = gt_outtab[].
when 9.
gt_outtab9 = gt_outtab[].
endcase.
perform f01_set_layo changing ls_layo.
perform f01_set_fcat changing lt_fcat.
perform f01_set_evts changing lt_evts.
concatenate 'LIST_' i_list into l_tabname.
case i_list.
when 1.
call function 'REUSE_ALV_BLOCK_LIST_APPEND'
exporting
is_layout = ls_layo
it_fieldcat = lt_fcat
i_tabname = l_tabname
it_events = lt_evts
it_sort = lt_sort
i_text = 'Hello' "#EC NOTEXT
tables
t_outtab = gt_outtab1
exceptions
program_error = 1
maximum_of_appends_reached = 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.
when 2.
call function 'REUSE_ALV_BLOCK_LIST_APPEND'
exporting
is_layout = ls_layo
it_fieldcat = lt_fcat
i_tabname = l_tabname
it_events = lt_evts
it_sort = lt_sort
i_text = 'Hello' "#EC NOTEXT
tables
t_outtab = gt_outtab2
exceptions
program_error = 1
maximum_of_appends_reached = 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.
when 3.
call function 'REUSE_ALV_BLOCK_LIST_APPEND'
exporting
is_layout = ls_layo
it_fieldcat = lt_fcat
i_tabname = l_tabname
it_events = lt_evts
it_sort = lt_sort
i_text = 'Hello' "#EC NOTEXT
tables
t_outtab = gt_outtab3
exceptions
program_error = 1
maximum_of_appends_reached = 2
others = 3.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-ms -
ALV - Subtotals with different waers
Hello!
I have a hierarquical ALV sorted by LIFNR and payments with the WRBTR and WAERS columns.
WAERS can be 'ARS' 'USD' etc. for the same LIFNR.
I want to display subtotals of WRBTR field for each LIFNR by WAERS.
Can anyone help me please?
Thanks,
Liliana.Hi Liliana,
Plz check this code .
report zxx_alvexer4 message-id zz .
*& TABLES DECLARATION *
tables: vbak, vbap.
*& TYPE POOLS DECLARATION *
type-pools: slis.
DATA DECLARATIONS *
data: v_flag type c. "Flag to display the header
data: v_repid type sy-repid.
*& INTERNAL TABLE DECLARATION *
data: begin of it_vbak occurs 0,
vbeln like vbak-vbeln,
audat like vbak-audat,
auart like vbak-auart,
netwr like vbak-netwr,
expand(1),
end of it_vbak.
data: begin of it_vbap occurs 0,
vbeln like vbap-vbeln,
posnr like vbap-posnr,
matnr like vbap-matnr,
pstyv like vbap-pstyv,
charg like vbap-charg,
end of it_vbap.
data: it_fldcat type slis_t_fieldcat_alv,
it_fldcat1 type slis_t_fieldcat_alv,
*events
it_events type slis_t_event with header line,
v_call type c,
x_user type slis_exit_by_user,
it_variant like disvariant occurs 0 with header line,
x_keyinfo type slis_keyinfo_alv,
*layout
x_layout type slis_layout_alv,
*sort
it_sort type slis_t_sortinfo_alv,
wa_sort like line of it_sort,
x_cat type slis_fieldcat_alv,
v_tabix like sy-tabix.
Selection screen Declaration
*--BLOCK1
selection-screen begin of block b1 with frame title text-001.
select-options: s_vbeln for vbak-vbeln,
s_auart for vbak-auart.
selection-screen end of block b1.
AT SELECTION-SCREEN *
*- Validations
at selection-screen.
perform validate_screen.
START OF SELECTION *
start-of-selection.
*- To get data from VBAK
perform get_data.
*to get data from VBAP
perform get_data_vbap.
perform prepare_alv.
END OF SELECTION *
end-of-selection.
perform display_report.
*& Form VALIDATE_SCREEN
text
--> p1 text
<-- p2 text
form validate_screen .
data: lv_vbeln like vbak-vbeln,
lv_auart like vbak-auart.
if not s_vbeln[] is initial.
select vbeln
into lv_vbeln
from vbak
where vbeln in s_vbeln.
endselect.
if sy-subrc <> 0.
message e000 with 'INVALID SALES DOC'(002).
endif.
endif.
if not s_auart[] is initial.
select auart
into lv_auart
from vbak
where auart in s_auart.
endselect.
if sy-subrc <> 0.
message e000 with 'INVALID SALES DOC TYPE'(003).
endif.
endif.
endform. " VALIDATE_SCREEN
*& Form GET_DATA
text
--> p1 text
<-- p2 text
form get_data .
select vbeln
audat
auart
netwr
from vbak
into table it_vbak
where vbeln in s_vbeln
and auart in s_auart.
if sy-subrc = 0.
sort it_vbak by vbeln.
endif.
endform. " GET_DATA
*& Form GET_DATA_VBAP
text
--> p1 text
<-- p2 text
form get_data_vbap .
select vbeln
posnr
matnr
pstyv
charg
into table it_vbap
from vbap
for all entries in it_vbak
where vbeln = it_vbak-vbeln.
if sy-subrc = 0.
sort it_vbap by vbeln posnr.
endif.
endform. " GET_DATA_VBAP
*& Form prepare_alv
text
--> p1 text
<-- p2 text
form prepare_alv .
Prepare field catalog .
perform prepare_catalog.
Modify catalog
perform change_attr_of_catalog.
Modify Layout
perform modify_layout.
Sort Catalog
perform sort_catalog.
endform. " prepare_alv
*& Form prepare_catalog
text
--> p1 text
<-- p2 text
form prepare_catalog .
call function 'REUSE_ALV_FIELDCATALOG_MERGE'
exporting
i_program_name = sy-repid
i_internal_tabname = 'IT_VBAK'
i_inclname = sy-repid
changing
ct_fieldcat = it_fldcat1[]
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.
append lines of it_fldcat1 to it_fldcat.
clear: it_fldcat1[].
call function 'REUSE_ALV_FIELDCATALOG_MERGE'
exporting
i_program_name = sy-repid
i_internal_tabname = 'IT_VBAP'
i_inclname = sy-repid
changing
ct_fieldcat = it_fldcat1[]
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.
append lines of it_fldcat1 to it_fldcat.
endform. " prepare_catalog
*& Form change_attr_of_catalog
text
--> p1 text
<-- p2 text
form change_attr_of_catalog .
loop at it_fldcat into x_cat.
v_tabix = sy-tabix.
case x_cat-fieldname.
when 'EXPAND'.
if x_cat-tabname = 'IT_VBAK'.
x_cat-no_out = 'X'.
endif.
when 'VBELN'.
if x_cat-tabname = 'IT_VBAK'.
x_cat-no_out = 'X'.
endif.
when 'VBELN'.
if x_cat-tabname = 'IT_VBAK'.
x_cat-col_pos = '1'.
x_cat-seltext_m = 'SALES DOC'.
x_cat-seltext_l = 'SALES DOC'.
x_cat-seltext_s = 'SALES DOC'.
x_cat-outputlen = '10'.
endif.
when 'AUDAT'.
if x_cat-tabname = 'IT_VBAK'.
x_cat-col_pos = '2'.
x_cat-seltext_m = 'DOC DATE'.
x_cat-seltext_l = 'DOC DATE'.
x_cat-seltext_s = 'DOC DATE'.
x_cat-outputlen = '8'.
endif.
when 'AUART'.
if x_cat-tabname = 'IT_VBAK'.
x_cat-col_pos = '3'.
x_cat-seltext_m = 'ORDER REASON'.
x_cat-seltext_l = 'ORDER REASON'.
x_cat-seltext_s = 'ORDER REASON'.
x_cat-outputlen = '5'.
endif.
when 'NETWR'.
if x_cat-tabname = 'IT_VBAK'.
x_cat-col_pos = '4'.
x_cat-seltext_m = 'NET PRICE'.
x_cat-seltext_l = 'NET PRICE'.
x_cat-seltext_s = 'NET PRICE'.
x_cat-outputlen = '15'.
endif.
endcase.
modify it_fldcat from x_cat.
clear x_cat.
endloop.
endform. " change_attr_of_catalog
*& Form modify_layout
text
--> p1 text
<-- p2 text
form modify_layout .
x_layout-default_item = 'X'.
x_layout-zebra = 'X'.
x_layout-expand_fieldname = 'EXPAND'.
endform. " modify_layout
*& Form sort_catalog
text
--> p1 text
<-- p2 text
form sort_catalog .
clear wa_sort.
wa_sort-spos = '01'.
wa_sort-fieldname = 'VBELN' .
wa_sort-tabname = 'IT_VBAP'.
wa_sort-up = 'X'.
append wa_sort to it_sort.
clear wa_sort.
wa_sort-spos = '02'.
wa_sort-fieldname = 'POSNR' .
wa_sort-tabname = 'IT_VBAP'.
wa_sort-up = 'X'.
append wa_sort to it_sort.
endform. " sort_catalog
*& Form DISPLAY_REPORT
text
--> p1 text
<-- p2 text
form display_report .
it_variant-report = sy-repid.
sort it_vbak by vbeln.
sort it_vbap by vbeln posnr.
call function 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
exporting
i_callback_program = sy-repid
is_layout = x_layout
it_fieldcat = it_fldcat[]
it_sort = it_sort
is_variant = it_variant
it_events = it_events[]
i_tabname_header = 'IT_VBAK'
i_tabname_item = 'IT_VBAP'
is_keyinfo = x_keyinfo
importing
e_exit_caused_by_caller = v_call
es_exit_caused_by_user = x_user
tables
t_outtab_header = it_vbak
t_outtab_item = it_vbap
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.
endform. " DISPLAY_REPORT
Regards,
Laxmi
Message was edited by: Laxmi -
Hi all F4 in alv grid with restricted value -- no solution from forum
hi all
i have developed report using alv grid using FM (important).
i have a field xyz which is input/output enabled in alv grid output. this field is attached with f4 help.
my requirement is to get or read the row in alv grid when user press f4 on that field so that restricted value should come in f4 help i.e. i have to read current line when user presses f4 i.e. the single line data in alv grid.
so how to get or read the current row when user press f4 i.e user will choose any row in alv grid and this output is on alv grid and there are multiple records.
or in other word is it possible to read current row in alv grid when user presses F4, if yes how???.
i hope u understood the query.Hai,
Check the code it may help u.
For F4 Values on Screen:
PROCESS ON VALUE_REQUEST
using module call starting with FIELD i.e FIELD field MODULE module
There are number of function modules that can be used for the purpose, but these
can fullfill the task easily or combination of them.
DYNP_VALUE_READ
F4IF_FIELD_VALUE_REQUEST
F4IF_INT_TABLE_VALUE_REQUEST
POPUP_WITH_TABLE_DISPLAY
DYNP_VALUE_READ
This function module is used to read values in the screen fields. Use of this
FM causes forced transfer of data from screen fields to ABAP fields.
There are 3 exporting parameters
DYNAME = program name = SY-CPROG
DYNUMB = Screen number = SY-DYNNR
TRANSLATE_TO_UPPER = 'X'
and one importing TABLE parameter
DYNPFIELDS = Table of TYPE DYNPREAD
The DYNPFIELDS parameter is used to pass internal table of type DYNPREAD
to this FM and the values read from the screen will be stored in this table.This
table consists of two fields:
FIELDNAME : Used to pass the name of screen field for which the value is to
be read.
FIELDVALUE : Used to read the value of the field in the screen.
e.g.
DATA: SCREEN_VALUES TYPE TABLE OF DYNPREAD ,
SCREEN_VALUE LIKE LINE OF SCREEN_VALUES.
SCREEN_VALUE-FIELDNAME = 'KUNNR' . * Field to be read
APPEND SCREEN_VALUE TO SCREEN_VALUES. * Fill the table
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
DYNAME = SY-CPROG
DYNUMB = SY-DYNNR
TRANSLATE_TO_UPPER = 'X'
TABLES
DYNPFIELDS = SCREEN_VALUES.
READ TABLE SCREEN_VALUES INDEX 1 INTO SCREEN_VALUE.Now the screen value for field KUNNR is in the SCREEN_VALUE-FIELDVALUE and can be used for further processing like using it to fill the internal table to be used as parameter in F4IF_INT_TABLE_VALUE_REQUEST ETC.
F4IF_FIELD_VALUE_REQUEST
This FM is used to display value help or input from ABAP dictionary.We have to pass the name of the structure or table(TABNAME) along with the field name(FIELDNAME) . The selection can be returned to the specified screen field if three
parameters DYNPNR,DYNPPROG,DYNPROFIELD are also specified or to a table if RETRN_TAB is specified.
CALL FUNCTION 'F4IF_FIELD_VALUE_REQUEST'
EXPORTING
TABNAME = table/structure
FIELDNAME = 'field name'
DYNPPROG = SY-CPROG
DYNPNR = SY-DYNR
DYNPROFIELD = 'screen field'
IMPORTING
RETURN_TAB = table of type DYNPREAD
F4IF_INT_TABLE_VALUE_REQUEST
This FM is used to dsiplay values stored in an internal table as input
help.This FM is used to program our own custom help if no such input help
exists in ABAP dictionary for a particular field. The parameter VALUE_TAB is used to pass the internal table containing input values.The parameter RETFIELD
is used to specify the internal table field whose value will be returned to the screen field or RETURN_TAB.
If DYNPNR,DYNPPROG and DYNPROFIELD are specified than the user selection is passed to the screen field specified in the DYNPROFIELD. If RETURN_TAB is specified the selectionis returned in a table.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
RETFIELD = field from int table whose value will be returned
DYNPPROG = SY-CPROG
DYNPNR = SY-DYNNR
DYNPROFIELD = 'screen field'
VALUE_ORG = 'S'
TABLES
VALUE_TAB = internal table whose values will be shown.
RETURN_TAB = internal table of type DDSHRETVAL
EXCEPTIONS
parameter_error = 1
no_values_found = 2
others = 3.
POPUP_WITH_TABLE_DISPLAY
This FM is used to display the contents of an internal table in a popup window.The user can select a row and the index of that is returned in the CHOISE
parameter.The VALUETAB is used to pass the internal table.
A suitable title can be set using TITLETEXT parameter. The starting and end position of the popup can be specified by the parameters STARTPOS_COL / ROW and ENDPOS_ROW / COL .
CALL FUNCTION 'POPUP_WITH_TABLE_DISPLAY'
EXPORTING
ENDPOS_COL =
ENDPOS_ROW =
STARTPOS_COL =
STARTPOS_ROW =
TITLETEXT = 'title text'
IMPORTING
CHOISE =
TABLES
VALUETAB =
EXCEPTIONS
BREAK_OFF = 1
OTHERS = 2.
e.g.
DATA: w_choice TYPE SY-TABIX.
DATA: BEGIN OF i_values OCCURS 0 WITH HEADER LINE,
values TYPE I,
END OF i_values.
PARAMETRS : id TYPE I.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR id
i_values-values = '0001'.
APPEND i_values.
i_values-values = '0002'.
APPEND i_values.
i_values-values = '0003'.
APPEND i_values.
i_values-values = '0004'.
APPEND i_values.
CALL FUNCTION 'POPUP_WITH_TABLE_DISPLAY'
EXPORTING
ENDPOS_COL = 40
ENDPOS_ROW = 12
STARTPOS_COL = 20
STARTPOS_ROW = 5
TITLETEXT = 'Select an ID'
IMPORTING
CHOISE = w_choice
TABLES
VALUETAB = i_values
EXCEPTIONS
BREAK_OFF = 1
OTHERS = 2.
CHECK w_choice > 0.
READ TABLE i_values INDEX w_choice....now we can process the selection as it is contained
...in the structure i_values.
Other FM that may be used to provide input help is HELP_START .
check this also.
See the following ex:
TYPES: BEGIN OF TY_MBLNR,
MBLNR LIKE MKPF-MBLNR,
END OF TY_MBLNR.
DATA: IT_MBLNR TYPE STANDARD TABLE OF TY_MBLNR WITH HEADER LINE.
data: it_ret like ddshretval occurs 0 with header line.
At selection-screen on value-request for s_mat-low.
Select MBLNR from mkpf into table it_mblnr.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
DDIC_STRUCTURE = ' '
RETFIELD = 'MBLNR'
PVALKEY = ' '
DYNPPROG = ' '
DYNPNR = ' '
DYNPROFIELD = ' '
STEPL = 0
WINDOW_TITLE =
VALUE = ' '
VALUE_ORG = 'S'
MULTIPLE_CHOICE = ' '
DISPLAY = ' '
CALLBACK_PROGRAM = ' '
CALLBACK_FORM = ' '
MARK_TAB =
IMPORTING
USER_RESET =
TABLES
VALUE_TAB = IT_MBLNR
FIELD_TAB =
RETURN_TAB = IT_RET
DYNPFLD_MAPPING =
EXCEPTIONS
PARAMETER_ERROR = 1
NO_VALUES_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.
IF SY-SUBRC = 0.
read table it_ret index 1.
move it_ret-fieldval to S_mat-low.
ENDIF.
Go through the test program.
REPORT Ztest_HELP .
TABLES : MARA.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
PARAMETERS : P_MATNR(10) TYPE C.
SELECTION-SCREEN END OF BLOCK B1.
DATA : BEGIN OF ITAB OCCURS 0,
MATNR TYPE MATNR,
END OF ITAB.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_MATNR.
SELECT MATNR
FROM MARA
INTO TABLE ITAB
UP TO 10 ROWS.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
RETFIELD = 'MATERIAL NUMBER'
DYNPPROG = SY-REPID
DYNPNR = SY-DYNNR
DYNPROFIELD = 'P_MATNR'
VALUE_ORG = 'S'
TABLES
VALUE_TAB = ITAB
EXCEPTIONS
PARAMETER_ERROR = 1
NO_VALUES_FOUND = 2
OTHERS = 3.
regards.
sowjanya.b. -
ALV reprot With four internal tables
Hi all,
Could any one please tell what is function module we have to use for displaying four internal tables in a single ALV REPORT.
Thanks & regards
VardhanThis is the code for displaying ALV using containers.. u need to create 4 containers in one screen and need to display data...
I would suggest you to get all the data into one internal table and display.. for more clarity u can give diff colors for diff table data using field catalog..
*& Report ZTRPSD110 *
* TITLE: Statement of Export Report for Tata Tetley *
* PURPOSE:Statement of Export Report for Tata Tetley *
* A. Start-of-selection: *
* 1. In get_billing_data using the selection screen parameters get the *
* billing data from billing header(VBAK) and Item (VBAP) *
* 2. Get the SHIP-TO partner data from VBPA using Customer number as *
* one condition and store in it_vbpa_sh
* 9. Popultae the ALV display table
* B. End-of-selection:
* Call screen 9000 and display data in ALV
REPORT ztrps110 MESSAGE-ID zttl LINE-SIZE 130.
TABLES: vbrk.
* CONSTANTS
CONSTANTS :
c_x(1) TYPE c VALUE 'X',
c_zxto TYPE vbak-auart VALUE 'ZXTO',
c_e TYPE spras VALUE 'E',
c_000000 TYPE posnr VALUE '000000',
c_ship_to TYPE parvw VALUE 'WE'. "Ship To Party
* Table Types
TYPES: BEGIN OF ty_vbrk_vbrp,
vbeln TYPE vbrk-vbeln, "Billing doc
posnr TYPE vbrp-posnr, "Billing item
aubel TYPE vbrp-aubel, "Sales order
waerk TYPE vbrk-waerk, "Doc currency
mvgr1 TYPE vbrp-mvgr1, "Material group 1
mvgr3 TYPE vbrp-mvgr3, "Material group 3
mvgr4 TYPE vbrp-mvgr4, "Material group 4
matnr TYPE vbrp-matnr, "Material no
ntgew TYPE vbrp-ntgew, "Net wt
gewei TYPE vbrp-gewei, "Wt unit
kzwi1 TYPE vbrp-kzwi1, "Subtotal 1
kursk TYPE vbrp-kursk, "Exchange rate
END OF ty_vbrk_vbrp.
TYPES: BEGIN OF ty_data,
land1 TYPE vbpa-land1,
landx TYPE t005t-landx,
mvgr3 TYPE vbrp-mvgr3,
mvgr4 TYPE vbrp-mvgr4,
bezei3 TYPE tvm3t-bezei,
bezei4 TYPE tvm4t-bezei,
ntgew_tea_bag TYPE vbrp-ntgew,
ntgew_pkt_tea TYPE vbrp-ntgew,
ntgew_bulk_tea TYPE vbrp-ntgew,
kzwi1_tea_bag TYPE vbrp-kzwi1, "Subtotal 1 Tea Bag
kzwi1_pkt_tea TYPE vbrp-kzwi1, "Subtotal 1 Pkt Tea
kzwi1_bulk_tea TYPE vbrp-kzwi1, "Subtotal 1 Bulk Tea
ntgew_tot TYPE vbrp-ntgew,
kzwi1_tot TYPE vbrp-kzwi1,
line_color(4) TYPE c, "For line color
END OF ty_data.
TYPES: BEGIN OF ty_vbpa,
vbeln TYPE vbpa-vbeln,
land1 TYPE vbpa-land1,
END OF ty_vbpa.
TYPES: BEGIN OF ty_t005t,
land1 TYPE t005t-land1,
landx TYPE t005t-landx,
END OF ty_t005t.
TYPES: BEGIN OF ty_tvm3t,
mvgr3 TYPE tvm3-mvgr3,
bezei TYPE tvm3t-bezei,
END OF ty_tvm3t.
TYPES: BEGIN OF ty_tvm4t,
mvgr4 TYPE tvm4-mvgr4,
bezei TYPE tvm4t-bezei,
END OF ty_tvm4t.
DATA: it_vbrk_vbrp TYPE STANDARD TABLE OF ty_vbrk_vbrp,
wa_vbrk_vbrp TYPE ty_vbrk_vbrp,
it_vbpa TYPE STANDARD TABLE OF ty_vbpa,
wa_vbpa TYPE ty_vbpa,
it_data TYPE STANDARD TABLE OF ty_data,
wa_data TYPE ty_data,
it_t005t TYPE STANDARD TABLE OF ty_t005t,
wa_t005t TYPE ty_t005t,
it_tvm3t TYPE STANDARD TABLE OF ty_tvm3t,
wa_tvm3t TYPE ty_tvm3t,
it_tvm4t TYPE STANDARD TABLE OF ty_tvm4t,
wa_tvm4t TYPE ty_tvm4t.
* Global data for grand total
DATA:
w_tot_ntgew_tea_bag TYPE vbrp-ntgew,
w_tot_ntgew_pkt_tea TYPE vbrp-ntgew,
w_tot_ntgew_bulk_tea TYPE vbrp-ntgew,
w_tot_ntgew_tot TYPE vbrp-ntgew,
w_tot_kzwi1_tea_bag TYPE vbrp-kzwi1,
w_tot_kzwi1_pkt_tea TYPE vbrp-kzwi1,
w_tot_kzwi1_bulk_tea TYPE vbrp-kzwi1,
w_tot_kzwi1_tot TYPE vbrp-kzwi1.
* Global data definitions for ALV
DATA :
* ALV Grid container
w_alv_container TYPE REF TO cl_gui_custom_container,
* ALV Grid
w_alv_grid TYPE REF TO cl_gui_alv_grid,
w_layo TYPE lvc_s_layo, "For layout
wt_fieldcat TYPE lvc_t_fcat, "For field catalog
okcode TYPE okcode, "OK Code
w_to(2) TYPE c,
w_title TYPE string.
*-------------- START OF SELECTION SCREEN ----------------------------*
SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
* Billing Date
SELECT-OPTIONS: s_fkdat FOR vbrk-fkdat MEMORY ID vf OBLIGATORY NO-EXTENSION.
SELECTION-SCREEN:SKIP 1.
SELECTION-SCREEN: END OF BLOCK b1.
*-------------- END OF SELECTION SCREEN ------------------------------*
*------------- EVENT START-OF-SELECTION -------------------------------*
START-OF-SELECTION.
* Get billing data from Delivery header(VBRK) and item (VBRP)
PERFORM get_billing_data.
* Get ship-to country
PERFORM get_ship_to_data.
* Get material group description 3
PERFORM get_material_group_3.
* Get material group description 4
PERFORM get_material_group_4.
* Form the ALV Grid title
PERFORM form_title.
* Process data
PERFORM process_data.
* Populate text descriptions
PERFORM populate_description.
*------------- EVENT END-OF-SELECTION -------------------------------*
END-OF-SELECTION.
* Set the text to when date high is there
IF NOT s_fkdat-high IS INITIAL.
w_to = 'to'(c16).
ENDIF.
* Call the scren 9000 for ALV Display
CALL SCREEN 9000.
*& Form get_billing_data
* Get billing data from Delivery header(VBRK) and item (VBRP)
* & store in internal table it_vbrk_vbrp
FORM get_billing_data .
REFRESH: it_vbrk_vbrp.
* Select Billing data by joining VBRK & VBRP and store in it_vbrk_vbrp
SELECT a~vbeln
b~posnr
b~aubel
a~waerk
b~mvgr1
b~mvgr3
b~mvgr4
b~matnr
b~ntgew
b~gewei
b~kzwi1
b~kursk
FROM vbrk AS a INNER JOIN vbrp AS b
ON a~vbeln = b~vbeln
INTO TABLE it_vbrk_vbrp
WHERE a~fkdat IN s_fkdat
* Consider only non-deleted document
AND fksto = space
* Billing doc type should be ZXTB
AND fkart = 'ZXTB'
AND pstyv = c_zxto.
IF sy-subrc <> 0.
MESSAGE i999(zttl) WITH 'No data is there'(m06).
LEAVE LIST-PROCESSING.
ENDIF.
ENDFORM. " get_billing_data
*& Form get_ship_to_data
* Get Ship-To party data
FORM get_ship_to_data .
DATA: l_it_vbpa TYPE STANDARD TABLE OF ty_vbpa.
REFRESH: it_vbpa, it_t005t.
IF NOT it_vbrk_vbrp[] IS INITIAL.
SELECT vbeln
land1
FROM vbpa
INTO TABLE it_vbpa
FOR ALL ENTRIES IN it_vbrk_vbrp
WHERE vbeln = it_vbrk_vbrp-aubel
AND posnr = c_000000
AND parvw = c_ship_to.
IF sy-subrc <> 0.
MESSAGE i999(zttl) WITH 'Exporter country not maintained'(m02).
LEAVE LIST-PROCESSING.
ELSE.
SORT it_vbpa BY vbeln.
* Create an unique and sorted driver table
l_it_vbpa[] = it_vbpa[].
SORT l_it_vbpa BY land1.
DELETE ADJACENT DUPLICATES FROM l_it_vbpa COMPARING land1.
IF NOT l_it_vbpa[] IS INITIAL.
* Get the country description from T005t table
SELECT land1
landx
FROM t005t
INTO TABLE it_t005t
FOR ALL ENTRIES IN l_it_vbpa
WHERE spras = c_e
AND land1 = l_it_vbpa-land1.
IF sy-subrc = 0.
SORT it_t005t BY land1.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDFORM. " get_ship_to_data
*& Form get_material_group_3
* Get material group 3
FORM get_material_group_3 .
DATA: l_it_vbrk_vbrp TYPE STANDARD TABLE OF ty_vbrk_vbrp.
REFRESH: it_tvm3t.
* Create an unique and sorted driver table
l_it_vbrk_vbrp[] = it_vbrk_vbrp[].
SORT l_it_vbrk_vbrp BY mvgr3.
DELETE ADJACENT DUPLICATES FROM l_it_vbrk_vbrp COMPARING mvgr3.
IF NOT l_it_vbrk_vbrp[] IS INITIAL.
SELECT mvgr3
bezei
FROM tvm3t
INTO TABLE it_tvm3t
FOR ALL ENTRIES IN l_it_vbrk_vbrp
WHERE mvgr3 = l_it_vbrk_vbrp-mvgr3.
IF sy-subrc = 0.
SORT it_tvm3t BY mvgr3.
ENDIF.
ENDIF.
ENDFORM. " get_material_group_3
*& Form get_material_group_4
* Get material group 4
FORM get_material_group_4 .
DATA: l_it_vbrk_vbrp TYPE STANDARD TABLE OF ty_vbrk_vbrp.
REFRESH: it_tvm4t.
* Create an unique and sorted driver table
l_it_vbrk_vbrp[] = it_vbrk_vbrp[].
SORT l_it_vbrk_vbrp BY mvgr4.
DELETE ADJACENT DUPLICATES FROM l_it_vbrk_vbrp COMPARING mvgr4.
IF NOT l_it_vbrk_vbrp[] IS INITIAL.
SELECT mvgr4
bezei
FROM tvm4t
INTO TABLE it_tvm4t
FOR ALL ENTRIES IN l_it_vbrk_vbrp
WHERE mvgr4 = l_it_vbrk_vbrp-mvgr4.
IF sy-subrc = 0.
SORT it_tvm4t BY mvgr4.
ENDIF.
ENDIF.
ENDFORM. " get_material_group_4
*& Form process_data
* Process the data and do summation and populate final display table
FORM process_data .
LOOP AT it_vbrk_vbrp INTO wa_vbrk_vbrp.
CLEAR: wa_data, wa_vbpa.
READ TABLE it_vbpa INTO wa_vbpa WITH KEY
vbeln = wa_vbrk_vbrp-aubel
BINARY SEARCH.
IF sy-subrc = 0.
wa_data-land1 = wa_vbpa-land1.
ENDIF.
wa_data-mvgr3 = wa_vbrk_vbrp-mvgr3.
wa_data-mvgr4 = wa_vbrk_vbrp-mvgr4.
* Do an unit conversion of the quamtity
CALL FUNCTION 'UNIT_CONVERSION_SIMPLE'
EXPORTING
input = wa_vbrk_vbrp-ntgew
* NO_TYPE_CHECK = 'X'
* ROUND_SIGN = ' '
unit_in = wa_vbrk_vbrp-gewei
unit_out = 'TO' "Metric tonn
IMPORTING
output = wa_vbrk_vbrp-ntgew
EXCEPTIONS
conversion_not_found = 1
division_by_zero = 2
input_invalid = 3
output_invalid = 4
overflow = 5
type_invalid = 6
units_missing = 7
unit_in_not_found = 8
unit_out_not_found = 9
OTHERS = 10.
IF sy-subrc <> 0.
wa_vbrk_vbrp-ntgew = wa_vbrk_vbrp-ntgew.
ENDIF.
* Convert the currency from Customer currency to local
* currency by multiplying with kursk
wa_vbrk_vbrp-kzwi1 = wa_vbrk_vbrp-kzwi1 * wa_vbrk_vbrp-kursk.
* Convert the amount to Lacks by dividing with 100000
wa_vbrk_vbrp-kzwi1 = wa_vbrk_vbrp-kzwi1 / 100000. "DV1K905028
* When MVGR1 is between A to F use the amount as TEA_BAG
IF wa_vbrk_vbrp-mvgr1 BETWEEN 'A' AND 'F'.
wa_data-ntgew_tea_bag = wa_vbrk_vbrp-ntgew.
wa_data-kzwi1_tea_bag = wa_vbrk_vbrp-kzwi1.
ENDIF.
* When MVGR1 is between G to L use the amount as TEA_BAG
IF wa_vbrk_vbrp-mvgr1 BETWEEN 'G' AND 'L'.
wa_data-ntgew_pkt_tea = wa_vbrk_vbrp-ntgew.
wa_data-kzwi1_pkt_tea = wa_vbrk_vbrp-kzwi1.
ENDIF.
* When MVGR1 is between G to L use the amount as TEA_BAG
IF wa_vbrk_vbrp-mvgr1 = 'M'.
wa_data-ntgew_bulk_tea = wa_vbrk_vbrp-ntgew.
wa_data-kzwi1_bulk_tea = wa_vbrk_vbrp-kzwi1.
ENDIF.
COLLECT wa_data INTO it_data.
ENDLOOP.
ENDFORM. " process_data
*& Form populate_description
* Populate the description fields
FORM populate_description .
LOOP AT it_data INTO wa_data.
CLEAR: wa_t005t.
READ TABLE it_t005t INTO wa_t005t WITH KEY land1 = wa_data-land1
BINARY SEARCH.
IF sy-subrc = 0.
wa_data-landx = wa_t005t-landx.
ENDIF.
* Read description of Material group 3
CLEAR wa_tvm3t.
READ TABLE it_tvm3t INTO wa_tvm3t WITH KEY
mvgr3 = wa_data-mvgr3
BINARY SEARCH.
IF sy-subrc = 0.
wa_data-bezei3 = wa_tvm3t-bezei.
ENDIF.
* Read description of Material group 4
CLEAR wa_tvm4t.
READ TABLE it_tvm4t INTO wa_tvm4t WITH KEY
mvgr4 = wa_data-mvgr4
BINARY SEARCH.
IF sy-subrc = 0.
wa_data-bezei4 = wa_tvm4t-bezei.
ENDIF.
* Get the grand totals
wa_data-ntgew_tot = wa_data-ntgew_tea_bag
+ wa_data-ntgew_pkt_tea
+ wa_data-ntgew_bulk_tea.
wa_data-kzwi1_tot = wa_data-kzwi1_tea_bag
+ wa_data-kzwi1_pkt_tea
+ wa_data-kzwi1_bulk_tea.
MODIFY it_data FROM wa_data TRANSPORTING landx
bezei3
bezei4
ntgew_tot
kzwi1_tot.
* Summattion of grand totals
w_tot_ntgew_tea_bag = w_tot_ntgew_tea_bag + wa_data-ntgew_tea_bag.
w_tot_ntgew_pkt_tea = w_tot_ntgew_pkt_tea + wa_data-ntgew_pkt_tea.
w_tot_ntgew_bulk_tea = w_tot_ntgew_bulk_tea + wa_data-ntgew_bulk_tea.
w_tot_ntgew_tot = w_tot_ntgew_tot + wa_data-ntgew_tot.
w_tot_kzwi1_tea_bag = w_tot_kzwi1_tea_bag + wa_data-kzwi1_tea_bag.
w_tot_kzwi1_pkt_tea = w_tot_kzwi1_pkt_tea + wa_data-kzwi1_pkt_tea.
w_tot_kzwi1_bulk_tea = w_tot_kzwi1_bulk_tea + wa_data-kzwi1_bulk_tea.
w_tot_kzwi1_tot = w_tot_kzwi1_tot + wa_data-kzwi1_tot.
ENDLOOP.
* Append a grand Total row at the end
CLEAR wa_data.
wa_data-landx = 'Grand Total:'.
wa_data-ntgew_tea_bag = w_tot_ntgew_tea_bag.
wa_data-ntgew_pkt_tea = w_tot_ntgew_pkt_tea.
wa_data-ntgew_bulk_tea = w_tot_ntgew_bulk_tea.
wa_data-ntgew_tot = w_tot_ntgew_tot.
wa_data-kzwi1_tea_bag = w_tot_kzwi1_tea_bag.
wa_data-kzwi1_pkt_tea = w_tot_kzwi1_pkt_tea.
wa_data-kzwi1_bulk_tea = w_tot_kzwi1_bulk_tea.
wa_data-kzwi1_tot = w_tot_kzwi1_tot.
wa_data-line_color = 'C310'.
APPEND wa_data TO it_data.
ENDFORM. " populate_description
*& Module STATUS_9000 OUTPUT
* Initialise PF-STATUS and title
MODULE status_9000 OUTPUT.
SET PF-STATUS 'MAIN9000'.
SET TITLEBAR 'TITLE_9000'.
ENDMODULE. " STATUS_9000 OUTPUT
*& Module initialize_9000 OUTPUT
* text
MODULE initialize_9000 OUTPUT.
* Call the ALV grid to display data
PERFORM display_alv_grid.
ENDMODULE. " initialize_9000 OUTPUT
*& Module USER_COMMAND_9000 INPUT
* Module to handle User Command
MODULE user_command_9000 INPUT.
CASE okcode.
WHEN 'BACK'.
SET SCREEN 0.
CLEAR okcode.
LEAVE SCREEN.
WHEN 'CANCEL'.
SET SCREEN 0.
CLEAR okcode.
LEAVE SCREEN.
WHEN 'EXIT'.
CLEAR okcode.
LEAVE PROGRAM.
WHEN OTHERS.
ENDCASE.
ENDMODULE. " USER_COMMAND_9000 INPUT
*& Form display_alv_grid
* Display the data in ALV Grid
FORM display_alv_grid .
IF w_alv_container IS INITIAL.
* Create the alv container object
CREATE OBJECT w_alv_container
EXPORTING
container_name = 'ALV_GRID'
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
OTHERS = 6.
IF sy-subrc <> 0.
MESSAGE e999(zttl) WITH 'Problem in ALV display'(t04).
ENDIF.
* Create the ALV grid object. The parent is the ALV container
CREATE OBJECT w_alv_grid
EXPORTING
i_parent = w_alv_container
EXCEPTIONS
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE e999(zttl) WITH 'Problem in ALV display'(t04).
ENDIF.
* This subrotine creates the field catalog and
* store in internal table lt_fieldcat
PERFORM prepare_fieldcat CHANGING wt_fieldcat.
* Layout design
w_layo-no_toolbar = ''.
* Not to allow totaling feature
w_layo-no_totline = c_x.
* Report title
* w_layo-grid_title = text-004.
w_layo-grid_title = w_title.
w_layo-zebra = c_x. "Alternating line color (striped)
w_layo-cwidth_opt = c_x. "Optimize column width
w_layo-sel_mode = 'A'. "Selection Mode
* Name of the color field
w_layo-info_fname = 'LINE_COLOR'."For row color
* Call the method to display the data in ALV grid
CALL METHOD w_alv_grid->set_table_for_first_display
EXPORTING
i_save = 'A'
is_layout = w_layo
CHANGING
it_outtab = it_data[]
it_fieldcatalog = wt_fieldcat
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE e999(zttl) WITH text-t04.
ENDIF.
ELSE.
* If the container & grid object is alreadt there reuse them
CALL METHOD w_alv_grid->refresh_table_display
EXCEPTIONS
finished = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE e999(zttl) WITH text-t04.
ENDIF.
ENDIF.
IF okcode = 'CANCEL'.
EXIT.
ENDIF.
ENDFORM. " display_alv_grid
*& Form prepare_fieldcat
-
ALV editable with traffic lights
Hello all,
I need some help about ALV editable; my reports display an ALV grid editable, and update all the new values on the DB table, but I have traffic lights as values on the DB table.
More informations:
So this is my internal table
<i>DATA: BEGIN OF it_table OCCURS 0,
document TYPE admi-document,
status TYPE admi-status, (traffic</i> lights from the table able to modify)
archiv_key TYPE admi_files-archiv_key,
status_opt TYPE admi_files-status_opt, (traffic lights from the table able to modify )
status_fil TYPE admi_files-status_fil, (traffic lights from the table able to modify )
END OF it_report.
</i>
I got all the match code form the table (DB) , so on my report I could modify all the traffic lights but when I save the modifications, I got a message error.
And the second problem was, I couldnt come back to the value initial and I getting the same message.
Can anybody help me please?
Thanks you.see the program and i am using traffic lights in my program --
REPORT ZWM_BIN_STOCK_REQ no standard page heading
message-id zwave.
D A T A D E C L A R A T I O N ****************************
Tables
tables : zpwvbap,
mara,
marc,
makt,
vbap,
zshift,
marm,
lqua.
TYPE-POOLS: SLIS.
Internal Table for Sales order
data : begin of i_vbap occurs 0,
matnr like zpwvbap-matnr," Material #
ZZCUTOFF like zpwvbak-ZZCUTOFF," Cutoff Time
vlpla like zpwvbap-vlpla,
kwmeng like zpwvbap-kwmeng," Quantity
vrkme like zpwvbap-vrkme, " Sales Unit
meins like zpwvbap-meins, " Unit of measure
end of i_vbap.
Internal Table for final Processing
data : begin of i_final occurs 0,
date(8) type c,
matnr like zpwvbap-matnr," Material #
zzshift like zshift-zzshift, " Wave Drop
maktx like makt-maktx," Desc
lgpla like lagp-lgpla, " Pick Bin
pverme like lqua-verme," Stock at Pick Bin
prverme like lqua-verme," Stock at Prod Bin
kwmeng like zpwvbap-kwmeng," Requiremnet from Wave Drop
vrkme like zpwvbap-vrkme, " Sales Unit
meins like zpwvbap-meins," Unit of measure
end of i_final.
Internal Table for Output
data : begin of i_output occurs 0,
field type c, " Traffic Lights
zzshift like zshift-zzshift, " Wave Drop
matnr like zpwvbap-matnr," Material #
maktx like makt-maktx," Desc
lgpla like lagp-lgpla, " Pick Bin
pverme like lqua-verme," Stock at Pick Bin
prverme like lqua-verme," Stock at Prod Bin
kwmeng like zpwvbap-kwmeng," Requiremnet from Wave Drop
vrkme like zpwvbap-vrkme," Sales Unit
meins like zpwvbap-meins," Unit of measure
diff like zpwvbap-kwmeng, " Diffrence
end of i_output.
Work Area for Final Internal Table
data wa_final like i_final.
data : w_zzcutoff(12) TYPE c,
v_date type sy-datum,
v_time(4) type c,
v_fldate(12) type c,
v_fhdate(12) type c,
v_pverme like lqua-verme,
v_prverme like lqua-verme,
v_diff like zpwvbap-kwmeng.
Variables for new check box
data : v_nverme like lqua-verme.
Internal Table for Pick Bin
data : begin of i_verme occurs 0,
verme like lqua-verme,
end of i_verme.
Internal table for Prod Bin
data : begin of i_pverme occurs 0,
verme like lqua-verme,
end of i_pverme.
Variables for ALV
DATA: FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
FIELDCAT_LN LIKE LINE OF FIELDCAT,
SORTCAT TYPE SLIS_T_SORTINFO_ALV,
SORTCAT_LN LIKE LINE OF SORTCAT,
EVENTCAT TYPE SLIS_T_EVENT,
EVENTCAT_LN LIKE LINE OF EVENTCAT,
LAYOUT TYPE SLIS_LAYOUT_ALV,
C_TOP_OF_PAGE TYPE SLIS_FORMNAME VALUE 'TOP_OF_PAGE',
g_user_command TYPE slis_formname VALUE 'USER_COMMAND',
GT_LIST_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER.
DATA: COL_POS TYPE I,
P_LIGNAM TYPE SLIS_FIELDNAME VALUE 'FIELD'.
DATA : V_REPID LIKE SY-REPID,
flag type c.
S E L E C T I O N - S C R E E N *************************
selection-screen : begin of block blk with frame title text-001.
parameter : p_plant like marc-werks obligatory default '1000'.
select-options : s_date for sy-datum obligatory ,
s_shift for zshift-zzshift,
s_matnr for mara-matnr,
s_dept for zpwvbap-zzdept,
s_pdept for marc-ZZPRODDEPT.
selection-screen: end of block blk.
parameters : p_check as checkbox ."default 'X'.
ranges r_cutoff for w_zzcutoff.
I N I T I A L I Z A T I O N ****************************
initialization.
V_REPID = SY-REPID.
s_date-low = sy-datum + 1.
append s_date.
S T A R T - O F - S E L E C T I O N ***********************
start-of-selection.
Get the Shift Data.
PERFORM GET_SHIFT_DETAILS.
Get the data from ZPWVBAP Table
PERFORM GET_DATA_VBAP.
E N D - O F - S E L E C T I O N **********************
end-of-selection.
if not i_output[] is initial.
sort i_output by field zzshift matnr.
Reset the all Fiedcatlog.
PERFORM RESETVALUES.
Traffic Lights
PERFORM BUILD_LAYOUT.
Fill the fieldcatlog values
PERFORM FILL_FIELDCATLOG.
Call the List Function module
PERFORM CALL_lIST.
endif.
*& Form GET_SHIFT_DETAILS
Get the Cutoff Time.
FORM GET_SHIFT_DETAILS.
clear : v_fldate,
v_fhdate.
if not s_shift-low is initial.
clear: v_time,
v_date.
if s_shift-low = '1'.
v_time = '2000'.
elseif s_shift-low = '2'.
v_time = '2300'.
endif.
v_date = s_date-low - 1.
concatenate v_date v_time into v_fldate.
endif.
if not s_shift-high is initial.
clear : v_date,
v_time.
if s_shift-high = '1'.
v_time = '2000'.
elseif s_shift-high = '2'.
v_time = '2300'.
endif.
if not s_date-high is initial.
v_date = s_date-high - 1.
else.
v_date = s_date-low - 1.
endif.
concatenate v_date v_time into v_fhdate.
endif.
if not v_fhdate is initial.
r_cutoff-low = v_fldate.
r_cutoff-high = v_fhdate.
r_cutoff-sign = 'I'.
r_cutoff-option = 'BT'.
append r_cutoff.
endif.
ENDFORM. " GET_SHIFT_DETAILS
*& Form GET_DATA_VBAP
Get the data from ZPWVBAP Table
FORM GET_DATA_VBAP.
Get the data from ZPWVBAP and ZPWVBAK Table
if not v_fhdate is initial.
select matnr ZZCUTOFF vlpla sum( kwmeng ) vrkme meins
into table i_vbap
from zpwvbap as a inner join zpwvbak as b on
a~vbeln = b~vbeln
where a~werks = p_plant
and a~matnr in s_matnr
and b~vdatu in s_date
and a~zzdept in s_dept
and b~zzcutoff in r_cutoff
group by matnr zzcutoff vlpla vrkme meins.
elseif not v_fldate is initial.
select matnr ZZCUTOFF vlpla sum( kwmeng ) vrkme meins
into table i_vbap
from zpwvbap as a inner join zpwvbak as b on
a~vbeln = b~vbeln
where a~werks = p_plant
and a~matnr in s_matnr
and b~vdatu in s_date
and a~zzdept in s_dept
and b~zzcutoff = v_fldate
group by matnr zzcutoff vlpla vrkme meins.
else.
select matnr ZZCUTOFF vlpla sum( kwmeng ) vrkme meins
into table i_vbap
from zpwvbap as a inner join zpwvbak as b on
a~vbeln = b~vbeln
where a~werks = p_plant
and a~matnr in s_matnr
and b~vdatu in s_date
and a~zzdept in s_dept
and b~zzcutoff in r_cutoff
group by matnr zzcutoff vlpla vrkme meins .
endif.
if sy-subrc ne 0.
message i000(zwave) with 'No data found for given selection'.
stop.
endif.
sort i_vbap by zzcutoff matnr.
loop at i_vbap.
clear : v_pverme,
v_prverme.
Compare the data with pick method
select single zzpick from marc into marc-zzpick
where matnr = i_vbap-matnr
and werks = p_plant
and zzpick = '01'.
if sy-subrc ne 0.
continue.
endif.
Compare the data from MARC Table with Production Department
select single zzPRODdept from marc into marc-zzPRODdept
where matnr = i_vbap-matnr
and werks = p_plant
and zzPRODdept in s_pdept.
if sy-subrc ne 0.
continue.
endif.
Get the Material Description from MAKT Table
Select single maktx from makt into makt-maktx
where matnr = i_vbap-matnr
and spras = 'E'.
if sy-subrc eq 0.
i_final-maktx = makt-maktx.
endif.
Get the Pick Bin
i_final-lgpla = i_vbap-vlpla.
refresh i_verme.
clear i_verme.
Get the stock at Pick bin
select verme from lqua into table i_verme
where lgpla = i_vbap-vlpla
and matnr = i_vbap-matnr
and LGNUM = '100'.
if sy-subrc eq 0.
loop at i_verme.
v_pverme = v_pverme + i_verme-verme.
endloop.
if sy-subrc eq 0.
i_final-pverme = v_pverme.
endif.
endif.
refresh i_pverme.
clear i_pverme.
Get the stock at Production bin
select verme from lqua into table i_pverme
where matnr = i_vbap-matnr
and LGNUM = '100'
and ( lgpla = '9595959595' or
lgpla = '2222222222' or
lgpla = '5555555555' or
lgpla = '3232323232' or
lgpla = '8080808080' or
lgpla = '4040404040' or
lgpla = '9090909090' ).
if sy-subrc eq 0.
loop at i_pverme.
v_prverme = v_prverme + i_pverme-verme.
endloop.
if sy-subrc eq 0.
i_final-prverme = v_prverme.
endif.
endif.
Compare the unit of measure and sales unit
if i_vbap-vrkme ne i_vbap-meins.
Get the data from MARM Table ( Unit of measure )
select single * from marm into marm
where matnr = i_vbap-matnr
and meinh = i_vbap-vrkme.
if sy-subrc eq 0.
i_final-pverme = ( i_final-pverme * marm-umren ) / marm-umrez.
endif.
endif.
Material #
i_final-matnr = i_vbap-matnr.
Quantity from ZPWVBAP
i_final-kwmeng = i_vbap-kwmeng.
Unit of Measure
i_final-meins = i_vbap-meins.
Sales Unit
i_final-vrkme = i_vbap-vrkme.
Wave Drop
if i_vbap-ZZCUTOFF+8(4) = '2000' .
i_final-zzshift = '1'.
endif.
if i_vbap-zzcutoff+8(4) = '2300'.
i_final-zzshift = '2'.
endif.
i_final-date = i_vbap-zzcutoff+0(8).
append i_final.
clear : i_final,
i_vbap.
**Difference
i_output-diff = i_output-pverme - i_vbap-kwmeng.
Traffic Lights Depends on value
if i_output-pverme > i_output-kwmeng.
i_output-field = '3'.
elseif i_output-pverme < i_output-kwmeng.
i_output-field = '1'.
elseif i_output-pverme = i_output-kwmeng.
i_output-field = '2'.
endif.
append i_output.
clear : i_output,
i_vbap.
endloop.
refresh i_vbap.
sort i_final by date matnr zzshift.
Processing the internal table to get same material with pick quantity
deduction even it for 2nd shift
loop at i_final.
Move the data into work area in order remove #
move i_final to wa_final.
clear : flag.
at new matnr.
move : wa_final-matnr to i_output-matnr," Material #
wa_final-maktx to i_output-maktx," Desc
wa_final-lgpla to i_output-lgpla," Pick Bin
wa_final-kwmeng to i_output-kwmeng," Order qty
wa_final-zzshift to i_output-zzshift," Shift
wa_final-pverme to i_output-pverme, " Pick bin qty
wa_final-vrkme to i_output-vrkme," Sales Unit
wa_final-prverme to i_output-prverme. " Prod Bin Qty
break sreddy.
Difference
i_output-diff = i_output-pverme - i_output-kwmeng.
New logic for Only HMR Department
if p_check = 'X'.
if i_output-pverme < i_output-kwmeng.
v_nverme = i_output-pverme + i_output-prverme.
if v_nverme > i_output-kwmeng.
if i_output-pverme < i_output-kwmeng.
i_output-field = '2'.
else.
Traffic Lights Depends on value
i_output-field = '3'.
endif.
elseif v_nverme < i_output-kwmeng.
i_output-field = '1'.
elseif v_nverme = i_output-kwmeng.
i_output-field = '2'.
endif.
elseif i_output-pverme > i_output-kwmeng.
i_output-field = '3'.
elseif i_output-pverme = i_output-kwmeng.
i_output-field = '3'.
endif.
else.
Traffic Lights Depends on value
if i_output-pverme > i_output-kwmeng.
i_output-field = '3'.
elseif i_output-pverme < i_output-kwmeng.
i_output-field = '1'.
elseif i_output-pverme = i_output-kwmeng.
i_output-field = '2'.
endif.
endif.
move i_output-diff to v_diff.
flag = 'X'.
endat.
if flag ne 'X'.
move : wa_final-matnr to i_output-matnr," Material #
wa_final-maktx to i_output-maktx," Desc
wa_final-lgpla to i_output-lgpla," Pick Bin
wa_final-kwmeng to i_output-kwmeng," Order qty
wa_final-zzshift to i_output-zzshift," Shift
wa_final-vrkme to i_output-vrkme," Sales Unit
wa_final-prverme to i_output-prverme. " Prod Bin Qty
Move Diffrence value
move v_diff to i_output-pverme.
clear: v_diff.
New logic for Only HMR Department
New logic for Only HMR Department
if p_check = 'X'.
if i_output-pverme < i_output-kwmeng.
v_nverme = i_output-pverme + i_output-prverme.
if v_nverme > i_output-kwmeng.
if i_output-pverme < i_output-kwmeng.
i_output-field = '2'.
else.
Traffic Lights Depends on value
i_output-field = '3'.
endif.
Traffic Lights Depends on value
i_output-field = '3'.
elseif v_nverme < i_output-kwmeng.
i_output-field = '1'.
elseif v_nverme = i_output-kwmeng.
i_output-field = '2'.
endif.
elseif i_output-pverme > i_output-kwmeng.
i_output-field = '3'.
elseif i_output-pverme = i_output-kwmeng.
i_output-field = '3'.
endif.
i_output-diff = i_output-pverme - i_output-kwmeng.
else.
Difference
i_output-diff = i_output-pverme - i_output-kwmeng.
Traffic Lights Depends on value
if i_output-pverme > i_output-kwmeng.
i_output-field = '3'.
elseif i_output-pverme < i_output-kwmeng.
i_output-field = '1'.
elseif i_output-pverme = i_output-kwmeng.
i_output-field = '2'.
endif.
endif.
endif.
append i_output.
clear : i_output,
wa_final,
i_final,
v_nverme.
endloop.
sort i_output by field zzshift matnr.
ENDFORM. " GET_DATA_VBAP
*& Form RESETVALUES
Reset the all fieldcatlogs
FORM RESETVALUES.
FIELDCAT_LN-KEY = SPACE.
FIELDCAT_LN-DO_SUM = SPACE.
FIELDCAT_LN-NO_OUT = SPACE.
FIELDCAT_LN-QFIELDNAME = SPACE.
FIELDCAT_LN-HOTSPOT = SPACE.
FIELDCAT_LN-OUTPUTLEN = '0'.
CLEAR: fieldcat_ln-seltext_l, fieldcat_ln-seltext_m,
fieldcat_ln-seltext_s, fieldcat_ln-reptext_ddic.
ENDFORM. " RESETVALUES
*& Form FILL_FIELDCATLOG
Fill the Fieldcatlog values
FORM FILL_FIELDCATLOG.
DATA: ls_fieldcat TYPE slis_fieldcat_alv.
Trafiic Light
CLEAR LS_FIELDCAT.
LS_FIELDCAT-FIELDNAME = 'FIELD'.
LS_FIELDCAT-TABNAME = 'I_OUTPUT'.
LS_FIELDCAT-OUTPUTLEN = 7.
LS_FIELDCAT-col_pos = '1'.
ls_fieldcat-seltext_L = 'Lights'.
ls_fieldcat-seltext_s = 'Lights'.
ls_fieldcat-seltext_m = 'Lights'.
APPEND LS_FIELDCAT TO FIELDCAT.
Wave Drop
CLEAR LS_FIELDCAT.
LS_FIELDCAT-FIELDNAME = 'ZZSHIFT'.
LS_FIELDCAT-TABNAME = 'I_OUTPUT'.
LS_FIELDCAT-OUTPUTLEN = 9.
LS_FIELDCAT-col_pos = '2'.
ls_fieldcat-seltext_L = 'Wave Drop'.
APPEND LS_FIELDCAT TO FIELDCAT.
Material
CLEAR LS_FIELDCAT.
LS_FIELDCAT-FIELDNAME = 'MATNR'.
LS_FIELDCAT-TABNAME = 'I_OUTPUT'.
LS_FIELDCAT-OUTPUTLEN = 18.
LS_FIELDCAT-col_pos = '3'.
ls_fieldcat-seltext_L = 'Material'.
APPEND LS_FIELDCAT TO FIELDCAT.
Description
CLEAR LS_FIELDCAT.
LS_FIELDCAT-FIELDNAME = 'MAKTX'.
LS_FIELDCAT-TABNAME = 'I_OUTPUT'.
LS_FIELDCAT-OUTPUTLEN = 40.
LS_FIELDCAT-col_pos = '4'.
ls_fieldcat-seltext_L = 'Description'.
APPEND LS_FIELDCAT TO FIELDCAT.
Pick Bin
CLEAR LS_FIELDCAT.
LS_FIELDCAT-FIELDNAME = 'LGPLA'.
LS_FIELDCAT-TABNAME = 'I_OUTPUT'.
LS_FIELDCAT-OUTPUTLEN = 15.
LS_FIELDCAT-col_pos = '5'.
ls_fieldcat-seltext_L = 'Pick Bin'.
APPEND LS_FIELDCAT TO FIELDCAT.
Trafiic Light
CLEAR LS_FIELDCAT.
LS_FIELDCAT-FIELDNAME = 'PVERME'.
LS_FIELDCAT-TABNAME = 'I_OUTPUT'.
LS_FIELDCAT-OUTPUTLEN = 16.
LS_FIELDCAT-col_pos = '6'.
ls_fieldcat-seltext_L = 'Stock at Pick Bin'.
APPEND LS_FIELDCAT TO FIELDCAT.
Stock at Prod Bin
CLEAR LS_FIELDCAT.
LS_FIELDCAT-FIELDNAME = 'PRVERME'.
LS_FIELDCAT-TABNAME = 'I_OUTPUT'.
LS_FIELDCAT-OUTPUTLEN = 16.
LS_FIELDCAT-col_pos = '7'.
ls_fieldcat-seltext_L = 'Stock at Prod Bin'.
APPEND LS_FIELDCAT TO FIELDCAT.
Req from wave drop
CLEAR LS_FIELDCAT.
LS_FIELDCAT-FIELDNAME = 'KWMENG'.
LS_FIELDCAT-TABNAME = 'I_OUTPUT'.
LS_FIELDCAT-OUTPUTLEN = 23.
LS_FIELDCAT-col_pos = '8'.
ls_fieldcat-seltext_L = 'Requirement from Wave Drop'.
APPEND LS_FIELDCAT TO FIELDCAT.
Sales Unit
CLEAR LS_FIELDCAT.
LS_FIELDCAT-FIELDNAME = 'VRKME'.
LS_FIELDCAT-TABNAME = 'I_OUTPUT'.
LS_FIELDCAT-OUTPUTLEN = 12.
LS_FIELDCAT-col_pos = '9'.
ls_fieldcat-seltext_L = 'Sales Unit'.
APPEND LS_FIELDCAT TO FIELDCAT.
Unit of Measure
CLEAR LS_FIELDCAT.
LS_FIELDCAT-FIELDNAME = 'MEINS'.
LS_FIELDCAT-TABNAME = 'I_OUTPUT'.
LS_FIELDCAT-OUTPUTLEN = 9.
LS_FIELDCAT-col_pos = '10'.
ls_fieldcat-seltext_L = 'UNIT'.
ls_fieldcat-no_out = 'X'.
APPEND LS_FIELDCAT TO FIELDCAT.
Diffference
CLEAR LS_FIELDCAT.
LS_FIELDCAT-FIELDNAME = 'DIFF'.
LS_FIELDCAT-TABNAME = 'I_OUTPUT'.
LS_FIELDCAT-OUTPUTLEN = 12.
LS_FIELDCAT-col_pos = '11'.
ls_fieldcat-seltext_L = 'Difference'.
APPEND LS_FIELDCAT TO FIELDCAT.
ENDFORM. " FILL_FIELDCATLOG
*& Form CALL_lIST
Use ALV Function module to display output
FORM CALL_lIST.
Top - of - Page
PERFORM COMMENT_BUILD USING GT_LIST_TOP_OF_PAGE[].
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = V_REPID
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = g_user_command
I_CALLBACK_TOP_OF_PAGE = C_TOP_OF_PAGE
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE =
I_GRID_SETTINGS =
IS_LAYOUT = LAYOUT
IT_FIELDCAT = FIELDCAT
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS =
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IT_ALV_GRAPHICS =
IT_ADD_FIELDCAT =
IT_HYPERLINK =
I_HTML_HEIGHT_TOP =
I_HTML_HEIGHT_END =
IT_EXCEPT_QINFO =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = I_OUTPUT
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.
ENDFORM. " CALL_lIST
*& Form BUILD_LAYOUT
text
FORM BUILD_LAYOUT.
LAYOUT-GET_SELINFOS = 'X'.
Now we want a traffic light to say if the Truck is deleted
the variable p_lignam contains the name in IREPO which stores the
value for the traffic light
LAYOUT-LIGHTS_FIELDNAME = P_LIGNAM.
layout-HEADER_TEXT = 'Lights'.
LAYOUT-LIGHTS_CONDENSE = 'X'.
ENDFORM. " BUILD_LAYOUT
*& Form COMMENT_BUILD
text
-->P_GT_LIST_TOP_OF_PAGE[] text
FORM COMMENT_BUILD USING LT_TOP_OF_PAGE TYPE
SLIS_T_LISTHEADER.
data : v_day(2) type c,
v_mon(2) type c,
v_year(4) type c,
v_ldate(10) type c,
v_hdate(10) type c.
DATA: LS_LINE TYPE SLIS_LISTHEADER.
data: d_date like sy-datum.
clear : v_ldate,
v_hdate.
Header Information.
LIST HEADING LINE: TYPE H
CLEAR LS_LINE.
LS_LINE-TYP = 'H'.
LS_LINE-KEY: NOT USED FOR THIS TYPE
LS_LINE-INFO = 'Bin Replenishment report for HMR'.
APPEND LS_LINE TO LT_TOP_OF_PAGE.
STATUS LINE: TYPE S
CLEAR LS_LINE.
LS_LINE-TYP = 'S'.
LS_LINE-KEY = TEXT-003.
LS_LINE-INFO = TEXT-003.
APPEND LS_LINE TO LT_TOP_OF_PAGE.
STATUS LINE: TYPE S
CLEAR LS_LINE.
LS_LINE-TYP = 'S'.
LS_LINE-KEY = TEXT-003.
LS_LINE-INFO = TEXT-003.
APPEND LS_LINE TO LT_TOP_OF_PAGE.
Get the data ( s_date_low) into proper format.
v_year = s_date-low+0(4).
v_mon = s_date-low+4(2).
v_day = s_date-low+6(2).
concatenate v_mon '/' v_day '/' v_year into v_ldate.
clear : v_mon,
v_year,
v_day.
Get the data ( s_date_high) into proper format.
v_year = s_date-high+0(4).
v_mon = s_date-high+4(2).
v_day = s_date-high+6(2).
concatenate v_mon '/' v_day '/' v_year into v_hdate.
clear : v_mon,
v_year,
v_day.
Delivery date
if not s_date-low is initial .
if not s_date-high is initial.
CLEAR LS_LINE.
LS_LINE-TYP = 'S'.
LS_LINE-KEY = 'Delivery date From:'.
LS_LINE-INFO = v_ldate.
APPEND LS_LINE TO LT_TOP_OF_PAGE.
CLEAR LS_LINE.
LS_LINE-TYP = 'S'.
LS_LINE-KEY = 'Delivery date To :'.
LS_LINE-INFO = v_hdate.
APPEND LS_LINE TO LT_TOP_OF_PAGE.
endif.
endif.
if not s_date-low is initial.
if s_date-high is initial.
CLEAR LS_LINE.
LS_LINE-TYP = 'S'.
LS_LINE-KEY = 'Delivery date :'.
LS_LINE-INFO = v_ldate.
APPEND LS_LINE TO LT_TOP_OF_PAGE.
endif.
endif.
Wave Drop
if not S_SHIFT-LOW is initial.
if not S_SHIFT-high is initial.
CLEAR LS_LINE.
LS_LINE-TYP = 'S'.
LS_LINE-KEY = 'Wave Drop From :'.
LS_LINE-INFO = s_shift-low.
APPEND LS_LINE TO LT_TOP_OF_PAGE.
CLEAR LS_LINE.
LS_LINE-TYP = 'S'.
LS_LINE-KEY = 'Wave Drop to :'.
LS_LINE-INFO = s_shift-high.
APPEND LS_LINE TO LT_TOP_OF_PAGE.
endif.
endif.
if not S_SHIFT-LOW is initial.
if S_SHIFT-high is initial.
CLEAR LS_LINE.
LS_LINE-TYP = 'S'.
LS_LINE-KEY = 'Wave Drop :'.
LS_LINE-INFO = s_shift-low.
APPEND LS_LINE TO LT_TOP_OF_PAGE.
CLEAR LS_LINE.
LS_LINE-TYP = 'S'.
LS_LINE-KEY = 'Wave Drop to :'.
LS_LINE-INFO = s_shift-high.
APPEND LS_LINE TO LT_TOP_OF_PAGE.
endif.
endif.
Department
if not s_dept-low is initial .
if not s_dept-high is initial.
CLEAR LS_LINE.
LS_LINE-TYP = 'S'.
LS_LINE-KEY = 'Department From :'.
LS_LINE-INFO = s_dept-low.
APPEND LS_LINE TO LT_TOP_OF_PAGE.
CLEAR LS_LINE.
LS_LINE-TYP = 'S'.
LS_LINE-KEY = 'Department to :'.
LS_LINE-INFO = s_dept-high.
APPEND LS_LINE TO LT_TOP_OF_PAGE.
endif.
endif.
if not s_dept-low is initial .
if s_dept-high is initial.
CLEAR LS_LINE.
LS_LINE-TYP = 'S'.
LS_LINE-KEY = 'Department :'.
LS_LINE-INFO = s_dept-low.
APPEND LS_LINE TO LT_TOP_OF_PAGE.
endif.
endif.
Production Department
if not S_PDEPT-LOW is initial.
if not S_PDEPT-high is initial.
CLEAR LS_LINE.
LS_LINE-TYP = 'S'.
LS_LINE-KEY = 'Production Department From :'.
LS_LINE-INFO = S_PDEPT-LOW.
APPEND LS_LINE TO LT_TOP_OF_PAGE.
CLEAR LS_LINE.
LS_LINE-TYP = 'S'.
LS_LINE-KEY = 'Production Department to :'.
LS_LINE-INFO = S_PDEPT-high.
APPEND LS_LINE TO LT_TOP_OF_PAGE.
endif.
endif.
if not S_PDEPT-LOW is initial.
if S_PDEPT-high is initial.
CLEAR LS_LINE.
LS_LINE-TYP = 'S'.
LS_LINE-KEY = 'Production Department :'.
LS_LINE-INFO = S_PDEPT-LOW.
APPEND LS_LINE TO LT_TOP_OF_PAGE.
endif.
endif.
ENDFORM. " COMMENT_BUILD
FORM TOP_OF_PAGE *
FORM TOP_OF_PAGE.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = GT_LIST_TOP_OF_PAGE
I_LOGO =
I_END_OF_LIST_GRID =
ENDFORM.
FORM USER_COMMAND *
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield. "#EC CALLED
CASE R_UCOMM.
WHEN '&IC1'.
read table i_output index rs_selfield-tabindex.
SET PARAMETER ID 'MAT' FIELD i_output-matnr.
SET PARAMETER ID 'WRK' FIELD p_plant.
if not i_output-matnr is initial.
call transaction 'MD04' and skip first screen.
endif.
ENDCASE.
ENDFORM. -
How to get ALV Output with selected Layout
I have a program which displays the output in ALV list format and i changed the layout and saved
In the selection-screen i have a field to select the layout after selecting the layout it output is not coming with that layout
can anyone tell me what is the problem
or give me a sample code
Thank youHi,
Check this code.
Hope it helps.
*& Report zSALES_ORDER
report z_sales_order.
type-pools: slis.
*DATA DECLARATION.
types: begin of i_vbak,
vbeln type vbeln_va,
augru type augru,
erdat type erdat,
end of i_vbak.
types: begin of i_vbap,
vbeln type vbeln_va,
augru type augru,
posnr type posnr_va,
matnr type matnr,
zmeng type dzmeng,
end of i_vbap.
types: begin of i_makt,
matnr type matnr,
maktx type maktx,
end of i_makt.
types: begin of i_lips,
posnr type posnr_vl,
matnr type matnr,
lfimg type lfimg,
end of i_lips.
types: begin of i_reason,
spras type spras,
augru type augru,
bezei type bezei40,
end of i_reason.
types: begin of i_vbpa,
vbeln type vbeln,
parvw type parvw,
kunnr type kunnr,
end of i_vbpa.
types: begin of i_kna1,
kunnr type kunnr,
name1 type name1_gp,
end of i_kna1.
types: begin of i_final,
vbeln type vbeln_va,
posnr type posnr_va,
matnr type matnr,
zmeng type dzmeng,
maktx type maktx,
lfimg type lfimg,
spras type spras,
augru type augru,
bezei type bezei40,
parvw type parvw,
kunnr type kunnr,
name1 type name1_gp,
end of i_final.
*INTERNAL TABLES
data: it_vbak type standard table of i_vbak.
data: it_vbap type standard table of i_vbap.
data: it_makt type standard table of i_makt.
data: it_lips type standard table of i_lips.
data: it_vbpa type standard table of i_vbpa.
data: it_kna1 type standard table of i_kna1.
data: it_final type standard table of i_final.
data: it_reason type standard table of i_reason.
data : v_flag.
*WORK AREA
data: wa_vbak type i_vbak.
data: wa_vbap type i_vbap.
data: wa_makt type i_makt.
data: wa_lips type i_lips.
data: wa_vbpa type i_vbpa.
data: wa_kna1 type i_kna1.
data: wa_final type i_final.
data: wa_reason type i_reason.
*DATA DECLARATION.
data: v_progname type sy-repid.
data: v_vbeln type vbak-vbeln.
data: v_gridtitle type lvc_title.
*PARAMETERS: D_VARI LIKE DISVARIANT-VARIANT.
data: i_variant like disvariant.
data: p_vari like disvariant-variant.
*DATA DECLARATION FOR CATALOGS LAYOUT SORT EVENTCATALOG TOPOFPAGE.
data: i_fieldcat type slis_t_fieldcat_alv.
data: i_layout type slis_layout_alv.
data: i_sortinfo type slis_t_sortinfo_alv.
data: i_listheader type slis_t_listheader.
data: i_eventcat type slis_t_event.
*INITIALIZATION - First point of execution of program
To initialize Any variables that are to be
used in the program, even before selection screen
appears.
initialization.
v_progname = sy-repid.
v_flag = space.
perform z_default_variant.
*SELECTION SCREEN
selection-screen begin of block blk1 with frame title text-002.
select-options: s_vbeln for v_vbeln.
selection-screen end of block blk1.
*Variable for ALV Variant
selection-screen begin of block b_var with frame title text-020.
parameters: d_vari like disvariant-variant.
selection-screen end of block b_var.
*AT SLECTION-SCREEN.
at selection-screen.
perform z_validations.
*AT SELECTION SCREEN.
at selection-screen on d_vari.
CHECK FOR THE EXISTENCE OF THE VARIANT SELECTED
perform zf_check_var_exist.
at selection-screen on value-request for d_vari.
PROVIDE THE F4-HELP.
perform zf_variant_f4.
*START OF SELECTION.
start-of-selection.
perform z_select.
perform check_validation_flag.
perform z_fieldcat using i_fieldcat.
perform z_layout.
perform z_sortinfo using i_sortinfo.
perform z_eventcat using i_eventcat.
perform z_gridtitle.
perform z_listheader using i_listheader.
perform z_display.
*& Form Z_VALIDATIONS
text
--> p1 text
<-- p2 text
form z_validations .
select vbeln into v_vbeln
up to 1 rows
from vbak
where vbeln in s_vbeln.
endselect.
if sy-subrc <> 0.
message i002(sy) with 'No Records'.
v_flag = 'X'.
endif.
endform. " Z_VALIDATIONS
*& Form Z_FIELDCAT
text
-->P_I_FIELDCAT text
form z_fieldcat using p_i_fieldcat type slis_t_fieldcat_alv.
data: i_fieldcat type slis_fieldcat_alv.
*VBAK-VELN
i_fieldcat-col_pos = '1'. " POSITION OF THE COLUMN.
i_fieldcat-fieldname = 'VBELN'. " FIELD FOR WHICH CATALOG ID FILLED.
i_fieldcat-tabname = 'IT_FINAL'. " INTERNAL TABLE TO WHICH THE FIELD BELONGS TO.
i_fieldcat-key = 'X'. " SO THAT THIS FIELD IS NOT SCROLLABLE AND HIDDABLE.
i_fieldcat-just = 'C'. " FOR JUSTIFICATION.
i_fieldcat-lzero = 'X'. " OUTPUT WITH LEADING ZEROS.
i_fieldcat-seltext_l = 'SALES ORDER'. " LONG TEXT FOR HEADER.
i_fieldcat-outputlen = 15. " SET THE OUTPUT LENGTH.
i_fieldcat-ref_tabname = 'VBAK'. " FOR F1 & F4 HELP AS REFERNCED TO THE DDIC TABLE.
append i_fieldcat to p_i_fieldcat.
*VBAP-SPRAS
i_fieldcat-col_pos = '2'. " POSITION OF THE COLUMN.
i_fieldcat-fieldname = 'SPRAS'. " FIELD FOR WHICH CATALOG ID FILLED.
i_fieldcat-tabname = 'IT_FINAL'. " INTERNAL TABLE TO WHICH THE FIELD BELONGS TO.
i_fieldcat-lzero = 'X'. " OUTPUT WITH LEADING ZEROS.
i_fieldcat-seltext_l = 'LANGUAGE'. " LONG TEXT FOR HEADER.
i_fieldcat-outputlen = 5. " SET THE OUTPUT LENGTH.
i_fieldcat-ref_tabname = 'TVAUT'. " FOR F1 & F4 HELP AS REFERNCED TO TABLE.
append i_fieldcat to p_i_fieldcat.
*VBAP-AUGRU
i_fieldcat-col_pos = '3'. " POSITION OF THE COLUMN.
i_fieldcat-fieldname = 'AUGRU'. " FIELD FOR WHICH CATALOG ID FILLED.
i_fieldcat-tabname = 'IT_FINAL'. " INTERNAL TABLE TO WHICH THE FIELD BELONGS TO.
i_fieldcat-lzero = 'X'. " OUTPUT WITH LEADING ZEROS.
i_fieldcat-seltext_l = 'REASON'. " LONG TEXT FOR HEADER.
i_fieldcat-outputlen = 5. " SET THE OUTPUT LENGTH.
i_fieldcat-ref_tabname = 'VBAK'. " FOR F1 & F4 HELP AS REFERNCED TO TABLE.
append i_fieldcat to p_i_fieldcat.
*VBAP-bezei
i_fieldcat-col_pos = '4'. " POSITION OF THE COLUMN.
i_fieldcat-fieldname = 'BEZEI'. " FIELD FOR WHICH CATALOG ID FILLED.
i_fieldcat-tabname = 'IT_FINAL'. " INTERNAL TABLE TO WHICH THE FIELD BELONGS TO.
i_fieldcat-lzero = 'X'. " OUTPUT WITH LEADING ZEROS.
i_fieldcat-seltext_l = 'DESCRIPTION'. " LONG TEXT FOR HEADER.
i_fieldcat-outputlen = 20. " SET THE OUTPUT LENGTH.
i_fieldcat-ref_tabname = 'TVAUT'. " FOR F1 & F4 HELP AS REFERNCED TO TABLE.
append i_fieldcat to p_i_fieldcat.
*VBAP-POSNR
i_fieldcat-col_pos = '5'. " POSITION OF THE COLUMN.
i_fieldcat-fieldname = 'POSNR'. " FIELD FOR WHICH CATALOG ID FILLED.
i_fieldcat-tabname = 'IT_FINAL'. " INTERNAL TABLE TO WHICH THE FIELD BELONGS TO.
i_fieldcat-lzero = 'X'. " OUTPUT WITH LEADING ZEROS.
i_fieldcat-seltext_l = 'ITEM'. " LONG TEXT FOR HEADER.
i_fieldcat-outputlen = 8. " SET THE OUTPUT LENGTH.
i_fieldcat-ref_tabname = 'VBAP'. " FOR F1 & F4 HELP AS REFERNCED TO TABLE.
append i_fieldcat to p_i_fieldcat.
*VBAP-MATNR.
i_fieldcat-col_pos = '6'. " POSITION OF THE COLUMN.
i_fieldcat-fieldname = 'MATNR'. " FIELD FOR WHICH CATALOG ID FILLED.
i_fieldcat-tabname = 'IT_FINAL'. " INTERNAL TABLE TO WHICH THE FIELD BELONGS TO.
i_fieldcat-lzero = 'X'. " OUTPUT WITH LEADING ZEROS.
i_fieldcat-seltext_l = 'MATERIAL'. " LONG TEXT FOR HEADER.
i_fieldcat-outputlen = 10. " SET THE OUTPUT LENGTH.
i_fieldcat-ref_tabname = 'VBAP'. " FOR F1 & F4 HELP AS REFERNCED TO TABLE.
append i_fieldcat to p_i_fieldcat.
*VBAP-ZMENG
i_fieldcat-col_pos = '7'. " POSITION OF THE COLUMN.
i_fieldcat-fieldname = 'ZMENG'. " FIELD FOR WHICH CATALOG ID FILLED.
i_fieldcat-tabname = 'IT_FINAL'. " INTERNAL TABLE TO WHICH THE FIELD BELONGS TO.
i_fieldcat-lzero = 'X'. " OUTPUT WITH LEADING ZEROS.
i_fieldcat-seltext_l = 'QUANT'. " LONG TEXT FOR HEADER.
i_fieldcat-outputlen = 10. " SET THE OUTPUT LENGTH.
i_fieldcat-ref_tabname = 'VBAP'. " FOR F1 & F4 HELP AS REFERNCED TO TABLE.
append i_fieldcat to p_i_fieldcat.
*MAKT-MAKTX
i_fieldcat-col_pos = '8'. " POSITION OF THE COLUMN.
i_fieldcat-fieldname = 'MAKTX'. " FIELD FOR WHICH CATALOG ID FILLED.
i_fieldcat-tabname = 'IT_FINAL'. " INTERNAL TABLE TO WHICH THE FIELD BELONGS TO.
i_fieldcat-lzero = 'X'. " OUTPUT WITH LEADING ZEROS.
i_fieldcat-seltext_l = 'DESCRIPTION'. " LONG TEXT FOR HEADER.
i_fieldcat-outputlen = 20. " SET THE OUTPUT LENGTH.
i_fieldcat-ref_tabname = 'MAKT'. " FOR F1 & F4 HELP AS REFERNCED TO TABLE.
append i_fieldcat to p_i_fieldcat.
*LIPS-VBELN
i_fieldcat-col_pos = '9'. " POSITION OF THE COLUMN.
i_fieldcat-fieldname = 'VBELN'. " FIELD FOR WHICH CATALOG ID FILLED.
i_fieldcat-tabname = 'IT_FINAL'. " INTERNAL TABLE TO WHICH THE FIELD BELONGS TO.
i_fieldcat-lzero = 'X'. " OUTPUT WITH LEADING ZEROS.
i_fieldcat-seltext_l = 'DELIVERY'. " LONG TEXT FOR HEADER.
i_fieldcat-outputlen = 15. " SET THE OUTPUT LENGTH.
i_fieldcat-ref_tabname = 'LIPS'. " FOR F1 & F4 HELP AS REFERNCED TO TABLE.
append i_fieldcat to p_i_fieldcat.
*LIPS-LFIMG
i_fieldcat-col_pos = '10'. " POSITION OF THE COLUMN.
i_fieldcat-fieldname = 'LFIMG'. " FIELD FOR WHICH CATALOG ID FILLED.
i_fieldcat-tabname = 'IT_FINAL'. " INTERNAL TABLE TO WHICH THE FIELD BELONGS TO.
i_fieldcat-lzero = 'X'. " OUTPUT WITH LEADING ZEROS.
i_fieldcat-do_sum = 'X'.
i_fieldcat-seltext_l = 'LFIMG'. " LONG TEXT FOR HEADER.
i_fieldcat-outputlen = 18. " SET THE OUTPUT LENGTH.
i_fieldcat-ref_tabname = 'LIPS'. " FOR F1 & F4 HELP AS REFERNCED TO TABLE.
append i_fieldcat to p_i_fieldcat.
*parvw
i_fieldcat-col_pos = '11'. " POSITION OF THE COLUMN.
i_fieldcat-fieldname = 'PARVW'. " FIELD FOR WHICH CATALOG ID FILLED.
i_fieldcat-tabname = 'IT_FINAL'. " INTERNAL TABLE TO WHICH THE FIELD BELONGS TO.
i_fieldcat-lzero = 'X'. " OUTPUT WITH LEADING ZEROS.
i_fieldcat-seltext_l = 'PARTNER FUN'. " LONG TEXT FOR HEADER.
i_fieldcat-outputlen = 18. " SET THE OUTPUT LENGTH.
i_fieldcat-ref_tabname = 'VBPA'. " FOR F1 & F4 HELP AS REFERNCED TO TABLE.
append i_fieldcat to p_i_fieldcat.
*KUNNR
i_fieldcat-col_pos = '12'. " POSITION OF THE COLUMN.
i_fieldcat-fieldname = 'KUNNR'. " FIELD FOR WHICH CATALOG ID FILLED.
i_fieldcat-tabname = 'IT_FINAL'. " INTERNAL TABLE TO WHICH THE FIELD BELONGS TO.
i_fieldcat-lzero = 'X'. " OUTPUT WITH LEADING ZEROS.
i_fieldcat-seltext_l = 'SHIP'. " LONG TEXT FOR HEADER.
i_fieldcat-outputlen = 18. " SET THE OUTPUT LENGTH.
i_fieldcat-ref_tabname = 'VBPA'. " FOR F1 & F4 HELP AS REFERNCED TO TABLE.
append i_fieldcat to p_i_fieldcat.
*NAME1
i_fieldcat-col_pos = '13'. " POSITION OF THE COLUMN.
i_fieldcat-fieldname = 'NAME1'. " FIELD FOR WHICH CATALOG ID FILLED.
i_fieldcat-tabname = 'IT_FINAL'. " INTERNAL TABLE TO WHICH THE FIELD BELONGS TO.
i_fieldcat-lzero = 'X'. " OUTPUT WITH LEADING ZEROS.
i_fieldcat-seltext_l = 'NAME'. " LONG TEXT FOR HEADER.
i_fieldcat-outputlen = 18. " SET THE OUTPUT LENGTH.
i_fieldcat-ref_tabname = 'KNA1'. " FOR F1 & F4 HELP AS REFERNCED TO TABLE.
append i_fieldcat to p_i_fieldcat.
endform. " Z_FIELDCAT
*& Form Z_SELECT
text
--> p1 text
<-- p2 text
form z_select .
select vbeln
augru erdat into corresponding fields of table it_vbak
from vbak
where vbeln in s_vbeln.
loop at it_vbak into wa_vbak.
wa_vbak-erdat = '99991231'.
modify it_vbak from wa_vbak transporting erdat.
endloop.
select * from vbak into corresponding fields of table it_vbak
for all entries in it_vbak
where erdat = it_vbak-erdat.
if sy-subrc = 0.
select vbeln
posnr
matnr
zmeng into corresponding fields of table it_vbap
from vbap
for all entries in it_vbak
where vbeln = it_vbak-vbeln.
if sy-subrc = 0.
select spras
augru
bezei into corresponding fields of table it_reason
from tvaut
for all entries in it_vbak
where augru = it_vbak-augru.
if sy-subrc = 0.
select vbeln
parvw
kunnr into corresponding fields of table it_vbpa
from vbpa
for all entries in it_vbak
where vbeln = it_vbak-vbeln.
if sy-subrc = 0.
select kunnr
name1 into corresponding fields of table it_kna1
from kna1
for all entries in it_vbpa
where kunnr = it_vbpa-kunnr.
if sy-subrc = 0.
select posnr
matnr
lfimg into corresponding fields of table it_lips
from lips
for all entries in it_vbap
where posnr = it_vbap-posnr.
if sy-subrc = 0.
select matnr
maktx into corresponding fields of table it_makt
from makt
for all entries in it_vbap
where matnr = it_vbap-matnr.
endif.
endif.
endif.
endif.
endif.
else.
message i002(sy) with 'No Data found'.
leave list-processing.
endif.
if sy-subrc = 0.
loop at it_vbap into wa_vbap.
read table it_vbak into wa_vbak with key vbeln = wa_vbap-vbeln binary search.
if sy-subrc = 0.
*MOVE DATA INTO IT_FINAL.
move: wa_vbak-vbeln to wa_final-vbeln,
wa_vbak-augru to wa_final-augru,
wa_vbap-posnr to wa_final-posnr,
wa_vbap-matnr to wa_final-matnr,
wa_vbap-zmeng to wa_final-zmeng.
endif.
read table it_lips into wa_lips with key posnr = wa_final-posnr binary search.
if sy-subrc = 0.
move: wa_lips-lfimg to wa_final-lfimg.
endif.
read table it_reason into wa_reason with key augru = wa_final-augru binary search.
if sy-subrc = 0.
move: wa_reason-spras to wa_final-spras,
wa_reason-bezei to wa_final-bezei.
endif.
read table it_makt into wa_makt with key matnr = wa_final-matnr binary search.
if sy-subrc = 0.
move: wa_makt-maktx to wa_final-maktx.
endif.
read table it_vbpa into wa_vbpa with key vbeln = wa_final-vbeln binary search.
if sy-subrc = 0.
move: wa_vbpa-parvw to wa_final-parvw,
wa_vbpa-kunnr to wa_final-kunnr.
endif.
read table it_kna1 into wa_kna1 with key kunnr = wa_final-kunnr binary search.
if sy-subrc = 0.
move: wa_kna1-name1 to wa_final-name1.
endif.
append wa_final to it_final.
clear wa_final.
endloop.
endif.
endform. " Z_SELECT
*& Form Z_LAYOUT
text
--> p1 text
<-- p2 text
form z_layout .
i_layout-zebra = 'X'.
i_layout-totals_text = 'Total'(a00).
i_layout-subtotals_text = 'SubTotal'(a01).
i_layout-box_tabname = 'IT_FINAL'.
endform. " Z_LAYOUT
*& Form Z_SORTINFO
text
-->P_I_SORTINFO text
form z_sortinfo using p_i_sortinfo type slis_t_sortinfo_alv.
data: i_sortinfo type slis_sortinfo_alv.
clear i_sortinfo.
i_sortinfo-spos = '1'.
i_sortinfo-fieldname = 'VBELN'.
i_sortinfo-tabname = 'IT_FINAL'.
i_sortinfo-up = 'X'.
i_sortinfo-group = 'UL'. " I.E UNDERLINE AFTER EVERY GROUP
i_sortinfo-subtot = 'X'.
append i_sortinfo to p_i_sortinfo.
endform. " Z_SORTINFO
*& Form Z_EVENTCAT
text
-->P_I_EVENTCAT text
form z_eventcat using p_i_eventcat type slis_t_event.
data: i_event type slis_alv_event.
call function 'REUSE_ALV_EVENTS_GET'
exporting
i_list_type = 0
importing
et_events = p_i_eventcat
exceptions
list_type_wrong = 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.
clear i_event.
read table p_i_eventcat with key name = slis_ev_top_of_page into
i_event.
if sy-subrc = 0.
move 'TOP_OF_PAGE' to i_event-form.
append i_event to p_i_eventcat.
endif.
read table p_i_eventcat with key name = slis_ev_pf_status_set into i_event.
if sy-subrc = 0.
move 'SET_PF_STATUS' to i_event-form.
append i_event to p_i_eventcat.
endif.
clear i_event.
read table p_i_eventcat into i_event with key name = slis_ev_user_command .
if sy-subrc = 0.
move 'USER_COMMAND' to i_event-form.
append i_event to p_i_eventcat.
endif.
endform. " Z_EVENTCAT
*& Form Z_DISPLAY
text
--> p1 text
<-- p2 text
form z_display .
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = v_progname
i_callback_pf_status_set = 'SET_PF_STATUS'
i_callback_user_command = 'USER_COMMAND'
i_callback_top_of_page = 'TOP_OF_PAGE'
i_grid_title = v_gridtitle
i_save = 'A'
is_layout = i_layout
it_fieldcat = i_fieldcat[]
it_sort = i_sortinfo
it_events = i_eventcat
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
tables
t_outtab = it_final
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.
endform. " Z_DISPLAY
*& Form Z_GRIDTITLE
text
--> p1 text
<-- p2 text
form z_gridtitle .
v_gridtitle = 'ALV FOR SALES ORDER DISPLAY'.
endform. " Z_GRIDTITLE
*TOP OF PAGE.
form top_of_page.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
it_list_commentary = i_listheader.
endform. "TOP_OF_PAGE
*MENU SETTINGS.
form set_pf_status using rt_extab type slis_t_extab.
set pf-status 'ALV_MENU'.
endform. "SET_PF_STATUS
*USER-COMMAND
form user_command using p_ucomm type sy-ucomm
rs_selfield type slis_selfield.
data : vbeln type vbeln_va.
case p_ucomm.
when 'BACK'.
leave program.
when '&IC1'.
clear : vbeln.
vbeln = rs_selfield-value.
set parameter id: 'AUN' field vbeln.
call transaction 'VA03' and skip first screen.
endcase.
endform. " USER_COMMAND
*& Form Z_LISTHEADER
text
-->P_I_LISTHEADER text
form z_listheader using p_i_listheader type slis_t_listheader.
data: l_listheader type slis_listheader.
refresh p_i_listheader.
clear l_listheader.
l_listheader-typ = 'H'.
l_listheader-info = text-001.
append l_listheader to p_i_listheader.
clear l_listheader.
l_listheader-typ = 'H'.
l_listheader-info = text-002.
append l_listheader to p_i_listheader.
endform. " Z_LISTHEADER
*& Form check_validation_flag
text
--> p1 text
<-- p2 text
form check_validation_flag .
if not v_flag is initial.
leave list-processing.
endif.
endform. " check_validation_flag
*& Form Z_DEFAULT_VARIANT
text
--> p1 text
<-- p2 text
form z_default_variant .
i_variant-report = v_progname.
call function 'REUSE_ALV_VARIANT_DEFAULT_GET'
exporting
i_save = 'A'
changing
cs_variant = i_variant
exceptions
wrong_input = 1
not_found = 2
program_error = 3
others = 4.
if sy-subrc = 0.
p_vari = i_variant-variant.
D_VARI = P_VARI.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
endform. " Z_DEFAULT_VARIANT
*& Form ZF_CHECK_VAR_EXIST
text
--> p1 text
<-- p2 text
form zf_check_var_exist .
data: l_variant like disvariant.
if not p_vari is initial.
clear l_variant.
l_variant-report = v_progname.
l_variant-variant = p_vari.
call function 'REUSE_ALV_VARIANT_EXISTENCE'
exporting
i_save = 'U'
changing
cs_variant = l_variant
exceptions
wrong_input = 1
not_found = 2
program_error = 3
others = 4.
if sy-subrc = 0.
clear i_variant.
move: l_variant-variant to i_variant-variant,
l_variant-report to i_variant-report.
else.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
endif.
endform. " ZF_CHECK_VAR_EXIST
*& Form ZF_VARIANT_F4
text
--> p1 text
<-- p2 text
form zf_variant_f4 .
data: x_variant like disvariant.
call function 'REUSE_ALV_VARIANT_F4'
exporting
is_variant = i_variant
I_TABNAME_HEADER =
I_TABNAME_ITEM =
IT_DEFAULT_FIELDCAT =
i_save = 'U'
i_display_via_grid = 'X'
importing
E_EXIT =
es_variant = x_variant
exceptions
not_found = 1
program_error = 2
others = 3
if sy-subrc = 0.
p_vari = x_variant-variant.
d_vari = p_vari.
clear i_variant.
move: x_variant-variant to i_variant-variant,
x_variant-report to i_variant-report.
else.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
endform. " ZF_VARIANT_F4
Regards,
Pritha. -
hi,
how can print 4 block of output in single screen , if its possable please send the code.....go through this program.
type-pools : slis.
*& structure declaration
types : begin of st_ekko,
ebeln type ekko-ebeln, "Purchasing Document Number
bstyp type ekko-bstyp, "Purchasing Document Category
bsart type ekko-bsart, "Purchasing Document Type
aedat type ekko-aedat, "record created on
ernam type ekko-ernam, "Person who Created the Object
end of st_ekko.
types : begin of st_ekpo,
ebeln type ekko-ebeln,
ebelp type ekpo-ebelp, "Item Number of Purchasing Document
ematn type ekpo-ematn, "Material number
matkl type ekpo-matkl, "Material group
netpr type ekpo-netpr, "Net price in purchasing document
end of st_ekpo.
*& internal table and work area declaration
data : it_ekpo type standard table of st_ekpo,
it_ekko type standard table of st_ekko,
it_fieldcat1 type slis_t_fieldcat_alv,
wa_fieldcat1 type slis_fieldcat_alv,
it_fieldcat2 type slis_t_fieldcat_alv,
wa_fieldcat2 type slis_fieldcat_alv,
it_events type slis_t_event,
wa_layout type slis_layout_alv.
*& data declaration
data : v_ebeln type ekko-ebeln.
*& selection-screen
selection-screen begin of block a with frame title text-000.
select-options : so_ebeln for v_ebeln.
selection-screen end of block a.
*& At-selection-screen
at selection-screen on so_ebeln.
perform validate_ebeln.
*& start-of-selection
start-of-selection.
perform data_retrieval.
*& end-of-selection
end-of-selection.
perform initialize_alv_block.
perform build_fieldcatalog1.
perform build_fieldcatalog2.
perform build_layout.
perform get_events .
perform append_ekkodata_to_alv_block.
perform append_ekpodata_to_alv_block.
perform display_blocked_alv.
*& FORM initialize_alv_block
form initialize_alv_block.
call function 'REUSE_ALV_BLOCK_LIST_INIT'
exporting
i_callback_program = sy-repid.
endform.
*& FORM validate_ebeln
form validate_ebeln.
select ebeln
from ekko
into table it_ekko
where ebeln in so_ebeln.
if sy-subrc ne 0.
message text-003 type 'W'.
endif.
endform.
*& FORM data_retrieval
form data_retrieval.
select ebeln bstyp bsart aedat ernam
from ekko
into table it_ekko
where ebeln in so_ebeln.
if sy-subrc ne 0.
message text-001 type 'I'.
endif.
select ebeln ebelp ematn matkl netpr
from ekpo
into table it_ekpo
where ebeln in so_ebeln.
if sy-subrc ne 0.
message text-002 type 'I'.
endif.
endform.
*& Form build_fieldcatalog1
form build_fieldcatalog1.
wa_fieldcat1-fieldname = 'EBELN'.
wa_fieldcat1-seltext_l = 'PURCHASE ORDER'.
wa_fieldcat1-col_pos = 0.
wa_fieldcat1-do_sum = 'X'.
append wa_fieldcat1 to it_fieldcat1.
wa_fieldcat1-fieldname = 'BSTYP'.
wa_fieldcat1-seltext_l = 'DOCUMENT CATEGORY'.
wa_fieldcat1-col_pos = 1.
append wa_fieldcat1 to it_fieldcat1.
wa_fieldcat1-fieldname = 'BSART'.
wa_fieldcat1-seltext_l = 'DOCUMENT TYPE'.
wa_fieldcat1-col_pos = 2.
append wa_fieldcat1 to it_fieldcat1.
wa_fieldcat1-fieldname = 'AEDAT'.
wa_fieldcat1-seltext_l = 'DATE'.
wa_fieldcat1-col_pos = 3.
append wa_fieldcat1 to it_fieldcat1.
wa_fieldcat1-fieldname = 'ERNAM'.
wa_fieldcat1-seltext_l = 'NAME'.
wa_fieldcat1-col_pos = 4.
append wa_fieldcat1 to it_fieldcat1.
endform. "build_fieldcatalog
*& Form build_fieldcatalog2
form build_fieldcatalog2.
wa_fieldcat2-fieldname = 'EBELN'.
wa_fieldcat2-seltext_l = 'PURCHASE ORDER'.
wa_fieldcat2-col_pos = 0.
append wa_fieldcat2 to it_fieldcat2.
wa_fieldcat2-fieldname = 'EBELP'.
wa_fieldcat2-seltext_l = 'ITEM NUMBER'.
wa_fieldcat2-col_pos = 1.
append wa_fieldcat2 to it_fieldcat2.
wa_fieldcat2-fieldname = 'EMATN'.
wa_fieldcat2-seltext_l = 'MATERIAL TYPE'.
wa_fieldcat2-col_pos = 2.
append wa_fieldcat2 to it_fieldcat2.
wa_fieldcat2-fieldname = 'MATKL'.
wa_fieldcat2-seltext_l = 'MATERIAL GROUP'.
wa_fieldcat2-col_pos = 3.
append wa_fieldcat2 to it_fieldcat2.
wa_fieldcat2-fieldname = 'NETPR'.
wa_fieldcat2-seltext_l = 'NET PRICE'.
wa_fieldcat2-col_pos = 4.
wa_fieldcat2-do_sum = 'X'.
append wa_fieldcat2 to it_fieldcat2.
endform. "build_fieldcatalog
*& form build_layout.
form build_layout.
wa_layout-zebra ='X'.
wa_layout-no_vline = ' '.
wa_layout-no_hline = ' '.
wa_layout-colwidth_optimize = 'X'.
wa_layout-window_titlebar = 'PURCHASE ORDER HEADER AND ITEM DETAILS'.
endform. "build_layout
*& form append_ekkodata_to_alv_block
form append_ekkodata_to_alv_block.
call function 'REUSE_ALV_BLOCK_LIST_APPEND'
exporting
is_layout = wa_layout
it_fieldcat = it_fieldcat1
i_tabname ='it_ekko'
it_events = it_events[]
IT_SORT = IT_SORT
I_TEXT = ' '
tables
t_outtab = it_ekko
exceptions
program_error = 1
maximum_of_appends_reached = 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.
*& form append_ekpodata_to_alv_block
form append_ekpodata_to_alv_block.
call function 'REUSE_ALV_BLOCK_LIST_APPEND'
exporting
is_layout = wa_layout
it_fieldcat = it_fieldcat2
i_tabname ='it_ekpo'
it_events = it_events[]
IT_SORT = IT_SORT
I_TEXT = ' '
tables
t_outtab = it_ekpo
exceptions
program_error = 1
maximum_of_appends_reached = 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.
*& FORM display_blocked_alv.
form display_blocked_alv.
call function 'REUSE_ALV_BLOCK_LIST_DISPLAY'.
endform.
*& Form GET_EVENTS
form get_events .
call function 'REUSE_ALV_EVENTS_GET'
exporting
i_list_type = 2
importing
et_events = it_events[]
exceptions
list_type_wrong = 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. " GET_EVENTS
in this program i have append two blocks of data..like this u can append the other two blocks to display the four blocks of data..
Maybe you are looking for
-
Ipod Touch 4th Gen audio with headphones is messed up
Hi, So recently my 4th generation ipod touch has been having audio issues when headphones are plugged in. What it does it make the audio really loud and noisy. People talking or singing cannot be understood, it is completely static and muffled. Thing
-
How to get the right file name in an attachment
I have design a program to get the attach file from an attachment. But when I click the link to save the file, the default name of the file is 'attach' whenever I get different files. Who know what is the problem, please tell me the truth. Here are s
-
Solaris 8 x86 Hangs on reboot with Verfying DMI Pool Data
I've just installed solaris 8 on intel. I previously run 2.7 on same system no problem. After installing 8 and rebooting the machine hangs after displaying Verifying DMI Pool Data ......... It appears to of verified, but then does nothing else. I hav
-
Hi Folks I have designed a dashboard page as shows below. However, my manager wants to give 'Budget' as column heading from 'Original Budget' to 'Variance %'. Previously I used static text to make differentiation but it is very hard to group from cli
-
Why are my photos squashed?
I have tried sending photos as attachments from iPhoto, Preview, as jpegs from my Apple Mail program. I have edited the sizes, varied the resolution, sent them smaller, larger and actual size. They are all squashed. I started to cc myself and those