We can help. Together we learn....

Changing field descriptions

by Voice | Monday, July 13, 2009 in | comments (0)

If you want to change the label/field description for any SAP table field, then you can use the following method.

  1. Goto CMOD.
  2. Goto-Text Enhancement-key words-change
  3. Enter the field name
  4. Change the description.
  5. Save.
  6. Goto SE11, check field description.

Info - For all select

by Voice | Tuesday, May 05, 2009 in | comments (0)

1. Before doing a for all select, just make sure the internal table you are using for all select is not empty (INITIAL). If it is empty then for all select will fetch all the records in the database and thay may be a problem. So be careful.


2. Mechanism of for all select: SAP first fetches all the record and then it sort the records found and then it does a delete duplicates comparing all the fields. So, if you want to retrieve all the records, you MUST select all the key fields or else you will lose some records.

Try it for youself:
Check the number of records present in the database table and the number of records present in internal table.


REPORT  Z000_TEST_FOR_ALL_SELECT.

types: begin of ty_dd02l,
         tabname type tabname,
       end of ty_dd02l,

       begin of ty_dd03l,
         tabname type tabname,
         KEYFLAG type KEYFLAG,
       end of ty_dd03l.

data: i_dd02l type standard table of ty_dd02l initial size 0,
      i_dd03l type standard table of ty_dd03l initial size 0.

data: v_tabname type dd02l-tabname.
select-options s_table for v_tabname.

select TABNAME
   from dd02l
  into table i_dd02l
  where tabname in s_table.

IF sy-subrc = 0.
  select TABNAME
         KEYFLAG
    from dd03l
    into table i_dd03l
    for all entries in i_dd02l
    where tabname = i_dd02l-tabname.

  IF sy-subrc = 0.

  ENDIF.
ENDIF.


Field symbol - Info

by Voice | Monday, April 27, 2009 in | comments (0)

SAP recommends that you should only use field symbol when you can not achieve the same functionality by other means. 

Performance wise it is better to use field symbols but if not used properly, it can give a short dump. With conventional work area method, syntax checker is able to detect most of such errors incorporated in the code. But with field symbol it is unable to do so and hence unless and until you are very sure about the use, field symbols may back fire on you.

Below is one sample code which can help you in understanding the use of field symbols. Like a work are or table, field symbols can be declared by using a structure or it can be left unassigned and in this case it take the structure of the variable with which it is referred for the first time.

Field-symbols become indespensible when in your program there is a need to create a work area name or field name or internal table name dynamically. 

In this example, field symbols are used to call an internal table dynamically. You can extrapolate the same concept to work area and variables.

----------------------------------------------------------------------------------------------
PARAMETERS: p_1 TYPE tdobject.

DATA: i_stxh TYPE STANDARD TABLE OF stxh,
      w_stxh TYPE stxh.

SELECT * FROM stxh
INTO TABLE i_stxh
WHERE tdobject = p_1.

