To create a transaction to directly edit a table managed in SM30, go to SE93, create a Transaction with parameters, and follow steps below :
Read MoreTo create a transaction to directly edit a table managed in SM30, go to SE93, create a Transaction with parameters, and follow steps below :
Read MoreValues for GMCODE field can ben found into table T158G.
┌────────┬───────┬──────────────────────────────────────────────────────────┐
│ GMCODE │ TCODE │ Description │
├────────┼───────┼──────────────────────────────────────────────────────────┤
│ 1 │ MB01 │ GM_Code 01: Goods receipt for purchase order │
│ 2 │ MB31 │ GM_Code 02: Goods receipt for production order │
│ 3 │ MB1A │ GM_Code 03: Goods issue │
│ 4 │ MB1B │ GM_Code 04: Transfer posting │
│ 5 │ MB1C │ GM_Code 05: Other goods receipts │
│ 6 │ MB11 │ GM_Code 06: Reversal of goods movements │
│ 7 │ MB04 │ GM_Code 07: Subsequent adjustment to a subcontract order │
└────────┴───────┴──────────────────────────────────────────────────────────┘
Local class :
TYPES : ti_itcsy TYPE STANDARD TABLE OF itcsy WITH DEFAULT KEY.
CLASS lcl_sapscript DEFINITION.
*------------------------------
* Public section
*------------------------------
PUBLIC SECTION.
CLASS-METHODS init_tables IMPORTING input_table TYPE ti_itcsy
output_table TYPE ti_itcsy.
CLASS-METHODS get_input_value IMPORTING iv_field TYPE tdtprgname
RETURNING VALUE(rv_value) TYPE tdsymvalue.
CLASS-METHODS get_output_table RETURNING VALUE(rt_output) TYPE ti_itcsy.
CLASS-METHODS set_output_value IMPORTING iv_field TYPE tdtprgname
iv_value TYPE tdsymvalue
RETURNING VALUE(rt_output) TYPE ti_itcsy.
PRIVATE SECTION.
CLASS-DATA : it_static_tbl_input TYPE ti_itcsy,
it_static_tbl_output TYPE ti_itcsy.
ENDCLASS.
CLASS lcl_sapscript IMPLEMENTATION.
METHOD init_tables.
CLEAR : it_static_tbl_input, it_static_tbl_output.
it_static_tbl_input = input_table.
it_static_tbl_output = output_table.
ENDMETHOD.
METHOD get_input_value.
READ TABLE it_static_tbl_input INTO DATA(ls_table) WITH KEY name = iv_field.
IF sy-subrc = 0.
rv_value = ls_table-value.
ENDIF.
ENDMETHOD.
METHOD set_output_value.
READ TABLE it_static_tbl_output ASSIGNING FIELD-SYMBOL(<fs_output>) WITH KEY name = iv_field.
IF sy-subrc = 0.
<fs_output>-value = iv_value.
ENDIF.
rt_output = it_static_tbl_output.
ENDMETHOD.
METHOD get_output_table.
rt_output = it_static_tbl_output.
ENDMETHOD.
ENDCLASS.
Example of use :
Read MoreUse FM GET_PRINT_PARAM.
Result will be in field E_USR01-SPLD.
Check transaction OMVL
Since v7.40, it is possible to check if a value is into TVARVC table in 1 line of code 😎 :
IF NEW /dmbe/cli_db_tvarv( )->is_value_in_tvarv( i_variant = 'ZTVARVC_NAME' i_value = |{ lv_value }| ).
" Your code here...
ENDIF.
This is one possibility, there are many others…
Have a look on program : RSDEMO_CUSTOM_CONTROL. to insert an image in Dynpro (not selection screen)
check the code below :
Read MoreThis post just to save time, instead of doing where-used on VBELN field…
Type table of VBELN:
– TT_VBELN => TABLE_LINE
– MDS_SALES_KEY_TAB => Champ VBELN (type VBELN_VA)
Type range of VBELN: WTYSC_VBELN_RANGES_TAB
Search tag : type de table
⚠️ This code works only if range values are restricted to Include Equal (I EQ) and domain values are not range of values.
Example of calling code :
DATA : lv_wrong_value TYPE domvalue_l.
PERFORM f_check_range_val_from_domain USING 'MTART'
s_mtart[]
CHANGING lv_wrong_value.
IF lv_wrong_value IS NOT INITIAL.
SET CURSOR FIELD 'S_MTART-LOW' ##NO_TEXT.
MESSAGE i001(zz) WITH lv_wrong_value DISPLAY LIKE 'E'.
" Material type &1 is not valid
ENDIF.
This post just to save time, instead of doing where-used on MATNR field…
Type table of MATNR : TABLE_MATNR => TABLE_LINE
Type range of MATNR : RANGE_T_MATNR
Search tag : type de table