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: 

VA01 user exit at line item with partner address

Former Member
0 Kudos

I need a user exit for VA01 that is at the line item level. The catch is I also need access to the partner address data. I have found userexit_pricing_prepare_tkomk (include MV45AFZZ) but that doesn't give you the "instance" address information (the address data that is specific to that order, after being changed). It only gives you the address number for the partner's default address.

Does anybody know if such an exit exists?

Regards,

Aaron

2 REPLIES 2

former_member156446
Active Contributor
0 Kudos

pick the adrnr and hit ADRC or ARD6 or ADR* table to get the address in details.

Former Member
0 Kudos

Hi Aaron,

I had a similar requirement Long back & This was my code I written. Hope this helps you.



*  Extract and Update field for partner-id - Goods Supplying vendor
  CLEAR TKOMK-Y_GSVN.
  PERFORM XVBPA_LESEN(SAPFV45K) USING 'WL'  VBAP-POSNR SY-TABIX.
  IF XVBPA-UPDKZ <> 'D'.
    TKOMK-Y_GSVN = XVBPA-LIFNR.
  ENDIF.

  PERFORM XVBPA_LESEN(SAPFV45K) USING 'ZP'  VBAP-POSNR SY-TABIX.
  IF XVBPA-UPDKZ <> 'D'.
    TKOMK-BSART = 'ZIN'.

    SELECT SINGLE LAND1 FROM LFA1 INTO TKOMK-Y_COMM_CTY  WHERE LIFNR = XVBPA-LIFNR.
  ENDIF.


FORM XVBPA_LESEN USING US_PARVW US_POSNR US_TABIX.

DATA: DA_VBADR   TYPE   VBADR.
DATA: DA_VBPA    LIKE   XVBPA.

CLEAR DA_VBPA.

READ TABLE XVBPA INDEX 1 INTO DA_VBPA TRANSPORTING VBELN.

XVBPAKEY-MANDT = VBAK-MANDT.
XVBPAKEY-VBELN = DA_VBPA-VBELN.
XVBPAKEY-PARVW = US_PARVW.
XVBPAKEY-POSNR = US_POSNR.

READ TABLE XVBPA WITH KEY XVBPAKEY.

IF SY-SUBRC > 0.
   XVBPAKEY-POSNR = POSNR_LOW.
   READ TABLE XVBPA WITH KEY XVBPAKEY.
ENDIF.

IF SY-SUBRC > 0.
  CLEAR XVBPA.
  IF  US_PARVW = 'WE'.
    CLEAR KUWEV.
  ENDIF.
  IF  US_PARVW = 'RG'.
    CLEAR KURGV.
  ENDIF.
ENDIF.

US_TABIX = SY-TABIX.

* CAM is not activated

 IF ZAV_FLAG IS INITIAL.

  IF NOT XVBPA-ADRNR IS INITIAL.
    CLEAR XVBADR.
    XVBADR-ADRNR = XVBPA-ADRNR.
    READ TABLE XVBADR.
    IF SY-SUBRC > 0.
      CLEAR XVBADR.
    ENDIF.
  ENDIF.

* CAM is activated

  ELSE.
*if there is an address
    IF NOT XVBPA-ADRNR IS INITIAL.
*clear address data
      CLEAR XVBADR.
*try to read address in internal table XVBADR
      READ TABLE XVBADR WITH KEY ADRNR = XVBPA-ADRNR  ADRNP = XVBPA-ADRNP.
*if address is not in internal table XVBADR
      IF SY-SUBRC NE 0.
*read address in CAM tables
   CALL FUNCTION 'SD_ADDRESS_GET'
      EXPORTING
        FIF_ADDRESS_NUMBER    = XVBPA-ADRNR
        FIF_PERSONAL_NUMBER   = XVBPA-ADRNP
        FIF_ADDRESS_INDICATOR = XVBPA-ADRDA
      IMPORTING
        FES_ADDRESS           = DA_VBADR
      EXCEPTIONS
        OTHERS                = 4.
        IF SY-SUBRC EQ 0.
          MOVE-CORRESPONDING DA_VBADR TO XVBADR.
          APPEND XVBADR.
        ELSE.
          CLEAR XVBADR.
        ENDIF.
      ENDIF.
    ENDIF.
  ENDIF.

ENDFORM.

Thanks & Regards,

Dileep .C