Fm To Update Adrc Table

Posted on -
Fm To Update Adrc Table 7,8/10 5526 votes

'Hi
Does anyone know of any Function module or BAPI
that will change the address in table ADRC.
Thanks,
Kamla

  1. Fm To Update Adrc Table

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

This message is intended for the use of the individual or entity to which
it is addressed and may contain information that is confidential and
privileged and exempt from disclosure under applicable law. If the reader
of this message is not the intended recipient, you are hereby notified that
any dissemination, distribution, or copying of this communication is
strictly prohibited. If you have received this communication in error,
please contact the sender immediately and delete it from your system.
Thank you
*****************************************************************************************************************************************************************************************


'

Can you please advise me on how i can mass-update below fields using a Fm for vendor master record in ECC? Search Term 1, Search term 2 and Remarks field in ADRC table. LFA1 - SPERR, SPERM and SPERQ. Requirement: I need to be able to do this programmatically as I need to create a simple report for an end user.

Skip to end of metadataGo to start of metadata

Consider two tables 'ZXA_HEADER' and 'ZXA_HEADERT'. 'ZXA_HEADERT' is the text table of ZXA_HEADER. When we transport entries in the header table we would also need to transport entries in the text table as well. We can transport objects

1.By adding individual entries to the transport request.
2.By using a Piece list to transport the required objects.
OBJECT_TYPE: 'REPO','KPI','DASH'.

Fm To Update Adrc Table

ZXA_HEADER

Field

Key

Data Type

Length

OBJECTID

Yes

CHAR

60

OBJECT_TYPE

Yes

CHAR

4

OBJVERS

Yes

CHAR

1

XMLROW

STRING

0

GUID

CHAR

36

OWNER

CHAR

12

ZXA_HEADERT

Field

Key

Data Type

Length

LANGU

Yes

LANG

1

OBJECTID

Yes

CHAR

60

OBJECT_TYPE

Yes

CHAR

4

OBJVERS

Yes

CHAR

1

TXTSH

CHAR

TXTLG

CHAR


1.By adding individual entries to the transport request.
It is important to understand structures e071 and e071k. We need one entry of e071 for every table whose entries needs to be transported. e071k contains the key combination of the entry that needs to be transported. Hence we would have entry in e071k for every unique record that needs to be transported.
As in this mechanism we do not use a piece list we have to manually add all dependant table entries from other tables. In this example we need to transport header and then all corresponding entries of the text table individually. If we use a piece list we can determine dependant table and table entries that need to be transported.
REPORT transport_program_table_entries.

DATA:
lt_zxa_header TYPETABLEOF zxa_header,
ls_zxa_header TYPE zxa_header,
lt_zxa_headert TYPETABLEOF zxa_headert,
ls_zxa_headert TYPE zxa_header.

DATA:
l_request TYPE trkorr,
lt_e071 TYPE tr_objects,
lt_e071k TYPE tr_keys,
lv_position TYPE ddposition,
lv_tabkey TYPE trobj_name,
ls_e071 TYPE e071,
ls_e071k TYPE e071k.

//let us assume that we only want to transport objects with object_type 'INVOICE'.SELECT * FROM zxa_header INTOTABLE lt_zxa_header WHERE object_type EQ'INVOICE'.
//transport those only entries in the text table that are in the lt_zxa_header
SELECT * FROM zxa_headert INTOTABLE lt_zxa_headert FOR ALL ENTRIES IN lt_rsxa_header WHERE objectid EQ lt_rsxa_header-objectid AND object_type EQ lt_rsxa_header-object_type
//Create one header row for table ZXA_HEADER.
//E071 contains only one row per table. The objfunc is 'K' if we need to transport //specific entries as specified in the e071k structure.
ls_e071-trkorr = l_request.
ls_e071-as4pos = 1.
ls_e071-pgmid = 'R3TR'.
ls_e071-object = 'TABU'.
ls_e071-obj_name = 'ZXA_HEADER'.
ls_e071-objfunc = 'K'.
ls_e071-lang = sy-langu.

APPEND ls_e071 TO lt_e071.
CLEAR ls_e071.
CLEAR lv_position.
//add all table entries in table ZXA_HEADER that need to be transported to lt_e071k
LOOPAT lt_zxa_header INTO ls_zxa_header.

lv_position = lv_position + 1.

lv_tabkey = ls_rsxa_header-objectid.
lv_tabkey+60 = ls_rsxa_header-object_type.
lv_tabkey+64 = ls_rsxa_header-objvers.

ls_e071k-trkorr = iv_request.
ls_e071k-pgmid = 'R3TR'.
ls_e071k-object = 'TABU'.
ls_e071k-objname = 'ZXA_HEADER'.
ls_e071k-as4pos = iv_position.
ls_e071k-mastertype = 'TABU'.
ls_e071k-mastername = 'ZXA_HEADER'.
ls_e071k-lang = sy-langu.
ls_e071k-tabkey = iv_tabkey.

