cancel
Showing results for 
Search instead for 
Did you mean: 

data not displayed correctly in the smartform

Former Member
0 Kudos

Hi All

I wrote a code so as to get the phone number of the Business partner displayed in the smart form , but it shows me the phone number of the previous Business patner which has being end dated .

let me knw wht changes do i make to reflect the phone number of the current BP in use .

like i have Two BP's , one has already being end dated and the second one is in the current period, i want the phone number of the current Bp.

What additional code i need to add please suggest ????

CALL FUNCTION 'API_RE_CN_GET_DETAIL'

EXPORTING

id_bukrs = contract-bukrs

id_recnnr = contract-recnnr

IMPORTING

et_partner = t_et_partner

EXCEPTIONS

error = 1

OTHERS = 2.

IF NOT t_et_partner[] IS INITIAL.

LOOP AT t_et_partner INTO w_et_partner WHERE role = 'Z00016'.

w_partner = w_et_partner-partner.

EXIT.

ENDLOOP.

CALL FUNCTION 'BAPI_BUPA_ADDRESS_GETDETAIL'

EXPORTING

businesspartner = w_partner

valid_date = sy-datlo

TABLES

bapiadtel = t_bapiadtel.

LOOP AT t_bapiadtel INTO w_bapiadtel.

CONCATENATE '('

w_bapiadtel-telephone(3)

')'

w_bapiadtel-telephone+3(3)

'-'

w_bapiadtel-telephone+6(4)

INTO w_contact_num.

EXIT.

ENDLOOP.

ENDIF.

Early response is appreciated .

Thanks

Shweta

Accepted Solutions (1)

Accepted Solutions (1)

naimesh_patel
Active Contributor
0 Kudos

Check the validity of dates. Change your loop to:


LOOP AT t_et_partner INTO w_et_partner 
WHERE role = 'Z00016'
and  VALIDFROM  > SY-DATUM
and  VALIDTO < SY-DATUM.
w_partner = w_et_partner-partner.
EXIT.
ENDLOOP.

.

Regards,

Naimesh Patel

Former Member
0 Kudos

It is not bounded on sy-datum . i have to pick that partner whose valid from is the latest . how do i do that ?

Thanks in advance.

naimesh_patel
Active Contributor
0 Kudos

In that case, you can sort the T_ET_PARTNER by VALIDTO date in descending mode and pick up the first record.


SORT T_ET_PARTNERS BY VALIDTO DESCENDING.

READ TABLE T_ET_PARTNERS INTO W_ET_PARTNER INDEX 1.

Regards,

Naimesh Patel

Answers (0)