Application Development and Automation 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: 
Read only

Formatted Output

Former Member
0 Likes
692

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
661

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

5 REPLIES 5
Read only

Former Member
0 Likes
661

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

Read only

Former Member
0 Likes
661

Ok that works but how do I initialize the values to be able to output them?

Read only

Former Member
0 Likes
661

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..

Read only

Former Member
0 Likes
661

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

Read only

Former Member
0 Likes
662

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