FIELD-SYMBOLS <i_t> TYPE ANY table.
FIELD-SYMBOLS <w_t> TYPE ANY.
data: name(10TYPE c.
data: name1(10TYPE c.

name = 'I_STXH'.
name1 = 'W_STXH'.
ASSIGN (name) TO <i_t>.
ASSIGN (name1) TO <w_t>.

IF sy-subrc = 0.

ENDIF.

LOOP AT <i_t> INTO <w_t>.

ENDLOOP.
 



--------------------------------------------------------------------------------------------------------------------------------------------------------
If you wish to assign content on one field symbol to other field symbol you can use,
assign <fs1> to <fs2>.

We are moving to a better and faster site SAPYard.com  (http://www.sapyard.com/).

This content has been moved to the below link. Please visit it at your convenience. Thank you for your patience and cooperation.

http://www.sapyard.com/using-idoc-output-type-special-processing-options/

IDocs using Change Pointers - Useful Transactions

1. BD21 - Creating IDoc Types from Change Pointers
Sometimes lot of Change Pointer gets created, but fails to get processed due to system issues.
This t-code is quite helpful to generate IDocs from unprocessed change pointers. The status of change pointer can easily be checked from BDCPV table/view.

2. BD22 -Delete Change Pointers
This one is also quite helpful in production environment. Sometimes we can have scenarios where a lot of change pointers gets created due to some erroneous configuration or settings. In order to remove them from the system and clear up the associated tables, this t-code is quite helpful.

3. Reprocessing Successful IDocs again

Using BD87, we cannot re-process successful IDocs again, but sometime certain issues may require us to re-send an already processed successful IDoc.

Also, If the number of Idocs that needed to be retransmitted is limited, then you can retransmit them from the concerned application like Shipment, Delivery, Purchase Order by Reprocessing the Output Type.

But when we need to transmit multiple IDocs, using the standard program RC1_IDOC_SET_STATUS is quite helpful.

You can go to WE02 or WE09, copy all the processed IDoc numbers and paste them after executing this program in SE38. You would also need to specify the new IDoc status .

If you need to process this IDoc again using BD87, you cann;t directly set the same to 30 ( IDoc ready for dispatch), as BD87 remembers the last status (which was '53'- Application document posted) and hence wouldn't again process this IDoc.

Hence we can change the status to say some intermediate one like 32 - (Idoc was edited) and then again run this program and change the status t0 30 from 32.

After that we can again process this IDocs using BD87 and re-send them to the external system like EDI.

 

Sometime the requirement is such that search help is required from the values obtained in run time or from constant values. In this you can use the FM: F4IF_INT_TABLE_VALUE_REQUEST to meet your purpose. The basic logic is that it uses data from the internal table to show in the F4 search help.

 

Example: Here an internal table is populated with some constants. This program is just for guideline.

 

* Type for internal table for populating the file-type

 Types: BEGIN OF x_filtyp,

              filetype TYPE char3,          " File type

              description TYPE char50,      " description

             END OF x_filtyp.

 

***********************************************************************

* INTERNAL TABLES                                                     *

***********************************************************************

DATA:

* File type

i_filtyp TYPE STANDARD TABLE OF x_filtyp INITIAL SIZE 0,

 

PARAMETERS: p_file(3) TYPE c.

 

***********************************************************************

* INITIALIZATION                                                      *

***********************************************************************

INITIALIZATION.

*Populating file type in an internal table

  PERFORM sub_filtyp.

 

 

***********************************************************************

* AT SELECTION-SCREEN                                                 *

***********************************************************************

AT SELECTION-SCREEN.

* On value request for p_filtyp

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_filtyp .

  PERFORM sub_get_help_filtyp USING p_file.

 

*&---------------------------------------------------------------------*

*&      Form  sub_filtyp

*&---------------------------------------------------------------------*

FORM sub_filtyp.

 

* local variables

  DATA: l_wa_filtyp TYPE x_filtyp.   "work area

 

* Appending row

  l_wa_filtyp-filetype = c_a.

  l_wa_filtyp-description = 'Alphabet A'.

  APPEND l_wa_filtyp TO i_filtyp.

* Appending row

  l_wa_filtyp-filetype = c_b.

  l_wa_filtyp-description = 'Alphabet B'.

  APPEND l_wa_filtyp TO i_filtyp.

 

ENDFORM.                    "sub_filtyp

 

*&---------------------------------------------------------------------*

*&      Form  sub_get_help_filtyp

*&---------------------------------------------------------------------*

FORM sub_get_help_filtyp USING l_filtyp .

 

* local vairables

  DATA: l_dynfld    TYPE dynfnam,          "Screen Field Name

        l_retfld    TYPE fieldname,        "Return Field Name

        l_i_fields TYPE STANDARD TABLE OF dfies,    "for call function

        l_i_return TYPE TABLE OF ddshretval,        "for call function

        l_wa_field  TYPE dfies,                     "work area

        l_wa_return TYPE ddshretval,                "work

        l_wa_value  TYPE seahlpres,

        l_i_value   TYPE STANDARD TABLE OF seahlpres,

        l_i_mapping TYPE STANDARD TABLE OF dselc,

        l_wa_mapping TYPE dselc.

 

  l_wa_mapping-fldname = 'DESCRIPTION'.

  APPEND l_wa_mapping TO l_i_mapping.

 

  l_wa_field-fieldname = 'FILETYPE'.

  l_wa_field-tabname = 'I_FILTYP'.

  l_wa_field-intlen    = 6.

  l_wa_field-leng      = 6.

  l_wa_field-outputlen = 6.

  l_wa_field-position = 1 .

  l_wa_field-scrtext_s = l_wa_field-fieldname.

  l_wa_field-scrtext_m = l_wa_field-fieldname.

  l_wa_field-scrtext_l = l_wa_field-fieldname.

  l_wa_field-reptext   = l_wa_field-fieldname.

  APPEND l_wa_field TO l_i_fields.

  CLEAR l_wa_field .

 

  l_wa_field-fieldname = 'DESCRIPTION'.

  l_wa_field-tabname = 'I_FILTYP'.

*  l_wa_field-OFFSET = 3.

  l_wa_field-intlen    = 50.

  l_wa_field-leng      = 50.

  l_wa_field-outputlen = 50.

  l_wa_field-position = 2 .

  l_wa_field-scrtext_s = l_wa_field-fieldname.

  l_wa_field-scrtext_m = l_wa_field-fieldname.

  l_wa_field-scrtext_l = l_wa_field-fieldname.

  l_wa_field-reptext   = l_wa_field-fieldname.

  APPEND l_wa_field TO l_i_fields.

 

  LOOP AT i_filtyp INTO wa_filtyp.

    l_wa_value-string  = wa_filtyp-filetype.

    APPEND l_wa_value TO l_i_value.

    l_wa_value-string  = wa_filtyp-description.

    APPEND l_wa_value TO l_i_value.

  ENDLOOP.

 

  l_retfld = 'FILETYPE'.

  l_dynfld = l_filtyp.

 

* call fucntion for search help

  CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

    EXPORTING

      retfield         = l_retfld

      dynpprog         = sy-repid

      dynpnr           = sy-dynnr

      dynprofield      = l_dynfld

      window_title     = 'Filetype'

*      value_org        = 'S'

      callback_program = sy-repid

    TABLES

      value_tab        = l_i_value

      field_tab        = l_i_fields

      return_tab       = l_i_return

*      dynpfld_mapping  = l_i_mapping

    EXCEPTIONS

      parameter_error  = 1

      no_values_found  = 2

      OTHERS           = 3.

 

  IF sy-subrc NE 0.

   

  ELSE.

 

    READ TABLE l_i_return INTO l_wa_return

                WITH KEY fieldname = 'FILETYPE'.

    IF sy-subrc EQ 0.

      l_filtyp = l_wa_return-fieldval.

    ENDIF.

 

  ENDIF.

ENDFORM.                    " sub_get_help_filtyp

 

 

You can add your code in AT SELECTION-SCREEN for establishing dependency on two or more selection screen parameters.

 

Example:

 

PARAMETERS: p_matnr TYPE matnr,
p_check TYPE char1.

AT SELECTION-SCREEN.
IF p_matnr = '000000000000000023' .
p_check = '1'.
ELSEIF p_matnr = '1697'.
p_check = 2.
ENDIF.

  

 

Output

For P_matnr = 23 (selected by user), p_check will be automatically populated 1 and 2 for p_matnr = 1697.

We are moving to a better and faster site SAPYard.com  (http://www.sapyard.com/).

The content has been moved to below link. Please visit it at your convenience. Thank you for all your cooperation.



Categories