‎2007 Mar 19 4:40 PM
I have a ztable(kunnr, vbeln, erdat, erzet, flag)
I want to get the following output using information as reference from this table
1234 A0010000 Walmart
where
client number (4) is fixed 1234
filler(2) blank
recordtype(1) always 'A'
client customer number (15) left justified, keep leadign zeroes, right fill with spaces, vbak-kunnr, take the value of vrkpa-kunnr
customer name(30), vbpa-parvw agvbpa-adrnr adrc-addrnumber adrc_name1, take value of adrc-name1
‎2007 Mar 19 6:36 PM
Hi Megan,
You need to get the customer number you want from VRKPA using a select statement..
select single kunnr from vrkpa into lv_kunnr where kunde = wa_ztable-kunnr.
And also you can use FM "BAPI_CUSTOMER_GETDETAIL2" to get the address details of the customer..
CALL function "BAPI_CUSTOMER_GETDETAIL2"
exporting
CUSTOMERNO = lv_kunnr (the value you derived from above..)
tables
CUSTOMERBANKDETAIL = it_cusadd (internal table to be defined as BAPICUSTOMER_02)
Your customer name1 is in it_cusadd-name1.
so your write statement is like..
write:/ '1234',
6 'A',
7 lv_kunnr,
22 it_cusadd-name1.
(you need to write the code for multiple records accordingly)..
Hope this helps..
BR
Rakesh
‎2007 Mar 19 5:21 PM
Hi Megan,
You can use write statement using the column display option..
ex. write:/ 10 sy-mandt, 15 recordtype, 16 customer number,.....
Hope this solves your problem..
Let me know if you have further questions..
BR
Rakesh
‎2007 Mar 19 5:32 PM
Ok that works but how do I initialize the values to be able to output them?
‎2007 Mar 19 5:38 PM
Hi Megan,
Please create an internal table with the data you need to display as an output.. Read data into it from different tables (ZTABLE, VBPA, ADRNR etc..).
Loop at (itab).
Write:...
endloop..
Hope this helps..
Let me know if you have further questions..
BR
Rakesh
PS: Please close the thread if your question is answered..
‎2007 Mar 19 6:16 PM
how to read data into internal table from different tables?
I have
data: begin of itab1 occurs 0,
clientnumber(4) type c value '1234',
filler(2) type c,
recordtype(1) type c value 'A',
customernumber(15) type c,
customername(30) type c,
end of itab1.
customernumber is vbak-kunnr, take value of vrkpa-kunnr
customername is vbpa-parvw = ag vbpa-adrnr adrc-addrnumber adrc-name1, take value of adrc-name1
So far I have done for customernumber
data: kunnr1(15) type c.
data: wa_ztable like ztable.
select kunnr from ztable into wa_ztable where flag = space.
kunnr1 = wa_ztable-kunnr.
endselect.
write:/ '1234',
6 'A',
7 kunnr1,
22 'Customer Name'.
But it says I need to get customernumber value from vrkpa-kunnr, whereas in ztable kunnr is saved as vbak-kunnr
I dont even know how to get the address
‎2007 Mar 19 6:36 PM
Hi Megan,
You need to get the customer number you want from VRKPA using a select statement..
select single kunnr from vrkpa into lv_kunnr where kunde = wa_ztable-kunnr.
And also you can use FM "BAPI_CUSTOMER_GETDETAIL2" to get the address details of the customer..
CALL function "BAPI_CUSTOMER_GETDETAIL2"
exporting
CUSTOMERNO = lv_kunnr (the value you derived from above..)
tables
CUSTOMERBANKDETAIL = it_cusadd (internal table to be defined as BAPICUSTOMER_02)
Your customer name1 is in it_cusadd-name1.
so your write statement is like..
write:/ '1234',
6 'A',
7 lv_kunnr,
22 it_cusadd-name1.
(you need to write the code for multiple records accordingly)..
Hope this helps..
BR
Rakesh