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

Reg : Logic

Former Member
0 Likes
478

Hi Experts ,

The requirement Is like this ??

Im Having N of Items In Sales order ?

wats my questions is ? if i do any changes for the items in sales order . it has to give Error Log issue.

For this i had written code like this ?

SELECT vbeln posnr

FROM vbap

INTO TABLE t_vbap

WHERE vbeln = com_kbv1-vbeln.

DESCRIBE TABLE t_vbap LINES n.

CHECK sy-subrc EQ 0.

CLEAR tp_vbap.

SELECT matnr

kwmeng

werks

lgort

FROM vbap

INTO tp_vbap

UP TO n ROWS

WHERE vbeln = com_kbv1-vbeln.

IF sy-subrc EQ 0.

EXIT.

ENDIF.

ENDSELECT

First it Initial checks the how many items are der for that Sales oder ?

Then it wil checks any changes have been done for the Items are not ?

Here my logic is working for Only for First Item Only ??

if i try 2 do any changes for the second item its not giving any error ?

How 2 solve this ????

Regs

Murthy

3 REPLIES 3
Read only

Former Member
0 Likes
455

SELECT vbeln posnr

FROM vbap

INTO TABLE t_vbap

WHERE vbeln = com_kbv1-vbeln.

DESCRIBE TABLE t_vbap LINES n.

CHECK sy-subrc EQ 0.

<b>LOOP AT t_VBAP.</b>

CLEAR tp_vbap.

SELECT matnr

kwmeng

werks

lgort

FROM vbap

INTO table tp_vbap

UP TO n ROWS

<b>For ALL ENTRIES IN t_VBAP</b>

<b>WHERE vbeln = t_VBAP-vbeln.</b>

IF sy-subrc EQ 0.

EXIT.

ENDIF.

<b>ENDLOOP.</b>

Read only

Former Member
0 Likes
455

Dear Narayna ,

Use this :

SELECT vbeln posnr

FROM vbap

INTO TABLE t_vbap

WHERE vbeln = com_kbv1-vbeln.

clear tp_vbap.

if t_vbap[] is not initial.

SELECT matnr

kwmeng

werks

lgort

FROM vbap

INTO tp_vbap

for ALL ENTRIES of t_vbap

WHERE vbeln = t-vbap-vbeln .

IF sy-subrc EQ 0.

EXIT.

ENDIF.

endif.

clear t_vbap.

ENDSELECT

reward if useful.

regards

Amit singla

Read only

Former Member
0 Likes
455

Dear Narayna ,

Use this :

SELECT vbeln posnr

FROM vbap

INTO TABLE t_vbap

WHERE vbeln = com_kbv1-vbeln.

clear tp_vbap.

if t_vbap[] is not initial.

SELECT matnr

kwmeng

werks

lgort

FROM vbap

INTO tp_vbap

for ALL ENTRIES of t_vbap

WHERE vbeln = t-vbap-vbeln and

posnr = t-vbap-posnr.

IF sy-subrc EQ 0.

EXIT.

ENDIF.

endif.

clear t_vbap.

ENDSELECT

reward if useful.

regards

Amit singla