Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

SQ01/SQ01 How to get data from tables If (condition) Table 1 else table 2

Hi,

Please help me in acheive below task.

Tables under consideration -> MBEW , MARA , MAKT  T001W & A071, A073 & KONP

Basically my requirement is to get material stock and value along with selling price.

Issue : Selling price is maintained in Tables A071 & A073.

If  in selection screen I provide Sales Organisation & Article it should read table A071 & KONP.

If in selection screen I provide Site & article it should read from A073 & KONP.

Below join works for A073. May i know how should i include A071 also and check the IF condition.

Thank you,

best Regards

Sudhir.

replied

Hello Chandra,

In fact such things force us to switch to ABAP report program which will be very convenient. However, you can explore the following.

1. Have the selection fields from SQ02 Extras  (not from SQ01) .

2. Have additional fields for both selling prices (A071, A073).

3. Write code for these Additional fields in terms of Selection fields, like

IF SO_VKORG IS NOT INITIAL.

SELECT ........FROM......   INTO ADDLFLD1 WHERE......

ENDIF.

Similarly for the other field

IF SO_WERKS IS NOT INITIAL.

SELECT ........FROM......   INTO ADDLFLD2 WHERE......

ENDIF.

Make MATNR (Article) field obligatory in the selection screen.

You need not have to add the other table A071 for this purpose. Even I guess you need not have A073 too in the join.

This is a guideline towards a possible solution. Rest depends upon your exploration.

Good luck

KJogeswaraRao

0 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question