Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

A sample code to reterieve fields from ADDR1_DATA using fun. ADDR_GET

Former Member
0 Kudos
835

I need to reterieve the fields like BUILDING, CITY, REGION, NAME1, NAME2, NAME3 from the structure ADDR1_DATA, using a function module ADDR_GET with address number from the table AUFK(AUFK-ADRNRA).I would be helpful if u provide me with a sample coding.

1 ACCEPTED SOLUTION

amit_khare
Active Contributor
0 Kudos
295

Hi,

You can try out RFITEMAP.

This is a SAp standard report which uses the same function.Also you can put the function name in SE37 and then check the where-used List. This function is used quite often for the same.

Hope it may be of your use.

Regards

Amit

8 REPLIES 8

amit_khare
Active Contributor
0 Kudos
296

Hi,

You can try out RFITEMAP.

This is a SAp standard report which uses the same function.Also you can put the function name in SE37 and then check the where-used List. This function is used quite often for the same.

Hope it may be of your use.

Regards

Amit

former_member188685
Active Contributor
0 Kudos
295

Pass the parameters to ADDR_GET

  DATA:
    lf_addr1_sel     TYPE addr1_sel,
    lf_addr1_val     TYPE addr1_val.
data: x_addr1_data type addr1_data.
    lf_addr1_sel-addrnumber = id_addrnumber.
    CALL FUNCTION 'ADDR_GET'
      EXPORTING
        address_selection             = lf_addr1_sel
*       ADDRESS_GROUP                 =
*       READ_SADR_ONLY                = ' '
*       READ_TEXTS                    = ' '
      IMPORTING
        address_value                 = lf_addr1_val
*       ADDRESS_ADDITIONAL_INFO       =
*       RETURNCODE                    =
*       ADDRESS_TEXT                  =
*       SADR                          =
*     TABLES
*       ADDRESS_GROUPS                =
*       ERROR_TABLE                   =
*       VERSIONS                      =
      EXCEPTIONS
*       PARAMETER_ERROR               = 1
*       ADDRESS_NOT_EXIST             = 2
*       VERSION_NOT_EXIST             = 3
*       INTERNAL_ERROR                = 4
        OTHERS                        = 5.
    IF sy-subrc = 0.
      MOVE-CORRESPONDING lf_addr1_val TO x_addr1_data.
    ENDIF.

from x_addr1_data retrieve the info.

0 Kudos
295

Hi,

or try fm ADDR_GET_COMPLETE:

TYPE-POOLS: szadr.
DATA adr_kompl TYPE szadr_addr1_complete.
DATA adr1 TYPE szadr_addr1_line.
DATA adtel TYPE szadr_adtel_line.
DATA admail TYPE szadr_adsmtp_line.
DATA adfax TYPE szadr_adfax_line.
...

  CALL FUNCTION 'ADDR_GET_COMPLETE'
       EXPORTING
            addrnumber              = AUFK-ADRNRA
       IMPORTING
            addr1_complete          = adr_kompl
       EXCEPTIONS
            parameter_error         = 1
            address_not_exist       = 2
            internal_error          = 3
            wrong_access_to_archive = 4
            OTHERS                  = 5.

*read Adress
  READ TABLE adr_kompl-addr1_tab INTO adr1
             WITH KEY data-date_to = '99991231'.

Andreas

0 Kudos
295

Can u provide the same addr_get function module using subroutine perform and form.

0 Kudos
295
 DATA:
    lf_addr1_sel     TYPE addr1_sel,
    lf_addr1_val     TYPE addr1_val.
data: x_addr1_data type addr1_data.
    lf_addr1_sel-addrnumber = id_addrnumber.


perform addr_get using lf_addr1_sel.


form addr_get isong p_addr1_sel type addr1_sel.

    CALL FUNCTION 'ADDR_GET'
      EXPORTING
        address_selection             = p_addr1_sel
*       ADDRESS_GROUP                 =
*       READ_SADR_ONLY                = ' '
*       READ_TEXTS                    = ' '
      IMPORTING
        address_value                 = lf_addr1_val
*       ADDRESS_ADDITIONAL_INFO       =
*       RETURNCODE                    =
*       ADDRESS_TEXT                  =
*       SADR                          =
*     TABLES
*       ADDRESS_GROUPS                =
*       ERROR_TABLE                   =
*       VERSIONS                      =
      EXCEPTIONS
*       PARAMETER_ERROR               = 1
*       ADDRESS_NOT_EXIST             = 2
*       VERSION_NOT_EXIST             = 3
*       INTERNAL_ERROR                = 4
        OTHERS                        = 5.
    IF sy-subrc = 0.
      MOVE-CORRESPONDING lf_addr1_val TO x_addr1_data.
    ENDIF.


endform.

0 Kudos
295

I NEED MORE CLARIFICATION.

THIS IS OK BUT I NEED TO USE THE IF_ADDR1_VAL FOLLOWING THE PERFORM STATEMENT, I ORDER TO ACHIEVE IT THEN HOW SHOULD THE PARAMETERS OF THE SUBROUTINE PERFORM BE.

PERFORM ADDR_GET USING lf_addr1_sel.

MOVE-CORRESPONDING lf_addr1_val TO x_addr1_data.

FORM ADDR_GET USING lf_addr1_sel

.

.

.

ENDFORM.

0 Kudos
295
perform addr_get using lf_addr1_sel
                 changing lf_addr1_val.
MOVE-CORRESPONDING lf_addr1_val TO x_addr1_data. 

form addr_get using p_addr1_sel type addr1_sel
                 changing p_addr1_val type addr1_val.


endform.

see this...

0 Kudos
295

please don't forget to reward ,

and in other posts too..