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

Need Help with the code...?

Former Member
0 Likes
702

Hi experts,

I have to design a selection screen that ask for the user to enter the purchase order number as EBELN field from EKBE table..Once the user enters the data, then I have to display a header data as follows:

Vendor Number: RBKP-LIFNR

Vendor Name: LFA1-NAME1 (Link via LIFNR)

Purchase Order: EKBE-EBELN

SAP Inv: RBKP-BELNR

Vendor Invoice No: RBKP-XBLNR

For this Header I have to display the Item details as:

POLine Amount Quantity UoM PO Text

I am not able to figure out what will be the select statements like...Please help me in this...

Cheers:Jim

Message was edited by:

jimmy wiliams

Message was edited by:

jimmy wiliams

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
673

Hi

Refer to the code below.

*declaration

Select-options: s_ebeln for ekko-ebeln obligatory.

Start-of-selection.

*Get purchase order

Select ebeln

lifnr

from ekko

into table i_ekko

where ebeln in s_ebeln.

If sy-subrc NE 0.

Message …..

Endif.

*Get Vendor name

If not i_ekko[] is initial.

select lifnr

name1

into table i_lfa1

from lfa1

for all entries in i_ekko

where lifnr = i_ekko-lifnr.

*Get Invoice

If not i_lfa1[] is initial.

Select belnr

Xblnr

Into table i_rbkp

From rbkp

For all entries in i_lfa1

Where lifnr = i_lfa1-lifnr.

*Get item info

Select ebelp

Menge

Lmein

Txz01

From ekpo

Into table i_ekpo

For all entries in i_ekko

Where ebeln = i_ekko-ebeln.

Now loop through each of the internal and write the report.

Reward points if it was useful.

Regards,

Hema.

6 REPLIES 6
Read only

Former Member
0 Likes
673

Hi,

*Declaration

select-options : s_ebeln for ekko-ebeln obligatory.

start-of-selection.

  • Get Purchase Order data

select ebeln lifnr

into table i_ekko

from ekko

where ebeln in s_ebeln.

if sy-subrc = 0.

commit work.

endif.

  • Get Vendor Name

if not i_ekko[] is initial.

select lifnr name1

into table i_lfa1

from lfa1

for all entries in i_ekko

where lifnr = i_ekko-lifnr.

if sy-subrc = 0.

commit work.

endif.

endif.

  • Get Purchase Order item details

if not i_ekko[] is initial.

select ebeln ebelp .......

into table i_ekpo

from ekpo

for all entries in i_ekko

where ebeln = i_ekko-ebeln.

if sy-subrc = 0.

commit work.

endif.

endif.

  • Now loop thru i_ekko and write the required data for your report output.

hope this helps you.

thanks,

sksingh

Read only

0 Likes
673

Hey guys,

Please help me with this code...I am not able to figure out how to go about with this..

Read only

Former Member
0 Likes
673

hi

select

RBKP~LIFNR

LFA1~NAME1 (Link via LIFNR)

EKBE~EBELN

RBKP~BELNR

RBKP~XBLNR

from RBKP LFA1 EKBE into itab

where ebeln = <field name>

select

<item details/ POLine Amount Quantity UoM PO Text>

from <database table> into itab2

where ebeln = <field name>

regards

'ravish

<b>plz dont forget to reward points if helpful</b>

Read only

Former Member
0 Likes
673

Hi jimmy,

As told by me yesterday. select data in header table by reading three internal tables.

TYPES: begin of itype,

lifnr TYPE rbkp-lifnr,

belnr TYPE rbkp-belnr,

xblnr TYPE rbkp-xblnr,

END OF itype.

TYPES:BEGIN OF itype1,

name1 TYPE lfa1-name1,

END OF itype1.

TYPES: BEGIN OF itype2,

ebeln TYPE ekbe-ebeln,

belnr type ekbe-belnr,

END OF itype2.

DATA: itab TYPE TABLE OF itype, "internal table

wtab TYPE itype. "work area

DATA: itab1 TYPE TABLE OF itype1, "internal table

wtab1 TYPE itype1. "work area

DATA: itab2 TYPE TABLE OF itype2, "internal table

wtab2 TYPE itype2. "work area

select ebeln belnr from ekbe into table itab2 where ebeln in s_ebeln.

SELECT lifnr belnr xblnr FROM rbkp INTO TABLE itab FOR ALL ENTRIES IN

itab2 WHERE

belnr = itab2-belnr.

.

SELECT name1 FROM lfa1 INTO TABLE itab1 FOR ALL ENTRIES IN itab WHERE

lifnr = itab-lifnr.

Loop at itab2 into wtab2.

iheader-ebeln = wtab2-ebeln.

read table itab into wtab

with key belnr = wtab2-belnr.

iheader-lifnr = wtab-lifnr.

iheader-belnr = wtab-belnr.

iheader-xblnr = wtab-xblnr.

read table itab1 into wtab1

with key lifnr = iheader-lifnr.

iheader-name1 = wtab1-name1.

end loop.

in this way extract item data also.

and put it in a table i_item.

and then use

REUSE_ALV_HIERSEQ_LIST_DISPLAY

regards,

Ruchika

Reward if useful.

Read only

0 Likes
673

Thnx Ruchi....I am just trying it...

Thnx to all of you also...

Read only

Former Member
0 Likes
674

Hi

Refer to the code below.

*declaration

Select-options: s_ebeln for ekko-ebeln obligatory.

Start-of-selection.

*Get purchase order

Select ebeln

lifnr

from ekko

into table i_ekko

where ebeln in s_ebeln.

If sy-subrc NE 0.

Message …..

Endif.

*Get Vendor name

If not i_ekko[] is initial.

select lifnr

name1

into table i_lfa1

from lfa1

for all entries in i_ekko

where lifnr = i_ekko-lifnr.

*Get Invoice

If not i_lfa1[] is initial.

Select belnr

Xblnr

Into table i_rbkp

From rbkp

For all entries in i_lfa1

Where lifnr = i_lfa1-lifnr.

*Get item info

Select ebelp

Menge

Lmein

Txz01

From ekpo

Into table i_ekpo

For all entries in i_ekko

Where ebeln = i_ekko-ebeln.

Now loop through each of the internal and write the report.

Reward points if it was useful.

Regards,

Hema.