on 08-02-2007 2:37 PM
Hi folks,
i am working on a PO from for third party processing . I want to display the item details under which i have to display the customer name and address where it is going to be shipped to. Problem is i am getting items but not the correct ship to party details for that item. I have written the code please correct me if i am wrong.
LOOP AT IT_EKPO INTO WA_EKPO.
SELECT single kunnr
ADRNR
FROM KNA1
INTO CORRESPONDING FIELDS OF wa_KNA1 WHERE KUNNR = wa_EKPO-KUNNR.
IF SY-SUBRC = 0.
SELECT SINGLE ADDRNUMBER
NAME1
STREET
HOUSE_NUM1
MC_CITY1
POST_CODE1
REGION
COUNTRY
FROM ADRC INTO CORRESPONDING FIELDS OF WA_ADRC1
WHERE ADDRNUMBER = WA_KNA1-ADRNR.
ENDIF.
ENDLOOP.
but when i give the workareas in smartform but i m not getting the correct ship to party details for that corresponding item..please guide me ...
thanks in advance.
jana
Hi ,
First of all u should not use select inside a loop . It is a poor programming practice .
Your logic is not very clear form the piece of code u have given .Can you make it somewhat more clear .
Regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
the format of the smartforms should be
material | description | unit | Quantity | Net Value
13 | book | 2 | 2 | 30
Please Deliver to
1301 sw 10th ave,
florida 33498.
This will continue for each material where it should be delivered to..
Thing is i have to get the customer for that particular material and address which i am not getting. Could anyone provide the logic for it..
regards
jana
Hi, are you using a standard SAP program to call this output, or you call it in a Z program.
You should always gather all the info you need before calling the form, then pass the form attributes,
instead of you're select you could use
in the address_selection structure you only have to enter the address number
CALL FUNCTION 'ADDR_GET'
EXPORTING
address_selection = address_selection
read_texts = abap_true
IMPORTING
address_value = address_value
address_text = address_text
EXCEPTIONS
parameter_error = 1
address_not_exist = 2
version_not_exist = 3
internal_error = 4
OTHERS = 5.
You could arrange you address data to fit on the same line, if you don't want that,
you will have to create 2 lines. Create a table node, go in details, then add a table line for you're header, and 2 for you item lines. If you want to retrieve the address number dynamically at runtime, you could insert a coding node in you're loop where you will have to declare and fill you're global variable.
Hope it will help!
Alex
Used FM to get the address info instead
You only have to pass this parameter
address_selection-addrnumber = im_adrnr.
CALL FUNCTION 'ADDR_GET'
EXPORTING
address_selection = address_selection
read_texts = abap_true
IMPORTING
address_value = address_value
address_text = address_text
EXCEPTIONS
parameter_error = 1
address_not_exist = 2
version_not_exist = 3
internal_error = 4
OTHERS = 5.
Create a table node, go in details, add 3 lines, one for you're table header and 2 for you items lines! Hope it will helps,
Alex
Smartforms allow you to manipulate BAR (business address repository) throught address node.
First, you should retrieve only the field ADRNR from table KNA1,
then create and address node in smartforms passing this field,
thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
First ensure that in EKPO table for KUNNR field data exits or not?
If exists is it the same Shipt to Party whose address has to be displayed ?
Other wise using this Kunnr fetch the SHipto from the KNVP table using the partner function WE and fetch his address number from KNA1 and address from ADRC
Keep a break point in the code and check whether data is coming or not perfectly and then see the output in smartform.
<b>Reward points for useful Answers</b>
Regards
Anji
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
79 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.