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: 

how to relate lfa1 and adrc.

Former Member
0 Kudos

hi,

i want to display full address of vendor in script.and my input fields are vendor number,company code,Reconciliation key date.im using lfa1 and adrc tables.how to relate these two tables?or any other alternative?

can anyone pl help me.Thanks.

Edited by: Ranganayahi Chandirasekaran on Feb 9, 2008 12:23 PM

2 REPLIES 2

Former Member
0 Kudos

pass ur vendor no to LFA1 and get the address no(adrnr)

pass this to ADRC table's ADDRNUMBER field to get the address details..

raymond_giuseppi
Active Contributor
0 Kudos

Try something like

/:PERFORM sub_sap_script IN PROGRAM type_i_program
/:USING    &Z_LIFNR&
/:CHANGING &Z_STRT2&
/:ENDPERFORM
/:IF &Z_STRT2& NE &SPACE&
/:ENDIF.
FORM sub_sap_script TABLES from_sapscript STRUCTURE itcsy
                           to_sapscript   STRUCTURE itcsy.
  DATA: lv_lifnr TYPE lfa1-lifnr,
        lv_strt2 TYPE adrc-str_suppl1.
  READ TABLE from_sapscript WITH KEY 'Z_LIFNR'.
  MOVE from_sapscript-value TO lv_lifnr.
 
  CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
    EXPORTING
      input  = lv_lifnr
    IMPORTING
      output = lv_lifnr.
 
  SELECT SINGLE adrc~str_suppl1 INTO lv_strt2 FROM lfa1
    INNER JOIN adrc ON
       lfa1~adrnr = adrc~addrnumber
       WHERE lfa1~lifnr = lv_lifnr.
  IF sy-subrc EQ 0.
    READ TABLE to_sapscript WITH KEY 'Z_STRT2'.
    IF sy-subrc = 0.
      MOVE lv_strt2 TO to_sapscript-value.
      MODIFY to_sapscript INDEX sy-tabix.
    ENDIF.
  ENDIF.
ENDFORM. 

Regards