CODING EXAMPLE - LAYOUT ALV - ( very urgent )
Could any body please give me the coding example
where slis_layout_alv is used ? Please treat this as very urgent.
Yours sincerely,
SAURAV LAHIRY
Hi Saurav,
Please check this code.
REPORT y56098rdup_list
NO STANDARD PAGE HEADING LINE-SIZE 240 LINE-COUNT 65(8) .
Declartion of Tables.
TABLES: ztril_logtable,zreasoncodes,zsdcustxref, usr21, adrp.
TABLES-POOLS
TYPE-POOLS: slis.
Internal tables declarations.
Declaration of output internal table
DATA: BEGIN OF tb_output OCCURS 0,
user_id TYPE xubname, " Requestor ID
role TYPE zrole, "Role
kunnr TYPE kunnr , "Customer Number 1
customer_name TYPE name1, "Customer Name
stras TYPE stras_gp, "Street Address
ort01 TYPE city, "City
regio TYPE regio, "State
pstlz TYPE pstlz, "Postal Code
land1 TYPE land1_gp, "COUNTRY CODE
po_box TYPE ad_pobx, "PO Box Number
tril_po_postal TYPE zpobox_postal, "PO BOX Postal Code
tril_err_msg TYPE zerr_message, "Error Message
reason_type TYPE zreason_type, "Reason Type
reason_code TYPE zreason_code, "Reason Code
perc_prob TYPE zprobability , "Probability Percentage
pattern_number TYPE z_pattern_no, "Match Pattern Number
country_code TYPE land1, "COUNTRY CODE
user_id_name(92) TYPE c, "UserID + Fast Name + Last Name
zlkunnr LIKE zsdcustxref-zlkunnr, "Legacy Customer NO
saplegcustno(20) TYPE c, "SAP + Legacy Customer No
reason_desc LIKE zreasoncodes-reason_desc, "Reason Description
saplegcustno1(20) TYPE c,
END OF tb_output.
Declation of work area.
DATA: wa_output LIKE tb_output.
Declaration of Internal Table.
DATA: tb_fill_output LIKE tb_output OCCURS 0 WITH HEADER LINE,
wa_fill_output LIKE tb_fill_output.
Declaration of internal table for ZREASONCODES
DATA: BEGIN OF tb_reasoncodes OCCURS 0.
INCLUDE STRUCTURE zreasoncodes.
DATA: END OF tb_reasoncodes.
DATA: wa_reasoncodes LIKE tb_reasoncodes.
Declaration of internal table ZSDCUTXREF.
DATA: BEGIN OF tb_zsdcustxref OCCURS 0,
zlkunnr LIKE zsdcustxref-zlkunnr, " Legacy Customer No
zlsourc LIKE zsdcustxref-zlsourc, " Legacy customer source code
kunnr LIKE zsdcustxref-kunnr, " Customer No
END OF tb_zsdcustxref.
Declation of work area.
DATA: wa_zsdcustxref LIKE tb_zsdcustxref.
Declaration of internal table for USR21.
DATA: BEGIN OF tb_usr21 OCCURS 0,
bname LIKE usr21-bname, " USER NAME IN USER MASTER RECORD
persnumber LIKE usr21-persnumber, " PERSON NUMBER
name_first LIKE adrp-name_first, " FIRST NAME
name_last LIKE adrp-name_last, " LAST NAME
END OF tb_usr21.
Declation of work area.
DATA: wa_usr21 LIKE tb_usr21.
Declaration of internal table for ADRP.
DATA: BEGIN OF tb_adrp OCCURS 0,
persnumber LIKE adrp-persnumber, " PERSON NUMBER
name_first LIKE adrp-name_first, " FIRST NAME
name_last LIKE adrp-name_last, " LAST NAME
END OF tb_adrp.
DATA: wa_adrp LIKE tb_adrp.
Declaration for fieldcatalog
DATA: tb_fieldcat TYPE slis_t_fieldcat_alv,
wa_fieldcat TYPE slis_fieldcat_alv.
Declaration for events
DATA: tb_events TYPE slis_t_event,
wa_event TYPE slis_alv_event.
Declaration for Layout
DATA: tb_layout TYPE slis_layout_alv,
wb_layout TYPE slis_layout_alv.
DATA: wa_line TYPE slis_listheader,
tb_list_header TYPE slis_t_listheader.
DATA: g_date1(40) TYPE c,
g_date2(40) TYPE c,
g_date3(80) TYPE c.
Declaration for Selection Screen Fields
SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS: s_userid FOR ztril_logtable-user_id, "Requestor ID
s_r_type FOR zreasoncodes-reason_type, " Reason Type
s_r_code FOR zreasoncodes-reason_code
MATCHCODE OBJECT zr_code. " Reason Code
PARAMETERS : p_frmdat LIKE ztril_logtable-curr_date OBLIGATORY, " from date
p_to_dat LIKE ztril_logtable-curr_date OBLIGATORY. " to date
SELECTION-SCREEN: END OF BLOCK b1.
Declaration for Varialbes
DATA: g_sc_no(20) TYPE c, " To combine the SAP & Legacy Customer No
g_user_name(92) TYPE c. " To concatnate the Userid and User Name.
DATA : tb_repid LIKE trdir-name.
tb_repid = 'Y56098RDUP_LIST'.
*tb-repid type sy-repid.
DATA: BEGIN OF tb_user OCCURS 0,
user_id LIKE ztril_logtable-user_id,
END OF tb_user.
To get the P_USERID F4 Functionality for LOW and HIGH.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_userid-low.
SELECT user_id FROM ztril_logtable INTO TABLE tb_user.
SORT tb_user.
DELETE ADJACENT DUPLICATES FROM tb_user.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'S_USERID'
dynpprog = sy-repid
dynpnr = sy-dynnr
dynprofield = 'S_USERID'
value_org = 'S'
TABLES
value_tab = tb_user
EXCEPTIONS
parameter_error = 1
no_values_found = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE e210(zsd).
ENDIF.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_userid-high.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'S_USERID'
dynpprog = sy-repid
dynpnr = sy-dynnr
dynprofield = 'S_USERID'
value_org = 'S'
TABLES
value_tab = tb_user
EXCEPTIONS
parameter_error = 1
no_values_found = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE e210(zsd).
ENDIF.
At selection screen event.
AT SELECTION-SCREEN.
Validation of User_id(USER_ID) & Reason Type(REASON_CODE)
PERFORM checking_user_id.
Validation of Reason type from the table ZREASONCODES
PERFORM check_reasontype.
Validation of Reason code from the table ZREASONCODES
PERFORM check_reasoncode.
Validation for checking From-Date
PERFORM checking_from_date.
Validation for checking To-Date
PERFORM checking_to_date.
Start of selection event.
START-OF-SELECTION.
REFRESH data & clear data.
PERFORM refresh_tables.
Get ZTRIL_LOGTABLE Data.
PERFORM get_tril_logtable.
Get data from ZREASONCODE.
PERFORM get_reasoncode_data.
Get the data Customer No from ZSDCUSTREF based on ZTRIL_LOGTABLE-KUNNR
PERFORM get_sdcustrefdata.
Get the data First Name and Last Name
PERFORM get_data_from_usr21_adrp.
Updateing the output internal table i.e. IT_OUTPUT data
PERFORM fill_output_data.
Displaying output data with two different Rows.
PERFORM output_data.
Populate the field catelog.
PERFORM build_fieldcatlog.
Declartion Events.
PERFORM event_call.
Top of page Information
PERFORM top_of_page.
Declation of Layout
PERFORM layout USING tb_layout.
To get the Output Format( Simple List/ ALV )
PERFORM grid_display.
*& Form get_tril_logtable
To get the data from table ztril_logtable
FORM get_tril_logtable.
REFRESH: tb_output.
Reading data from the table ZTRIL_LOGTABLE
SELECT user_id
role "Role
kunnr "Customer Number 1
customer_name "Customer Name
stras "Street Address
ort01 "City
regio "State
pstlz "Postal Code
land1 "COUNTRY CODE
po_box "PO Box Number
tril_po_postal "PO BOX Postal Code
tril_err_msg "Error Message
reason_type "Reason Type
reason_code "Reason Code
perc_prob
pattern_number
FROM ztril_logtable INTO
CORRESPONDING FIELDS OF
TABLE tb_output
WHERE
( curr_date GE p_frmdat AND curr_date LE p_to_dat )
( curr_date BETWEEN p_frmdat AND p_to_dat )
AND
user_id IN s_userid
AND reason_code IN s_r_code
AND reason_type IN s_r_type.
IF sy-subrc NE 0.
MESSAGE i202(zsd).
ENDIF.
ENDFORM. " get_tril_logtable
*& Form get_reasoncode_data
To get the Reason code and Reason type
FORM get_reasoncode_data .
checking internal table initial data.
IF NOT tb_output[] IS INITIAL.
SELECT reason_type
reason_code
reason_desc
FROM zreasoncodes
INTO CORRESPONDING FIELDS OF TABLE tb_reasoncodes
WHERE reason_type IN s_r_type
AND reason_code IN s_r_code.
ENDIF.
ENDFORM. " get_reasoncode_data
*& Form get_sdcustrefdata
To get the legasy customer number data
FORM get_sdcustrefdata .
IF NOT tb_output[] IS INITIAL.
SELECT zlkunnr " Legacy Customer No
zlsourc " Legacy customer source code
kunnr " Customer No
FROM zsdcustxref INTO TABLE tb_zsdcustxref
FOR ALL ENTRIES IN tb_output
WHERE kunnr EQ tb_output-kunnr.
ENDIF.
ENDFORM. " get_sdcustrefdata
*& Form fill_output_data
To get the final data into the Internal Table
FORM fill_output_data .
IF NOT tb_output[] IS INITIAL.
SORT tb_output BY role user_id.
LOOP AT tb_output INTO wa_output.
READ TABLE tb_reasoncodes INTO wa_reasoncodes
WITH KEY
reason_type = wa_output-reason_type
reason_code = wa_output-reason_code BINARY SEARCH.
IF sy-subrc EQ 0.
wa_output-reason_desc = wa_reasoncodes-reason_desc.
CLEAR wa_reasoncodes.
ENDIF.
READ TABLE tb_zsdcustxref INTO wa_zsdcustxref
WITH KEY
kunnr = wa_output-kunnr.
IF sy-subrc EQ 0.
CONCATENATE wa_zsdcustxref-zlkunnr
wa_zsdcustxref-zlsourc
INTO
g_sc_no SEPARATED BY ' - '.
wa_output-saplegcustno1 = wa_zsdcustxref-zlkunnr.
wa_output-saplegcustno1 = g_sc_no.
ELSE.
wa_output-saplegcustno = wa_output-kunnr.
CLEAR: wa_reasoncodes,g_sc_no.
ENDIF.
READ TABLE tb_usr21 INTO wa_usr21 WITH KEY bname = wa_output-user_id.
IF sy-subrc EQ 0.
CONCATENATE wa_usr21-bname
CONCATENATE wa_usr21-name_first
wa_usr21-name_last
INTO
g_user_name SEPARATED BY space.
wa_output-user_id_name = g_user_name.
ENDIF.
MODIFY tb_output FROM wa_output
TRANSPORTING
reason_desc
saplegcustno
user_id_name
saplegcustno1.
CLEAR: g_user_name,wa_usr21, wa_adrp.
ENDLOOP.
ENDIF.
ENDFORM. " fill_output_data
*& Form get_data_from_USR21_ADRP
To get the first name and last name from ADRP table
FORM get_data_from_usr21_adrp .
IF NOT tb_output[] IS INITIAL.
SELECT bname
persnumber
FROM usr21
INTO CORRESPONDING FIELDS OF TABLE tb_usr21
FOR ALL ENTRIES IN tb_output
WHERE bname EQ tb_output-user_id.
IF NOT tb_usr21[] IS INITIAL.
SELECT persnumber
name_first
name_last
FROM adrp INTO TABLE tb_adrp
FOR ALL ENTRIES IN tb_usr21
WHERE persnumber EQ tb_usr21-persnumber.
ENDIF.
ENDIF.
LOOP AT tb_usr21 INTO wa_usr21.
READ TABLE tb_adrp INTO wa_adrp WITH KEY persnumber = wa_usr21-persnumber.
IF sy-subrc EQ 0.
wa_usr21-name_first = wa_adrp-name_first.
wa_usr21-name_last = wa_adrp-name_last.
CLEAR wa_adrp.
MODIFY tb_usr21 FROM wa_usr21 TRANSPORTING name_first name_last.
ENDIF.
ENDLOOP.
ENDFORM. " get_data_from_USR21_ADRP
*& Form build_fieldcatlog
It is used to build the fieldcatlog
FORM build_fieldcatlog .
wa_fieldcat-col_pos = 1.
wa_fieldcat-tabname = 'TB_FILL_DATA'.
wa_fieldcat-fieldname = 'USER_ID'.
wa_fieldcat-seltext_l = 'Requestor ID'.
wa_fieldcat-input = 'X'.
wa_fieldcat-edit = 'X'.
APPEND wa_fieldcat TO tb_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = 2.
wa_fieldcat-tabname = 'TB_FILL_DATA'.
wa_fieldcat-fieldname = 'USER_ID_NAME'.
wa_fieldcat-seltext_l = 'Requestor Name'.
wa_fieldcat-input = 'X'.
wa_fieldcat-edit = 'X'.
APPEND wa_fieldcat TO tb_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = 3.
wa_fieldcat-tabname = 'TB_FILL_DATA'.
wa_fieldcat-fieldname = 'SAPLEGCUSTNO'.
wa_fieldcat-seltext_l = 'SAP & Legacy Customer No'.
wa_fieldcat-input = 'X'.
wa_fieldcat-edit = 'X'.
APPEND wa_fieldcat TO tb_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = 4.
wa_fieldcat-tabname = 'TB_FILL_DATA'.
wa_fieldcat-fieldname = 'CUSTOMER_NAME'.
wa_fieldcat-seltext_m = 'Customer Name'.
wa_fieldcat-input = 'X'.
wa_fieldcat-edit = 'X'.
APPEND wa_fieldcat TO tb_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = 5.
wa_fieldcat-tabname = 'TB_FILL_DATA'.
wa_fieldcat-fieldname = 'STRAS'.
wa_fieldcat-seltext_m = 'Street Address'.
wa_fieldcat-input = 'X'.
wa_fieldcat-edit = 'X'.
APPEND wa_fieldcat TO tb_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = 6.
wa_fieldcat-tabname = 'TB_FILL_DATA'.
wa_fieldcat-fieldname = 'ORT01'.
wa_fieldcat-seltext_m = 'City'.
wa_fieldcat-input = 'X'.
wa_fieldcat-edit = 'X'.
APPEND wa_fieldcat TO tb_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = 7.
wa_fieldcat-tabname = 'TB_FILL_DATA'.
wa_fieldcat-fieldname = 'REGIO'.
wa_fieldcat-seltext_m = 'State'.
wa_fieldcat-input = 'X'.
wa_fieldcat-edit = 'X'.
APPEND wa_fieldcat TO tb_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = 8.
wa_fieldcat-tabname = 'TB_FILL_DATA'.
wa_fieldcat-fieldname = 'PSTLZ'.
wa_fieldcat-seltext_m = 'Postal Code'.
wa_fieldcat-input = 'X'.
wa_fieldcat-edit = 'X'.
APPEND wa_fieldcat TO tb_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = 9.
wa_fieldcat-tabname = 'TB_FILL_DATA'.
wa_fieldcat-fieldname = 'LAND1'.
wa_fieldcat-seltext_m = 'Country Code'.
wa_fieldcat-input = 'X'.
wa_fieldcat-edit = 'X'.
APPEND wa_fieldcat TO tb_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = 10.
wa_fieldcat-tabname = 'TB_FILL_DATA'.
wa_fieldcat-fieldname = 'PO_BOX'.
wa_fieldcat-seltext_m = 'PO BOX NO'.
wa_fieldcat-input = 'X'.
wa_fieldcat-edit = 'X'.
APPEND wa_fieldcat TO tb_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = 11.
wa_fieldcat-tabname = 'TB_FILL_DATA'.
wa_fieldcat-fieldname = 'TRIL_PO_POSTAL'.
wa_fieldcat-seltext_m = 'PO Box Postal Code'.
wa_fieldcat-input = 'X'.
wa_fieldcat-edit = 'X'.
APPEND wa_fieldcat TO tb_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = 12.
wa_fieldcat-tabname = 'TB_FILL_DATA'.
wa_fieldcat-fieldname = 'REASON_TYPE'.
wa_fieldcat-seltext_m = 'Reason Type'.
wa_fieldcat-input = 'X'.
wa_fieldcat-edit = 'X'.
APPEND wa_fieldcat TO tb_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = 13.
wa_fieldcat-tabname = 'TB_FILL_DATA'.
wa_fieldcat-fieldname = 'REASON_CODE'.
wa_fieldcat-seltext_m = 'Reason Code'.
wa_fieldcat-input = 'X'.
wa_fieldcat-edit = 'X'.
APPEND wa_fieldcat TO tb_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = 14.
wa_fieldcat-tabname = 'TB_FILL_DATA'.
wa_fieldcat-fieldname = 'REASON_DESC'.
wa_fieldcat-seltext_m = 'Reason Description'.
wa_fieldcat-input = 'X'.
wa_fieldcat-edit = 'X'.
APPEND wa_fieldcat TO tb_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = 15.
wa_fieldcat-tabname = 'TB_FILL_DATA'.
wa_fieldcat-fieldname = 'PERC_PROB'.
wa_fieldcat-seltext_m = 'TOP %'.
wa_fieldcat-input = 'X'.
wa_fieldcat-edit = 'X'.
APPEND wa_fieldcat TO tb_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = 16.
wa_fieldcat-tabname = 'TB_FILL_DATA'.
wa_fieldcat-fieldname = 'PATTERN_NUMBER'.
wa_fieldcat-seltext_m = 'Match Pattern'.
wa_fieldcat-input = 'X'.
wa_fieldcat-edit = 'X'.
wa_fieldcat-datatype = 'N'.
APPEND wa_fieldcat TO tb_fieldcat.
CLEAR wa_fieldcat.
ENDFORM. " build_fieldcatlog
*& Form event_call
It is used to call the events
FORM event_call .
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = tb_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. " event_call
*& Form grid_display
To display the output in ALV Grid format
FORM grid_display .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
i_callback_program = tb_repid
i_callback_pf_status_set = 'SET_PF_STATUS'
i_callback_user_command = 'USER_COMMAND'
i_callback_top_of_page = '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 = wb_layout
it_fieldcat = tb_fieldcat[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
it_events = tb_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
I_HTML_HEIGHT_TOP = 0
I_HTML_HEIGHT_END = 0
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
IR_SALV_FULLSCREEN_ADAPTER =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = tb_output
t_outtab = tb_fill_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. " grid_display
*& Form top_of_page
It is used to display the Top-of-page
FORM top_of_page .
CLEAR: wa_line, tb_list_header[].
wa_line-typ = 'H'.
wa_line-info = 'Duplicates Ignored by Requestor Report'.
APPEND wa_line TO tb_list_header.
CLEAR wa_line.
wa_line-typ = 'S'.
WRITE p_frmdat TO g_date1 DD/MM/YY.
WRITE p_to_dat TO g_date2 DD/MM/YY.
CONCATENATE 'From Date : ' g_date1 ' To Date : ' g_date2
INTO g_date3 SEPARATED BY space .
wa_line-info = g_date3.
APPEND wa_line TO tb_list_header.
CLEAR wa_line.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = tb_list_header.
i_logo =
I_END_OF_LIST_GRID =
ENDFORM. " top_of_page
*& Form layout
It is used to display the output layout
FORM layout USING p_tb_layout.
tb_layout-detail_popup = 'X'.
tb_layout-colwidth_optimize = 'X'.
ENDFORM. " layout
*& Form refresh_tables
TO Refresh the internal table workarea
FORM refresh_tables .
REFRESH: tb_output, tb_reasoncodes, tb_zsdcustxref, tb_usr21, tb_fill_output.
CLEAR: wa_output, wa_reasoncodes, wa_zsdcustxref, wa_usr21, wa_fill_output.
ENDFORM. " refresh_tables
*& Form SET_PF_STATUS
It is used to populate the PF_STATUS
FORM set_pf_status USING tb_extab TYPE slis_t_extab.
SET PF-STATUS 'ZSTANDARD'.
ENDFORM. " SET_PF_STATUS
*& Form USER_COMMAND
To avoid the shortdump of ALV Report
FORM user_command USING rf_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
ENDFORM. "user_command
*& Form check_reasoncode
Checking Reason Code
FORM check_reasoncode .
IF NOT s_r_type IS INITIAL.
SELECT SINGLE reason_code FROM zreasoncodes INTO s_r_code
WHERE reason_type IN s_r_type
AND reason_code IN s_r_code.
IF sy-subrc NE 0.
SET CURSOR FIELD 'S_R_CODE-LOW'.
MESSAGE e204(zsd).
ELSEIF s_r_code = 'TP'.
MESSAGE e208(zsd).
ENDIF.
ENDIF.
ENDFORM. " check_reasoncode
*& Form check_reasontype
Checking Reason Type
FORM check_reasontype .
IF s_r_type-low = 'TP' OR
s_r_type-high = 'TP'.
MESSAGE e208(zsd).
ENDIF.
SELECT SINGLE reason_type FROM zreasoncodes INTO s_r_type
WHERE reason_type IN s_r_type.
IF sy-subrc NE 0.
MESSAGE e201(zsd).
ENDIF.
ENDFORM. " check_reasontype
*& Form checking_From_date
Checking From Date
FORM checking_from_date .
SELECT SINGLE
curr_date
FROM ztril_logtable
INTO ztril_logtable-curr_date
WHERE curr_date EQ p_frmdat.
IF sy-subrc NE 0.
MESSAGE e205(zsd).
ENDIF.
ENDFORM. " checking_From_date
*& Form checking_To_date
Checking To_date
FORM checking_to_date .
SELECT SINGLE
curr_date
FROM ztril_logtable
INTO ztril_logtable-curr_date
WHERE curr_date EQ p_to_dat.
IF sy-subrc NE 0.
MESSAGE e206(zsd).
elseif p_frmdat lt p_to_dat.
Message e209(zsd).
ELSEIF p_frmdat GT p_to_dat.
MESSAGE e207(zsd).
ENDIF.
ENDFORM. " checking_To_date
*& Form checking_user_id
text
FORM checking_user_id .
SELECT SINGLE user_id
FROM ztril_logtable
INTO s_userid
WHERE user_id IN s_userid.
IF sy-subrc NE 0.
MESSAGE e200(zsd).
ENDIF.
ENDFORM. " checking_user_id
*& Form output_data
To print the Legacy customer No and SAP no into two different rows.*
FORM output_data .
LOOP AT tb_output INTO wa_output.
wa_fill_output-user_id = wa_output-user_id.
wa_fill_output-role = wa_output-role.
wa_fill_output-saplegcustno = wa_output-kunnr.
wa_fill_output-user_id_name = wa_output-user_id_name.
wa_fill_output-customer_name = wa_output-customer_name.
wa_fill_output-stras = wa_output-stras.
wa_fill_output-ort01 = wa_output-ort01.
wa_fill_output-regio = wa_output-regio.
wa_fill_output-pstlz = wa_output-pstlz.
wa_fill_output-land1 = wa_output-land1.
wa_fill_output-po_box = wa_output-po_box.
wa_fill_output-tril_po_postal = wa_output-tril_po_postal.
wa_fill_output-tril_err_msg = wa_output-tril_err_msg.
wa_fill_output-reason_type = wa_output-reason_type.
wa_fill_output-reason_code = wa_output-reason_code.
wa_fill_output-country_code = wa_output-country_code.
wa_fill_output-reason_desc = wa_output-reason_desc.
wa_fill_output-pattern_number = wa_output-pattern_number.
wa_fill_output-perc_prob = wa_output-perc_prob.
CLEAR: wa_output-user_id,
wa_output-role,
wa_output-kunnr,
wa_output-user_id_name,
wa_output-stras,
wa_output-ort01,
wa_output-regio,
wa_output-pstlz,
wa_output-land1,
wa_output-po_box,
wa_output-tril_po_postal,
wa_output-tril_err_msg,
wa_output-reason_type,
wa_output-reason_code,
wa_output-country_code,
wa_output-reason_desc,
wa_output-customer_name,
wa_output-pattern_number,
wa_output-perc_prob.
APPEND wa_fill_output TO tb_fill_output.
IF NOT wa_output-saplegcustno1 IS INITIAL.
CLEAR: wa_fill_output-user_id,
wa_fill_output-role,
wa_fill_output-kunnr,
wa_fill_output-user_id_name,
wa_fill_output-stras,
wa_fill_output-ort01,
wa_fill_output-regio,
wa_fill_output-pstlz,
wa_fill_output-land1,
wa_fill_output-po_box,
wa_fill_output-tril_po_postal,
wa_fill_output-tril_err_msg,
wa_fill_output-reason_type,
wa_fill_output-reason_code,
wa_fill_output-country_code,
wa_fill_output-reason_desc,
wa_fill_output-customer_name,
wa_fill_output-pattern_number,
wa_fill_output-perc_prob.
wa_fill_output-saplegcustno = wa_output-saplegcustno1.
APPEND wa_fill_output TO tb_fill_output.
CLEAR: wa_output.
ENDIF.
ENDLOOP.
ENDFORM. " output_data
Similar Messages
-
Query Regarding ALV - Very Urgent
Hi experts,
I have defined a ALV grid in my program using the startdard function module as editable. Now I want the grid to be displayed in the screen with my pf-status. how can i do that?.
Here is the sample code.
REPORT zadvcformsub
NO STANDARD PAGE HEADING MESSAGE-ID zf
LINE-SIZE 255 LINE-COUNT 66.
INCLUDE zftsvar .
TYPE-POOLS : slis.
TABLES : zftsregstr, zftsintnum, zftscusttc,
zadvcform, konv, knvv, sscrfields.
DATA : it_fieldcat TYPE slis_t_fieldcat_alv.
DATA : w_layout TYPE slis_layout_alv,
w_fieldcat TYPE slis_fieldcat_alv.
DATA : BEGIN OF it_initial OCCURS 1,
bukrs(4) TYPE c,
wkreg(3) TYPE c,
zkunag(10) TYPE c,
validfrom(10) TYPE c,
validto(10) TYPE c,
vkorg(4) TYPE c,
aland(3) TYPE c,
zformtype(1) TYPE c,
frmintno(10) TYPE c,
uname(12) TYPE c,
datum(10) TYPE c,
uzeit(8) TYPE c,
END OF it_initial.
DATA : BEGIN OF it_part OCCURS 1,
zkunag LIKE zadvcform-zkunag,
frmintno LIKE zadvcform-frmintno,
validfrom LIKE zadvcform-validfrom,
validto LIKE zadvcform-validto,
END OF it_part.
DATA : w_sno(2) TYPE c,
w_cust(10) TYPE c,
w_cform(10) TYPE c,
w_from(10) TYPE c,
w_to(10) TYPE c,
w_blank1(10) TYPE c,
w_blank2(10) TYPE c,
w_blank3(10) TYPE c,
w_blank4(10) TYPE c,
w_string_len TYPE i,
w_sel_line(255) TYPE c,
w_indx(2) TYPE c.
SELECTION-SCREEN SKIP 1.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS:
s_bukrs FOR zadvcform-bukrs NO INTERVALS NO-EXTENSION OBLIGATORY,
s_aland FOR zadvcform-aland NO INTERVALS NO-EXTENSION OBLIGATORY,
s_wkreg FOR zadvcform-wkreg NO INTERVALS NO-EXTENSION OBLIGATORY,
s_vkorg FOR zadvcform-vkorg NO INTERVALS NO-EXTENSION OBLIGATORY,
s_fmtyp FOR zadvcform-zformtype NO INTERVALS NO-EXTENSION OBLIGATORY.
SELECTION-SCREEN END OF BLOCK b1.
INITIALIZATION.
AT SELECTION-SCREEN.
START-OF-SELECTION.
w_fieldcat-fieldname = 'ZKUNAG'.
w_fieldcat-tabname = 'IT_PART'.
w_fieldcat-ref_fieldname = 'ZKUNAG'.
w_fieldcat-ref_tabname = 'ZADVCFORM'.
w_fieldcat-seltext_l = 'Customer Code'.
w_fieldcat-ddictxt = 'L'.
w_fieldcat-input = 'X'.
w_fieldcat-edit = 'X'.
APPEND w_fieldcat TO it_fieldcat.
w_fieldcat-fieldname = 'FRMINTNO'.
w_fieldcat-tabname = 'IT_PART'.
w_fieldcat-ref_fieldname = 'FRMINTNO'.
w_fieldcat-ref_tabname = 'ZADVCFORM'.
w_fieldcat-seltext_l = 'C Form No'.
w_fieldcat-ddictxt = 'L'.
w_fieldcat-input = 'X'.
w_fieldcat-edit = 'X'.
APPEND w_fieldcat TO it_fieldcat.
w_fieldcat-fieldname = 'VALIDFROM'.
w_fieldcat-tabname = 'IT_PART'.
w_fieldcat-ref_fieldname = 'VALIDFROM'.
w_fieldcat-ref_tabname = 'ZADVCFORM'.
w_fieldcat-seltext_l = 'Valid From'.
w_fieldcat-ddictxt = 'L'.
w_fieldcat-input = 'X'.
w_fieldcat-edit = 'X'.
APPEND w_fieldcat TO it_fieldcat.
w_fieldcat-fieldname = 'VALIDTO'.
w_fieldcat-tabname = 'IT_PART'.
w_fieldcat-ref_fieldname = 'VALIDTO'.
w_fieldcat-ref_tabname = 'ZADVCFORM'.
w_fieldcat-seltext_l = 'Valid To'.
w_fieldcat-ddictxt = 'L'.
w_fieldcat-input = ' '.
w_fieldcat-edit = ' '.
APPEND w_fieldcat TO it_fieldcat.
DO 15 TIMES.
CLEAR it_part.
APPEND it_part.
ENDDO.
SET PF-STATUS 'ZADVCFORM_COPY'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-cprog
i_callback_pf_status_set = 'ZADVCFORM_COPY'
it_fieldcat = it_fieldcat
i_grid_title = 'Advanced C Form Submission'
TABLES
t_outtab = it_part[]
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE i039(zaba) WITH 'Error in ALV'.
ENDIF.
I am geting the editable ALV grid but how to set my gui status.
regards,
Arul Jothi.Hi,
Here is an sample code to handle events.
DATA: I_EVENTS TYPE SLIS_T_EVENT.
PERFORM F4000_EVENTS_INIT CHANGING I_EVENTS.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
IT_EVENTS = I_EVENTS
TABLES
T_OUTTAB = I_MARA
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
FORM F4000_EVENTS_INIT USING I_EVENTS TYPE SLIS_T_EVENT.
DATA: LINE_EVENT TYPE SLIS_ALV_EVENT.
CLEAR LINE_EVENT.
LINE_EVENT-NAME = 'TOP_OF_PAGE'.
LINE_EVENT-FORM = 'F4001_TOP_OF_PAGE'.
APPEND LINE_EVENT TO I_EVENTS.
CLEAR LINE_EVENT.
LINE_EVENT-NAME = 'PF_STATUS_SET'.
LINE_EVENT-FORM = 'F4002_PF_STATUS_SET'.
APPEND LINE_EVENT TO I_EVENTS.
CLEAR LINE_EVENT.
LINE_EVENT-NAME = 'USER_COMMAND'.
LINE_EVENT-FORM = 'F4003_USER_COMMAND'.
APPEND LINE_EVENT TO I_EVENTS.
ENDFORM.
FORM F4003_USER_COMMAND USING UCOMM LIKE SY-UCOMM
SELFIELD TYPE SLIS_SELFIELD.
CASE UCOMM.
WHEN '&CHNG'.
READ TABLE I_MARA INDEX SELFIELD-TABINDEX.
IF I_MARA-MATNR NE SPACE.
SET PARAMETER ID 'MAT' FIELD I_MARA-MATNR.
CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN.
CLEAR UCOMM.
ENDIF.
ENDCASE.
ENDFORM. -
Hi all,
I have displayed data in alv.and the error condition is that if for a material if it has more than one S as ok_status records then it should throw an error. This logic is working fine.
Now suppose at first time user had entered S through keyboard which fails the condition so it throws an error first time.
Now user can change the ok status back to I or O from S (through keyboard although f4 help is available) which satisfies the conditon so that record should be saved. but when user presses save button then in the ALV display the changed status I or O for that record again converted back to status S automatically. and again gives an error.
if we try third time then it allows to save with record other than s ok status i.e. I or O.
this problem is comming only when we change the value through keyboard. If we select value using f4 help then whole logic is working fine, no problem at all.
Can you please help me out in this regard
Its very urgent.
Thanks & Regards
Ashutosh.Hi,
to exclude toolbar buttons..
DATA: LT_EXCLUDE TYPE UI_FUNCTIONS.
DATA LS_EXCLUDE TYPE UI_FUNC.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_COPY_ROW.
APPEND LS_EXCLUDE TO LT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_DELETE_ROW.
APPEND LS_EXCLUDE TO LT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_APPEND_ROW.
APPEND LS_EXCLUDE TO LT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_INSERT_ROW.
APPEND LS_EXCLUDE TO LT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_MOVE_ROW.
APPEND LS_EXCLUDE TO LT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_COPY.
APPEND LS_EXCLUDE TO LT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_CUT.
APPEND LS_EXCLUDE TO LT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_PASTE.
APPEND LS_EXCLUDE TO LT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_PASTE_NEW_ROW.
APPEND LS_EXCLUDE TO LT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_UNDO.
APPEND LS_EXCLUDE TO LT_EXCLUDE.
CALL METHOD G_GRID1->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
<b> IT_TOOLBAR_EXCLUDING = LT_EXCLUDE</b>
IS_LAYOUT = GS_LAYOUT
CHANGING
IT_FIELDCATALOG = IT_FIELDCAT
IT_OUTTAB = IT_FINAL[].
and you told you are using REUSE_ALV_GRID_DISPLAY_LVC
then in the user_command do this....
then your problem will be solved.
in the top you declare this..
DATA: REF_GRID TYPE REF TO CL_GUI_ALV_GRID.
FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
RS_SELFIELD TYPE SLIS_SELFIELD.
*then insert the following code in your USER_COMMAND routine...
IF REF_GRID IS INITIAL.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
E_GRID = REF_GRID.
ENDIF.
IF NOT REF_GRID IS INITIAL.
CALL METHOD REF_GRID->CHECK_CHANGED_DATA
ENDIF.
ENDFORM.
Regards
vijay -
Hai Gurus ,
What is the short key to run a program in background .. ?
I want to run a program (ALV report)in background to get a spool number .after this I want to send this report in email as PDF format ..
very urgent .. can any one help ...Hi,
BackGround : "CTRL" + "F9".
For Spool to PDF and Email, check the following ABAP code : RSTXPDFT4.
( For spool 2 PDF : FM : <b>'CONVERT_ABAPSPOOLJOB_2_PDF'</b>
For email with PDF attached : FM : <b>'SO_DOCUMENT_SEND_API1'</b> )
Hope this helps,
Erwan -
Logic for Refreshing the ALV Report (Very Urgent)
Hi Experts,
My <b>ALV report</b> needs a <b>refresh button</b> on the output.
The <b>Refresh button</b> should be available to allow user to keep this report on screen and <b>refresh regularly</b> rather than <b>going back</b> and <b>running it again.</b>
I am using <b>Function modules</b> and not <b>OOPS Concept</b> here.............As i am<b> unaware</b> of OOPS Please provide me solution in <b>FM's Only</b>.
Kindly send me <b>sample logic</b> for this, <b>Very urgent</b> if ur reply is helpfull.... u will be <b>rewarded heavily</b>.......................
THanks in advance.
Rajesh KumarHi,
This mean to say that if you have a 'refresh' push button in your gui status, every time you press the button, the list should get refreshed.
In ALV, to refresh the table you have to call the method "refresh_table_display".
It has the syntax very similar to creating the table.
It has two parameters. In the first one, you can mention if you want to refresh only the data (the icons are not refreshed)
or
if you want to refresh only the icons around the grid (the data is not refreshed - this option is mostly not used in day to day applications).
the synatx is :-
call method grid (name of grid )->refresh_table_display
exporting
IS_STABLE = <STRUCT OF TYPE LVC_S_STBL> (THIS IS FOR DATA REFRESHING)
I_SOFT_REFRESH = <VARIABLE OF CHAR 01> (THIS IS FOR ICON REFRESHING).
Regards,
Bhaskar -
I need one recurcive(unended loop) pl/sql example, its very urgent pls
Hi,
I need one recurcive (unended loop) pl/sql example, its very urgent pls
Thanks,
Sathis.I suppose you'll want to know how to get out of your undended loop too (although that does stop it being unended).
Example...
SQL> ed
Wrote file afiedt.buf
1 DECLARE
2 v_cnt NUMBER := 0;
3 BEGIN
4 LOOP
5 EXIT WHEN v_cnt = 1000;
6 v_cnt := v_cnt + 1;
7 END LOOP;
8* END;
SQL> /
PL/SQL procedure successfully completed.
SQL> -
Page layout 360x305 to smartform***very urgent***
Hi,
I want to take print out from dot matrix printer Page size is 360x305.
Can u please help me
how to create and assign page layout to my smart form.
Very urgent.Go to SPAD transaction.
Click on the Full administration button.
Go to tab Device types.
click on page formats and create a new page format.
Close the thread once your question is answered.
Regards,
SaiRam -
How to convert PO sapscript layout to pdf - need VERY URGENT Help
Dear All,
Requirement: PO sapscript layout after some modifications (say, ZMEDRUCK) has to be converted to pdf. Through me9f user will be able to give ranges of PO numbers and can view the print preview for the po. After that on clicking the print button we get the printout of the pos one after another based on the user input of PO numbers.
Our requirement is that when the user will click on the "Print Preview" of po (rather than pressing the print button) it i.e. PO sapscript layout has to get converted to pdf.
If you have already encountered this scenario, could you please send me the source code regarding this at the earliest. If you want to email it to my personal id, please let me know so that I can give it to you. Thank you.
It will be very beneficial for mine if you can send me some source code in this regard. (FYI. We want only Print output of PO sapscript. So, Print Program /SMB40/FM06P [after copying it to our ZSMB40/FM06P program] need to be modified for downloading the PO into PDF where there is no FMs like OPEN_FORM, WRITE_FORM, CLOSE_FORM. So already available source code in SAP forums can not help me.)). Kindly help me at the earliest. Its VERY URGENT
Thank you.
Thanks & Regards
SudiptaHi Chaith,
Could you please provide me the source code regarding this at the earliest.
We want only Print output of PO sapscript. So we need to modify only the Print Program SAPFM06P after copying it to ZSAPFM06P for downloading of modified PO (ZMEDRUCK) sapscript layout into PDF.
I am already having some source code from sdn portral. I am attaching it herewith. But it's not working as some constants and variable values need to be given. We want to take download of PO into PDF from ME9F transaction itself.
Could you please provide necessary values in the missing constants and variables and kindly resend the corrected modified Source code to me so that I can run the same code to download the modified PO ZMEDRUCK into PDF . Need YOUR URGENT HELP...
DATA: l_druvo LIKE t166k-druvo,
l_nast LIKE nast,
aux_nast LIKE nast,
l_from_memory,
l_doc TYPE meein_purchase_doc_print,
ent_screen TYPE c,
ent_retco TYPE i,
toa_dara TYPE toa_dara,
arc_params LIKE arc_params,
aux_form LIKE tnapr-fonam.
DATA: otf LIKE itcoo OCCURS 0 WITH HEADER LINE,
lt_docs TYPE TABLE OF docs,
pdf_bytecount TYPE i,
nom_archivo TYPE string.
aux_form = 'ZMEDRUCK'.
l_from_memory = c_true.
SELECT *
FROM nast
INTO aux_nast
UP TO 1 ROWS
WHERE kappl = c_po " Purchase Order
AND objky = t_datos-ebeln
AND aktiv = space
ORDER BY erdat DESCENDING eruhr DESCENDING.
ENDSELECT.
aux_nast-sort1 = c_swp.
CLEAR ent_screen.
CLEAR ent_retco.
IF aux_nast-aende EQ space.
l_druvo = c_1.
ELSE.
l_druvo = c_2.
ENDIF.
l_druvo = '2'.
CALL FUNCTION 'ME_READ_PO_FOR_PRINTING'
EXPORTING
ix_nast = aux_nast
ix_screen = ent_screen
IMPORTING
ex_retco = ent_retco
ex_nast = l_nast
doc = l_doc
CHANGING
cx_druvo = l_druvo
cx_from_memory = l_from_memory.
CHECK ent_retco EQ 0.
CALL FUNCTION 'ECP_PRINT_PO'
EXPORTING
ix_nast = l_nast
ix_druvo = l_druvo
doc = l_doc
ix_screen = ent_screen
ix_from_memory = l_from_memory
ix_toa_dara = toa_dara
ix_arc_params = arc_params
ix_fonam = aux_form
IMPORTING
ex_retco = ent_retco.
CLEAR otf.
CALL FUNCTION 'READ_OTF_FROM_MEMORY'
EXPORTING
memory_key = l_nast-objky " PO Number
TABLES
otf = otf
EXCEPTIONS
memory_empty = 1
OTHERS = 2.
CALL FUNCTION 'CONVERT_OTF_2_PDF'
IMPORTING
bin_filesize = pdf_bytecount
TABLES
otf = otf
doctab_archive = lt_docs
lines = pdfout
EXCEPTIONS
err_conv_not_possible = 1
err_otf_mc_noendmarker = 2
OTHERS = 3.
CONCATENATE c_dest t_datos-ebeln c_ext INTO nom_archivo.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
bin_filesize = pdf_bytecount
filename = nom_archivo
filetype = c_bin
IMPORTING
filelength = pdf_bytecount
TABLES
data_tab = pdfout. -
Please help me with the following two questions, very urgent
Hi All,
Please help me with some scenerios about what are the common problems when modifying a standard script such a standard Invoice script and how can we overcome them.
What are the common problems encountered when working with SAP SMARTFORMS and how to overcome them?
Please help me with these questions, its very urgent.
Thanks in advance.
MD.hi
hope it will help you.
reward if ehlp.
How to create a New smartfrom, it is having step by step procedure
http://sap.niraj.tripod.com/id67.html
step by step good ex link is....
http://smoschid.tripod.com/How_to_do_things_in_SAP/How_To_Build_SMARTFORMS/How_To_Build_SMARTFORMS.html
Here is the procedure
1. Create a new smartforms
Transaction code SMARTFORMS
Create new smartforms call ZSMART
2. Define looping process for internal table
Pages and windows
First Page -> Header Window (Cursor at First Page then click Edit -> Node -> Create)
Here, you can specify your title and page numbering
&SFSY-PAGE& (Page 1) of &SFSY-FORMPAGES(Z4.0)& (Total Page)
Main windows -> TABLE -> DATA
In the Loop section, tick Internal table and fill in
ITAB1 (table in ABAP SMARTFORM calling function) INTO ITAB2
3. Define table in smartforms
Global settings :
Form interface
Variable name Type assignment Reference type
ITAB1 TYPE Table Structure
Global definitions
Variable name Type assignment Reference type
ITAB2 TYPE Table Structure
4. To display the data in the form
Make used of the Table Painter and declare the Line Type in Tabstrips Table
e.g. HD_GEN for printing header details,
IT_GEN for printing data details.
You have to specify the Line Type in your Text elements in the Tabstrips Output options.
Tick the New Line and specify the Line Type for outputting the data.
Declare your output fields in Text elements
Tabstrips - Output Options
For different fonts use this Style : IDWTCERTSTYLE
For Quantity or Amout you can used this variable &GS_ITAB-AMOUNT(12.2)&
5. Calling SMARTFORMS from your ABAP program
REPORT ZSMARTFORM.
Calling SMARTFORMS from your ABAP program.
Collecting all the table data in your program, and pass once to SMARTFORMS
SMARTFORMS
Declare your table type in :-
Global Settings -> Form Interface
Global Definintions -> Global Data
Main Window -> Table -> DATA
Written by : SAP Hints and Tips on Configuration and ABAP/4 Programming
http://sapr3.tripod.com
TABLES: MKPF.
DATA: FM_NAME TYPE RS38L_FNAM.
DATA: BEGIN OF INT_MKPF OCCURS 0.
INCLUDE STRUCTURE MKPF.
DATA: END OF INT_MKPF.
SELECT-OPTIONS S_MBLNR FOR MKPF-MBLNR MEMORY ID 001.
SELECT * FROM MKPF WHERE MBLNR IN S_MBLNR.
MOVE-CORRESPONDING MKPF TO INT_MKPF.
APPEND INT_MKPF.
ENDSELECT.
At the end of your program.
Passing data to SMARTFORMS
call function 'SSF_FUNCTION_MODULE_NAME'
exporting
formname = 'ZSMARTFORM'
VARIANT = ' '
DIRECT_CALL = ' '
IMPORTING
FM_NAME = FM_NAME
EXCEPTIONS
NO_FORM = 1
NO_FUNCTION_MODULE = 2
OTHERS = 3.
if sy-subrc <> 0.
WRITE: / 'ERROR 1'.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
call function FM_NAME
EXPORTING
ARCHIVE_INDEX =
ARCHIVE_INDEX_TAB =
ARCHIVE_PARAMETERS =
CONTROL_PARAMETERS =
MAIL_APPL_OBJ =
MAIL_RECIPIENT =
MAIL_SENDER =
OUTPUT_OPTIONS =
USER_SETTINGS = 'X'
IMPORTING
DOCUMENT_OUTPUT_INFO =
JOB_OUTPUT_INFO =
JOB_OUTPUT_OPTIONS =
TABLES
GS_MKPF = INT_MKPF
EXCEPTIONS
FORMATTING_ERROR = 1
INTERNAL_ERROR = 2
SEND_ERROR = 3
USER_CANCELED = 4
OTHERS = 5.
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
Smartform
you can check this link here you can see the steps and you can do it the same by looking at it..
http://smoschid.tripod.com/How_to_do_things_in_SAP/How_To_Build_SMARTFORMS/How_To_Build_SMARTFORMS.html
SMARTFORMS STEPS.
1. In Tcode se11 Create a structure(struct) same like the Internal table that you are going to use in your report.
2. Create Table type(t_struct) of stracture in se11.
3. In your program declare Internal table(Itab) type table of structure(struct).
4. Define work area(wa) like line of internal table.
5. Open Tcode Smartforms
6. In form Global setting , forminterface Import parameter define Internal table(Itab) like table type of stracture(t_struct).
7. In form Global setting , Global definitions , in Global data define Work area(wa) like type stracture(struct).
8. In form pages and window, create Page node by default Page1 is available.
9. In page node you can create numbers of secondary window. But in form there is only one Main window.
10. By right click on page you can create windows or Go to Edit, Node, Create.
11. After creating the window right click on window create table for displaying the data that you are passing through internal table.
12. In the table Data parameter, loop internal internal table (Itab) into work area(wa).
13. In table there are three areas Header, Main Area, Footer.
14. Right click on the Main area create table line by default line type1 is there select it.
15. Divide line into cells according to your need then for each cell create Text node.
16. In text node general attribute. Write down fields of your work area(wa) or write any thing you want to display.
17. Save form and activate it.
18. Then go to Environment, function module name, there you get the name of function module copy it.
19. In your program call the function module that you have copied from your form.
20. In your program in exporting parameter of function pass the internal table(itab).
SAP Smart Forms is introduced in SAP Basis Release 4.6C as the tool for creating and maintaining forms.
SAP Smart Forms allow you to execute simple modifications to the form and in the form logic by using simple graphical tools; in 90% of all cases, this won't include any programming effort. Thus, a power user without any programming knowledge can
configure forms with data from an SAP System for the relevant business processes.
To print a form, you need a program for data retrieval and a Smart Form that contains the entire from logic. As data retrieval and form logic are separated, you must only adapt the Smart Form if changes to the form logic are necessary. The application program passes the data via a function module interface to the Smart Form. When activating the Smart Form, the system automatically generates a function module. At runtime, the system processes this function module.
You can insert static and dynamic tables. This includes line feeds in individual table cells, triggering events for table headings and subtotals, and sorting data before output.
You can check individual nodes as well as the entire form and find any existing errors in the tree structure. The data flow analysis checks whether all fields (variables) have a defined value at the moment they are displayed.
SAP Smart Forms allow you to include graphics, which you can display either as part of the form or as background graphics. You use background graphics to copy the layout of an existing (scanned) form or to lend forms a company-specific look. During printout, you can suppress the background graphic, if desired.
SAP Smart Forms also support postage optimizing.
Also read SAP Note No. 168368 - Smart Forms: New form tool in Release 4.6C
What Transaction to start SAP Smart Forms?
Execute transaction SMARTFORMS to start SAP Smart Forms.
Key Benefits of SAP Smart Forms:
SAP Smart Forms allows you to reduce considerably the implementation costs of mySAP.com solutions since forms can be adjusted in minimum time.
You design a form using the graphical Form Painter and the graphical Table Painter. The form logic is represented by a hierarchy structure (tree structure) that consists of individual nodes, such as nodes for global settings, nodes for texts, nodes for output tables, or nodes for graphics.
To make changes, use Drag & Drop, Copy & Paste, and select different attributes.
These actions do not include writing of coding lines or using a Script language.
Using your form description maintained in the Form Builder, Smart Forms generates a function module that encapsulates layout, content and form logic. So you do not need a group of function modules to print a form, but only one.
For Web publishing, the system provides a generated XML output of the processed form.
Smart Forms provides a data stream called XML for Smart Forms (XSF) to allow the use of 3rd party printing tools. XSF passes form content from R/3 to an external product without passing any layout information about the Smart Form.
SmartForms System Fields
Within a form you can use the field string SFSY with its system fields. During form processing the system replaces these fields with the corresponding values. The field values come from the SAP System or are results of the processing.
System fields of Smart Forms
&SFSY-DATE&
Displays the date. You determine the display format in the user master record.
&SFSY-TIME&
Displays the time of day in the form HH:MM:SS.
&SFSY-PAGE&
Inserts the number of the current print page into the text. You determine the format of the page number (for example, Arabic, numeric) in the page node.
&SFSY-FORMPAGES&
Displays the total number of pages for the currently processed form. This allows you to include texts such as'Page x of y' into your output.
&SFSY-JOBPAGES&
Contains the total page number of all forms in the currently processed print request.
&SFSY-WINDOWNAME&
Contains the name of the current window (string in the Window field)
&SFSY-PAGENAME&
Contains the name of the current page (string in the Page field)
&SFSY-PAGEBREAK&
Is set to 'X' after a page break (either automatic [Page 7] or command-controlled [Page 46])
&SFSY-MAINEND&
Is set as soon as processing of the main window on the current page ends
&SFSY-EXCEPTION&
Contains the name of the raised exception. You must trigger your own exceptions, which you defined in the form interface, using the user_exception macro (syntax: user_exception <exception name >).
Example Forms Available in Standard SAP R/3
SF_EXAMPLE_01
Simple example; invoice with table output of flight booking for one customer
SF_EXAMPLE_02
Similar to SF_EXAMPLE_01 but with subtotals
SF_EXAMPLE_03
Similar to SF_EXAMPLE_02, whereby several customers are selected in the application program; the form is called for each customer and all form outputs are included in an output request
Advantages of SAP Smart Forms
SAP Smart Forms have the following advantages:
1. The adaption of forms is supported to a large extent by graphic tools for layout and logic, so that no programming knowledge is necessary (at least 90% of all adjustments). Therefore, power user forms can also make configurations for your business processes with data from an SAP system. Consultants are only required in special cases.
2. Displaying table structures (dynamic framing of texts)
3. Output of background graphics, for form design in particular the use of templates which were scanned.
4. Colored output of texts
5. User-friendly and integrated Form Painter for the graphical design of forms
6. Graphical Table Painter for drawing tables
7. Reusing Font and paragraph formats in forms (Smart Styles)
8. Data interface in XML format (XML for Smart Forms, in short XSF)
9. Form translation is supported by standard translation tools
10. Flexible reuse of text modules
11. HTML output of forms (Basis release 6.10)
12. Interactive Web forms with input fields, pushbuttons, radio buttons, etc. (Basis-Release 6.10) -
Hi all,
Its very urgent for me to develop RTF template so please any one have templates for the following reports.
1.AR invoice.
2.Customer Statements.
3.Dunning Letter Print.
please any one have templates for the above reports please send immediately and it will be great helpful for me. my mail id is [email protected]
Thanks and Regards
PrabuHi Ratnesh/Prabhu
I am working on AR Invoice Report. can anybody send me the Template pls.
my yahoo id is [email protected] along with source code.
Ratnesh: I have some issues with this report
We have seeded reports in Oracle apps. Lets take an example of a purchase order report. Say the seeded out-of-the-box report has the following information:
PO number, PO details
I can go ahead and use the template builder and create a nice looking report with that information.
Now, lets say that I want to display the supplier name in my purchase order report. Since the seeeded purchase order report does not have the supplier name (it is not there in the xml generated by the standard out-of-the-box report), the only way I can display the supplier name on the report is by querying up the supplier table and getting that information. I know that I can go ahead and modify the existing out-of-the-box report, but I do not want to do that. I do not have control over the XML that is generated since the XML is generated when the report is run. Is there any way to retrieve the extra information (the supplier name in this example) AFTER the xml has been generated and BEFORE the template is applied ?
My Actual requirement is :
I have the same requirement to develop AR Invoice Report in XML publisher, actually it was developed using Optio Layout.my issue is the actual AR Invoice RDF contains 20 records and it showing the 20 recodes when we run that program (concurrent program output) after that while printing this report uisng the OPTIO layout (The Optio system is fetching some more records (10 records)) it printing total 30 records. i mean here the OPTIO is handling some pl/sql code i guess..
so now how we can handle this requirement using XMLP.I am using RTF Templates with 5.6.2 v. Is it possible to do the same manner how the OPTIO was doing. Is this possible with any other Templates ?. or we need to customize the RDF itself ? .but I know that I can go ahead and modify the existing out-of-the-box report, but I do not want to do that. I do not have control over the XML that is generated since the XML is generated when the report is run. Is there any way to retrieve the extra information AFTER the xml has been generated and BEFORE the template is applied ?
I really appriciate u r replay..
Thanks,
Madhu -
Simple BOM with sub-items (very very urgent)--1 item & 2 subitem
Hi all,
i am creating a BOM with sub-items using 'BAPI_MATERIAL_BOM_GROUP_CREATE'. while creating sub-item, it is taking only one subitem. but i am giving multiple sub-items per item.
i am giving a program where i am assigning 2 subitems to one item.
after tha bapi call, 1 subitem is creating.
i have tried so many times by clearing the work area & calling the bapi for each sub-item.but it is creating only one sub-item only.
i am giving an example of my report.plz correct it if i am wrong.it is veryt very urgent.
any idea will be highly appreaciated.
Regards
pabitra
REPORT ZTEST_CHIN message-id 01.
This code will create a material BoM for the material
MAINMATERIAL with the components COMPON1 and COMPON2.
Data Declaration
DATA:
it_bomgroup LIKE bapi1080_bgr_c OCCURS 0 WITH HEADER LINE,
it_variants LIKE bapi1080_bom_c OCCURS 0 WITH HEADER LINE,
it_items LIKE bapi1080_itm_c OCCURS 0 WITH HEADER LINE,
it_matrel LIKE bapi1080_mbm_c OCCURS 0 WITH HEADER LINE,
it_itemas LIKE bapi1080_rel_itm_bom_c OCCURS 0 WITH HEADER LINE,
it_return LIKE bapiret2 OCCURS 0 WITH HEADER LINE,
it_subitems LIKE bapi1080_sui_c OCCURS 0 WITH HEADER LINE,
it_subitemas LIKE BAPI1080_REL_SUI_ITM_C OCCURS 0 WITH HEADER LINE.
Fill the data
Material BoM Group Header Data
CLEAR it_bomgroup.
it_bomgroup-bom_group_identification = 'BAPI_SMP_COL1'.
it_bomgroup-object_type = 'BGR'.
it_bomgroup-object_id = 'SIMPLE1'.
it_bomgroup-bom_usage = '1'. " YOU COULD CHANGE THE BOM USAGE TO YOUR
it_bomgroup-ltxt_lang = sy-langu.
it_bomgroup-technical_type = ' '.
it_bomgroup-bom_text = 'Simple BoM - FM'.
APPEND it_bomgroup.
Header Details of the different variants
CLEAR it_variants.
it_variants-bom_group_identification = 'BAPI_SMP_COL1'.
it_variants-object_type = 'BOM'.
it_variants-object_id = 'SIMPLE1'.
it_variants-alternative_bom = '01'.
it_variants-bom_status = '01'.
it_variants-base_qty = '1.000'.
it_variants-valid_from_date = sy-datum.
it_variants-function = 'NEW'.
APPEND it_variants.
Details of the materials of the different variants
CLEAR it_matrel.
it_matrel-bom_group_identification = 'BAPI_SMP_COL1'.
it_matrel-material = 'BAPIBOMFG1'.
it_matrel-bom_usage = '1'.
it_matrel-alternative_bom = '01'.
APPEND it_matrel.
Linking subitems to the corresponding variants
CLEAR it_subitemas.
it_subitemas-bom_group_identification = 'BAPI_SMP_COL1'.
it_subitemas-sub_object_type = 'SUI'.
it_subitemas-sub_object_id = 'SIM1'.
it_subitemas-super_object_type = 'ITM'.
it_subitemas-super_object_id = 'SIMPLE1'.
APPEND it_subitemas.
Linking items to the corresponding variants
CLEAR it_itemas.
it_itemas-bom_group_identification = 'BAPI_SMP_COL1'.
it_itemas-sub_object_type = 'ITM'.
it_itemas-sub_object_id = 'SIMPLE1'.
it_itemas-super_object_type = 'BOM'.
it_itemas-super_object_id = 'SIMPLE1'.
it_itemas-valid_from_date = sy-datum.
it_itemas-function = 'NEW'.
APPEND it_itemas.
Details of the items of the variants
CLEAR it_items.
it_items-bom_group_identification = 'BAPI_SMP_COL1'.
it_items-object_type = 'ITM'.
it_items-object_id = 'SIMPLE1'.
it_items-item_no = '0010'.
it_items-item_cat = 'L'.
it_items-component = 'BAPIBOMRW1'.
it_items-comp_qty = '2'.
it_items-valid_from_date = sy-datum.
APPEND it_items.
CLEAR it_subitems.
it_subitems-bom_group_identification = 'BAPI_SMP_COL1'.
it_subitems-object_type = 'SUI'.
it_subitems-object_id = 'SIM1'.
it_subitems-subitem_no = '0001'.
it_subitems-INSTALLATION_POINT = 'ab1'.
it_subitems-subitem_qty = '1'.
APPEND it_subitems.
CALL FUNCTION 'BAPI_MATERIAL_BOM_GROUP_CREATE'
EXPORTING
all_error = 'X'
TABLES
bomgroup = it_bomgroup
variants = it_variants
items = it_items
materialrelations = it_matrel
itemassignments = it_itemas
subitems = it_subitems
subitemassignments = it_subitemas
return = it_return.
CLEAR it_subitems.
it_subitems-bom_group_identification = 'BAPI_SMP_COL1'.
it_subitems-object_type = 'SUI'.
it_subitems-object_id = 'SIM1'.
it_subitems-subitem_no = '0002'.
it_subitems-INSTALLATION_POINT = 'ab2'.
it_subitems-subitem_qty = '1'.
APPEND it_subitems.
CALL FUNCTION 'BAPI_MATERIAL_BOM_GROUP_CREATE'
EXPORTING
all_error = 'X'
TABLES
bomgroup = it_bomgroup
variants = it_variants
items = it_items
materialrelations = it_matrel
itemassignments = it_itemas
subitems = it_subitems
subitemassignments = it_subitemas
return = it_return.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
LOOP AT it_return.
WRITE:/ it_return-type, it_return-id, it_return-number,
it_return-message.
ENDLOOP.Hi rich,
Thanks. i will do the same.can u plz suggest me , where i am doing mistake in my coding to create sub-items in a BOM?
Thanks & Regards
pabi -
File Upload Help Needed - Very Urgent
Dear All
I am making a application in Webdynpro for uploading an excel file to the server. Can someone give me a demo application so that I can run it and see whether my server is configured or not. Also I have made the application right now and have coded the need full. But when I select a file and say submit it shows me a page not found error. Currently I am working round the clock on my project and am stuck up here. Its very urgent can any body help please with an example or a demo application.
Regards GauravHi,
Check whether in server, MultipartBodyParameterName property is set to "com.sap.servlet.multipart.body" . You can check this by going to Visual Admin -> Cluster tab -> Services -> web container -> Properties sheet.
Do assign points if i answered your question.
Regards
Vasu -
Fields for table-----very very urgent
Hi all,
my company is following BAPI instead of IDOC for it's EDI immplementation.so i am writing a report for 856 signal(shipment notice).the procedure is like this.
after shipment creation,i will download all the PO,SO & shipment data to a text file(edi format).then we will transfer this file to 3rd party EDI software.then that software will send that signal or file to our customer.
i need some datas to download. but i am not getting those fields.you can find these fields in the 856 document of EDI.those field descriptions are like
1)packaging code
2)SCAC code
3)shipment method of payment
4)waybill number
5)duns number
6)entity identification code for customer
7)measurement reference code for packing item (pallet)
8)measurement qualifier for packing item like pallet
9)title transfer date & title transfer time
it is very very urgent.plz suggest.helpful answers will be rewarded.
any suggestion will be highly appreaciated.
Regards
pabitra<b> ALV_GRID_DISPLAY, how to ovewrite subtotal obtained by ALV sort</b>
I want to overwrite the subtotal value in column C (Currently 60 ) which i got using standard ALV sort.
Example: using ALV_LIST_DISPLAY function module & sort functionality:
Column-A____Column-B_____Column-C____Column-D
K1____________2_____________10__________20
K1____________2_____________20__________40
K1____________3_____________30__________90
subtotal:________7____________60_________150
Note : Each row in Column C is calculated as D/B.
I would like to extend the calculation in subtotals also.
But subtotals give me the sum of values in C.
In column C,I want 150/7 (subtotal of D / subtotal of B)
I.E., Column C = 150 / 7 = 21.42.
Any inputs regarding my problem would be much appreciated.
Thanks in advance !! -
How to write code for this logic in a routine, very urgent --help me
hi all,
i want to apply this logic into one subroutin ZABC.
here i m giving my logic ,can any body help me in coding for this, this is very urgent, i hv to submit on wednesday.
4.1 Read the company code number BSEG-BUKRS from document line item.
4.2 Fetch PRDHA from MARA into GV_PRDHA where MATNR = BSEG-MATNR.
4.3 Fetch Business area (GSBER) from ZFIBU into GV_GSBER where (PRDHA = GV_PRDHA and BUKRS = BSEG-BUKRS) OR (PRDHA = GV_PRDHA and BUKRS = SPACE).
4.4 If business area match is found, go to step 3.9. Else continue.
4.5 If BKPF-BLART IN set ZVS_POSDT OR BKPF-XBLNR starts with I0*, execute steps below. Else, go to Step 3.6.
i. MOVE: BSEG-BKURS TO work area field WA_ZFIBUE-BUKRS,
BSEG-MATNR TO work area field WA_ZFIBUE-MATNR,
GV_PRDHA TO work area field WA_ZFIBUE-PRDHA,
BSEG-HKONT TO work area field WA_ZFIBUE-HKONT,
BSEG-GSBER TO work area field WA_ZFIBUE-GSBER,
BSEG-PSWBT TO work area field WA_ZFIBUE-PSWBT,
BKPF-BUDAT TO work area field WA_ZFIBUE-BUDAT,
SY-DATUM TO work area field WA_ZFIBUE-CREDATE,
SY-UZEIT TO work area field WA_ZFIBUE-CRETIME,
Fetch running serial number (WA_ZFIBUE-SERIALNO) from ZFICO. This number will be stored in ZFICO with PARAMTYPE = "BPM030307", SUBTYPE = "ZFIBUE" and KEY1 = "SERIALNO". The actual serial number will be stored in the field VALUE1.
i. Insert WA_ZFIBUE INTO ZFIBUE.
ii. Send email notification to the user (if it is not already sent to user on the same posting date).
Use function module SO_NEW_DOCUMENT_ATT_SEND_API1 to send mail.
Fetch email address and date of last email from ZFICO. These values will be stored in ZFICO with PARAMTYPE = "BPM030307", SUBTYPE = "EMAIL" and KEY1 = "<USERNAME>". The email address will be stored in the field VALUE1 and posting date in VALUE2. Once mail is sent, VALUE2 is updated with latest posting date (BKPF-BUDAT).
iii. Increment the running serial number and update ZFICO with new serial number.
a. GV_ SERIALNO = WA_ZFIBUE-SERIALNO + 1
b. Update ZFICO Set value1 = GV_SERIALNO
Where PARAMTYPE = "BPM030307" AND
SUBTYPE = "ZFIBUE" AND
KEY1 = "SERIALNO".
iv Move VDFT to BSEG-GSBER.
v. Exit routine.
4.6 Fetch MTART into GV_MTART from MARA where MATNR = BSEG-MATNR.
4.7 If SY-BATCH = INITIAL AND GV_MTART <> ROH, issue the error message - Maintain the mapping of product hierarchy <PRDHA> from article <MATNR> for <BUKRS>. Else, go to step 3.8.
4.8 If SY-BATCH <> INITIAL AND GV_MTART <> ROH, issue the error message - Maintain product hierarchy on article master. Go to step 3.10.
4.9 Move GV_GSBER TO BSEG-GSBER.
4.10 Exit Routine
plz give me reply asap --this is very urgent
thanks in advance
swathiHi Swathi,
If it's very very urgent then you better get on with it, don't waste time on the web. Chop chop. -
Open items for purchase order its very urgent
hi
my requirement is to write extract program for purchase order(me21) to extract only open items.
please provide sample code its very urgent.
thanks in advance.
points will be rewarded.
thanks
hari prasad reddycheck the below report :
REPORT ZMM_OPEN_PO_REPORT no standard page heading
line-size 255
message-id zwave.
======================================================================
Program Name : ZMM_OPEN_PO_REPORT *
Description : This report displays all Open PO Items and output *
would be PO Number,Material number and so on *
Author : Seshu *
Date : 01/24/2007 *
MODIFICATION HISTORY *
DATE | AUTHOR | CHANGE # | DESCRIPTION OF MODIFICATION *
--|||--
01/24/07| Seshu | DEVK921979 | Initial *
D A T A D E C L A R A T I O N P A R T ***
type-pools
type-pools : slis.
Tables
tables : ekko, " Purchase order Header
ekpo, " Purchase order Item
marc. " Material with Plant data
Internal table for output.
data : begin of i_output occurs 0,
ebeln like ekko-ebeln,
matnr like ekpo-matnr,
end of i_output.
ALV Data declaration.
data : v_repid like sy-repid.
ALV Function Module Variables
DATA: gs_layout type slis_layout_alv,
g_exit_caused_by_caller,
gs_exit_caused_by_user type slis_exit_by_user.
DATA: gt_fieldcat type slis_t_fieldcat_alv,
gs_print type slis_print_alv,
gt_events type slis_t_event,
gt_list_top_of_page type slis_t_listheader,
g_status_set type slis_formname value 'PF_STATUS_SET',
g_user_command type slis_formname value 'USER_COMMAND',
g_top_of_page type slis_formname value 'TOP_OF_PAGE',
g_top_of_list type slis_formname value 'TOP_OF_LIST',
g_end_of_list type slis_formname value 'END_OF_LIST',
g_variant LIKE disvariant,
g_save(1) TYPE c,
g_tabname_header TYPE slis_tabname,
g_tabname_item TYPE slis_tabname,
g_exit(1) TYPE c,
gx_variant LIKE disvariant.
data : gr_layout_bck type slis_layout_alv.
Ranges
ranges r_eindt for eket-eindt.
initialization.
v_repid = sy-repid.
start-of-selection.
Get the data from EKKO ,EKPO and MARC Table
perform get_data_tables.
end-of-selection.
display the data in the form of ALV
perform display_data.
*& Form get_data_tables
Get the data from EKKO,EKPO and MARC Table
FORM get_data_tables.
clear : i_output.
refresh : i_output.
fill the dates in ranges
r_eindt-low = sy-datum - 7.
r_eindt-high = sy-datum + 14.
r_eindt-option = 'BT'.
r_eindt-sign = 'I'.
append r_eindt.
Get the data from EKKO,EKPO and EKET Tables
select aebeln bmatnr into table i_output
from ekko as a inner join
ekpo as b on aebeln = bebeln
inner join marc as c on cmatnr = bmatnr
inner join mara as d on dmatnr = bmatnr
inner join eket as e on eebeln = aebeln
and eebelp = bebelp
where c~beskz = 'E'
and c~werks = '1000'
and d~mtart = 'FERT'
and b~loekz = space
and b~elikz = space
and e~eindt in r_eindt.
if sy-subrc ne 0.
message e000(zwave) with 'No open purchase order found'.
endif.
ENDFORM. " get_data_tables
*& Form display_data
text
FORM display_data.
Fill the Fiedlcat
PERFORM fieldcat_init using gt_fieldcat[].
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 = ' '
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 = gr_layout_bck
IT_FIELDCAT = gt_fieldcat[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = g_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. " display_data
*& Form fieldcat_init
text
-->P_GT_FIELDCAT[] text
FORM fieldcat_init USING e01_lt_fieldcat type slis_t_fieldcat_alv.
DATA: LS_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
Purchase order number
CLEAR LS_FIELDCAT.
LS_FIELDCAT-FIELDNAME = 'EBELN'.
LS_FIELDCAT-ref_fieldname = 'EBELN'.
LS_FIELDCAT-ref_tabname = 'EKKO'.
LS_FIELDCAT-TABNAME = 'I_OUTPUT'.
ls_fieldcat-seltext_L = 'Purchase Order'.
ls_fieldcat-seltext_M = 'Purchase Order'.
ls_fieldcat-seltext_S = 'Purchase Order'.
APPEND LS_FIELDCAT TO E01_LT_FIELDCAT.
Material #
CLEAR LS_FIELDCAT.
LS_FIELDCAT-FIELDNAME = 'MATNR'.
LS_FIELDCAT-ref_fieldname = 'MATNR'.
LS_FIELDCAT-ref_tabname = 'EKPO'.
LS_FIELDCAT-TABNAME = 'I_OUTPUT'.
ls_fieldcat-seltext_L = 'Material'.
ls_fieldcat-seltext_M = 'Material'.
ls_fieldcat-seltext_S = 'Material'.
APPEND LS_FIELDCAT TO E01_LT_FIELDCAT.
ENDFORM. " fieldcat_init
Maybe you are looking for
-
I am using webutil function WEBUTIL_FILE.FILE_EXISTS function to check the existence of the file. The problem is if there is no file in the specified path the application throws an exception defined as WHEN OTHERS . As the WHEN OTHERS is so generic,
-
How do you get pass the Terms & Conditions page while downloading iOS7. Nothing happens when press AGREE
-
SpeedGrade CC 7.1 for Mac cannot be updated to 7.2. help please
I have SpeedGrade CC 7.1.0 on my MacBook Pro retina 15 inches running OSX 10.9. I learned that 7.2 has been released but it won't show up in AAM Updater. so I proceed to download the Updater and run it manually. The result: Update failed. the update
-
Rename presentation layer catalog
Hi, I have renamed the presentation layer catalog in RPD. When I am seeing the dashboard all the reports are getting displayed but when I see the individual reports I am getting :"Either you do not have permission to use the subject area X within Ans
-
what do i do about this message?