Application Development 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: 

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

chanda
Contributor
0 Kudos

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.

1 ACCEPTED SOLUTION

jogeswararao_kavala
Active Contributor
0 Kudos

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

6 REPLIES 6

jogeswararao_kavala
Active Contributor
0 Kudos

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 Kudos

Dear sir,

Firstly big thanks for your express help which worked .

I followed above procedure and the results came out perfect.

I want to make some further changes to the report to include radio buttons for choosing the select statement.

I read your blog to use check bok and implemented it using SQ02, it worked fine but is there a way to use radiobutton in the same way.

" AS RADIOBUTTON  GROUP G1 " does not seem to work.

can you please help on this.

Thank you again.

Best regards,

Sudhir.

0 Kudos

RADIO-BUTTON 1

RADIO-BUTTON 2

RESULT

jogeswararao_kavala
Active Contributor
0 Kudos

Also Chandra,

Please close the thread if you are done. And avoid adding different issues in one thread, which takes the shape of infoset tutorial.

Good luck

KJogeswaraRao

0 Kudos

Dear Sir,

Thank you ,

It was great experience working on SAP query, possible only with the help of your wonderful documents .

Thanks & Regards,

Sudhir.

0 Kudos

Hello Chandra,

Am very glad to be able to help your issue resolved.

Regards

KJogeswaraRao