Sunday, July 25, 2010

ABAP: Customized F4 help

If we use F4 help on one field and want to transfer values for another field on the screen with values based  the input field.


    data loto TYPE TABLE OF dselc.

    data ls_loto TYPE dselc.


Fill DYNPFLD_MAPPING with fieldname and screen-name

    ls_loto-fldname = 'CARRID'.

    ls_loto-dyfldname = 'ABC'.

    APPEND ls_loto to loto.

    CLEAR ls_loto.

     ls_loto-fldname = 'CONNID'.

    ls_loto-dyfldname = 'ABCD'.

    APPEND ls_loto to loto.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

  EXPORTING

   DDIC_STRUCTURE         = 'SFLIGHT'

    retfield               = 'CARRID'

   DYNPPROG               = sy-repid

   DYNPNR                 = sy-dynnr

   DYNPROFIELD            = 'ABC'

   VALUE_ORG              = 'S'

  tables

    value_tab             = it_sflight

   FIELD_TAB              = lot

   RETURN_TAB             = ret

   DYNPFLD_MAPPING        = loto.



This will automatically fill the other field as well (here CONNID).

ABAP: Display table in long text of message

Sometimes we need to pass a table alongwith the message longtext.
It's simple but with a small catch , we need to pass the table as we are using 'Script'.
Sample code:
Call FM : RKE_POPUP_TEXT_DECIDE_VARTEXT
Data : L_TEXTTAB LIKE TLINE OCCURS 0 WITH HEADER LINE,
L_TEXTTAB-TDFORMAT = 'AS'.
LOOP AT itab.
l_TEXTTAB-TDLINE = itab-value.
CONDENSE L_TEXTTAB-TDLINE.
APPEND L_TEXTTAB.
L_TEXTTAB-TDFORMAT = '/'.
ENDLOOP.
Pass l_textab as TABLES
T_TEXTTAB = L_TEXTTAB.
pass &T& in the long text as command.

ABAP: Switch Application servers internally

Use function module : TH_WPINFO to find the work processes.
Now, find the WP 'ENQUEUE' , the servers having this WP is the central instance of a group of application servers.
To swicth the background jobs internally to different application server , use the 'TARGETSYSTEM' parameter of the 'JOB_CLOSE' FM .
The RFC connection for application servers can be found in SM59 under connection type as 'Internal connection'.