APPEND ls_e071k TO lt_e071k.
CLEAR ls_e071k.
ENDLOOP.
//Create one header row for table ZXA_HEADERT.
//E071 contains only one row per table. The objfunc is 'K' if we need to transport //specific entries as specified in the e071k structure.
ls_e071-trkorr = l_request.
ls_e071-as4pos = 2.
ls_e071-pgmid = 'R3TR'.
ls_e071-object = 'TABU'.
ls_e071-obj_name = 'ZXA_HEADERT'.
ls_e071-objfunc = 'K'.
ls_e071-lang = sy-langu.

Fm To Update Adrc Table

APPEND ls_e071 TO lt_e071.
CLEAR ls_e071.
CLEAR lv_position.
//add all table entries in table ZXA_HEADER that need to be transported to lt_e071k
LOOPAT lt_zxa_headert INTO ls_zxa_headert.

lv_position = lv_position + 1.

lv_tabkey = ls_zxa_headert-langu.
lv_tabkey+1 = ls_zxa_headert-objectid.
lv_tabkey+61 = ls_zxa_headert-object_type.
lv_tabkey+65 = ls_zxa_headert-objvers.

ls_e071k-trkorr = iv_request.
ls_e071k-pgmid = 'R3TR'.
ls_e071k-object = 'TABU'.
ls_e071k-objname = 'ZXA_HEADERT'.
ls_e071k-as4pos = iv_position.
ls_e071k-mastertype = 'TABU'.
ls_e071k-mastername = 'ZXA_HEADERT'.
ls_e071k-lang = sy-langu.
ls_e071k-tabkey = iv_tabkey.

APPEND ls_e071k TO lt_e071k.
CLEAR ls_e071k.
ENDLOOP.
//To add entries to the transport request we call the following function module
CALLFUNCTION'TR_REQUEST_CHOICE'
EXPORTING
iv_suppress_dialog = 'X'
iv_request = l_request
it_e071 = lt_e071
it_e071k = lt_e071k.


2.By using a Piece list to transport the required objects.

Using a piece list helps in organizing the transports and also is less cumbersome as we only provide the objects in the primary table. The rest of the object are automatically derived and added to the transport request.
Transaction 'SOBJ': Definition of Transportable Object Types. In this transaction we can create a piece list.

Transportable Object Types: http://help.sap.com/saphelp_nw70/helpdata/EN/46/8e540127d02805e10000000a1553f6/frameset.htm

Steps to create a new Transportable Object

a. Create a new entry by clicking on 'New Entries'

b. Type - 'L' for a Logical Transport Object

c. Enter the following properties as shown below and save it.

d. Please enter the piece list for the newly created Transportable Object as shown below. For example for table ZXA_HEADER: '/&' - OBJECTID, 'REPO' - OBJECT_TYPE, 'A' - OBJVERS; ZXA_HEADERT: '/L' - Language, '/&' - OBJECTID, 'REPO' - OBJECT_TYPE, 'A' - OBJVERS.

i. /* is the remaining key parts that only occur in the relevant table, and are not part of the object name.

ii. /L is the language field

iii. A or D is the object version

iv. /& is the name part of the object key.

REPORT transport_program_table_piece_list.

DATA:
lt_zxa_header TYPETABLEOF zxa_header,
ls_zxa_header TYPE zxa_header.

DATA:
l_request TYPE trkorr,
lt_e071 TYPE tr_objects,
l_tran_obj TYPE trobjtype,
ls_e071 TYPE e071.

//let us assume that we only want to transport objects with object_type 'INVOICE'.SELECT * FROM zxa_header INTOTABLE lt_zxa_header WHERE object_type EQ'INVOICE'.
//crate ls_e071 structure for each transportable object and append it to lt_e071
LOOPAT lt_rsxa_header INTO ls_rsxa_header.
CASE ls_rsxa_header-object_type.
WHEN'REPO'.
l_tran_obj = 'XARP'.
WHENOTHERS.
l_tran_obj = 'XOBJ'.
ENDCASE.
ls_e071-trkorr = l_request.
ls_e071-as4pos = sy-tabix.
ls_e071-pgmid = 'R3TR'.
ls_e071-object = l_tran_obj.
ls_e071-obj_name = ls_rsxa_header-objectid.
ls_e071-lang = sy-langu.
Append ls_e071 to lt_e071.
CLEAR ls_e071.

ENDLOOP.

//To add entries to the transport request we call the following function module
CALLFUNCTION'TR_REQUEST_CHOICE'
EXPORTING
iv_suppress_dialog = 'X'
iv_request = l_request
it_e071 = lt_e071.